diff --git a/.gitignore b/.gitignore index bc3eee8545..5c8d075e50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ bin/ +ecf/ exec/ build/ fix/ include/ lib/ share/ -modulefiles/extrn_comp_build/ sorc/*/ tests/WE2E/WE2E_tests_*.yaml tests/WE2E/*.txt diff --git a/jobs/JAQM_MANAGER b/jobs/JAQM_MANAGER new file mode 100755 index 0000000000..0720502e63 --- /dev/null +++ b/jobs/JAQM_MANAGER @@ -0,0 +1,77 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script copies files from various directories into the experiment +# directory, creates links to some of them, and modifies others (e.g. +# templates) to customize them for the current experiment setup. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +. ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# Save current shell options (in a global array). Then set new options +# for this script/function. +# +#----------------------------------------------------------------------- +# +{ save_shell_opts; . $USHdir/preamble.sh; } > /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). +# +#----------------------------------------------------------------------- +# +scrfunc_fp=$( $READLINK -f "${BASH_SOURCE[0]}" ) +scrfunc_fn=$( basename "${scrfunc_fp}" ) +scrfunc_dir=$( dirname "${scrfunc_fp}" ) +# +#----------------------------------------------------------------------- +# +# Print message indicating entry into script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +Entering script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" + +This is the J-job script for the task that runs a forecast with FV3 for +the specified cycle. +========================================================================" +# +export PS4='$SECONDS + ' +date + +############################################## +# Set variables used in the script +############################################## +${HOMEaqm}/scripts/exaqm_manager.sh +status=$? +[[ $status -ne 0 ]] && exit $status + +########################################## +# Remove the Temporary working directory +########################################## +cd $DATAROOT +[[ $KEEPDATA = "FALSE" ]] && rm -rf $DATA + +date +exit 0 diff --git a/jobs/JDATA_CLEANUP b/jobs/JDATA_CLEANUP new file mode 100755 index 0000000000..9d5e34af7f --- /dev/null +++ b/jobs/JDATA_CLEANUP @@ -0,0 +1,77 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script copies files from various directories into the experiment +# directory, creates links to some of them, and modifies others (e.g. +# templates) to customize them for the current experiment setup. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +. ${GLOBAL_VAR_DEFNS_FP} +. $USHdir/job_preamble.sh +# +#----------------------------------------------------------------------- +# +# Save current shell options (in a global array). Then set new options +# for this script/function. +# +#----------------------------------------------------------------------- +# +{ save_shell_opts; . $USHdir/preamble.sh; } > /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). +# +#----------------------------------------------------------------------- +# +scrfunc_fp=$( $READLINK -f "${BASH_SOURCE[0]}" ) +scrfunc_fn=$( basename "${scrfunc_fp}" ) +scrfunc_dir=$( dirname "${scrfunc_fp}" ) +# +#----------------------------------------------------------------------- +# +# Print message indicating entry into script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +Entering script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" + +This is the J-job script for the task that runs a forecast with FV3 for +the specified cycle. +========================================================================" +# +export PS4='$SECONDS + ' +date + +############################################## +# Set variables used in the script +############################################## +${HOMEaqm}/scripts/exdata_cleanup.sh +status=$? +[[ $status -ne 0 ]] && exit $status + +########################################## +# Remove the Temporary working directory +########################################## +cd $DATAROOT +[[ $KEEPDATA = "FALSE" ]] && rm -rf $DATA + +date +exit 0 diff --git a/jobs/JREGIONAL_RUN_POST b/jobs/JREGIONAL_RUN_POST index 308e254b7e..a09f665e81 100755 --- a/jobs/JREGIONAL_RUN_POST +++ b/jobs/JREGIONAL_RUN_POST @@ -141,7 +141,9 @@ if [ ${#FCST_LEN_CYCL[@]} -gt 1 ]; then cyc_mod=$(( ${cyc} - ${DATE_FIRST_CYCL:8:2} )) CYCLE_IDX=$(( ${cyc_mod} / ${INCR_CYCL_FREQ} )) FCST_LEN_HRS=${FCST_LEN_CYCL[$CYCLE_IDX]} +fi +if [ "${WORKFLOW_MANAGER}" = "rocoto" ]; then fcst_len_hrs=$( printf "%03d" "${FCST_LEN_HRS}" ) if [ "${fhr}" = "${fcst_len_hrs}" ]; then touch "${COMIN}/post_${PDY}${cyc}_task_complete.txt" diff --git a/modulefiles/tasks/wcoss2/aqm_manager.local.lua b/modulefiles/tasks/wcoss2/aqm_manager.local.lua new file mode 100644 index 0000000000..3370fa018b --- /dev/null +++ b/modulefiles/tasks/wcoss2/aqm_manager.local.lua @@ -0,0 +1 @@ +load("python_regional_workflow") diff --git a/modulefiles/tasks/wcoss2/data_cleanup.local.lua b/modulefiles/tasks/wcoss2/data_cleanup.local.lua new file mode 100644 index 0000000000..3370fa018b --- /dev/null +++ b/modulefiles/tasks/wcoss2/data_cleanup.local.lua @@ -0,0 +1 @@ +load("python_regional_workflow") diff --git a/modulefiles/tasks/wcoss2/python_regional_workflow.lua b/modulefiles/tasks/wcoss2/python_regional_workflow.lua index 519f1cdf4a..0a3bc3207b 100644 --- a/modulefiles/tasks/wcoss2/python_regional_workflow.lua +++ b/modulefiles/tasks/wcoss2/python_regional_workflow.lua @@ -1,3 +1,5 @@ +load(pathJoin("PrgEnv-intel", os.getenv("PrgEnv_intel_ver"))) +load(pathJoin("craype", os.getenv("craype_ver"))) load(pathJoin("intel", os.getenv("intel_ver"))) load(pathJoin("python", os.getenv("python_ver"))) load(pathJoin("prod_util", os.getenv("prod_util_ver"))) diff --git a/parm/FV3LAM_wflow.xml b/parm/FV3LAM_wflow.xml index 4515c849e8..13dcdf4483 100644 --- a/parm/FV3LAM_wflow.xml +++ b/parm/FV3LAM_wflow.xml @@ -108,13 +108,13 @@ Directories and files. {%- if run_envir == "nco" %} {%- if do_ensemble %} -@Y@m@d@H/dyn"> -@Y@m@d@H/phy"> +@Y@m@d@H/dyn"> +@Y@m@d@H/phy"> {%- else %} -@Y@m@d@H/dyn"> -@Y@m@d@H/phy"> +@Y@m@d@H/dyn"> +@Y@m@d@H/phy"> {%- endif %} - + {%- else %} @Y@m@d@H{{ slash_ensmem_subdir }}/dyn"> @Y@m@d@H{{ slash_ensmem_subdir }}/phy"> @@ -122,10 +122,10 @@ Directories and files. {%- endif %} {%- if run_envir == "nco" %} -@Y@m@d"> +@Y@m@d"> {%- else %} - + {%- endif %} diff --git a/parm/ecflow/defs/ecf_defn_template.def b/parm/ecflow/defs/ecf_defn_template.def new file mode 100644 index 0000000000..7e3df44c6d --- /dev/null +++ b/parm/ecflow/defs/ecf_defn_template.def @@ -0,0 +1,818 @@ +extern /totality_limit:TOTALITY +extern /cycled_v16_3/primary/00/gfs/v16.3/gfs/jgfs_forecast +extern /cycled_v16_3/primary/06/gfs/v16.3/gfs/jgfs_forecast +extern /cycled_v16_3/primary/12/gfs/v16.3/gfs/jgfs_forecast +extern /cycled_v16_3/primary/18/gfs/v16.3/gfs/jgfs_forecast + +suite {{ ecf_suite_nm }} + inlimit /totality_limit:TOTALITY + family primary + edit aqm_ver '{{ model_ver }}' + edit PACKAGEHOME '{{ home_ecf }}' + edit NET '{{ net }}' + edit RUN '{{ run }}' + edit PROJ '{{ net | upper }}' + edit PROJENVIR 'DEV' + edit MACHINE_SITE 'development' + edit ENVIR '{{ envir }}' + edit QUEUE 'dev' + edit QUEUE_ARCH 'dev_transfer' + edit OUTPUTDIR '{{ logbasedir }}' + family 00 + edit CYC '00' + family aqm + family v1.0 + edit ECF_FILES '%PACKAGEHOME%/ecf/scripts' + family nexus + task jnexus_gfs_sfc + trigger /cycled_v16_3/primary/18/gfs/v16.3/gfs/jgfs_forecast==complete or ../../../../18/aqm/v1.0/aqm_manager/aqm_manager:release_next_cycle + # NCO replace with time based trigger + task jnexus_emission_00 + edit NSPT '00' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_01 + edit NSPT '01' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_02 + edit NSPT '02' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_03 + edit NSPT '03' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_04 + edit NSPT '04' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_05 + edit NSPT '05' + trigger ./jnexus_gfs_sfc==complete + task jnexus_post_split + trigger ./jnexus_emission_00==complete and ./jnexus_emission_01==complete and ./jnexus_emission_02==complete + endfamily + family prep + task jget_extrn_ics + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jget_extrn_lbcs + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jmake_ics + trigger ./jget_extrn_ics==complete + task jmake_lbcs + trigger ./jget_extrn_lbcs==complete + task jics + trigger ./jmake_ics==complete + task jlbcs + trigger ./jmake_lbcs==complete + endfamily + family pts_fire_emis + task jpoint_source + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jfire_emission + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + endfamily + family forecast + task jforecast + trigger ../nexus==complete and ../prep==complete and ../pts_fire_emis==complete + endfamily + family post + task jpost_f000 + edit FHR '000' + trigger ../forecast==complete + task jpost_f001 + edit FHR '001' + trigger ../forecast==complete + task jpost_f002 + edit FHR '002' + trigger ../forecast==complete + task jpost_f003 + edit FHR '003' + trigger ../forecast==complete + task jpost_f004 + edit FHR '004' + trigger ../forecast==complete + task jpost_f005 + edit FHR '005' + trigger ../forecast==complete + task jpost_f006 + edit FHR '006' + trigger ../forecast==complete + endfamily + family product + task jpre_post_stat + trigger ../forecast==complete + task jpost_stat_o3 + trigger ./jpre_post_stat==complete + task jpost_stat_pm25 + trigger ./jpre_post_stat==complete + task jbias_correction_o3 + trigger ./jpre_post_stat==complete + task jbias_correction_pm25 + trigger ./jpre_post_stat==complete + endfamily + family aqm_manager + task aqm_manager + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + event 1 release_next_cycle + event 2 requeue_cycle + task data_cleanup + trigger ../forecast==complete + endfamily + endfamily # v1.0 + endfamily # aqm + endfamily # 00 + family 06 + edit CYC '06' + family aqm + family v1.0 + edit ECF_FILES '%PACKAGEHOME%/ecf/scripts' + family nexus + task jnexus_gfs_sfc + trigger /cycled_v16_3/primary/18/gfs/v16.3/gfs/jgfs_forecast==complete or ../../../../00/aqm/v1.0/aqm_manager/aqm_manager:release_next_cycle + # NCO replace with time based trigger + task jnexus_emission_00 + edit NSPT '00' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_01 + edit NSPT '01' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_02 + edit NSPT '02' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_03 + edit NSPT '03' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_04 + edit NSPT '04' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_05 + edit NSPT '05' + trigger ./jnexus_gfs_sfc==complete + task jnexus_post_split + trigger ./jnexus_emission_00==complete and ./jnexus_emission_01==complete and ./jnexus_emission_02==complete + endfamily + family prep + task jget_extrn_ics + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jget_extrn_lbcs + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jmake_ics + trigger ./jget_extrn_ics==complete + task jmake_lbcs + trigger ./jget_extrn_lbcs==complete + task jics + trigger ./jmake_ics==complete + task jlbcs + trigger ./jmake_lbcs==complete + endfamily + family pts_fire_emis + task jpoint_source + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jfire_emission + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + endfamily + family forecast + task jforecast + trigger ../nexus==complete and ../prep==complete and ../pts_fire_emis==complete + endfamily + family post + task jpost_f000 + edit FHR '000' + trigger ../forecast==complete + task jpost_f001 + edit FHR '001' + trigger ../forecast==complete + task jpost_f002 + edit FHR '002' + trigger ../forecast==complete + task jpost_f003 + edit FHR '003' + trigger ../forecast==complete + task jpost_f004 + edit FHR '004' + trigger ../forecast==complete + task jpost_f005 + edit FHR '005' + trigger ../forecast==complete + task jpost_f006 + edit FHR '006' + trigger ../forecast==complete + task jpost_f007 + edit FHR '007' + trigger ../forecast==complete + task jpost_f008 + edit FHR '008' + trigger ../forecast==complete + task jpost_f009 + edit FHR '009' + trigger ../forecast==complete + task jpost_f010 + edit FHR '010' + trigger ../forecast==complete + task jpost_f011 + edit FHR '011' + trigger ../forecast==complete + task jpost_f012 + edit FHR '012' + trigger ../forecast==complete + task jpost_f013 + edit FHR '013' + trigger ../forecast==complete + task jpost_f014 + edit FHR '014' + trigger ../forecast==complete + task jpost_f015 + edit FHR '015' + trigger ../forecast==complete + task jpost_f016 + edit FHR '016' + trigger ../forecast==complete + task jpost_f017 + edit FHR '017' + trigger ../forecast==complete + task jpost_f018 + edit FHR '018' + trigger ../forecast==complete + task jpost_f019 + edit FHR '019' + trigger ../forecast==complete + task jpost_f020 + edit FHR '020' + trigger ../forecast==complete + task jpost_f021 + edit FHR '021' + trigger ../forecast==complete + task jpost_f022 + edit FHR '022' + trigger ../forecast==complete + task jpost_f023 + edit FHR '023' + trigger ../forecast==complete + task jpost_f024 + edit FHR '024' + trigger ../forecast==complete + task jpost_f025 + edit FHR '025' + trigger ../forecast==complete + task jpost_f026 + edit FHR '026' + trigger ../forecast==complete + task jpost_f027 + edit FHR '027' + trigger ../forecast==complete + task jpost_f028 + edit FHR '028' + trigger ../forecast==complete + task jpost_f029 + edit FHR '029' + trigger ../forecast==complete + task jpost_f030 + edit FHR '030' + trigger ../forecast==complete + task jpost_f031 + edit FHR '031' + trigger ../forecast==complete + task jpost_f032 + edit FHR '032' + trigger ../forecast==complete + task jpost_f033 + edit FHR '033' + trigger ../forecast==complete + task jpost_f034 + edit FHR '034' + trigger ../forecast==complete + task jpost_f035 + edit FHR '035' + trigger ../forecast==complete + task jpost_f036 + edit FHR '036' + trigger ../forecast==complete + task jpost_f037 + edit FHR '037' + trigger ../forecast==complete + task jpost_f038 + edit FHR '038' + trigger ../forecast==complete + task jpost_f039 + edit FHR '039' + trigger ../forecast==complete + task jpost_f040 + edit FHR '040' + trigger ../forecast==complete + task jpost_f041 + edit FHR '041' + trigger ../forecast==complete + task jpost_f042 + edit FHR '042' + trigger ../forecast==complete + task jpost_f043 + edit FHR '043' + trigger ../forecast==complete + task jpost_f044 + edit FHR '044' + trigger ../forecast==complete + task jpost_f045 + edit FHR '045' + trigger ../forecast==complete + task jpost_f046 + edit FHR '046' + trigger ../forecast==complete + task jpost_f047 + edit FHR '047' + trigger ../forecast==complete + task jpost_f048 + edit FHR '048' + trigger ../forecast==complete + task jpost_f049 + edit FHR '049' + trigger ../forecast==complete + task jpost_f050 + edit FHR '050' + trigger ../forecast==complete + task jpost_f051 + edit FHR '051' + trigger ../forecast==complete + task jpost_f052 + edit FHR '052' + trigger ../forecast==complete + task jpost_f053 + edit FHR '053' + trigger ../forecast==complete + task jpost_f054 + edit FHR '054' + trigger ../forecast==complete + task jpost_f055 + edit FHR '055' + trigger ../forecast==complete + task jpost_f056 + edit FHR '056' + trigger ../forecast==complete + task jpost_f057 + edit FHR '057' + trigger ../forecast==complete + task jpost_f058 + edit FHR '058' + trigger ../forecast==complete + task jpost_f059 + edit FHR '059' + trigger ../forecast==complete + task jpost_f060 + edit FHR '060' + trigger ../forecast==complete + task jpost_f061 + edit FHR '061' + trigger ../forecast==complete + task jpost_f062 + edit FHR '062' + trigger ../forecast==complete + task jpost_f063 + edit FHR '063' + trigger ../forecast==complete + task jpost_f064 + edit FHR '064' + trigger ../forecast==complete + task jpost_f065 + edit FHR '065' + trigger ../forecast==complete + task jpost_f066 + edit FHR '066' + trigger ../forecast==complete + task jpost_f067 + edit FHR '067' + trigger ../forecast==complete + task jpost_f068 + edit FHR '068' + trigger ../forecast==complete + task jpost_f069 + edit FHR '069' + trigger ../forecast==complete + task jpost_f070 + edit FHR '070' + trigger ../forecast==complete + task jpost_f071 + edit FHR '071' + trigger ../forecast==complete + task jpost_f072 + edit FHR '072' + trigger ../forecast==complete + endfamily + family product + task jpre_post_stat + trigger ../forecast==complete + task jpost_stat_o3 + trigger ./jpre_post_stat==complete + task jpost_stat_pm25 + trigger ./jpre_post_stat==complete + task jbias_correction_o3 + trigger ./jpre_post_stat==complete + task jbias_correction_pm25 + trigger ./jpre_post_stat==complete + endfamily + family aqm_manager + task aqm_manager + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + event 1 release_next_cycle + event 2 requeue_cycle + task data_cleanup + trigger ../forecast==complete + endfamily + endfamily # v1.0 + endfamily # aqm + endfamily # 06 + family 12 + edit CYC '12' + family aqm + family v1.0 + edit ECF_FILES '%PACKAGEHOME%/ecf/scripts' + family nexus + task jnexus_gfs_sfc + trigger /cycled_v16_3/primary/18/gfs/v16.3/gfs/jgfs_forecast==complete or ../../../../06/aqm/v1.0/aqm_manager/aqm_manager:release_next_cycle + # NCO replace with time based trigger + task jnexus_emission_00 + edit NSPT '00' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_01 + edit NSPT '01' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_02 + edit NSPT '02' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_03 + edit NSPT '03' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_04 + edit NSPT '04' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_05 + edit NSPT '05' + trigger ./jnexus_gfs_sfc==complete + task jnexus_post_split + trigger ./jnexus_emission_00==complete and ./jnexus_emission_01==complete and ./jnexus_emission_02==complete + endfamily + family prep + task jget_extrn_ics + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jget_extrn_lbcs + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jmake_ics + trigger ./jget_extrn_ics==complete + task jmake_lbcs + trigger ./jget_extrn_lbcs==complete + task jics + trigger ./jmake_ics==complete + task jlbcs + trigger ./jmake_lbcs==complete + endfamily + family pts_fire_emis + task jpoint_source + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jfire_emission + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + endfamily + family forecast + task jforecast + trigger ../nexus==complete and ../prep==complete and ../pts_fire_emis==complete + endfamily + family post + task jpost_f000 + edit FHR '000' + trigger ../forecast==complete + task jpost_f001 + edit FHR '001' + trigger ../forecast==complete + task jpost_f002 + edit FHR '002' + trigger ../forecast==complete + task jpost_f003 + edit FHR '003' + trigger ../forecast==complete + task jpost_f004 + edit FHR '004' + trigger ../forecast==complete + task jpost_f005 + edit FHR '005' + trigger ../forecast==complete + task jpost_f006 + edit FHR '006' + trigger ../forecast==complete + task jpost_f007 + edit FHR '007' + trigger ../forecast==complete + task jpost_f008 + edit FHR '008' + trigger ../forecast==complete + task jpost_f009 + edit FHR '009' + trigger ../forecast==complete + task jpost_f010 + edit FHR '010' + trigger ../forecast==complete + task jpost_f011 + edit FHR '011' + trigger ../forecast==complete + task jpost_f012 + edit FHR '012' + trigger ../forecast==complete + task jpost_f013 + edit FHR '013' + trigger ../forecast==complete + task jpost_f014 + edit FHR '014' + trigger ../forecast==complete + task jpost_f015 + edit FHR '015' + trigger ../forecast==complete + task jpost_f016 + edit FHR '016' + trigger ../forecast==complete + task jpost_f017 + edit FHR '017' + trigger ../forecast==complete + task jpost_f018 + edit FHR '018' + trigger ../forecast==complete + task jpost_f019 + edit FHR '019' + trigger ../forecast==complete + task jpost_f020 + edit FHR '020' + trigger ../forecast==complete + task jpost_f021 + edit FHR '021' + trigger ../forecast==complete + task jpost_f022 + edit FHR '022' + trigger ../forecast==complete + task jpost_f023 + edit FHR '023' + trigger ../forecast==complete + task jpost_f024 + edit FHR '024' + trigger ../forecast==complete + task jpost_f025 + edit FHR '025' + trigger ../forecast==complete + task jpost_f026 + edit FHR '026' + trigger ../forecast==complete + task jpost_f027 + edit FHR '027' + trigger ../forecast==complete + task jpost_f028 + edit FHR '028' + trigger ../forecast==complete + task jpost_f029 + edit FHR '029' + trigger ../forecast==complete + task jpost_f030 + edit FHR '030' + trigger ../forecast==complete + task jpost_f031 + edit FHR '031' + trigger ../forecast==complete + task jpost_f032 + edit FHR '032' + trigger ../forecast==complete + task jpost_f033 + edit FHR '033' + trigger ../forecast==complete + task jpost_f034 + edit FHR '034' + trigger ../forecast==complete + task jpost_f035 + edit FHR '035' + trigger ../forecast==complete + task jpost_f036 + edit FHR '036' + trigger ../forecast==complete + task jpost_f037 + edit FHR '037' + trigger ../forecast==complete + task jpost_f038 + edit FHR '038' + trigger ../forecast==complete + task jpost_f039 + edit FHR '039' + trigger ../forecast==complete + task jpost_f040 + edit FHR '040' + trigger ../forecast==complete + task jpost_f041 + edit FHR '041' + trigger ../forecast==complete + task jpost_f042 + edit FHR '042' + trigger ../forecast==complete + task jpost_f043 + edit FHR '043' + trigger ../forecast==complete + task jpost_f044 + edit FHR '044' + trigger ../forecast==complete + task jpost_f045 + edit FHR '045' + trigger ../forecast==complete + task jpost_f046 + edit FHR '046' + trigger ../forecast==complete + task jpost_f047 + edit FHR '047' + trigger ../forecast==complete + task jpost_f048 + edit FHR '048' + trigger ../forecast==complete + task jpost_f049 + edit FHR '049' + trigger ../forecast==complete + task jpost_f050 + edit FHR '050' + trigger ../forecast==complete + task jpost_f051 + edit FHR '051' + trigger ../forecast==complete + task jpost_f052 + edit FHR '052' + trigger ../forecast==complete + task jpost_f053 + edit FHR '053' + trigger ../forecast==complete + task jpost_f054 + edit FHR '054' + trigger ../forecast==complete + task jpost_f055 + edit FHR '055' + trigger ../forecast==complete + task jpost_f056 + edit FHR '056' + trigger ../forecast==complete + task jpost_f057 + edit FHR '057' + trigger ../forecast==complete + task jpost_f058 + edit FHR '058' + trigger ../forecast==complete + task jpost_f059 + edit FHR '059' + trigger ../forecast==complete + task jpost_f060 + edit FHR '060' + trigger ../forecast==complete + task jpost_f061 + edit FHR '061' + trigger ../forecast==complete + task jpost_f062 + edit FHR '062' + trigger ../forecast==complete + task jpost_f063 + edit FHR '063' + trigger ../forecast==complete + task jpost_f064 + edit FHR '064' + trigger ../forecast==complete + task jpost_f065 + edit FHR '065' + trigger ../forecast==complete + task jpost_f066 + edit FHR '066' + trigger ../forecast==complete + task jpost_f067 + edit FHR '067' + trigger ../forecast==complete + task jpost_f068 + edit FHR '068' + trigger ../forecast==complete + task jpost_f069 + edit FHR '069' + trigger ../forecast==complete + task jpost_f070 + edit FHR '070' + trigger ../forecast==complete + task jpost_f071 + edit FHR '071' + trigger ../forecast==complete + task jpost_f072 + edit FHR '072' + trigger ../forecast==complete + endfamily + family product + task jpre_post_stat + trigger ../forecast==complete + task jpost_stat_o3 + trigger ./jpre_post_stat==complete + task jpost_stat_pm25 + trigger ./jpre_post_stat==complete + task jbias_correction_o3 + trigger ./jpre_post_stat==complete + task jbias_correction_pm25 + trigger ./jpre_post_stat==complete + endfamily + family aqm_manager + task aqm_manager + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + event 1 release_next_cycle + event 2 requeue_cycle + task data_cleanup + trigger ../forecast==complete + endfamily + endfamily # v1.0 + endfamily # aqm + endfamily # 12 + family 18 + edit CYC '18' + family aqm + family v1.0 + edit ECF_FILES '%PACKAGEHOME%/ecf/scripts' + family nexus + task jnexus_gfs_sfc + trigger /cycled_v16_3/primary/18/gfs/v16.3/gfs/jgfs_forecast==complete or ../../../../12/aqm/v1.0/aqm_manager/aqm_manager:release_next_cycle + # NCO replace with time based trigger + task jnexus_emission_00 + edit NSPT '00' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_01 + edit NSPT '01' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_02 + edit NSPT '02' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_03 + edit NSPT '03' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_04 + edit NSPT '04' + trigger ./jnexus_gfs_sfc==complete + task jnexus_emission_05 + edit NSPT '05' + trigger ./jnexus_gfs_sfc==complete + task jnexus_post_split + trigger ./jnexus_emission_00==complete and ./jnexus_emission_01==complete and ./jnexus_emission_02==complete + endfamily + family prep + task jget_extrn_ics + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jget_extrn_lbcs + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jmake_ics + trigger ./jget_extrn_ics==complete + task jmake_lbcs + trigger ./jget_extrn_lbcs==complete + task jics + trigger ./jmake_ics==complete + task jlbcs + trigger ./jmake_lbcs==complete + endfamily + family pts_fire_emis + task jpoint_source + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + task jfire_emission + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + endfamily + family forecast + task jforecast + trigger ../nexus==complete and ../prep==complete and ../pts_fire_emis==complete + endfamily + family post + task jpost_f000 + edit FHR '000' + trigger ../forecast==complete + task jpost_f001 + edit FHR '001' + trigger ../forecast==complete + task jpost_f002 + edit FHR '002' + trigger ../forecast==complete + task jpost_f003 + edit FHR '003' + trigger ../forecast==complete + task jpost_f004 + edit FHR '004' + trigger ../forecast==complete + task jpost_f005 + edit FHR '005' + trigger ../forecast==complete + task jpost_f006 + edit FHR '006' + trigger ../forecast==complete + endfamily + family product + task jpre_post_stat + trigger ../forecast==complete + task jpost_stat_o3 + trigger ./jpre_post_stat==complete + task jpost_stat_pm25 + trigger ./jpre_post_stat==complete + task jbias_correction_o3 + trigger ./jpre_post_stat==complete + task jbias_correction_pm25 + trigger ./jpre_post_stat==complete + endfamily + family aqm_manager + task aqm_manager + trigger ../nexus/jnexus_gfs_sfc==active or ../nexus/jnexus_gfs_sfc==complete + event 1 release_next_cycle + event 2 requeue_cycle + task data_cleanup + trigger ../forecast==complete + endfamily + endfamily # v1.0 + endfamily # aqm + endfamily # 18 + endfamily # primary +endsuite diff --git a/parm/ecflow/env/env_template.sh b/parm/ecflow/env/env_template.sh new file mode 100644 index 0000000000..b5f1394638 --- /dev/null +++ b/parm/ecflow/env/env_template.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +export ECF_PORT="34310" +export ECF_HOST="ddecflow01" +export ECF_HOME="{{ ecf_home }}" +export ECF_DATA_ROOT="{{ ecf_data_root }}" +export ECF_OUTPUTDIR="{{ ecf_outputdir }}" +export ECF_COMDIR="{{ ecf_comdir }}" +export LFS_OUTPUTDIR="{{ lfs_outputdir }}" + +mkdir -p $ECF_HOME +mkdir -p $ECF_DATA_ROOT +mkdir -p $ECF_OUTPUTDIR +mkdir -p $ECF_COMDIR +mkdir -p $LFS_OUTPUTDIR + +ecflow_client --alter add variable EMC_USER chan-hoo.jeon /{{ ecf_suite_nm }} +ecflow_client --alter add variable ECF_INCLUDE {{ home_ecf }}/ecf/include /{{ ecf_suite_nm }} + +ecflow_client --alter add variable PDY {{ pdy }} /{{ ecf_suite_nm }}/primary/00 +ecflow_client --alter add variable PDY {{ pdy }} /{{ ecf_suite_nm }}/primary/06 +ecflow_client --alter add variable PDY {{ pdy }} /{{ ecf_suite_nm }}/primary/12 +ecflow_client --alter add variable PDY {{ pdy }} /{{ ecf_suite_nm }}/primary/18 + diff --git a/parm/ecflow/include_tmpl/envir-p1.h b/parm/ecflow/include_tmpl/envir-p1.h new file mode 100644 index 0000000000..e40b9dec7a --- /dev/null +++ b/parm/ecflow/include_tmpl/envir-p1.h @@ -0,0 +1,50 @@ +# envir-p1.h + +export model_ver="v7.0" +export RUN=%RUN% +export NET=%NET% +export envir=%ENVIR% + +if [ -n "%SENDCANNEDDBN:%" ]; then export SENDCANNEDDBN=${SENDCANNEDDBN:-%SENDCANNEDDBN:%}; fi +export SENDCANNEDDBN=${SENDCANNEDDBN:-"NO"} + +if [[ "$envir" == prod && "$SENDDBN" == YES ]]; then + export eval=%EVAL:NO% + if [ $eval == YES ]; then export SIPHONROOT=${UTILROOT}/para_dbn + else export SIPHONROOT=/lfs/h1/ops/prod/dbnet_siphon + fi + if [ "$PARATEST" == YES ]; then export SIPHONROOT=${UTILROOT}/fakedbn; export NODBNFCHK=YES; fi +else + export SIPHONROOT=${UTILROOT}/fakedbn +fi +export SIPHONROOT=${UTILROOT}/fakedbn +export DBNROOT=$SIPHONROOT + +if [[ ! " prod para test " =~ " ${envir} " && " ops.prod ops.para " =~ " $(whoami) " ]]; then err_exit "ENVIR must be prod, para, or test [envir-p1.h]"; fi + + +# Developer configuration +PTMP=/lfs/h2/emc/ptmp +PSLOT=ecflow_aqm + +export SENDDBN="NO" +export SENDDBN_NTC="NO" + +export OPSROOT="${PTMP}/${USER}/${PSLOT}/para" +export COMROOT="${OPSROOT}/com" +export DATAROOT="${OPSROOT}/tmp" +export DCOMROOT="${OPSROOT}/dcom" + +#export DCOMINbio: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/aqm/bio +#export DCOMINdust: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/FENGSHA +#export DCOMINfire: /lfs/h2/emc/physics/noscrub/kai.wang/RAVE_fire/RAVE_NA_NRT +#export DCOMINchem_lbcs: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/LBCS/AQM_NA13km_AM4_v1 +#export DCOMINgefs: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/GEFS_DATA +#export DCOMINpt_src: /lfs/h2/emc/physics/noscrub/Youhua.Tang/nei2016v1-pt/v2023-01-PT +#export DCOMINairnow: /lfs/h1/ops/prod/dcom + +if [ -n "%PDY:%" ]; then + export PDY=${PDY:-%PDY:%} + export CDATE=${PDY}%CYC:% +fi + diff --git a/parm/ecflow/include_tmpl/head.h b/parm/ecflow/include_tmpl/head.h new file mode 100644 index 0000000000..dbd9e5941a --- /dev/null +++ b/parm/ecflow/include_tmpl/head.h @@ -0,0 +1,93 @@ +date +hostname +set -xe # print commands as they are executed and enable signal trapping + +export PS4='+ $SECONDS + ' + +# Variables needed for communication with ecFlow +export ECF_NAME=%ECF_NAME% +export ECF_HOST=%ECF_LOGHOST% +export ECF_PORT=%ECF_PORT% +export ECF_PASS=%ECF_PASS% +export ECF_TRYNO=%ECF_TRYNO% +export ECF_RID=${ECF_RID:-${PBS_JOBID:-$(hostname -s).$$}} +export ECF_JOB=%ECF_JOB% +export ECF_JOBOUT=%ECF_JOBOUT% +export ecflow_ver=%ecflow_ver% + +if [ -d /apps/ops/prod ]; then # On WCOSS2 + set +x + echo "Running 'module reset'" + module reset + set -x +fi + +# Setting the model package location +modelhome=%PACKAGEHOME:% +eval "export HOME${model:?'model undefined'}=$modelhome" +eval "versionfile=\$HOME${model}/versions/run.ver" +if [ -f "$versionfile" ]; then + . $versionfile +fi +export envir=%ENVIR% +export MACHINE_SITE=%MACHINE_SITE% +export RUN_ENVIR=${RUN_ENVIR:-nco} +export SENDECF=${SENDECF:-YES} +export SENDCOM=${SENDCOM:-YES} +if [ -n "%PDY:%" ]; then export PDY=${PDY:-%PDY:%}; fi +if [ -n "%PARATEST:%" ]; then export PARATEST=${PARATEST:-%PARATEST:%}; fi +if [ -n "%COMPATH:%" ]; then export COMPATH=${COMPATH:-%COMPATH:%}; fi +if [ -n "%MAILTO:%" ]; then export MAILTO=${MAILTO:-%MAILTO:%}; fi +if [ -n "%DBNLOG:%" ]; then export DBNLOG=${DBNLOG:-%DBNLOG:%}; fi +export KEEPDATA=YES +export SENDDBN=${SENDDBN:-%SENDDBN:YES%} +export SENDDBN_NTC=${SENDDBN_NTC:-%SENDDBN_NTC:YES%} + +if [ -d /apps/ops/prod ]; then # On WCOSS2 + set +x + if [ $(whoami) == ops.para ]; then + module use -a /apps/ops/para/nco/modulefiles/core + fi + echo "Running module load ecflow/$ecflow_ver" + module load ecflow/$ecflow_ver + echo "ecflow module location: $(module display ecflow |& head -2 | tail -1 | sed 's/:$//')" + set -x + . ${ECF_ROOT}/versions/run.ver + set +x + module load prod_util/${prod_util_ver} + module load prod_envir/${prod_envir_ver} + echo "Listing modules from head.h:" + module list + set -x +fi + +timeout 300 ecflow_client --init=${ECF_RID} + +if [[ " ops.prod ops.para " =~ " $(whoami) " ]]; then + POST_OUT=${POST_OUT:-/lfs/h1/ops/%ENVIR%/tmp/posts/ecflow_post_in.${ECF_RID}} + echo 'export ECF_NAME=${ECF_NAME}' > $POST_OUT + echo 'export ECF_HOST=${ECF_HOST}' >> $POST_OUT + echo 'export ECF_PORT=${ECF_PORT}' >> $POST_OUT + echo 'export ECF_PASS=${ECF_PASS}' >> $POST_OUT + echo 'export ECF_TRYNO=${ECF_TRYNO}' >> $POST_OUT + echo 'export ECF_RID=${ECF_RID}' >> $POST_OUT +fi + +# Define error handler +ERROR() { + set +ex + if [ "$1" -eq 0 ]; then + msg="Killed by signal (likely via qdel)" + else + msg="Killed by signal $1" + fi + ecflow_client --abort="$msg" + echo $msg + if [[ " ops.prod ops.para " =~ " $(whoami) " ]]; then + echo "# Trap Caught" >>$POST_OUT + fi + trap $1; exit $1 +} +# Trap all error and exit signals +trap 'ERROR $?' ERR EXIT + diff --git a/parm/ecflow/include_tmpl/tail.h b/parm/ecflow/include_tmpl/tail.h new file mode 100644 index 0000000000..c6686c5ca1 --- /dev/null +++ b/parm/ecflow/include_tmpl/tail.h @@ -0,0 +1,3 @@ +timeout 300 ecflow_client --complete # Notify ecFlow of a normal end +trap 0 # Remove all traps +exit 0 # End the shell diff --git a/parm/ecflow/scripts/aqm_manager/aqm_manager.ecf b/parm/ecflow/scripts/aqm_manager/aqm_manager.ecf new file mode 100644 index 0000000000..f360ec1f95 --- /dev/null +++ b/parm/ecflow/scripts/aqm_manager/aqm_manager.ecf @@ -0,0 +1,27 @@ +#PBS -N %RUN%_aqm_manager_%CYC% +#PBS -j oe +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=06:00:00 +#PBS -l select=1:ncpus=1:mem=1GB +#PBS -l place=vscatter +#PBS -l debug=true + +model=aqm +%include +%include + +export cyc=%CYC% +export cycle=t${cyc}z +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh aqm_manager "${JOBSdir}/JAQM_MANAGER" + +%include +%manual + +%end diff --git a/parm/ecflow/scripts/aqm_manager/data_cleanup.ecf b/parm/ecflow/scripts/aqm_manager/data_cleanup.ecf new file mode 100644 index 0000000000..b89105eef2 --- /dev/null +++ b/parm/ecflow/scripts/aqm_manager/data_cleanup.ecf @@ -0,0 +1,26 @@ +#PBS -N %RUN%_data_cleanup_%CYC% +#PBS -j oe +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:ncpus=1:mem=1GB +#PBS -l place=vscatter +#PBS -l debug=true + +model=aqm +%include +%include + +export cyc=%CYC% +export cycle=t${cyc}z + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh data_cleanup "${JOBSdir}/JDATA_CLEANUP" + +%include +%manual + +%end diff --git a/parm/ecflow/scripts/forecast/jforecast.ecf b/parm/ecflow/scripts/forecast/jforecast.ecf new file mode 100755 index 0000000000..20d71d9090 --- /dev/null +++ b/parm/ecflow/scripts/forecast/jforecast.ecf @@ -0,0 +1,27 @@ +#PBS -N {{ tn_run_fcst }} +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=04:00:00 +#PBS -l select=14:mpiprocs=128:ompthreads=1:ncpus=128 +#PBS -l place=vscatter:exclhost +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +export subcyc=0 + +%include +%include + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh run_fcst "${JOBSdir}/JREGIONAL_RUN_FCST" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/nexus/jnexus_emission.ecf b/parm/ecflow/scripts/nexus/jnexus_emission.ecf new file mode 100755 index 0000000000..8f8364fb42 --- /dev/null +++ b/parm/ecflow/scripts/nexus/jnexus_emission.ecf @@ -0,0 +1,28 @@ +#PBS -N aqm_nexus_emission_%NSPT%_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=01:00:00 +#PBS -l select=4:mpiprocs=64:ompthreads=2:ncpus=128 +#PBS -l place=vscatter:exclhost +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export nspt="%NSPT%" +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh nexus_emission "${JOBSdir}/JREGIONAL_NEXUS_EMISSION" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/nexus/jnexus_gfs_sfc.ecf b/parm/ecflow/scripts/nexus/jnexus_gfs_sfc.ecf new file mode 100755 index 0000000000..35f2ec80db --- /dev/null +++ b/parm/ecflow/scripts/nexus/jnexus_gfs_sfc.ecf @@ -0,0 +1,26 @@ +#PBS -N {{ tn_nexus_gfs_sfc }} +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ncpus=1 +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh nexus_gfs_sfc "${JOBSdir}/JREGIONAL_NEXUS_GFS_SFC" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/nexus/jnexus_post_split.ecf b/parm/ecflow/scripts/nexus/jnexus_post_split.ecf new file mode 100755 index 0000000000..40a63f9b49 --- /dev/null +++ b/parm/ecflow/scripts/nexus/jnexus_post_split.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_nexus_post_split_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ncpus=1 +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh nexus_post_split "${JOBSdir}/JREGIONAL_NEXUS_POST_SPLIT" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/post/jpost.ecf b/parm/ecflow/scripts/post/jpost.ecf new file mode 100755 index 0000000000..74b75cce23 --- /dev/null +++ b/parm/ecflow/scripts/post/jpost.ecf @@ -0,0 +1,28 @@ +#PBS -N aqm_post_%FHR%_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:15:00 +#PBS -l select=2:mpiprocs=24:ncpus=24 +#PBS -l place=vscatter:exclhost +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 +export fhr="%FHR%" + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh run_post "${JOBSdir}/JREGIONAL_RUN_POST" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/prep/jget_extrn_ics.ecf b/parm/ecflow/scripts/prep/jget_extrn_ics.ecf new file mode 100755 index 0000000000..f75588616d --- /dev/null +++ b/parm/ecflow/scripts/prep/jget_extrn_ics.ecf @@ -0,0 +1,27 @@ +#PBS -N {{ tn_get_extrn_ics }} +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:45:00 +#PBS -l select=1:mpiprocs=1:ncpus=1:mem=2G +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 +export ICS_OR_LBCS=ICS + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh get_extrn_ics "${JOBSdir}/JREGIONAL_GET_EXTRN_MDL_FILES" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/prep/jget_extrn_lbcs.ecf b/parm/ecflow/scripts/prep/jget_extrn_lbcs.ecf new file mode 100755 index 0000000000..f546fdaeae --- /dev/null +++ b/parm/ecflow/scripts/prep/jget_extrn_lbcs.ecf @@ -0,0 +1,27 @@ +#PBS -N {{ tn_get_extrn_lbcs }} +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=02:00:00 +#PBS -l select=1:mpiprocs=1:ncpus=1:mem=2G +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 +export ICS_OR_LBCS=LBCS + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh get_extrn_lbcs "${JOBSdir}/JREGIONAL_GET_EXTRN_MDL_FILES" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/prep/jics.ecf b/parm/ecflow/scripts/prep/jics.ecf new file mode 100755 index 0000000000..94b066fa00 --- /dev/null +++ b/parm/ecflow/scripts/prep/jics.ecf @@ -0,0 +1,31 @@ +#PBS -N aqm_ics_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ncpus=1 +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 +SDATE=$($NDATE -6 ${PDY}${cyc}) +PDYS_P1=$(echo $SDATE | cut -c1-8) +cycs_p1=$(echo $SDATE | cut -c9-10) + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +export PREV_CYCLE_DIR=$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDYS_P1}/${cycs_p1}) + +. ${USHdir}/load_modules_run_task.sh aqm_ics "${JOBSdir}/JREGIONAL_AQM_ICS" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/prep/jlbcs.ecf b/parm/ecflow/scripts/prep/jlbcs.ecf new file mode 100755 index 0000000000..5810d67f24 --- /dev/null +++ b/parm/ecflow/scripts/prep/jlbcs.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_lbcs_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:20:00 +#PBS -l select=1:mpiprocs=24:ncpus=24 +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh aqm_lbcs "${JOBSdir}/JREGIONAL_AQM_LBCS" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/prep/jmake_ics.ecf b/parm/ecflow/scripts/prep/jmake_ics.ecf new file mode 100755 index 0000000000..3d98397613 --- /dev/null +++ b/parm/ecflow/scripts/prep/jmake_ics.ecf @@ -0,0 +1,27 @@ +#PBS -N aqm_make_ics_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=4:mpiprocs=12:ncpus=12 +#PBS -l place=vscatter:exclhost +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh make_ics "${JOBSdir}/JREGIONAL_MAKE_ICS" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/prep/jmake_lbcs.ecf b/parm/ecflow/scripts/prep/jmake_lbcs.ecf new file mode 100755 index 0000000000..7def36d227 --- /dev/null +++ b/parm/ecflow/scripts/prep/jmake_lbcs.ecf @@ -0,0 +1,27 @@ +#PBS -N aqm_make_lbcs_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=128:ncpus=128 +#PBS -l place=vscatter:exclhost +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh make_lbcs "${JOBSdir}/JREGIONAL_MAKE_LBCS" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/product/jbias_correction_o3.ecf b/parm/ecflow/scripts/product/jbias_correction_o3.ecf new file mode 100755 index 0000000000..b6f4cdfd13 --- /dev/null +++ b/parm/ecflow/scripts/product/jbias_correction_o3.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_bias_correction_o3_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ompthreads=32:ncpus=32:mem=120G +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh bias_correction_o3 "${JOBSdir}/JREGIONAL_BIAS_CORRECTION_O3" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/product/jbias_correction_pm25.ecf b/parm/ecflow/scripts/product/jbias_correction_pm25.ecf new file mode 100755 index 0000000000..5a4d432d98 --- /dev/null +++ b/parm/ecflow/scripts/product/jbias_correction_pm25.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_bias_correction_pm25_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ompthreads=32:ncpus=32:mem=120G +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh bias_correction_pm25 "${JOBSdir}/JREGIONAL_BIAS_CORRECTION_PM25" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/product/jpost_stat_o3.ecf b/parm/ecflow/scripts/product/jpost_stat_o3.ecf new file mode 100755 index 0000000000..5286db55fa --- /dev/null +++ b/parm/ecflow/scripts/product/jpost_stat_o3.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_post_stat_o3_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ncpus=1:mem=120G +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh post_stat_o3 "${JOBSdir}/JREGIONAL_POST_STAT_O3" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/product/jpost_stat_pm25.ecf b/parm/ecflow/scripts/product/jpost_stat_pm25.ecf new file mode 100755 index 0000000000..7d9cffd1f4 --- /dev/null +++ b/parm/ecflow/scripts/product/jpost_stat_pm25.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_post_stat_pm25_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ncpus=1:mem=120G +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh post_stat_pm25 "${JOBSdir}/JREGIONAL_POST_STAT_PM25" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/product/jpre_post_stat.ecf b/parm/ecflow/scripts/product/jpre_post_stat.ecf new file mode 100755 index 0000000000..851e232bd2 --- /dev/null +++ b/parm/ecflow/scripts/product/jpre_post_stat.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_pre_post_stat_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ncpus=1 +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh pre_post_stat "${JOBSdir}/JREGIONAL_PRE_POST_STAT" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/pts_fire_emis/jfire_emission.ecf b/parm/ecflow/scripts/pts_fire_emis/jfire_emission.ecf new file mode 100755 index 0000000000..a1e8e5359f --- /dev/null +++ b/parm/ecflow/scripts/pts_fire_emis/jfire_emission.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_fire_emission_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=00:30:00 +#PBS -l select=1:mpiprocs=1:ncpus=1 +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh fire_emission "${JOBSdir}/JREGIONAL_FIRE_EMISSION" + +%include + +%manual +%end diff --git a/parm/ecflow/scripts/pts_fire_emis/jpoint_source.ecf b/parm/ecflow/scripts/pts_fire_emis/jpoint_source.ecf new file mode 100755 index 0000000000..30d348a7af --- /dev/null +++ b/parm/ecflow/scripts/pts_fire_emis/jpoint_source.ecf @@ -0,0 +1,26 @@ +#PBS -N aqm_point_source_%CYC% +#PBS -j oe +#PBS -S /bin/bash +#PBS -q %QUEUE% +#PBS -A %PROJ%-%PROJENVIR% +#PBS -l walltime=01:00:00 +#PBS -l select=1:mpiprocs=1:ncpus=1 +#PBS -l debug=true + +model=aqm +export cyc="%CYC%" +%include +%include + +export subcyc=0 + +export GLOBAL_VAR_DEFNS_FP="{{ global_var_defns_fp }}" +export USHdir="{{ ushdir }}" +JOBSdir="{{ jobsdir }}" + +. ${USHdir}/load_modules_run_task.sh point_source "${JOBSdir}/JREGIONAL_POINT_SOURCE" + +%include + +%manual +%end diff --git a/scripts/exaqm_manager.sh b/scripts/exaqm_manager.sh new file mode 100755 index 0000000000..74a77bf03c --- /dev/null +++ b/scripts/exaqm_manager.sh @@ -0,0 +1,136 @@ +#! /bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +. ${GLOBAL_VAR_DEFNS_FP} +# +#----------------------------------------------------------------------- +# +# Save current shell options (in a global array). Then set new options +# for this script/function. +# +#----------------------------------------------------------------------- +# +{ save_shell_opts; . $USHdir/preamble.sh; } > /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). +# +#----------------------------------------------------------------------- +# +scrfunc_fp=$( $READLINK -f "${BASH_SOURCE[0]}" ) +scrfunc_fn=$( basename "${scrfunc_fp}" ) +scrfunc_dir=$( dirname "${scrfunc_fp}" ) +# +#----------------------------------------------------------------------- +# +# Print message indicating entry into script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +Entering script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" + +This is the ex-script for AQM-MANAGER. +========================================================================" + +ecflow_sid=prod_aqm + +############################################## +# Set variables used in the script +############################################## +CDATE=${PDY}${cyc} +GDATE=$($NDATE -06 $CDATE) +gPDY=$(echo $GDATE | cut -c1-8) +gcyc=$(echo $GDATE | cut -c9-10) +NEXTDATE=$($NDATE +06 $CDATE) +NEXTPDY=$(echo $NEXTDATE | cut -c1-8) +NEXTcyc=$(echo $NEXTDATE | cut -c9-10) +# NEXT24HPDY=$($NDATE +24 ${PDY}00) +CURRENTDAYPDY=$(ecflow_client --query variable /${ecflow_sid}/primary/${gcyc}:PDY)00 +NEXTDAYPDY_CDATE=$($NDATE +24 $CURRENTDAYPDY) +NEXTDAYPDY=$(echo $NEXTDAYPDY_CDATE | cut -c1-8) + +gefs_check=$(compath.py ${envir}/gefs/${gefs_ver})/gefs.${NEXTPDY}/${NEXTcyc}/chem/sfcsig/geaer.t${NEXTcyc}z.atmf078.nemsio +gfs_check=$(compath.py ${envir}/gfs/${gfs_ver})/gfs.${NEXTPDY}/${NEXTcyc}/atmos/gfs.t${NEXTcyc}z.sfcf078.nc +found_required_file_for_next_cycle=NO +fcst_job_completed=NO +release_next_cycle=NO +previous_cycle_run_completed=NO +cleanup_job_done=NO +previous_cycle_aqm_manager_complete=NO + +h_try=1 +while [ $h_try -lt 70 ]; do + #################################### + # Set release_next_cycle event when + # current cycle fcst restart file exist + #################################### + if [ ${found_required_file_for_next_cycle} = "NO" ] && [ -d "${COMIN}/RESTART" ]; then + if [[ "$(ls -A ${COMIN}/RESTART )" && -f ${gefs_check} && -f ${gfs_check} ]]; then + ecflow_client --event release_next_cycle + found_required_file_for_next_cycle=YES + fi + fi + #################################### + # Requeue previous cycle when + # current forecast job is completed + #################################### + if [ ${fcst_job_completed} = "NO" ]; then + P_state=$(ecflow_client --query state /${ecflow_sid}/primary/${gcyc}) + e_state=$(ecflow_client --query state /${ecflow_sid}/primary/${cyc}/aqm/v1.0/forecast/jforecast) + if [[ ${e_state} = "complete" && ${P_state} = "complete" ]]; then + ecflow_client --event requeue_cycle + ecflow_client --alter change variable PDY $NEXTDAYPDY /${ecflow_sid}/primary/${gcyc} + ecflow_client --requeue force /${ecflow_sid}/primary/${gcyc}/aqm + fcst_job_completed=YES + fi + fi + + h_try=$((h_try+1)) + if [ ${found_required_file_for_next_cycle} = "YES" -a ${fcst_job_completed} = "YES" ]; then + h_try=99 + else + sleep 300 + fi +done +if [ $h_try -eq 70 ]; then + exit 70 +fi + +# +#----------------------------------------------------------------------- +# +# Print message indicating successful completion of script. +# +#----------------------------------------------------------------------- +# + print_info_msg " +======================================================================== +Successfully ran AQM-MANAGER!!! + +Exiting script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" +========================================================================" + +# +#----------------------------------------------------------------------- +# +# Restore the shell options saved at the beginning of this script/func- +# tion. +# +#----------------------------------------------------------------------- +# +{ restore_shell_opts; } > /dev/null 2>&1 + diff --git a/scripts/exdata_cleanup.sh b/scripts/exdata_cleanup.sh new file mode 100755 index 0000000000..c578518d06 --- /dev/null +++ b/scripts/exdata_cleanup.sh @@ -0,0 +1,82 @@ +#! /bin/bash + +# +#----------------------------------------------------------------------- +# +# Source the variable definitions file and the bash utility functions. +# +#----------------------------------------------------------------------- +# +. $USHdir/source_util_funcs.sh +. ${GLOBAL_VAR_DEFNS_FP} +# +#----------------------------------------------------------------------- +# +# Save current shell options (in a global array). Then set new options +# for this script/function. +# +#----------------------------------------------------------------------- +# +{ save_shell_opts; . $USHdir/preamble.sh; } > /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). +# +#----------------------------------------------------------------------- +# +scrfunc_fp=$( $READLINK -f "${BASH_SOURCE[0]}" ) +scrfunc_fn=$( basename "${scrfunc_fp}" ) +scrfunc_dir=$( dirname "${scrfunc_fp}" ) +# +#----------------------------------------------------------------------- +# +# Print message indicating entry into script. +# +#----------------------------------------------------------------------- +# +print_info_msg " +======================================================================== +Entering script: \"${scrfunc_fn}\" +In directory: \"${scrfunc_dir}\" + +This is the ex-script for DATA-CLEANUP. +========================================================================" + +# Clean up the DATA directory from previous cycle if found +[[ $KEEPDATA = "TRUE" ]] && exit 0 + +# Set variables used in the script +CDATE=${PDY}${cyc} +GDATE=$($NDATE -24 $CDATE) +gPDY=$(echo $GDATE | cut -c1-8) +gcyc=$(echo $GDATE | cut -c9-10) + +############################################## +# Looking for the following directory for cleanup +# forecast.${gPDY}${gcyc} +# get_extrn_ics.${gPDY}${gcyc} +# get_extrn_lbcs.${gPDY}${gcyc} +# nexus_gfs_sfc.${gPDY}${gcyc} +############################################## +target_for_delete=${DATAROOT}/forecast.${gPDY}${gcyc} +echo "Remove DATA from ${target_for_delete}" +[[ -d $target_for_delete ]] && rm -rf $target_for_delete + +target_for_delete=${DATAROOT}/get_extrn_ics.${gPDY}${gcyc} +echo "Remove DATA from ${target_for_delete}" +[[ -d $target_for_delete ]] && rm -rf $target_for_delete + +target_for_delete=${DATAROOT}/get_extrn_lbcs.${gPDY}${gcyc} +echo "Remove DATA from ${target_for_delete}" +[[ -d $target_for_delete ]] && rm -rf $target_for_delete + +target_for_delete=${DATAROOT}/nexus_gfs_sfc.${gPDY}${gcyc} +echo "Remove DATA from ${target_for_delete}" +[[ -d $target_for_delete ]] && rm -rf $target_for_delete + +exit 0 +##################################################### + diff --git a/scripts/exregional_bias_correction_o3.sh b/scripts/exregional_bias_correction_o3.sh index 651d5bb420..c0206933fc 100755 --- a/scripts/exregional_bias_correction_o3.sh +++ b/scripts/exregional_bias_correction_o3.sh @@ -381,7 +381,7 @@ EOF1 cp ${DATA}/${NET}.${cycle}.max_*hr_o3_bc.*.grib2 ${COMOUT} - if [ "$SENDDBN" = "YES" ]; then + if [ "$SENDDBN" = "TRUE" ]; then ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUT}/${NET}.${cycle}.max_1hr_o3_bc.227.grib2 ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUT}/${NET}.${cycle}.max_8hr_o3_bc.227.grib2 fi @@ -409,7 +409,7 @@ EOF1 cp awpaqm.${cycle}.*o3-max-bc.227.grib2 ${COMOUTwmo} # Distribute Data - if [ "${SENDDBN_NTC}" = "YES" ] ; then + if [ "${SENDDBN_NTC}" = "TRUE" ] ; then ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.1ho3-max-bc.227.grib2 ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.8ho3-max-bc.227.grib2 fi @@ -456,7 +456,7 @@ if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then cp ${NET}.${cycle}.ave_8hr_o3_bc.227.grib2 ${COMOUT} fi -if [ "${SENDDBN}" = "YES" ] ; then +if [ "${SENDDBN}" = "TRUE" ] ; then ${DBNROOT}/bin/dbn_alert MODEL AQM_CONC ${job} ${COMOUT}/${NET}.${cycle}.ave_1hr_o3_bc.227.grib2 if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then ${DBNROOT}/bin/dbn_alert MODEL AQM_CONC ${job} ${COMOUT}/${NET}.${cycle}.ave_8hr_o3_bc.227.grib2 @@ -508,7 +508,7 @@ if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then cp awpaqm.${cycle}.${hr}ho3-max-bc.227.grib2 ${COMOUTwmo} # Distribute Data - if [ "${SENDDBN}" = "YES" ]; then + if [ "${SENDDBN}" = "TRUE" ]; then ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.${hr}ho3-bc.227.grib2 ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.${hr}ho3-max-bc.227.grib2 fi diff --git a/scripts/exregional_bias_correction_pm25.sh b/scripts/exregional_bias_correction_pm25.sh index 65f14660ab..6924b4dbf8 100755 --- a/scripts/exregional_bias_correction_pm25.sh +++ b/scripts/exregional_bias_correction_pm25.sh @@ -280,7 +280,7 @@ fi POST_STEP cp ${DATA}/${NET}.${cycle}.pm25*bc*.grib2 ${COMOUT} -if [ "$SENDDBN" = "YES" ]; then +if [ "$SENDDBN" = "TRUE" ]; then $DBNROOT/bin/dbn_alert MODEL AQM_PM ${job} ${COMOUT} fi @@ -377,7 +377,7 @@ EOF1 cp ${NET}.${cycle}.max_1hr_pm25_bc.227.grib2 ${COMOUT} cp ${NET}.${cycle}.ave_24hr_pm25_bc.227.grib2 ${COMOUT} - if [ "${SENDDBN}" = "YES" ]; then + if [ "${SENDDBN}" = "TRUE" ]; then ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUT}/${NET}.${cycle}.max_1hr_pm25_bc.227.grib2 ${DBNROOT}/bin/dbn_alert MODEL AQM_PM ${job} ${COMOUT}/${NET}.${cycle}.ave_24hr_pm25_bc.227.grib2 fi @@ -395,7 +395,7 @@ wgrib2 tmpfile_pm25_bc -set_grib_type c3b -new_grid_winds earth -new_grid ${grid cp tmpfile_pm25_bc ${COMOUT}/${NET}.${cycle}.ave_1hr_pm25_bc.${id_domain}.grib2 cp ${NET}.${cycle}.grib2_pm25_bc.227 ${COMOUT}/${NET}.${cycle}.ave_1hr_pm25_bc.227.grib2 -if [ "${SENDDBN}" = "YES" ]; then +if [ "${SENDDBN}" = "TRUE" ]; then ${DBNROOT}/bin/dbn_alert MODEL AQM_PM ${job} ${COMOUT}/${NET}.${cycle}.ave_1hr_pm25_bc.227.grib2 fi @@ -463,7 +463,7 @@ if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then cp awpaqm.${cycle}.24hr-pm25-ave-bc.227.grib2 ${COMOUTwmo} # Distribute Data - if [ "${SENDDBN_NTC}" = "YES" ] ; then + if [ "${SENDDBN_NTC}" = "TRUE" ] ; then ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.1hpm25-bc.227.grib2 ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.daily-1hr-pm25-max-bc.227.grib2 ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.24hr-pm25-ave-bc.227.grib2 diff --git a/scripts/exregional_post_stat_o3.sh b/scripts/exregional_post_stat_o3.sh index 69b1879634..06a253247f 100755 --- a/scripts/exregional_post_stat_o3.sh +++ b/scripts/exregional_post_stat_o3.sh @@ -254,7 +254,7 @@ EOF1 wgrib2 ${NET}.${cycle}.max_1hr_o3.${id_domain}.grib2 -set_grib_type c3b -new_grid_winds earth -new_grid ${!gg} ${NET}.${cycle}.max_1hr_o3.${grid}.grib2 cp ${DATA}/${NET}.${cycle}.max_*hr_o3.*.grib2 ${COMOUT} - if [ "$SENDDBN" = "YES" ]; then + if [ "$SENDDBN" = "TRUE" ]; then ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUT}/${NET}.${cycle}.max_1hr_o3.${grid}.grib2 ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUT}/${NET}.${cycle}.max_8hr_o3.${grid}.grib2 fi @@ -278,7 +278,7 @@ EOF1 done cp awpaqm.${cycle}.*o3-max.${grid}.grib2 ${COMOUTwmo} - if [ "${SENDDBN_NTC}" = "YES" ]; then + if [ "${SENDDBN_NTC}" = "TRUE" ]; then ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.1ho3-max.${grid}.grib2 ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.8ho3-max.${grid}.grib2 fi diff --git a/scripts/exregional_post_stat_pm25.sh b/scripts/exregional_post_stat_pm25.sh index b44e4c84fc..cab6a164e0 100755 --- a/scripts/exregional_post_stat_pm25.sh +++ b/scripts/exregional_post_stat_pm25.sh @@ -149,7 +149,7 @@ if [ "${cyc}" = "06" ] || [ "${cyc}" = "12" ]; then cp awpaqm.${cycle}.1hpm25.${grid}.grib2 ${COMOUTwmo} # Distribute Data - if [ "${SENDDBN_NTC}" = "YES" ] ; then + if [ "${SENDDBN_NTC}" = "TRUE" ] ; then ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.1hpm25.${grid}.grib2 ${DBNROOT}/bin/dbn_alert ${DBNALERT_TYPE} ${NET} ${job} ${COMOUTwmo}/awpaqm.${cycle}.daily-1hr-pm25-max.${grid}.grib2 fi @@ -276,7 +276,7 @@ EOF1 cp awpaqm.${cycle}.daily-1hr-pm25-max.${grid}.grib2 ${COMOUTwmo} cp awpaqm.${cycle}.24hr-pm25-ave.${grid}.grib2 ${COMOUTwmo} - if [ "$SENDDBN" = "YES" ]; then + if [ "$SENDDBN" = "TRUE" ]; then ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUTwmo}/${NET}.${cycle}.ave_24hr_pm25.${grid}.grib2 ${DBNROOT}/bin/dbn_alert MODEL AQM_MAX ${job} ${COMOUTwmo}/${NET}.${cycle}.max_1hr_pm25.${grid}.grib2 fi diff --git a/scripts/exregional_pre_post_stat.sh b/scripts/exregional_pre_post_stat.sh index dce755c1bc..3d96a816cd 100755 --- a/scripts/exregional_pre_post_stat.sh +++ b/scripts/exregional_pre_post_stat.sh @@ -57,7 +57,7 @@ if [ ${#FCST_LEN_CYCL[@]} -gt 1 ]; then cyc_mod=$(( ${cyc} - ${DATE_FIRST_CYCL:8:2} )) CYCLE_IDX=$(( ${cyc_mod} / ${INCR_CYCL_FREQ} )) FCST_LEN_HRS=${FCST_LEN_CYCL[$CYCLE_IDX]} - if [ "${RUN_TASK_RUN_POST}" = "TRUE" ]; then + if [ "${WORKFLOW_MANAGER}" = "rocoto" ] && [ "${RUN_TASK_RUN_POST}" = "TRUE" ]; then rm -f "${COMIN}/${TN_RUN_POST}_${PDY}${cyc}_task_complete.txt" fi fi diff --git a/scripts/exregional_run_post.sh b/scripts/exregional_run_post.sh index 5cbcb6aa0b..1f22a64281 100755 --- a/scripts/exregional_run_post.sh +++ b/scripts/exregional_run_post.sh @@ -303,10 +303,6 @@ done rm -rf ${DATA_FHR} -# Delete the forecast directory -if [ $RUN_ENVIR = "nco" ] && [ $KEEPDATA = "FALSE" ]; then - rm -rf $DATAFCST -fi # #----------------------------------------------------------------------- # diff --git a/ush/config.aqm.nco.realtime.yaml b/ush/config.aqm.nco.realtime.yaml index 3609bdc246..532c646c1c 100644 --- a/ush/config.aqm.nco.realtime.yaml +++ b/ush/config.aqm.nco.realtime.yaml @@ -4,14 +4,16 @@ user: RUN_ENVIR: nco MACHINE: wcoss2 ACCOUNT: [account name] +platform: + WORKFLOW_MANAGER: ecflow workflow: USE_CRON_TO_RELAUNCH: true CRON_RELAUNCH_INTVL_MNTS: 3 EXPT_SUBDIR: aqm_nco_aqmna13km PREDEF_GRID_NAME: AQM_NA_13km CCPP_PHYS_SUITE: FV3_GFS_v16 - DATE_FIRST_CYCL: '2023042500' - DATE_LAST_CYCL: '2023042518' + DATE_FIRST_CYCL: '2023060500' + DATE_LAST_CYCL: '2023060518' INCR_CYCL_FREQ: 6 FCST_LEN_HRS: -1 FCST_LEN_CYCL: @@ -29,12 +31,12 @@ workflow: COLDSTART: false WARMSTART_CYCLE_DIR: /path/to/restart/dir nco: - envir: prod - NET: aqm - model_ver: v7.0 - RUN: aqm_nco_aqmna13km - OPSROOT: /path/to/custom/opsroot - KEEPDATA: false + envir_dfv: prod + NET_dfv: aqm + model_ver_dfv: v7.0 + RUN_dfv: aqm + OPSROOT_dfv: /path/to/custom/opsroot + KEEPDATA_dfv: false workflow_switches: RUN_TASK_MAKE_GRID: false RUN_TASK_MAKE_OROG: false diff --git a/ush/config_defaults.yaml b/ush/config_defaults.yaml index 7a4ee1fd31..16c3e073ad 100644 --- a/ush/config_defaults.yaml +++ b/ush/config_defaults.yaml @@ -807,10 +807,7 @@ workflow: INCR_CYCL_FREQ: 24 FCST_LEN_HRS: 24 FCST_LEN_CYCL: - - 6 - - 12 - - 12 - - 6 + - '{{ FCST_LEN_HRS }}' # #----------------------------------------------------------------------- @@ -905,7 +902,10 @@ nco: #----------------------------------------------------------------------- # # Set variables that are only used in NCO mode (i.e. when RUN_ENVIR is - # set to "nco"). Definitions: + # set to "nco"). All variables have the suffix _dfv meaning the default value. + # This is bacuase they are used as the default values for the production using ecFlow. + # + # Definitions: # # envir, NET, model_ver, RUN: # Standard environment variables defined in the NCEP Central Operations WCOSS @@ -937,35 +937,35 @@ nco: # #----------------------------------------------------------------------- # - envir: "prod" - NET: "aqm" - RUN: "aqm" - model_ver: "v7.0.0" - OPSROOT: '{{ workflow.EXPT_BASEDIR }}/../nco_dirs' - COMROOT: '{{ OPSROOT }}/com' - PACKAGEROOT: '{{ OPSROOT }}/packages' - DATAROOT: '{{ OPSROOT }}/tmp' - DCOMROOT: '{{ OPSROOT }}/dcom' - LOGBASEDIR: '{{ OPSROOT }}/output' - COMIN_BASEDIR: '{{ COMROOT }}/{{ NET }}/{{ model_ver }}' - COMOUT_BASEDIR: '{{ COMROOT }}/{{ NET }}/{{ model_ver }}' + envir_dfv: "prod" + NET_dfv: "aqm" + RUN_dfv: "aqm" + model_ver_dfv: "v7.0.0" + OPSROOT_dfv: '{{ workflow.EXPT_BASEDIR }}/../nco_dirs' + COMROOT_dfv: '{{ OPSROOT_dfv }}/com' + COMIN_BASEDIR: '{{ COMROOT_dfv }}/{{ NET_dfv }}/{{ model_ver_dfv }}' + COMOUT_BASEDIR: '{{ COMROOT_dfv }}/{{ NET_dfv }}/{{ model_ver_dfv }}' + + DATAROOT_dfv: '{{ OPSROOT_dfv }}/tmp' + DCOMROOT_dfv: '{{ OPSROOT_dfv }}/dcom' + LOGBASEDIR_dfv: '{{ OPSROOT_dfv }}/output' # #----------------------------------------------------------------------- # - # The following are also described in the NCO doc above + # The following are also described in the NCO doc above: default values # #----------------------------------------------------------------------- # - DBNROOT: "" - SENDECF: false - SENDDBN: false - SENDDBN_NTC: false - SENDCOM: false - SENDWEB: false - KEEPDATA: true - MAILTO: "" - MAILCC: "" + DBNROOT_dfv: "" + SENDECF_dfv: false + SENDDBN_dfv: false + SENDDBN_NTC_dfv: false + SENDCOM_dfv: false + SENDWEB_dfv: false + KEEPDATA_dfv: true + MAILTO_dfv: "" + MAILCC_dfv: "" #---------------------------- @@ -3015,18 +3015,18 @@ cpl_aqm_parm: DO_AQM_SAVE_FIRE: false AQM_CONFIG_DIR: "" - DCOMINbio: "" + DCOMINbio_dfv: "" AQM_BIO_FILE: "BEIS_SARC401.ncf" - DCOMINdust: "/path/to/dust/dir" + DCOMINdust_dfv: "/path/to/dust/dir" AQM_DUST_FILE_PREFIX: "FENGSHA_p8_10km_inputs" AQM_DUST_FILE_SUFFIX: ".nc" - DCOMINcanopy: "/path/to/canopy/dir" + DCOMINcanopy_dfv: "/path/to/canopy/dir" AQM_CANOPY_FILE_PREFIX: "gfs.t12z.geo" AQM_CANOPY_FILE_SUFFIX: ".canopy_regrid.nc" - DCOMINfire: "" + DCOMINfire_dfv: "" AQM_FIRE_FILE_PREFIX: "GBBEPx_C401GRID.emissions_v003" AQM_FIRE_FILE_SUFFIX: ".nc" AQM_FIRE_ARCHV_DIR: "/path/to/archive/dir/for/RAVE/on/HPSS" @@ -3035,10 +3035,10 @@ cpl_aqm_parm: AQM_RC_PRODUCT_FN: "aqm.prod.nc" AQM_RC_PRODUCT_FREQUENCY: "hourly" - DCOMINchem_lbcs: "" + DCOMINchem_lbcs_dfv: "" AQM_LBCS_FILES: "am4_bndy_c793.2019.v1.nc" - DCOMINgefs: "" + DCOMINgefs_def: "" AQM_GEFS_FILE_PREFIX: "geaer" AQM_GEFS_FILE_CYC: "" @@ -3049,7 +3049,7 @@ cpl_aqm_parm: NEXUS_GFS_SFC_DIR: "" NEXUS_GFS_SFC_ARCHV_DIR: "/NCEPPROD/hpssprod/runhistory" - DCOMINpt_src: "/path/to/point/source/base/directory" + DCOMINpt_src_dfv: "/path/to/point/source/base/directory" - DCOMINairnow: "/path/to/airnow/obaservation/data" + DCOMINairnow_dfv: "/path/to/airnow/obaservation/data" AQM_AIRNOW_HIST_DIR: "/path/to/historical/airnow/data/dir" diff --git a/ush/create_ecflow_scripts.py b/ush/create_ecflow_scripts.py new file mode 100644 index 0000000000..755d34de9c --- /dev/null +++ b/ush/create_ecflow_scripts.py @@ -0,0 +1,229 @@ +#!/usr/bin/env python3 + +import os +import sys +from textwrap import dedent +import jinja2 as j2 +from jinja2 import meta +import yaml +import re + +from python_utils import ( + import_vars, + print_info_msg, + print_err_msg_exit, + cfg_to_yaml_str, + load_shell_config, + flatten_dict, + cp_vrfy, + ln_vrfy, + mkdir_vrfy, + date_to_str +) + +from fill_jinja_template import fill_jinja_template + +def create_ecflow_scripts(global_var_defns_fp): + """ Creates ecFlow job cards and definition script in the specific + experiment directory.""" + + cfg = load_shell_config(global_var_defns_fp) + cfg = flatten_dict(cfg) + import_vars(dictionary=cfg) + + print_info_msg(f""" + Creating ecFlow job cards and definition scripts in the home directory (HOMEaqm): + HOMEaqm = '{HOMEaqm}'""", verbose=VERBOSE) + + # + #----------------------------------------------------------------------- + # + # Create ecFlow directories in the home directory. + # + #----------------------------------------------------------------------- + # + home_ecf = HOMEaqm + mkdir_vrfy("-p", os.path.join(home_ecf, "ecf")) + mkdir_vrfy("-p", os.path.join(home_ecf, "ecf/scripts")) + mkdir_vrfy("-p", os.path.join(home_ecf, "ecf/defs")) + + # + #----------------------------------------------------------------------- + # + # Copy include directory into experiment directory. + # + #----------------------------------------------------------------------- + # + cp_vrfy("-r", os.path.join(PARMdir,"ecflow/include_tmpl"), os.path.join(home_ecf, "ecf/include")) + + # + #----------------------------------------------------------------------- + # + # Create job cards for tasks + # + #----------------------------------------------------------------------- + # + ecf_suite_nm = f"prod_{NET_dfv}" + grp_aqm_manager = ["aqm_manager", "data_cleanup"] + grp_forecast = ["jforecast"] + grp_nexus = ["jnexus_emission", "jnexus_gfs_sfc", "jnexus_post_split"] + grp_post = ["jpost"] + grp_prep = ["jget_extrn_ics", "jget_extrn_lbcs", "jics", "jlbcs", "jmake_ics", "jmake_lbcs"] + grp_product = ["jbias_correction_o3", "jbias_correction_pm25", "jpost_stat_o3", "jpost_stat_pm25", "jpre_post_stat"] + grp_pts_fire_emis = ["jfire_emission", "jpoint_source"] + + tsk_grp = {"aqm_manager": grp_aqm_manager, "forecast": grp_forecast, "nexus": grp_nexus, "post": grp_post, "prep": grp_prep, "product": grp_product, "pts_fire_emis": grp_pts_fire_emis} + + task_all = grp_aqm_manager + grp_forecast + grp_nexus + grp_post + grp_prep + grp_product + grp_pts_fire_emis + + for tsk in task_all: + print('Creating ecFlow job card for', tsk) + # + # Set template file path + # + for grp_k, grp_v in tsk_grp.items(): + if tsk in grp_v: + ecflow_script_group = grp_k + break + + mkdir_vrfy("-p", os.path.join(home_ecf, "ecf/scripts", ecflow_script_group)) + ecflow_script_fn = f"{tsk}.ecf" + ecflow_script_tmpl_fp = os.path.join(PARMdir, "ecflow/scripts", ecflow_script_group, ecflow_script_fn) + ecflow_script_fp = os.path.join(home_ecf, "ecf/scripts", ecflow_script_group, ecflow_script_fn) + + settings = { + "global_var_defns_fp": GLOBAL_VAR_DEFNS_FP, + "ushdir": USHdir, + "jobsdir": JOBSdir, + "tn_get_extrn_ics": TN_GET_EXTRN_ICS, + "tn_get_extrn_lbcs": TN_GET_EXTRN_LBCS, + "tn_nexus_gfs_sfc": TN_NEXUS_GFS_SFC, + "tn_run_fcst": TN_RUN_FCST, + } + settings_str = cfg_to_yaml_str(settings) + + # Call a python script to generate the ecFlow job card. + args = ["-q", + "-o", ecflow_script_fp, + "-t", ecflow_script_tmpl_fp, + "-u", settings_str ] + + try: + fill_jinja_template(args) + except: + raise Exception( + dedent( + f"""Call to create the ecFlow job card for '{tsk}' failed.""" + ) + ) + + # + #----------------------------------------------------------------------- + # + # Create soft-link for mulitple scripts + # + #----------------------------------------------------------------------- + # + max_fcst_len = max(FCST_LEN_CYCL)+1 + for itsk in range(0, max_fcst_len): + ecf_script_orgi = os.path.join(home_ecf, "ecf/scripts/post", "jpost.ecf") + ecf_script_link_fn = f"jpost_f{itsk:03d}.ecf" + ecf_script_link = os.path.join(home_ecf, "ecf/scripts/post", ecf_script_link_fn) + ln_vrfy(f"""-fsn '{ecf_script_orgi}' '{ecf_script_link}'""") + + for itsk in range(0, NUM_SPLIT_NEXUS): + ecf_script_orgi = os.path.join(home_ecf, "ecf/scripts/nexus", "jnexus_emission.ecf") + ecf_script_link_fn = f"jnexus_emission_{itsk:02d}.ecf" + ecf_script_link = os.path.join(home_ecf, "ecf/scripts/nexus", ecf_script_link_fn) + ln_vrfy(f"""-fsn '{ecf_script_orgi}' '{ecf_script_link}'""") + + # + #----------------------------------------------------------------------- + # + # Create definition file + # + #----------------------------------------------------------------------- + # + ecflow_defn_fn = f"{NET_dfv}_cycled.def" + ecflow_defn_tmpl_fp = os.path.join(PARMdir, "ecflow/defs", "ecf_defn_template.def") + ecflow_defn_fp = os.path.join(home_ecf, "ecf/defs", ecflow_defn_fn) + + settings = { + "model_ver": model_ver_dfv, + "ecf_suite_nm": ecf_suite_nm, + "home_ecf": home_ecf, + "net": NET_dfv, + "run": RUN_dfv, + "envir": envir_dfv, + "logbasedir": LOGBASEDIR_dfv, + } + settings_str = cfg_to_yaml_str(settings) + + # Call a python script to generate the ecFlow job card. + args = ["-q", + "-o", ecflow_defn_fp, + "-t", ecflow_defn_tmpl_fp, + "-u", settings_str ] + + try: + fill_jinja_template(args) + except: + raise Exception( + dedent( + f"""Call to create the ecFlow definition file failed.""" + ) + ) + + # + #----------------------------------------------------------------------- + # + # Create ecFlow enviroment file + # + #----------------------------------------------------------------------- + # + ecflow_env_fn = "ecf_env.sh" + ecflow_env_tmpl_fp = os.path.join(PARMdir, "ecflow/env", "env_template.sh") + ecflow_env_fp = os.path.join(home_ecf, "ecf", ecflow_env_fn) + + ecf_home = f"{EXPTDIR}/ecflow" + ecf_data_root = f"{EXPTDIR}/ecflow/data" + ecf_outputdir = f"{EXPTDIR}/ecflow/output" + ecf_comdir = f"{EXPTDIR}/ecflow/com" + lfs_outputdir = f"{EXPTDIR}/ecflow/lsf" + + date_first = date_to_str(DATE_FIRST_CYCL, format="%Y%m%d") + + settings = { + "ecf_home": ecf_home, + "ecf_data_root": ecf_data_root, + "ecf_outputdir": ecf_outputdir, + "ecf_comdir": ecf_comdir, + "lfs_outputdir": lfs_outputdir, + "ecf_suite_nm": ecf_suite_nm, + "home_ecf": home_ecf, + "pdy": date_first, + } + settings_str = cfg_to_yaml_str(settings) + + # Call a python script to generate the ecFlow job card. + args = ["-q", + "-o", ecflow_env_fp, + "-t", ecflow_env_tmpl_fp, + "-u", settings_str ] + + try: + fill_jinja_template(args) + except: + raise Exception( + dedent( + f"""Call to create the ecFlow job card for '{tsk}' failed.""" + ) + ) + + + return True + + +if __name__ == "__main__": + create_ecflow_scripts(global_var_defns_fp) + diff --git a/ush/generate_FV3LAM_wflow.py b/ush/generate_FV3LAM_wflow.py index 9be5dfdf91..a548adc0bf 100755 --- a/ush/generate_FV3LAM_wflow.py +++ b/ush/generate_FV3LAM_wflow.py @@ -19,6 +19,7 @@ ln_vrfy, mkdir_vrfy, mv_vrfy, + rm_vrfy, run_command, date_to_str, define_macos_utilities, @@ -38,7 +39,7 @@ from fill_jinja_template import fill_jinja_template from set_namelist import set_namelist from check_python_version import check_python_version - +from create_ecflow_scripts import create_ecflow_scripts def generate_FV3LAM_wflow(ushdir, logfile: str = "log.generate_FV3LAM_wflow", debug: bool = False) -> str: """Function to setup a forecast experiment and create a workflow @@ -246,21 +247,32 @@ def generate_FV3LAM_wflow(ushdir, logfile: str = "log.generate_FV3LAM_wflow", de # # ----------------------------------------------------------------------- # - exptdir = expt_config["workflow"]["EXPTDIR"] - wflow_launch_script_fp = expt_config["workflow"]["WFLOW_LAUNCH_SCRIPT_FP"] - wflow_launch_script_fn = expt_config["workflow"]["WFLOW_LAUNCH_SCRIPT_FN"] - log_info( - f""" - Creating symlink in the experiment directory (EXPTDIR) that points to the + exptdir = expt_config["workflow"]["EXPTDIR"] + wflow_launch_script_fp = expt_config["workflow"]["WFLOW_LAUNCH_SCRIPT_FP"] + wflow_launch_script_fn = expt_config["workflow"]["WFLOW_LAUNCH_SCRIPT_FN"] + log_info( + f""" + Creating symlink in the experiment directory (EXPTDIR) that points to the workflow launch script (WFLOW_LAUNCH_SCRIPT_FP): EXPTDIR = '{exptdir}' WFLOW_LAUNCH_SCRIPT_FP = '{wflow_launch_script_fp}'""", verbose=verbose, - ) + ) + + create_symlink_to_file( + wflow_launch_script_fp, os.path.join(exptdir, wflow_launch_script_fn), False + ) + + elif expt_config["platform"]["WORKFLOW_MANAGER"] == "ecflow": + + global_var_defns_fp = expt_config["workflow"]["GLOBAL_VAR_DEFNS_FP"] + homeaqm = expt_config["user"]["HOMEaqm"] + home_ecf = f"{homeaqm}/ecf" + rm_vrfy("-rf",f"{home_ecf}") + + # create ecflow definition file and job cards + create_ecflow_scripts(global_var_defns_fp) - create_symlink_to_file( - wflow_launch_script_fp, os.path.join(exptdir, wflow_launch_script_fn), False - ) # # ----------------------------------------------------------------------- # @@ -277,8 +289,9 @@ def generate_FV3LAM_wflow(ushdir, logfile: str = "log.generate_FV3LAM_wflow", de import_vars(dictionary=flatten_dict(expt_config)) export_vars(source_dict=flatten_dict(expt_config)) - if USE_CRON_TO_RELAUNCH: - add_crontab_line() + if expt_config["platform"]["WORKFLOW_MANAGER"] == "rocoto": + if USE_CRON_TO_RELAUNCH: + add_crontab_line() # # Copy or symlink fix files diff --git a/ush/job_preamble.sh b/ush/job_preamble.sh index adb3f0b503..b291d3c7a5 100644 --- a/ush/job_preamble.sh +++ b/ush/job_preamble.sh @@ -7,11 +7,82 @@ # #----------------------------------------------------------------------- # -export share_pid=${WORKFLOW_ID}_${PDY}${cyc} +if [ "${WORKFLOW_MANAGER}" = "ecflow" ]; then + export share_pid=${share_pid:-${PDY}${cyc}} +else + export share_pid=${share_pid:-${WORKFLOW_ID}_${PDY}${cyc}} +fi + if [ $# -ne 0 ]; then export pid=$share_pid export jobid=${job}.${pid} fi +# +#----------------------------------------------------------------------- +# +# Set NCO standard environment variables +# +#----------------------------------------------------------------------- +# +export envir="${envir:-${envir_dfv}}" +export NET="${NET:-${NET_dfv}}" +export RUN="${RUN:-${RUN_dfv}}" +export model_ver="${model_ver:-${model_ver_dfv}}" +export COMROOT="${COMROOT:-${COMROOT_dfv}}" +export DATAROOT="${DATAROOT:-${DATAROOT_dfv}}" +export DCOMROOT="${DCOMROOT:-${DCOMROOT_dfv}}" +export LOGBASEDIR="${LOGBASEDIR:-${LOGBASEDIR_dfv}}" + +export DBNROOT="${DBNROOT:-${DBNROOT_dfv}}" +export SENDECF="${SENDECF:-${SENDECF_dfv}}" +export SENDDBN="${SENDDBN:-${SENDDBN_dfv}}" +export SENDDBN_NTC="${SENDDBN_NTC:-${SENDDBN_NTC_dfv}}" +export SENDCOM="${SENDCOM:-${SENDCOM_dfv}}" +export SENDWEB="${SENDWEB:-${SENDWEB_dfv}}" +export KEEPDATA="${KEEPDATA:-${KEEPDATA_dfv}}" +export MAILTO="${MAILTO:-${MAILTO_dfv}}" +export MAILCC="${MAILCC:-${MAILCC_dfv}}" + +if [ "${RUN_ENVIR}" = "nco" ]; then + [[ "$WORKFLOW_MANAGER" = "rocoto" ]] && export COMROOT=$COMROOT + export COMIN="${COMIN:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDY}/${cyc})}" + export COMOUT="${COMOUT:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDY}/${cyc})}" + export COMINm1="${COMINm1:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDYm1})}" + + export COMINgfs="${COMINgfs:-$(compath.py ${envir}/gfs/${gfs_ver})}" + export COMINgefs="${COMINgefs:-$(compath.py ${envir}/gefs/${gefs_ver})}" + +else + export COMIN="${COMIN_BASEDIR}/${PDY}${cyc}" + export COMOUT="${COMOUT_BASEDIR}/${PDY}${cyc}" + export COMINm1="${COMIN_BASEDIR}/${RUN}.${PDYm1}" +fi +export COMOUTwmo="${COMOUTwmo:-${COMOUT}/wmo}" + +export DCOMINbio="${DCOMINbio:-${DCOMINbio_dfv}}" +export DCOMINdust="${DCOMINdust:-${DCOMINdust_dfv}}" +export DCOMINcanopy="${DCOMINcanopy:-${DCOMINcanopy_dfv}}" +export DCOMINfire="${DCOMINfire:-${DCOMINfire_dfv}}" +export DCOMINchem_lbcs="${DCOMINchem_lbcs:-${DCOMINchem_lbcs_dfv}}" +export DCOMINgefs="${DCOMINgefs:-${DCOMINgefs_dfv}}" +export DCOMINpt_src="${DCOMINpt_src:-${DCOMINpt_src_dfv}}" +export DCOMINairnow="${DCOMINairnow:-${DCOMINairnow_dfv}}" + +# +#----------------------------------------------------------------------- +# +# Change YES/NO (NCO standards; job card) to TRUE/FALSE (workflow standards) +# for NCO environment variables +# +#----------------------------------------------------------------------- +# +export KEEPDATA=$(boolify "${KEEPDATA}") +export SENDCOM=$(boolify "${SENDCOM}") +export SENDDBN=$(boolify "${SENDDBN}") +export SENDDBN_NTC=$(boolify "${SENDDBN_NTC}") +export SENDECF=$(boolify "${SENDECF}") +export SENDWEB=$(boolify "${SENDWEB}") + # #----------------------------------------------------------------------- # @@ -114,29 +185,7 @@ else fi export -f PREP_STEP export -f POST_STEP -# -#----------------------------------------------------------------------- -# -# Set COMIN / COMOUT / other common variables -# -#----------------------------------------------------------------------- -# -if [ "${RUN_ENVIR}" = "nco" ]; then - export COMROOT=$COMROOT - export COMIN="${COMIN:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDY}/${cyc})}" - export COMOUT="${COMOUT:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDY}/${cyc})}" - export COMINm1="${COMINm1:-$(compath.py -o ${NET}/${model_ver}/${RUN}.${PDYm1})}" - - export COMINgfs="${COMINgfs:-$(compath.py ${envir}/gfs/${gfs_ver})}" - export COMINgefs="${COMINgefs:-$(compath.py ${envir}/gefs/${gefs_ver})}" - export KEEPDATA="${KEEPDATA:-$KEEPDATA}" -else - export COMIN="${COMIN_BASEDIR}/${PDY}${cyc}" - export COMOUT="${COMOUT_BASEDIR}/${PDY}${cyc}" - export COMINm1="${COMIN_BASEDIR}/${RUN}.${PDYm1}" -fi -export COMOUTwmo="${COMOUTwmo:-${COMOUT}/wmo}" # #----------------------------------------------------------------------- # @@ -145,7 +194,7 @@ export COMOUTwmo="${COMOUTwmo:-${COMOUT}/wmo}" # #----------------------------------------------------------------------- # -if [ "${RUN_ENVIR}" = "nco" ] && [ "${WORKFLOW_MANAGER}" = "rocoto" ]; then +if [ "${RUN_ENVIR}" = "nco" ] && [ "${WORKFLOW_MANAGER}" != "ecflow" ]; then __EXPTLOG=${EXPTDIR}/log mkdir -p ${__EXPTLOG} for i in ${LOGDIR}/*.${WORKFLOW_ID}.log; do diff --git a/ush/load_modules_run_task.sh b/ush/load_modules_run_task.sh index 1bc6aac62b..a1b8398a46 100755 --- a/ush/load_modules_run_task.sh +++ b/ush/load_modules_run_task.sh @@ -99,16 +99,17 @@ set -u #----------------------------------------------------------------------- # machine=$(echo_lowercase $MACHINE) -if [ "${WORKFLOW_MANAGER}" = "rocoto" ]; then +if [ "${WORKFLOW_MANAGER}" != "ecflow" ]; then source "${HOMEaqm}/etc/lmod-setup.sh" ${machine} - if [ "${machine}" != "wcoss2" ]; then - module use "${HOMEaqm}/modulefiles" - module load "${BUILD_MOD_FN}" || print_err_msg_exit "\ - Loading of platform- and compiler-specific module file (BUILD_MOD_FN) +fi +if [ "${machine}" != "wcoss2" ]; then + module use "${HOMEaqm}/modulefiles" + module load "${BUILD_MOD_FN}" || print_err_msg_exit "\ + Loading of platform- and compiler-specific module file (BUILD_MOD_FN) for the workflow task specified by task_name failed: task_name = \"${task_name}\" BUILD_MOD_FN = \"${BUILD_MOD_FN}\"" - fi +fi # #----------------------------------------------------------------------- # @@ -135,9 +136,9 @@ for the workflow task specified by task_name failed: # #----------------------------------------------------------------------- # - modules_dir="$HOMEaqm/modulefiles/tasks/$machine" - modulefile_name="${task_name}" - default_modules_dir="$HOMEaqm/modulefiles" +modules_dir="$HOMEaqm/modulefiles/tasks/$machine" +modulefile_name="${task_name}" +default_modules_dir="$HOMEaqm/modulefiles" # #----------------------------------------------------------------------- # @@ -145,32 +146,34 @@ for the workflow task specified by task_name failed: # #----------------------------------------------------------------------- # - print_info_msg "$VERBOSE" " +print_info_msg "$VERBOSE" " Loading modules for task \"${task_name}\" ..." - module use "${modules_dir}" || print_err_msg_exit "\ -Call to \"module use\" command failed." - - # source version file (run) only if it is specified in versions directory +module use "${modules_dir}" || print_err_msg_exit "\ + Call to \"module use\" command failed." + +# source version file (run) only if it is specified in versions directory +if [ "${WORKFLOW_MANAGER}" != "ecflow" ]; then VERSION_FILE="${HOMEaqm}/versions/${RUN_VER_FN}" if [ -f ${VERSION_FILE} ]; then . ${VERSION_FILE} fi - # - # Load the .local module file if available for the given task - # - modulefile_local="${task_name}.local" - if [ -f ${modules_dir}/${modulefile_local}.lua ]; then - module load "${modulefile_local}" || print_err_msg_exit "\ +fi +# +# Load the .local module file if available for the given task +# +modulefile_local="${task_name}.local" +if [ -f ${modules_dir}/${modulefile_local}.lua ]; then + module load "${modulefile_local}" || print_err_msg_exit "\ Loading .local module file (in directory specified by modules_dir) for the specified task (task_name) failed: task_name = \"${task_name}\" modulefile_local = \"${modulefile_local}\" modules_dir = \"${modules_dir}\"" - fi - - module list fi + +module list + # Modules that use conda and need an environment activated will set the # SRW_ENV variable to the name of the environment to be activated. That # must be done within the script, and not inside the module. Do that @@ -200,7 +203,13 @@ print_info_msg "$VERBOSE" " Launching J-job (jjob_fp) for task \"${task_name}\" ... jjob_fp = \"${jjob_fp}\" " -exec "${jjob_fp}" + +if [ "${WORKFLOW_MANAGER}" = "ecflow" ]; then + /bin/bash "${jjob_fp}" +else + exec "${jjob_fp}" +fi + # #----------------------------------------------------------------------- # @@ -211,4 +220,3 @@ exec "${jjob_fp}" # { restore_shell_opts; } > /dev/null 2>&1 - diff --git a/ush/machine/hera.yaml b/ush/machine/hera.yaml index ec66ef5957..76f150d475 100644 --- a/ush/machine/hera.yaml +++ b/ush/machine/hera.yaml @@ -43,13 +43,13 @@ data: RAP_obs: /scratch2/BMC/public/data/grids/rap/obs cpl_aqm_parm: AQM_CONFIG_DIR: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/aqm/epa/data - DCOMINbio: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/aqm/bio - DCOMINdust: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/FENGSHA - DCOMINcanopy: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/canopy - DCOMINfire: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/RAVE_fire - DCOMINchem_lbcs: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/LBCS/AQM_NA13km_AM4_v1 - DCOMINgefs: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/GEFS_DATA - DCOMINpt_src: /scratch1/RDARCH/rda-arl-gpu/Barry.Baker/emissions/nexus/NEI2016v1/v2023-01-PT + DCOMINbio_dfv: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/aqm/bio + DCOMINdust_dfv: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/FENGSHA + DCOMINcanopy_dfv: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/canopy + DCOMINfire_dfv: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/RAVE_fire + DCOMINchem_lbcs_dfv: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/LBCS/AQM_NA13km_AM4_v1 + DCOMINgefs_dfv: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/GEFS_DATA + DCOMINpt_src_dfv: /scratch1/RDARCH/rda-arl-gpu/Barry.Baker/emissions/nexus/NEI2016v1/v2023-01-PT NEXUS_INPUT_DIR: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/emissions/nexus NEXUS_FIX_DIR: /scratch2/NCEPDEV/naqfc/RRFS_CMAQ/nexus/fix diff --git a/ush/machine/wcoss2.yaml b/ush/machine/wcoss2.yaml index e104363a1e..349c279746 100644 --- a/ush/machine/wcoss2.yaml +++ b/ush/machine/wcoss2.yaml @@ -39,14 +39,14 @@ data: HRRR: compath.py ${envir}/hrrr/${hrrr_ver}/hrrr.${PDYext}/conus cpl_aqm_parm: AQM_CONFIG_DIR: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/aqm/epa/data - DCOMINbio: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/aqm/bio - DCOMINdust: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/FENGSHA - DCOMINcanopy: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/canopy - DCOMINfire: /lfs/h2/emc/physics/noscrub/kai.wang/RAVE_fire/RAVE_NA_NRT - DCOMINchem_lbcs: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/LBCS/AQM_NA13km_AM4_v1 - DCOMINgefs: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/GEFS_DATA - DCOMINpt_src: /lfs/h2/emc/physics/noscrub/Youhua.Tang/nei2016v1-pt/v2023-01-PT - DCOMINairnow: /lfs/h1/ops/prod/dcom + DCOMINbio_dfv: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/aqm/bio + DCOMINdust_dfv: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/FENGSHA + DCOMINcanopy_dfv: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/canopy + DCOMINfire_dfv: /lfs/h2/emc/physics/noscrub/kai.wang/RAVE_fire/RAVE_NA_NRT + DCOMINchem_lbcs_dfv: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/LBCS/AQM_NA13km_AM4_v1 + DCOMINgefs_dfv: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/GEFS_DATA + DCOMINpt_src_dfv: /lfs/h2/emc/physics/noscrub/Youhua.Tang/nei2016v1-pt/v2023-01-PT + DCOMINairnow_dfv: /lfs/h1/ops/prod/dcom AQM_AIRNOW_HIST_DIR: /lfs/h2/emc/physics/noscrub/jianping.huang/Bias_correction/aqmv7.0 NEXUS_INPUT_DIR: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/nexus_emissions NEXUS_FIX_DIR: /lfs/h2/emc/lam/noscrub/RRFS_CMAQ/nexus/fix diff --git a/ush/setup.py b/ush/setup.py index bca641a3be..e6ed1a2a13 100644 --- a/ush/setup.py +++ b/ush/setup.py @@ -975,11 +975,10 @@ def get_location(xcs, fmt, expt_cfg): # running in community mode, we set these paths to the experiment # directory. nco_vars = [ - "opsroot", - "comroot", - "packageroot", - "dataroot", - "dcomroot", + "opsroot_dfv", + "comroot_dfv", + "dataroot_dfv", + "dcomroot_dfv", "comin_basedir", "comout_basedir", ] @@ -990,24 +989,23 @@ def get_location(xcs, fmt, expt_cfg): for nco_var in nco_vars: nco_config[nco_var.upper()] = exptdir - nco_config["LOGBASEDIR"] = os.path.join(exptdir, "log") + nco_config["LOGBASEDIR_dfv"] = os.path.join(exptdir, "log") # Use env variables for NCO variables and create NCO directories - if run_envir == "nco": - + workflow_manager = expt_config["platform"].get("WORKFLOW_MANAGER") + if run_envir == "nco" and workflow_manager == "rocoto": for nco_var in nco_vars: envar = os.environ.get(nco_var) if envar is not None: nco_config[nco_var.upper()] = envar - mkdir_vrfy(f' -p "{nco_config.get("OPSROOT")}"') - mkdir_vrfy(f' -p "{nco_config.get("COMROOT")}"') - mkdir_vrfy(f' -p "{nco_config.get("PACKAGEROOT")}"') - mkdir_vrfy(f' -p "{nco_config.get("DATAROOT")}"') - mkdir_vrfy(f' -p "{nco_config.get("DCOMROOT")}"') - mkdir_vrfy(f' -p "{nco_config.get("LOGBASEDIR")}"') - if nco_config["DBNROOT"]: - mkdir_vrfy(f' -p "{nco_config["DBNROOT"]}"') + mkdir_vrfy(f' -p "{nco_config.get("OPSROOT_dfv")}"') + mkdir_vrfy(f' -p "{nco_config.get("COMROOT_dfv")}"') + mkdir_vrfy(f' -p "{nco_config.get("DATAROOT_dfv")}"') + mkdir_vrfy(f' -p "{nco_config.get("DCOMROOT_dfv")}"') + mkdir_vrfy(f' -p "{nco_config.get("LOGBASEDIR_dfv")}"') + if nco_config["DBNROOT_dfv"] and workflow_manager == "rocoto": + mkdir_vrfy(f' -p "{nco_config["DBNROOT_dfv"]}"') # create experiment dir mkdir_vrfy(f' -p "{exptdir}"')