Skip to content

Commit

Permalink
Merge pull request NOAA-EMC#173 from JessicaMeixner-NOAA/bugfix/rtofs…
Browse files Browse the repository at this point in the history
…issues

Updates for RTOFS preprocessing for wave model
  • Loading branch information
KateFriedman-NOAA committed Nov 6, 2020
2 parents 9fa9ffe + 670b97c commit b096e29
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 21 deletions.
8 changes: 2 additions & 6 deletions jobs/JGLOBAL_WAVE_PREP
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/$COMPONENT}

if [ $RUN_ENVIR = "nco" ]; then
export COMIN_WAV_ICE=${COMIN_WAV_ICE:-$(compath.py gfs/prod)}/${CDUMP}.${PDY}/${cyc}/atmos
export COMIN_WAV_CUR=${COMIN_WAV_CUR:-$(compath.py ${WAVECUR_DID}/prod)}/${WAVECUR_DID}.${RPDY}
if [ ! -d $COMIN_WAV_CUR ]; then
export RPDY=`$NDATE -24 ${PDY}00 | cut -c1-8`
export COMIN_WAV_CUR=$(compath.py ${WAVECUR_DID}/prod)/${WAVECUR_DID}.${RPDY}
fi
export COMIN_WAV_RTOFS=${COMIN_WAV_RTOFS:-$(compath.py ${WAVECUR_DID}/prod)}
else
if [ ! -d $DMPDIR/${WAVECUR_DID}.${RPDY} ]; then export RPDY=`$NDATE -24 ${PDY}00 | cut -c1-8`; fi
if [ ! -L $ROTDIR/${WAVECUR_DID}.${RPDY} ]; then # Check if symlink already exists in ROTDIR
Expand All @@ -85,7 +81,7 @@ else
$NLN $DMPDIR/$CDUMP.${PDY}/$cyc/${WAVICEFILE} $ROTDIR/$CDUMP.${PDY}/$cyc/atmos/${WAVICEFILE}
fi
export COMIN_WAV_ICE=${COMIN_WAV_ICE:-$ROTDIR/$RUN.$PDY/$cyc/atmos}
export COMIN_WAV_CUR=${ROTDIR}/${WAVECUR_DID}.${RPDY}
export COMIN_WAV_RTOFS=${ROTDIR}
fi

# Execute the Script
Expand Down
64 changes: 52 additions & 12 deletions scripts/exgfs_wave_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# Apr2019 JHAlves - Transitioning to GEFS workflow #
# Nov2019 JHAlves - Merging wave scripts to global workflow #
# Jun2020 JHAlves - Porting to R&D machine Hera #
# Oct2020 JMeixner - Updating RTOFS dates for processing minimal amount #
# #
# WAV_MOD_ID and WAV_MOD_TAG replace modID. WAV_MOD_TAG #
# is used for ensemble-specific I/O. For deterministic #
Expand Down Expand Up @@ -643,22 +644,57 @@
touch cmdfile
chmod 744 cmdfile

ymdh_rtofs=${PDY}00 # RTOFS runs once daily use ${PDY}00
ymdh_end=`$NDATE ${FHMAX_WAV_CUR} ${PDY}00`
ymdh_rtofs=${RPDY}00 # RTOFS runs once daily use ${PDY}00
if [ "$ymdh_beg" -lt "$ymdh_rtofs" ];then
#If the start time is before the first hour of RTOFS, use the previous cycle
export RPDY=`$NDATE -24 ${RPDY}00 | cut -c1-8`
fi
#Set the first time for RTOFS files to be the beginning time of simulation
ymdh_rtofs=$ymdh_beg

if [ "$FHMAX_WAV_CUR" -le 72 ]; then
rtofsfile1=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f024_prog.nc
rtofsfile2=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f048_prog.nc
rtofsfile3=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f072_prog.nc
if [ ! -f $rtofsfile1 ] || [ ! -f $rtofsfile2 ] || [ ! -f $rtofsfile3 ]; then
#Needed current files are not available, so use RTOFS from previous day
export RPDY=`$NDATE -24 ${RPDY}00 | cut -c1-8`
fi
else
rtofsfile1=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f096_prog.nc
rtofsfile2=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f120_prog.nc
rtofsfile3=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f144_prog.nc
rtofsfile4=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f168_prog.nc
rtofsfile5=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f192_prog.nc
if [ ! -f $rtofsfile1 ] || [ ! -f $rtofsfile2 ] || [ ! -f $rtofsfile3 ] ||
[ ! -f $rtofsfile4 ] || [ ! -f $rtofsfile5 ]; then
#Needed current files are not available, so use RTOFS from previous day
export RPDY=`$NDATE -24 ${RPDY}00 | cut -c1-8`
fi
fi

export COMIN_WAV_CUR=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}

ymdh_end_rtofs=`$NDATE ${FHMAX_WAV_CUR} ${RPDY}00`
if [ "$ymdh_end" -lt "$ymdh_end_rtofs" ]; then
ymdh_end_rtofs=$ymdh_end
fi

NDATE_DT=${WAV_CUR_HF_DT}
FLGHF='T'

FLGFIRST='T'
fext='f'

if [ ${CFP_MP:-"NO"} = "YES" ]; then nm=0 ; fi # Counter for MP CFP
while [ "$ymdh_rtofs" -le "$ymdh_end" ]
while [ "$ymdh_rtofs" -le "$ymdh_end_rtofs" ]
do
# Timing has to be made relative to the single 00z RTOFS cycle for that PDY
fhr_rtofs=`${NHOUR} ${ymdh_rtofs} ${PDY}00`
fext='f'

# Timing has to be made relative to the single 00z RTOFS cycle for RTOFS PDY (RPDY)
# Start at first fhr for
fhr_rtofs=`${NHOUR} ${ymdh_rtofs} ${RPDY}00`
fh3_rtofs=`printf "%03d" "${fhr_rtofs#0}"`

curfile1h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fh3_rtofs}_1hrly_prog.nc
curfile3h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fh3_rtofs}_3hrly_prog.nc
curfile1h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fh3_rtofs}_prog.nc
curfile3h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fh3_rtofs}_prog.nc

if [ -s ${curfile1h} ] && [ "${FLGHF}" = "T" ] ; then
curfile=${curfile1h}
Expand Down Expand Up @@ -686,12 +722,16 @@
fi

if [ ${CFP_MP:-"NO"} = "YES" ]; then
echo "$nm $USHwave/wave_prnc_cur.sh $ymdh_rtofs $curfile $fhr_rtofs > cur_$ymdh_rtofs.out 2>&1" >> cmdfile
echo "$nm $USHwave/wave_prnc_cur.sh $ymdh_rtofs $curfile $fhr_rtofs $FLGFIRST > cur_$ymdh_rtofs.out 2>&1" >> cmdfile
nm=`expr $nm + 1`
else
echo "$USHwave/wave_prnc_cur.sh $ymdh_rtofs $curfile $fhr_rtofs > cur_$ymdh_rtofs.out 2>&1" >> cmdfile
echo "$USHwave/wave_prnc_cur.sh $ymdh_rtofs $curfile $fhr_rtofs $FLGFIRST > cur_$ymdh_rtofs.out 2>&1" >> cmdfile
fi

if [ "${FLGFIRST}" = "T" ] ; then
FLGFIRST='F'
fi

if [ $fhr_rtofs -ge ${WAV_CUR_HF_FH} ] ; then
NDATE_DT=${WAV_CUR_DT}
fi
Expand Down
7 changes: 4 additions & 3 deletions ush/wave_prnc_cur.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set -x
ymdh_rtofs=$1
curfile=$2
fhr=$3
flagfirst=$4
fh3=`printf "%03d" "${fhr#0}"`

# Timing has to be made relative to the single 00z RTOFS cycle for that PDY
Expand Down Expand Up @@ -61,11 +62,11 @@ fi
# Cleanup
rm -f cur_temp[123].nc cur_5min_??.nc cur_glo_uv_${PDY}_${fext}${fh3}.nc weights.nc

if [ ${fhr} -gt 0 ]
if [ ${flagfirst} = "T" ]
then
sed -e "s/HDRFL/F/g" ${FIXwave}/ww3_prnc.cur.${WAVECUR_FID}.inp.tmpl > ww3_prnc.inp
else
sed -e "s/HDRFL/T/g" ${FIXwave}/ww3_prnc.cur.${WAVECUR_FID}.inp.tmpl > ww3_prnc.inp
else
sed -e "s/HDRFL/F/g" ${FIXwave}/ww3_prnc.cur.${WAVECUR_FID}.inp.tmpl > ww3_prnc.inp
fi

rm -f cur.nc
Expand Down

0 comments on commit b096e29

Please sign in to comment.