Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[develop] fixes to enable stochastic physics #870

Merged
merged 5 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions scripts/exregional_run_fcst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,12 @@ fi
#-----------------------------------------------------------------------
#
STOCH="FALSE"
if [ "${DO_ENSEMBLE}" = "TRUE" ] && ([ "${DO_SPP}" = "TRUE" ] || [ "${DO_SPPT}" = "TRUE" ] || [ "${DO_SHUM}" = "TRUE" ] || \
if ([ "${DO_SPP}" = "TRUE" ] || [ "${DO_SPPT}" = "TRUE" ] || [ "${DO_SHUM}" = "TRUE" ] || \
[ "${DO_SKEB}" = "TRUE" ] || [ "${DO_LSM_SPP}" = "TRUE" ]); then
STOCH="TRUE"
fi
if [ "${STOCH}" == "TRUE" ]; then
ln_vrfy -sf ${FV3_NML_STOCH_FP} ${DATA}/${FV3_NML_FN}
cp_vrfy ${FV3_NML_STOCH_FP} ${DATA}/${FV3_NML_FN}
else
ln_vrfy -sf ${FV3_NML_FP} ${DATA}/${FV3_NML_FN}
fi
Expand All @@ -461,8 +461,7 @@ fi
#
#-----------------------------------------------------------------------
#
if [ "$STOCH" == "TRUE" ]; then
cp_vrfy ${DATA}/${FV3_NML_FN} ${DATA}/${FV3_NML_FN}_base
if ([ "$STOCH" == "TRUE" ] && [ "${DO_ENSEMBLE}" = "TRUE" ]); then
python3 $USHdir/set_FV3nml_ens_stoch_seeds.py \
--path-to-defns ${GLOBAL_VAR_DEFNS_FP} \
--cdate "$CDATE" || print_err_msg_exit "\
Expand Down
4 changes: 2 additions & 2 deletions tests/test_python/test_set_FV3nml_ens_stoch_seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def setUp(self):
mkdir_vrfy("-p", self.mem_dir)
cp_vrfy(
os.path.join(PARMdir, "input.nml.FV3"),
os.path.join(EXPTDIR, "input.nml_base"),
os.path.join(self.mem_dir, "input.nml"),
)


set_env_var("USHdir", USHdir)
set_env_var("ENSMEM_INDX", 2)
set_env_var("FV3_NML_FN", "input.nml")
set_env_var("FV3_NML_FP", os.path.join(EXPTDIR, "input.nml_base"))
set_env_var("FV3_NML_FP", os.path.join(self.mem_dir, "input.nml"))
set_env_var("DO_SHUM", True)
set_env_var("DO_SKEB", True)
set_env_var("DO_SPPT", True)
Expand Down
2 changes: 1 addition & 1 deletion ush/generate_FV3LAM_wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def generate_FV3LAM_wflow(
#
#-----------------------------------------------------------------------
#
if DO_ENSEMBLE and any((DO_SPP, DO_SPPT, DO_SHUM, DO_SKEB, DO_LSM_SPP)):
if any((DO_SPP, DO_SPPT, DO_SHUM, DO_SKEB, DO_LSM_SPP)):

set_namelist(
[
Expand Down
8 changes: 4 additions & 4 deletions ush/set_FV3nml_ens_stoch_seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def set_FV3nml_ens_stoch_seeds(cdate):
#
# -----------------------------------------------------------------------
#
fv3_nml_ensmem_fp = f"{os.getcwd()}{os.sep}{FV3_NML_FN}_base"
fv3_nml_ensmem_fp = f"{os.getcwd()}{os.sep}{FV3_NML_FN}"

ensmem_num = int(ENSMEM_INDX)

Expand Down Expand Up @@ -93,14 +93,14 @@ def set_FV3nml_ens_stoch_seeds(cdate):
if DO_LSM_SPP:
iseed_lsm_spp = cdate_i * 1000 + ensmem_num * 10 + 9

settings["nam_sppperts"] = {"iseed_lndp": [iseed_lsm_spp]}
settings["nam_sfcperts"] = {"iseed_lndp": [iseed_lsm_spp]}

settings_str = cfg_to_yaml_str(settings)

print_info_msg(
dedent(
f"""
The variable 'settings' specifying seeds in '{FV3_NML_FP}'
The variable 'settings' specifying seeds in '{fv3_nml_ensmem_fp}'
has been set as follows:

settings =\n\n"""
Expand All @@ -111,7 +111,7 @@ def set_FV3nml_ens_stoch_seeds(cdate):

try:
set_namelist(
["-q", "-n", FV3_NML_FP, "-u", settings_str, "-o", fv3_nml_ensmem_fp]
["-q", "-n", fv3_nml_ensmem_fp, "-u", settings_str, "-o", fv3_nml_ensmem_fp]
)
except:
print_err_msg_exit(
Expand Down
Loading