Skip to content

Commit

Permalink
Rename wave output and refactor some wave scripts
Browse files Browse the repository at this point in the history
Wave products are renamed to be uniform with other components and
follow NCO implementation standards. This means all output is in
the format `${RUN}.wave.tCCz.product[.fHHH][.domain].suffix`.

Some wave scripts (init and gridded post) are refactored to make
them consistent with other parts of the workflow. All scripts for
both jobs now pass `shellcheck` without warnings.

The biggest changes in the refactor include beyond those necessary
for the file rename include:
- Using the `run_mpmd.sh` script
- Updated templates to use atparse instead of `sed`
- Removed redirection of output to logs that get deleted (NOAA-EMC#296)

One functional change is raw interpolated grids are no longer
copied to COM, only the resulting grib files. Need to confirm with
Jessica this is okay.

Refs NOAA-EMC#296
Refs NOAA-EMC#3270
  • Loading branch information
WalterKolczynski-NOAA committed Feb 25, 2025
1 parent 012c5ea commit aa838e2
Show file tree
Hide file tree
Showing 50 changed files with 494 additions and 970 deletions.
2 changes: 1 addition & 1 deletion env/AWSPW.env
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ elif [[ "${step}" = "prep_emissions" ]]; then

elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
export USE_CFP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/AZUREPW.env
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [[ "${step}" = "fcst" ]] || [[ "${step}" = "efcs" ]]; then

elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
export USE_CFP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/GAEAC5.env
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ case ${step} in
;;
"waveinit" | "waveprep" | "wavepostsbs" | "wavepostbndpnt" | "wavepostpnt" | "wavepostbndpntbll")

export CFP_MP="YES"
export USE_CFP="YES"
[[ "${step}" = "waveprep" ]] && export MP_PULSE=0
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/GAEAC6.env
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ case ${step} in
;;
"waveinit" | "waveprep" | "wavepostsbs" | "wavepostbndpnt" | "wavepostpnt" | "wavepostbndpntbll")

export CFP_MP="YES"
export USE_CFP="YES"
[[ "${step}" = "waveprep" ]] && export MP_PULSE=0
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/GOOGLEPW.env
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ elif [[ "${step}" = "prep_emissions" ]]; then

elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
export USE_CFP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/HERA.env
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ elif [[ "${step}" = "prep_emissions" ]]; then

elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
export USE_CFP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/HERCULES.env
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ case ${step} in
;;
"waveinit" | "waveprep" | "wavepostsbs" | "wavepostbndpnt" | "wavepostpnt" | "wavepostbndpntbll")

export CFP_MP="YES"
export USE_CFP="YES"
[[ "${step}" = "waveprep" ]] && export MP_PULSE=0
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/JET.env
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ elif [[ "${step}" = "prep_emissions" ]]; then

elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
export USE_CFP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/ORION.env
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ elif [[ "${step}" = "prep_emissions" ]]; then
elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || \
[[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostpnt" ]] || [[ "${step}" == "wavepostbndpntbll" ]]; then

export CFP_MP="YES"
export USE_CFP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
2 changes: 1 addition & 1 deletion env/S4.env
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ elif [[ "${step}" = "prep_emissions" ]]; then

elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]] || [[ "${step}" = "wavepostpnt" ]]; then

export CFP_MP="YES"
export USE_CFP="YES"
if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi
export wavempexec=${launcher}
export wave_mpmd=${mpmd_opt}
Expand Down
7 changes: 3 additions & 4 deletions jobs/JGLOBAL_WAVE_INIT
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ export wavempexec=${wavempexec:-"mpirun -n"}
export wave_mpmd=${wave_mpmd:-"cfp"}

# Execute the Script
${SCRgfs}/exgfs_wave_init.sh
"${SCRgfs}/exgfs_wave_init.sh"

##########################################
# Remove the Temporary working directory
##########################################
cd ${DATAROOT}
[[ ${KEEPDATA} = "NO" ]] && rm -rf ${DATA}

cd "${DATAROOT}" || true
if [[ ${KEEPDATA} = "NO" ]]; then rm -rf "${DATA}"; fi

exit 0
21 changes: 6 additions & 15 deletions jobs/JGLOBAL_WAVE_POST_SBS
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,21 @@ if [[ -n "${wavepostGRD}" || -n "${waveinterpGRD}" ]]; then
else
echo "Both wavepostGRD and waveinterpGRD are empty. No grids to process."
fi
# Set wave model ID tag to include member number
# if ensemble; waveMEMB var empty in deterministic
# Set wave model ID tag to include member number
# if ensemble; waveMEMB var empty in deterministic
membTAG='p'
if [ "${waveMEMB}" == "00" ]; then membTAG='c'; fi
export membTAG
export WAV_MOD_TAG=${RUN}wave${waveMEMB}

export CFP_VERBOSE=1

# Execute the Script
${SCRgfs}/exgfs_wave_post_gridded_sbs.sh
"${SCRgfs}/exgfs_wave_post_gridded_sbs.sh"
err=$?
if [ ${err} -ne 0 ]; then
echo "FATAL ERROR: ex-script of GWES_POST failed!"
exit ${err}
if [[ ${err} -ne 0 ]]; then
echo "FATAL ERROR: ex-script of gridded wave post failed!"
exit "${err}"
fi

##########################################
# Remove the Temporary working directory
##########################################
cd ${DATAROOT}
[[ ${KEEPDATA} = "NO" ]] && rm -rf ${DATA}

cd "${DATAROOT}" || true
if [[ ${KEEPDATA} = "NO" ]]; then rm -rf "${DATA}"; fi

exit 0
6 changes: 3 additions & 3 deletions jobs/rocoto/wavepostsbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export job="wavepostsbs"
# shellcheck disable=SC2153
IFS=', ' read -r -a fhr_list <<< "${FHR_LIST}"

export FHR3 jobid
export FORECAST_HOUR jobid
for FORECAST_HOUR in "${fhr_list[@]}"; do
FHR3=$(printf '%03d' "${FORECAST_HOUR}")
jobid="${job}_f${FHR3}.$$"
fhr3=$(printf '%03d' "${FORECAST_HOUR}")
jobid="${job}_f${fhr3}.$$"
# Execute the JJOB
"${HOMEgfs}/jobs/JGLOBAL_WAVE_POST_SBS"
status=$?
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/ak_10m_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/at_10m_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/ep_10m_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/glo_15mxt_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/glo_200_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/glo_30m_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/reg025_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
2 changes: 1 addition & 1 deletion parm/wave/wc_10m_interp.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ Input file for interpolation of GLO30m_ext Grid
$------------------------------------------------
$ Start Time DT NSteps
TIME DT NSTEPS
@[time] @[dt] @[nsteps]
$ Total number of grids
2
$ Grid extensions
Expand Down
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.ak_10m.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.ant_9km.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 20
@[time] 7 @[modnr] @[gridnr] 0 20
$
-60 0 8.64919046313 8.64919046313 64
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.aoc_9km.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 20
@[time] 7 @[modnr] @[gridnr] 0 20
$
70 0 9.0 9.0 64
$ 60 0 8.64919046313 8.64919046313 64
Expand Down
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.at_10m.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.ep_10m.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.glo_025.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.glo_100.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.glo_10m.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.glo_15mxt.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.glo_200.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.glo_30m.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
6 changes: 3 additions & 3 deletions parm/wave/ww3_grib2.glo_500.inp.tmpl
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ WAVEWATCH-III gridded output input file
$ ----------------------------------------
TIME DT NT
@[time] @[dt] @[nt]
N
FLAGS
@[grib_flags]
$
TIME 7 MODNR GRIDNR 0 0
@[time] 7 @[modnr] @[gridnr] 0 0
$
$ end of input file
Loading

0 comments on commit aa838e2

Please sign in to comment.