From 31ad23527802f7d07171132cc620f7135c4d8cba Mon Sep 17 00:00:00 2001 From: "Henry R. Winterbottom" <49202169+HenryWinterbottom-NOAA@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:27:30 -0700 Subject: [PATCH] Reorganize NPOESS scripts (#2166) This PR addresses issue #1226. The following is accomplished: - Using the GEMPAK j-job script `JGFS_ATMOS_GEMPAK_PGRB2_SPEC`, the structure of `JGFS_ATMOS_PGRB2_SPEC_NPOESS` is updated; - Environment variables specific to the script `exgfs_atmos_grib2_special_npoess.sh` are moved accordingly; this specifically applies to the environment variable `FHOUR`, `SHOUR`, `FHINC`, `SLEEP_TIME`, and `SLEEP_INT`; - The `SLEEP_TIME` and `SLEEP_INT` parameters can now be defined at the top-level (if necessary); - Restart file checks are move to `exgfs_atmos_grib2_special_npoess.sh`; however, this may not be necessary (see `TODO` note within draft PR. Resolves #1226 --- jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS | 42 ------------------- scripts/exgfs_atmos_grib2_special_npoess.sh | 45 ++++++++++++++++++++- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS b/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS index 1cb29be58b..a98835ada2 100755 --- a/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS +++ b/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS @@ -10,7 +10,6 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "npoess" -c "base" export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} - ################################ # Set up the HOME directory ################################ @@ -38,47 +37,6 @@ GRID="0p50" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GRIB_0p50:COM_ATMOS_ mkdir -m 775 -p "${COM_ATMOS_GOES}" -# TODO - This should be in the ex-script (#1226) - -#################################### -# Specify Forecast Hour Range -#################################### -export SHOUR=000 -export FHOUR=180 -export FHINC=003 - -#################################### -# Specify Timeout Behavior of Post -# -# SLEEP_TIME - Amount of time to wait for -# a restart file before exiting -# SLEEP_INT - Amount of time to wait between -# checking for restart files -#################################### -export SLEEP_TIME=900 -export SLEEP_INT=5 - -#################################### -# Check if this is a restart -#################################### -if [[ -f "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.goessimpgrb2" ]]; then - modelrecvy=$(cat < "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.goessimpgrb") - recvy_cyc="${modelrecvy:8:2}" - recvy_shour="${modelrecvy:10:13}" - - if [[ ${RERUN} == "NO" ]]; then - NEW_SHOUR=$(( recvy_shour + FHINC )) - if (( NEW_SHOUR >= SHOUR )); then - export SHOUR=${NEW_SHOUR} - fi - if (( recvy_shour >= FHOUR )); then - echo "Forecast Pgrb Generation Already Completed to ${FHOUR}" - else - echo "Starting: PDY=${PDY} cycle=t${recvy_cyc}z SHOUR=${SHOUR}" - fi - fi -fi - ############################################################# # Execute the script "${HOMEgfs}/scripts/exgfs_atmos_grib2_special_npoess.sh" diff --git a/scripts/exgfs_atmos_grib2_special_npoess.sh b/scripts/exgfs_atmos_grib2_special_npoess.sh index 23161c2714..a43c279ae6 100755 --- a/scripts/exgfs_atmos_grib2_special_npoess.sh +++ b/scripts/exgfs_atmos_grib2_special_npoess.sh @@ -40,13 +40,52 @@ export opt26=' -set_grib_max_bits 25 -fi -if ' export opt27=":(APCP|ACPCP|PRATE|CPRAT|DZDT):" export opt28=' -new_grid_interpolation budget -fi ' -SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) +#################################### +# Specify Timeout Behavior of Post +# +# SLEEP_TIME - Amount of time to wait for +# a restart file before exiting +# SLEEP_INT - Amount of time to wait between +# checking for restart files +#################################### +export SLEEP_TIME=${SLEEP_TIME:-900} +export SLEEP_INT=${SLEEP_TIME:-5} + +SLEEP_LOOP_MAX=$(( SLEEP_TIME / SLEEP_INT )) + +# TODO: Does this section do anything? I retained if for clarity of +# changes/updates, but it does not appear to do anything. + +#################################### +# Check if this is a restart +#################################### +if [[ -f "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.goessimpgrb2" ]]; then + modelrecvy=$(cat < "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.goessimpgrb") + recvy_cyc="${modelrecvy:8:2}" + recvy_shour="${modelrecvy:10:13}" + + if [[ ${RERUN} == "NO" ]]; then + NEW_SHOUR=$(( recvy_shour + FHINC )) + if (( NEW_SHOUR >= SHOUR )); then + export SHOUR="${NEW_SHOUR}" + fi + if (( recvy_shour >= FHOUR )); then + echo "Forecast Pgrb Generation Already Completed to ${FHOUR}" + else + echo "Starting: PDY=${PDY} cycle=t${recvy_cyc}z SHOUR=${SHOUR}" + fi + fi +fi ############################################################################## # Specify Forecast Hour Range F000 - F024 for GFS_NPOESS_PGRB2_0P5DEG ############################################################################## export SHOUR=000 export FHOUR=024 +export FHINC=003 +if [[ "${FHOUR}" -gt "${FHMAX_GFS}" ]]; then + export FHOUR="${FHMAX_GFS}" +fi ############################################################ # Loop Through the Post Forecast Files @@ -109,6 +148,10 @@ done ################################################################ export SHOUR=000 export FHOUR=180 +export FHINC=003 +if [[ "${FHOUR}" -gt "${FHMAX_GFS}" ]]; then + export FHOUR="${FHMAX_GFS}" +fi ################################# # Process GFS PGRB2_SPECIAL_POST