Skip to content

Commit

Permalink
Reorganize NPOESS scripts (NOAA-EMC#2166)
Browse files Browse the repository at this point in the history
This PR addresses issue NOAA-EMC#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 NOAA-EMC#1226
  • Loading branch information
HenryRWinterbottom authored Jan 2, 2024
1 parent 22bd82f commit 31ad235
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
42 changes: 0 additions & 42 deletions jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################
Expand Down Expand Up @@ -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"
Expand Down
45 changes: 44 additions & 1 deletion scripts/exgfs_atmos_grib2_special_npoess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 31ad235

Please sign in to comment.