Skip to content

Commit

Permalink
Remove multi-grid wave support (NOAA-EMC#3188)
Browse files Browse the repository at this point in the history
# Description
- Eliminate instances where `waveGRD` is a list containing multiple
supported wave grids. Also, remove the associated for loops (e.g., `for
wavGRD in ${waveGRD}; do`)
- Resolves NOAA-EMC#2637
  • Loading branch information
AntonMFernando-NOAA authored Jan 7, 2025
1 parent 060aec3 commit fececaf
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 328 deletions.
20 changes: 1 addition & 19 deletions parm/config/gefs/config.wave
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,10 @@ export RUNwave="${RUN}wave"
export RUNRSTwave="gdas"

#grid dependent variable defaults
export waveGRDN='1' # grid number for ww3_multi
export waveGRDG='10' # grid group for ww3_multi
export USE_WAV_RMP='NO' # YES/NO rmp grid remapping pre-processed coefficients
export waveMULTIGRID='.false.' # .true./.false. for multi or shel
export MESH_WAV="mesh.${waveGRD}.nc" # Mesh grid for wave model for CMEPS
export waveesmfGRD=' ' # input grid for multigrid

#Grid dependent variables for various grids
case "${waveGRD}" in
"gnh_10m;aoc_9km;gsh_15m")
#GFSv16 settings:
export waveGRDN='1 2 3'
export waveGRDG='10 20 30'
export USE_WAV_RMP='YES'
export waveMULTIGRID='.true.'
export IOSRV='3'
export MESH_WAV=' '
export waveesmfGRD='glox_10m'
export waveuoutpGRD='points'
export waveinterpGRD='glo_15mxt at_10m ep_10m wc_10m glo_30m'
export wavepostGRD='gnh_10m aoc_9km gsh_15m'
;;
"gwes_30m")
#Grid used for P8
export waveinterpGRD=''
Expand Down Expand Up @@ -157,7 +139,7 @@ export WW3CURIENS='F'
export GOFILETYPE=1 # GOFILETYPE=1 one gridded file per output step
export POFILETYPE=1 # POFILETYPE=1 one point file per output step

# Parameters for ww3_multi/shel.inp
# Parameters for ww3_shel.inp
# Unified output T or F
export FUNIPNT='T'
# Output server type (see ww3_shel/multi.inp in WW3 repo)
Expand Down
20 changes: 1 addition & 19 deletions parm/config/gfs/config.wave
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,10 @@ export RUNwave="${RUN}wave"
export RUNRSTwave="gdas"

#grid dependent variable defaults
export waveGRDN='1' # grid number for ww3_multi
export waveGRDG='10' # grid group for ww3_multi
export USE_WAV_RMP='NO' # YES/NO rmp grid remapping pre-processed coefficients
export waveMULTIGRID='.false.' # .true./.false. for multi or shel
export MESH_WAV="mesh.${waveGRD}.nc" # Mesh grid for wave model for CMEPS
export waveesmfGRD=' ' # input grid for multigrid

#Grid dependent variables for various grids
case "${waveGRD}" in
"gnh_10m;aoc_9km;gsh_15m")
#GFSv16 settings:
export waveGRDN='1 2 3'
export waveGRDG='10 20 30'
export USE_WAV_RMP='YES'
export waveMULTIGRID='.true.'
export IOSRV='3'
export MESH_WAV=' '
export waveesmfGRD='glox_10m'
export waveuoutpGRD='points'
export waveinterpGRD='glo_15mxt at_10m ep_10m wc_10m glo_30m'
export wavepostGRD='gnh_10m aoc_9km gsh_15m'
;;
"gwes_30m")
#Grid used for P8
export waveinterpGRD=''
Expand Down Expand Up @@ -187,7 +169,7 @@ export WW3CURIENS='F'
export GOFILETYPE=1 # GOFILETYPE=1 one gridded file per output step
export POFILETYPE=1 # POFILETYPE=1 one point file per output step

# Parameters for ww3_multi/shel.inp
# Parameters for ww3_shel.inp
# Unified output T or F
export FUNIPNT='T'
# Output server type (see ww3_shel/multi.inp in WW3 repo)
Expand Down
2 changes: 1 addition & 1 deletion scripts/exgfs_wave_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ source "${USHgfs}/preamble.sh"
chmod 744 cmdfile

# Eliminate duplicate grids
array=($WAVECUR_FID $WAVEICE_FID $WAVEWND_FID $waveuoutpGRD $waveGRD $waveesmfGRD $wavepostGRD $waveinterpGRD)
array=($WAVECUR_FID $WAVEICE_FID $WAVEWND_FID $waveuoutpGRD $waveGRD $wavepostGRD $waveinterpGRD)
grdALL=$(printf "%s\n" "${array[@]}" | sort -u | tr '\n' ' ')

for grdID in ${grdALL}; do
Expand Down
16 changes: 7 additions & 9 deletions scripts/exgfs_wave_post_gridded_sbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,13 @@ source "${USHgfs}/preamble.sh"

if [ $fhr = $fhrg ]
then
for wavGRD in ${waveGRD}; do
gfile="${COMIN_WAVE_HISTORY}/${WAV_MOD_TAG}.out_grd.${wavGRD}.${YMD}.${HMS}"
if [[ ! -s "${gfile}" ]]; then
echo " FATAL ERROR : NO RAW FIELD OUTPUT FILE ${gfile}"
err=3; export err; "${errchk}"
exit "${err}"
fi
${NLN} "${gfile}" "./out_grd.${wavGRD}"
done
gfile="${COMIN_WAVE_HISTORY}/${WAV_MOD_TAG}.out_grd.${waveGRD}.${YMD}.${HMS}"
if [[ ! -s "${gfile}" ]]; then
echo " FATAL ERROR : NO RAW FIELD OUTPUT FILE ${gfile}"
err=3; export err; "${errchk}"
exit "${err}"
fi
${NLN} "${gfile}" "./out_grd.${waveGRD}"

if [ "$DOGRI_WAV" = 'YES' ]
then
Expand Down
25 changes: 5 additions & 20 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -375,28 +375,16 @@ WW3_postdet() {

# Link output files
local wavprfx="${RUN}wave${WAV_MEMBER:-}"
if [[ "${waveMULTIGRID}" == ".true." ]]; then
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.mww3.${PDY}${cyc}" "log.mww3"
for ww3_grid in ${waveGRD}; do
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.${ww3_grid}.${PDY}${cyc}" "log.${ww3_grid}"
done
else
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.${waveGRD}.${PDY}${cyc}" "log.ww3"
fi
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.${waveGRD}.${PDY}${cyc}" "log.ww3"

# Loop for gridded output (uses FHINC)
local fhr vdate FHINC ww3_grid
fhr=${FHMIN_WAV}
fhinc=${FHOUT_WAV}
while (( fhr <= FHMAX_WAV )); do
vdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${fhr} hours" +%Y%m%d.%H0000)
if [[ "${waveMULTIGRID}" == ".true." ]]; then
for ww3_grid in ${waveGRD} ; do
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_grd.${ww3_grid}.${vdate}" "${DATA}/${vdate}.out_grd.${ww3_grid}"
done
else
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_grd.${waveGRD}.${vdate}" "${DATA}/${vdate}.out_grd.ww3"
fi
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_grd.${waveGRD}.${vdate}" "${DATA}/${vdate}.out_grd.ww3"

if (( FHMAX_HF_WAV > 0 && FHOUT_HF_WAV > 0 && fhr < FHMAX_HF_WAV )); then
fhinc=${FHOUT_HF_WAV}
fi
Expand All @@ -408,11 +396,8 @@ WW3_postdet() {
fhinc=${FHINCP_WAV}
while (( fhr <= FHMAX_WAV )); do
vdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${fhr} hours" +%Y%m%d.%H0000)
if [[ "${waveMULTIGRID}" == ".true." ]]; then
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${vdate}" "${DATA}/${vdate}.out_pnt.${waveuoutpGRD}"
else
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${vdate}" "${DATA}/${vdate}.out_pnt.ww3"
fi
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${vdate}" "${DATA}/${vdate}.out_pnt.ww3"

fhr=$((fhr + fhinc))
done
}
Expand Down
33 changes: 3 additions & 30 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -591,22 +591,9 @@ WW3_predet(){
# Files from wave prep and wave init jobs
# Copy mod_def files for wave grids
local ww3_grid
if [[ "${waveMULTIGRID}" == ".true." ]]; then
local array=("${WAVECUR_FID}" "${WAVEICE_FID}" "${WAVEWND_FID}" "${waveuoutpGRD}" "${waveGRD}" "${waveesmfGRD}")
echo "Wave Grids: ${array[*]}"
local grdALL
# shellcheck disable=SC2312
grdALL=$(printf "%s\n" "${array[@]}" | sort -u | tr '\n' ' ')

for ww3_grid in ${grdALL}; do
${NCP} "${COMIN_WAVE_PREP}/${RUN}wave.mod_def.${ww3_grid}" "${DATA}/mod_def.${ww3_grid}" \
|| ( echo "FATAL ERROR: Failed to copy '${RUN}wave.mod_def.${ww3_grid}' from '${COMIN_WAVE_PREP}'"; exit 1 )
done
else
#if shel, only 1 waveGRD which is linked to mod_def.ww3
${NCP} "${COMIN_WAVE_PREP}/${RUN}wave.mod_def.${waveGRD}" "${DATA}/mod_def.ww3" \
|| ( echo "FATAL ERROR: Failed to copy '${RUN}wave.mod_def.${waveGRD}' from '${COMIN_WAVE_PREP}'"; exit 1 )
fi
#if shel, only 1 waveGRD which is linked to mod_def.ww3
${NCP} "${COMIN_WAVE_PREP}/${RUN}wave.mod_def.${waveGRD}" "${DATA}/mod_def.ww3" \
|| ( echo "FATAL ERROR: Failed to copy '${RUN}wave.mod_def.${waveGRD}' from '${COMIN_WAVE_PREP}'"; exit 1 )

if [[ "${WW3ICEINP}" == "YES" ]]; then
local wavicefile="${COMIN_WAVE_PREP}/${RUN}wave.${WAVEICE_FID}.t${current_cycle:8:2}z.ice"
Expand Down Expand Up @@ -638,20 +625,6 @@ WW3_predet(){
fi

WAV_MOD_TAG="${RUN}wave${waveMEMB}"
if [[ "${USE_WAV_RMP:-YES}" == "YES" ]]; then
local file file_array file_count
# shellcheck disable=SC2312
mapfile -t file_array < <(find "${FIXgfs}/wave" -name "rmp_src_to_dst_conserv_*" | sort)
file_count=${#file_array[@]}
if (( file_count > 0 )); then
for file in "${file_array[@]}" ; do
${NCP} "${file}" "${DATA}/"
done
else
echo 'FATAL ERROR : No rmp precomputed nc files found for wave model, ABORT!'
exit 4
fi
fi
}

# shellcheck disable=SC2034
Expand Down
Loading

0 comments on commit fececaf

Please sign in to comment.