Skip to content

Commit

Permalink
Use pregenerated (in the experiment generation step) values for ensem…
Browse files Browse the repository at this point in the history
…ble member names and indices in those workflow config files in which this isn't already done; in some corresponding ex-scripts, generalize construction of ensemble member names to use ENSMEM_BASENAME and NDIGITS_IN_ENSMEM_NAMES; other related fixes.
  • Loading branch information
gsketefian committed Nov 28, 2024
1 parent ca67bb6 commit f327dcd
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 55 deletions.
2 changes: 1 addition & 1 deletion jobs/JREGIONAL_CHECK_POST_OUTPUT
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Run-time environment variables:
#
# CDATE
# ENSMEM_INDX
# ENSMEM_NAME
# GLOBAL_VAR_DEFNS_FP
#
# Experiment variables
Expand Down
15 changes: 8 additions & 7 deletions parm/wflow/coldstart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default_task: &default_task
nprocs: '{{ parent.nnodes * parent.ppn }}'
subcyc: !cycstr "@M"
LOGDIR: !cycstr "&LOGDIR;"
ENSMEM_INDX: '#mem#'
ENSMEM_INDX: '#mem_indx#'
native: '{{ platform.SCHED_NATIVE_CMD }}'
nodes: '{{ nnodes }}:ppn={{ ppn }}'
partition: '{% if platform.get("PARTITION_DEFAULT") %}&PARTITION_DEFAULT;{% else %}None{% endif %}'
Expand Down Expand Up @@ -82,8 +82,9 @@ task_get_extrn_lbcs:

metatask_run_ensemble:
var:
mem: '{% if global.DO_ENSEMBLE %}{%- for m in range(1, global.NUM_ENS_MEMBERS+1) -%}{{ "%03d "%m }}{%- endfor -%} {% else %}{{ "000"|string }}{% endif %}'
task_make_ics_mem#mem#:
mem_indx: '&ENSMEM_INDICES;'
mem_name: '&ENSMEM_NAMES;'
task_make_ics_#mem_name#:
<<: *default_task
command: '&LOAD_MODULES_RUN_TASK; "make_ics" "&JOBSdir;/JREGIONAL_MAKE_ICS"'
envars:
Expand Down Expand Up @@ -122,7 +123,7 @@ metatask_run_ensemble:
left: staged_sfc_climo
right: '{% if not rocoto.get("tasks", {}).get("task_make_sfc_climo") %}staged_sfc_climo{% endif %}'

task_make_lbcs_mem#mem#:
task_make_lbcs_#mem_name#:
<<: *default_task
command: '&LOAD_MODULES_RUN_TASK; "make_lbcs" "&JOBSdir;/JREGIONAL_MAKE_LBCS"'
envars:
Expand All @@ -140,7 +141,7 @@ metatask_run_ensemble:
attrs:
task: get_extrn_lbcs

task_run_fcst_mem#mem#:
task_run_fcst_#mem_name#:
<<: *default_task
command: '&LOAD_MODULES_RUN_TASK; "run_fcst" "&JOBSdir;/JREGIONAL_RUN_FCST"'
envars:
Expand All @@ -157,10 +158,10 @@ metatask_run_ensemble:
and:
taskdep_make_ics:
attrs:
task: make_ics_mem#mem#
task: make_ics_#mem_name#
taskdep_make_lbcs:
attrs:
task: make_lbcs_mem#mem#
task: make_lbcs_#mem_name#
or_nexus_emission:
not:
taskvalid:
Expand Down
6 changes: 5 additions & 1 deletion parm/wflow/default_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ rocoto:
RUN: '{{ nco.RUN_default }}'
SCRIPTSdir: '{{ user.SCRIPTSdir }}'
SENDCOM: '{{ nco.SENDCOM_default }}'
SLASH_ENSMEM_SUBDIR: '{{- "/" }}
{%- if global.DO_ENSEMBLE %}
{{- "#mem_name#" }}
{%- endif %}'
ENSMEM_INDICES: '{%- for mem_indx in global.ENSMEM_INDS %}
{{- mem_indx ~ " " }}
{%- endfor %}'
Expand All @@ -43,7 +47,7 @@ rocoto:
DATAROOT: '{{ nco.PTMP }}/&envir;/tmp'
DCOMROOT: '{{ nco.PTMP }}/&envir;/dcom'
COMIN_DIR: '{% if user.RUN_ENVIR == "nco" %}&COMROOT;/&NET;/&model_ver;/&RUN;.@Y@m@d/@H{% else %}{{ workflow.EXPTDIR }}/@Y@m@d@H{% endif %}'
FCST_DIR: '{% if user.RUN_ENVIR == "nco" %}&DATAROOT;/run_fcst_mem#mem#_@Y@m@d@H{% else %}{{ workflow.EXPTDIR }}/@Y@m@d@H{% endif %}'
FCST_DIR: '{% if user.RUN_ENVIR == "nco" %}&DATAROOT;/run_fcst_#mem_name#_@Y@m@d@H{% else %}{{ workflow.EXPTDIR }}/@Y@m@d@H{% endif %}'
LOGDIR: '{% if user.RUN_ENVIR == "nco" %}&COMROOT;/output/logs/@Y@m@d{% else %}{{ workflow.EXPTDIR }}/log{% endif %}'
attrs:
cyclethrottle: "200"
Expand Down
15 changes: 8 additions & 7 deletions parm/wflow/plot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default_task_plot: &default_task
fhr: '#fhr#'
LOGDIR: !cycstr "&LOGDIR;"
SLASH_ENSMEM_SUBDIR: '&SLASH_ENSMEM_SUBDIR;'
ENSMEM_INDX: '#mem#'
ENSMEM_INDX: '#mem_indx#'
nprocs: '{{ parent.nnodes * parent.ppn }}'
join: !cycstr '&LOGDIR;/{{ jobname }}_@Y@m@d@H&LOGEXT;'
native: '{{ platform.SCHED_NATIVE_CMD }}'
Expand All @@ -28,29 +28,30 @@ default_task_plot: &default_task

metatask_plot_allvars:
var:
mem: '{% if global.DO_ENSEMBLE %}{%- for m in range(1, global.NUM_ENS_MEMBERS+1) -%}{{ "%03d "%m }}{%- endfor -%} {% else %}{{ "000"|string }}{% endif %}'
metatask_plot_allvars_mem#mem#_all_fhrs:
mem_indx: '&ENSMEM_INDICES;'
mem_name: '&ENSMEM_NAMES;'
metatask_plot_allvars_#mem_name#_all_fhrs:
var:
fhr: '{% for h in range(0, workflow.LONG_FCST_LEN+1) %}{{ " %03d" % h }}{% endfor %}'
cycledef: '{% for h in range(0, workflow.LONG_FCST_LEN+1) %}{% if h <= workflow.FCST_LEN_CYCL|min %}forecast {% else %}long_forecast {% endif %}{% endfor %}'
task_plot_allvars_mem#mem#_f#fhr#:
task_plot_allvars_#mem_name#_f#fhr#:
<<: *default_task
command: '&LOAD_MODULES_RUN_TASK; "plot_allvars" "&JOBSdir;/JREGIONAL_PLOT_ALLVARS"'
dependency:
or_do_post: &post_files_exist
and_run_post: # If post was meant to run, wait on the whole post metatask
taskvalid:
attrs:
task: run_post_mem#mem#_f#fhr#
task: run_post_#mem_name#_f#fhr#
metataskdep:
attrs:
metatask: run_ens_post
and_inline_post: # If inline post ran, wait on the forecast task to complete
not:
taskvalid:
attrs:
task: run_post_mem#mem#_f#fhr#
task: run_post_#mem_name#_f#fhr#
taskdep:
attrs:
task: run_post_mem#mem#_f#fhr#
task: run_post_#mem_name#_f#fhr#

17 changes: 9 additions & 8 deletions parm/wflow/post.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default_task_post: &default_task
cyc: !cycstr '@H'
fhr: '#fhr#'
SLASH_ENSMEM_SUBDIR: '&SLASH_ENSMEM_SUBDIR;'
ENSMEM_INDX: '#mem#'
ENSMEM_INDX: '#mem_indx#'
nprocs: '{{ parent.nnodes * parent.ppn }}'
join: !cycstr '&LOGDIR;/{{ jobname }}_@Y@m@d@H&LOGEXT;'
native: '{{ platform.SCHED_NATIVE_CMD }}'
Expand All @@ -24,18 +24,19 @@ default_task_post: &default_task

metatask_run_ens_post:
var:
mem: '{% if global.DO_ENSEMBLE %}{%- for m in range(1, global.NUM_ENS_MEMBERS+1) -%}{{ "%03d "%m }}{%- endfor -%} {% else %}{{ "000"|string }}{% endif %}'
metatask_run_post_mem#mem#_all_fhrs:
mem_indx: '&ENSMEM_INDICES;'
mem_name: '&ENSMEM_NAMES;'
metatask_run_post_#mem_name#_all_fhrs:
var:
fhr: '{% for h in range(0, workflow.LONG_FCST_LEN+1) %}{{ " %03d" % h }}{% endfor %}'
cycledef: '{% for h in range(0, workflow.LONG_FCST_LEN+1) %}{% if h <= workflow.FCST_LEN_CYCL|min %}forecast {% else %}long_forecast {% endif %}{% endfor %}'
task_run_post_mem#mem#_f#fhr#:
task_run_post_#mem_name#_f#fhr#:
<<: *default_task
dependency:
or:
taskdep:
attrs:
task: run_fcst_mem#mem#
task: run_fcst_#mem_name#
and:
datadep_dyn:
text: !cycstr '&FCST_DIR;&SLASH_ENSMEM_SUBDIR;/dynf#fhr#.nc'
Expand All @@ -52,7 +53,7 @@ metatask_run_ens_post:
metatask_sub_hourly_post:
var:
fmn: '{% for min in range(0, 60, task_run_post.DT_SUBHOURLY_POST_MNTS) %}{{ " %02d" % min }}{% endfor %}'
task_run_post_mem#mem#_f#fhr##fmn#: &subhourly_run_post_task
task_run_post_#mem_name#_f#fhr##fmn#: &subhourly_run_post_task
<<: *default_task
envars:
<<: *default_vars
Expand All @@ -61,7 +62,7 @@ metatask_run_ens_post:
or:
taskdep:
attrs:
task: run_fcst_mem#mem#
task: run_fcst_#mem_name#
and:
datadep_dyn:
text: !cycstr '&FCST_DIR;&SLASH_ENSMEM_SUBDIR;/dynf#fhr#:#fmn#:00.nc'
Expand All @@ -76,5 +77,5 @@ metatask_run_ens_post:
var:
fhr: '{{ " %03d" % workflow.FCST_LEN_HRS }}'
fmn: '00'
task_run_post_mem#mem#_f#fhr##fmn#:
task_run_post_#mem_name#_f#fhr##fmn#:
<<: *subhourly_run_post_task
11 changes: 6 additions & 5 deletions parm/wflow/prdgen.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
metatask_run_prdgen:
var:
mem: '{% if global.DO_ENSEMBLE %}{%- for m in range(1, global.NUM_ENS_MEMBERS+1) -%}{{ "%03d "%m }}{%- endfor -%} {% else %}{{ "000"|string }}{% endif %}'
metatask_run_prdgen_hrs_mem#mem#:
mem_indx: '&ENSMEM_INDICES;'
mem_name: '&ENSMEM_NAMES;'
metatask_run_prdgen_hrs_#mem_name#:
var:
fhr: '{% for h in range(0, workflow.LONG_FCST_LEN+1) %}{{ " %03d" % h }}{% endfor %}'
cycledef: '{% for h in range(0, workflow.LONG_FCST_LEN+1) %}{% if h <= workflow.FCST_LEN_HRS %}forecast {% else %}long_forecast {% endif %}{% endfor %}'
task_run_prdgen_mem#mem#_f#fhr#:
task_run_prdgen_#mem_name#_f#fhr#:
account: '&ACCOUNT;'
attrs:
cycledefs: '#cycledef#'
Expand All @@ -18,7 +19,7 @@ metatask_run_prdgen:
cyc: !cycstr '@H'
fhr: '#fhr#'
SLASH_ENSMEM_SUBDIR: '&SLASH_ENSMEM_SUBDIR;'
ENSMEM_INDX: '#mem#'
ENSMEM_INDX: '#mem_indx#'
nprocs: '{{ parent.nnodes * parent.ppn }}'
join: !cycstr '&LOGDIR;/{{ jobname }}_@Y@m@d@H&LOGEXT;'
native: '{{ platform.SCHED_NATIVE_CMD }}'
Expand All @@ -31,4 +32,4 @@ metatask_run_prdgen:
dependency:
taskdep:
attrs:
task: run_post_mem#mem#_f#fhr#
task: run_post_#mem_name#_f#fhr#
11 changes: 6 additions & 5 deletions parm/wflow/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default_task_test: &default_task
subcyc: !cycstr "@M"
LOGDIR: !cycstr "&LOGDIR;"
SLASH_ENSMEM_SUBDIR: '&SLASH_ENSMEM_SUBDIR;'
ENSMEM_INDX: '#mem#'
ENSMEM_INDX: '#mem_indx#'
native: '{{ platform.SCHED_NATIVE_CMD }}'
nnodes: 1
nodes: '{{ nnodes }}:ppn={{ ppn }}'
Expand All @@ -26,17 +26,18 @@ default_task_test: &default_task

metatask_integration_test:
var:
mem: '{% if global.DO_ENSEMBLE %}{%- for m in range(1, global.NUM_ENS_MEMBERS+1) -%}{{ "%03d "%m }}{%- endfor -%} {% else %}{{ "000"|string }}{% endif %}'
task_integration_test_mem#mem#:
mem_indx: '&ENSMEM_INDICES;'
mem_name: '&ENSMEM_NAMES;'
task_integration_test_#mem_name#:
<<: *default_task
command: '&LOAD_MODULES_RUN_TASK; "integration_test" "&JOBSdir;/JREGIONAL_INTEGRATION_TEST"'
join: !cycstr '&LOGDIR;/{{ jobname }}_@Y@m@d@H&LOGEXT;'
dependency:
and_run_fcst:
taskvalid:
attrs:
task: run_fcst_mem#mem#
task: run_fcst_#mem_name#
taskdep:
attrs:
task: run_fcst_mem#mem#
task: run_fcst_#mem_name#

31 changes: 14 additions & 17 deletions parm/wflow/verify_pre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,14 @@ metatask_check_post_output_all_mems:
# so, to ensure that the stand-alone post metatask for the current member
# has completed for all forecast hours.
and_standalone_post:
# This "or" is to check whether a stand-alane post task exists [either for
# mem000 (if running a deterministic forecast) or for mem001 (if running
# an ensemble forecast)]. Checking for forecast hour 000 is sufficient.
# If so, it implies post is being run stand-alone.
or_post_task_exists: &post_task_exists
taskvalid_mem000:
attrs:
task: run_post_mem000_f000
taskvalid_mem001:
attrs:
task: run_post_mem001_f000
# This checks whether a stand-alane post task exists for the first ensemble
# member (which will be member 0 for a deterministic forecast or member 1
# for an ensemble forecast). Checking for forecast hour 000 is sufficient.
# If so, it implies post is being run stand-alone (as opposed to inline,
# i.e. from within the weather model).
taskvalid_first_ensmem: &post_task_exists
attrs:
task: '{{- "run_post_" ~ global.ENSMEM_NAMES[0] ~ "_f000" }}'
# We would like a dependency here on the run_post_#mem_name#_all_fhrs metatask,
# but that is apparently not possible in rocoto with a metataskvalid/
# metataskdep combination (currently, metataskvalid is not a defined
Expand Down Expand Up @@ -254,13 +251,13 @@ metatask_check_post_output_all_mems:
# the weather model), and if so, to ensure that the forecast task for the
# current member has completed.
and_inline_post:
# This "not" is to check whether a stand-alone post task DOESN'T exist
# [either for mem000 (if running a deterministic forecast) or for mem001
# (if running an ensemble forecast)]. If so, it implies that either
# post is being run inline (as part of the weather model) or is not being
# run at all.
# This "not" is to check whether a stand-alone post task DOESN'T exist.
# If it does, it will either be for ensemble member 0 for a deterministic
# forecast or for member 1 for an ensemble forecast. If such a post task
# doesn't exist, it implies that either post is being run inline (i.e. as
# part of the weather model) or is not being run at all.
not:
or_post_task_exists:
taskvalid_first_ensmem:
<<: *post_task_exists
# This "or" is to verify that either the forecast task for the current
# member exists and has completed, or that it doesn't exist.
Expand Down
7 changes: 5 additions & 2 deletions scripts/exregional_get_extrn_mdl_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
# global:
# DO_ENSEMBLE
# NUM_ENS_MEMBERS
# ENSMEM_BASENAME
# NDIGITS_IN_ENSMEM_NAMES
#
#-----------------------------------------------------------------------
#
Expand Down Expand Up @@ -217,7 +219,7 @@ if [ $(boolify $SYMLINK_FIX_FILES) = "TRUE" ]; then
fi

if [ $(boolify $DO_ENSEMBLE) = "TRUE" ] ; then
mem_dir="/mem{mem:03d}"
mem_dir="/${ENSMEM_BASENAME}{mem:0${NDIGITS_IN_ENSMEM_NAMES}d}"
member_list=(1 ${NUM_ENS_MEMBERS})
additional_flags="$additional_flags \
--members ${member_list[@]}"
Expand Down Expand Up @@ -287,7 +289,8 @@ if [ "${EXTRN_MDL_NAME}" = "GEFS" ]; then
sorted_fn=( )
for fcst_hr in "${all_fcst_hrs_array[@]}"; do
# Read in filenames from EXTRN_MDL_FNS and sort them
base_path="${EXTRN_MDL_STAGING_DIR}/mem`printf %03d $num`"
ensmem_indx_fmt=$(printf "%0${NDIGITS_IN_ENSMEM_NAMES}d" $((10#${num})))
base_path="${EXTRN_MDL_STAGING_DIR}/${ENSMEM_BASENAME}${ensmem_indx_fmt}"
filenames_array=`awk -F= '/EXTRN_MDL_FNS/{print $2}' $base_path/${EXTRN_DEFNS}`
for filename in ${filenames_array[@]}; do
IFS='.' read -ra split_fn <<< "$filename"
Expand Down
4 changes: 2 additions & 2 deletions scripts/exregional_run_post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# COMOUT
# DATA_FHR
# DBNROOT
# ENSMEM_INDX
# ENSMEM_NAME
# GLOBAL_VAR_DEFNS_FP
# NET
# PDY
Expand Down Expand Up @@ -226,7 +226,7 @@ fi
# Set the names of the forecast model's write-component output files.
#
if [ "${RUN_ENVIR}" = "nco" ]; then
DATAFCST=$DATAROOT/run_fcst_mem${ENSMEM_INDX}.${share_pid}
DATAFCST=$DATAROOT/run_fcst_${ENSMEM_NAME}.${share_pid}
else
DATAFCST=$DATA
fi
Expand Down

0 comments on commit f327dcd

Please sign in to comment.