forked from NOAA-GSL/UPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move creation of model_config file from the experiment generation ste…
…p to the forecast task. (NOAA-EMC#256) Move creation of model_config file from the experiment generation step to the forecast task. Description of changes: ---------------------- In PR#245, the creation of model_config files was moved out of the forecast task (in scripts/exregional_run_fcst.sh) and into the experiment generation step (in ush/generate_FV3SAR_wflow.sh), and a model_config file was created only in the cycle directory (i.e. not in each run directory) assuming that the parameters in model_config will not change for forecasts under a given cycle (e.g. for various ensemble members under a given cycle). Although this is true for certain cases (e.g. cold starts), as pointed out by @christinaholtNOAA, this assumption does not hold in certain use cases (e.g. real-time runs) in which there may be multiple forecasts for a given cycle that need different values of the parameters in model_config (e.g. different forecast lengths, different computational resources, etc). For this reason, a model_config file must be created for each specific forecast and placed in the run directory for that forecast. Thus, in this PR, we move the creation of the model_config files back into the ush/exregional_run_fcst.sh script. Tests conducted: --------------- Ran all WE2E tests on hera. All but 3 passed. The 3 that failed are regional_003, regional_004, and regional_010, but those currently fail in the develop branch with the same errors. File-by-file description of modifications: ----------------------------------------- jobs/JREGIONAL_RUN_FCST: * Set the new cdate argument of the exregional_run_fcst() funciton to CDATE (which is set as an environment variable in the rocoto XML). scripts/exregional_run_fcst.sh: * Add new input argument cdate to this function. This is needed in creating the model_config file for this forecast. * Call the new function create_model_config_file() to create a model_config file in the current run directory. * For ensemble forecasts, remove creation of link to a cycle-specific model_config file. This file is now created on a per-forecast basis. * Edit comments. tests/baselines_list.txt: * Order WE2E test names lexicographically. ush/create_model_config_file.sh: * New function to set the parameters in the model_config file for a given cdate and forecast run directory. ush/create_model_config_files.sh: * Remove this file since the work this used to do for all cycles is now done by the new function ush/create_model_config_file.sh for one cycle. [Actually, this file got renamed to ush/create_model_config_file.sh (drop the "s" after file).] ush/generate_FV3SAR_wflow.sh: * Remove creation of model_config files for all cycles. This is now done on a per-forecast basis in scripts/exregional_run_fcst.sh.
- Loading branch information
1 parent
f1748c0
commit be69f8f
Showing
6 changed files
with
206 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# This file defines a function that creates a model configuration file | ||
# for the specified cycle. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
function create_model_config_file() { | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Save current shell options (in a global array). Then set new options | ||
# for this script/function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ save_shell_opts; set -u -x; } > /dev/null 2>&1 | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Get the full path to the file in which this script/function is located | ||
# (scrfunc_fp), the name of that file (scrfunc_fn), and the directory in | ||
# which the file is located (scrfunc_dir). | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
local scrfunc_fp=$( readlink -f "${BASH_SOURCE[0]}" ) | ||
local scrfunc_fn=$( basename "${scrfunc_fp}" ) | ||
local scrfunc_dir=$( dirname "${scrfunc_fp}" ) | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Get the name of this function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
local func_name="${FUNCNAME[0]}" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Specify the set of valid argument names for this script/function. Then | ||
# process the arguments provided to this script/function (which should | ||
# consist of a set of name-value pairs of the form arg1="value1", etc). | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
local valid_args=( | ||
cdate \ | ||
run_dir \ | ||
) | ||
process_args valid_args "$@" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# For debugging purposes, print out values of arguments passed to this | ||
# script. Note that these will be printed out only if VERBOSE is set to | ||
# TRUE. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_input_args valid_args | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Declare local variables. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
local i \ | ||
model_config_fp \ | ||
yyyy \ | ||
mm \ | ||
dd \ | ||
hh \ | ||
mm \ | ||
dot_quilting_dot \ | ||
dot_print_esmf_dot | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Create a model configuration file within each cycle directory. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
print_info_msg "$VERBOSE" " | ||
Creating a model configuration file (\"${MODEL_CONFIG_FN}\") within each | ||
cycle directory..." | ||
# | ||
# Copy template of cycle-dependent model configure files from the templates | ||
# directory to the current cycle directory. | ||
# | ||
model_config_fp="${run_dir}/${MODEL_CONFIG_FN}" | ||
cp_vrfy "${MODEL_CONFIG_TMPL_FP}" "${model_config_fp}" | ||
# | ||
# Extract from cdate the starting year, month, day, and hour of the forecast. | ||
# | ||
yyyy=${cdate:0:4} | ||
mm=${cdate:4:2} | ||
dd=${cdate:6:2} | ||
hh=${cdate:8:2} | ||
# | ||
# Set parameters in the model configure file. | ||
# | ||
dot_quilting_dot="."${QUILTING,,}"." | ||
dot_print_esmf_dot="."${PRINT_ESMF,,}"." | ||
|
||
set_file_param "${model_config_fp}" "PE_MEMBER01" "${PE_MEMBER01}" | ||
set_file_param "${model_config_fp}" "dt_atmos" "${DT_ATMOS}" | ||
set_file_param "${model_config_fp}" "start_year" "$yyyy" | ||
set_file_param "${model_config_fp}" "start_month" "$mm" | ||
set_file_param "${model_config_fp}" "start_day" "$dd" | ||
set_file_param "${model_config_fp}" "start_hour" "$hh" | ||
set_file_param "${model_config_fp}" "nhours_fcst" "${FCST_LEN_HRS}" | ||
set_file_param "${model_config_fp}" "ncores_per_node" "${NCORES_PER_NODE}" | ||
set_file_param "${model_config_fp}" "quilting" "${dot_quilting_dot}" | ||
set_file_param "${model_config_fp}" "print_esmf" "${dot_print_esmf_dot}" | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# If the write component is to be used, then a set of parameters, including | ||
# those that define the write component's output grid, need to be specified | ||
# in the model configuration file (model_config_fp). This is done by | ||
# appending a template file (in which some write-component parameters are | ||
# set to actual values while others are set to placeholders) to model_config_fp | ||
# and then replacing the placeholder values in the (new) model_config_fp | ||
# file with actual values. The full path of this template file is specified | ||
# in the workflow variable WRTCMP_PARAMS_TMPL_FP. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
if [ "$QUILTING" = "TRUE" ]; then | ||
|
||
cat ${WRTCMP_PARAMS_TMPL_FP} >> ${model_config_fp} | ||
|
||
set_file_param "${model_config_fp}" "write_groups" "${WRTCMP_write_groups}" | ||
set_file_param "${model_config_fp}" "write_tasks_per_group" "${WRTCMP_write_tasks_per_group}" | ||
|
||
set_file_param "${model_config_fp}" "output_grid" "\'${WRTCMP_output_grid}\'" | ||
set_file_param "${model_config_fp}" "cen_lon" "${WRTCMP_cen_lon}" | ||
set_file_param "${model_config_fp}" "cen_lat" "${WRTCMP_cen_lat}" | ||
set_file_param "${model_config_fp}" "lon1" "${WRTCMP_lon_lwr_left}" | ||
set_file_param "${model_config_fp}" "lat1" "${WRTCMP_lat_lwr_left}" | ||
|
||
if [ "${WRTCMP_output_grid}" = "rotated_latlon" ]; then | ||
set_file_param "${model_config_fp}" "lon2" "${WRTCMP_lon_upr_rght}" | ||
set_file_param "${model_config_fp}" "lat2" "${WRTCMP_lat_upr_rght}" | ||
set_file_param "${model_config_fp}" "dlon" "${WRTCMP_dlon}" | ||
set_file_param "${model_config_fp}" "dlat" "${WRTCMP_dlat}" | ||
elif [ "${WRTCMP_output_grid}" = "lambert_conformal" ]; then | ||
set_file_param "${model_config_fp}" "stdlat1" "${WRTCMP_stdlat1}" | ||
set_file_param "${model_config_fp}" "stdlat2" "${WRTCMP_stdlat2}" | ||
set_file_param "${model_config_fp}" "nx" "${WRTCMP_nx}" | ||
set_file_param "${model_config_fp}" "ny" "${WRTCMP_ny}" | ||
set_file_param "${model_config_fp}" "dx" "${WRTCMP_dx}" | ||
set_file_param "${model_config_fp}" "dy" "${WRTCMP_dy}" | ||
elif [ "${WRTCMP_output_grid}" = "regional_latlon" ]; then | ||
set_file_param "${model_config_fp}" "lon2" "${WRTCMP_lon_upr_rght}" | ||
set_file_param "${model_config_fp}" "lat2" "${WRTCMP_lat_upr_rght}" | ||
set_file_param "${model_config_fp}" "dlon" "${WRTCMP_dlon}" | ||
set_file_param "${model_config_fp}" "dlat" "${WRTCMP_dlat}" | ||
fi | ||
|
||
fi | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Restore the shell options saved at the beginning of this script/function. | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
{ restore_shell_opts; } > /dev/null 2>&1 | ||
|
||
} | ||
|
Oops, something went wrong.