Skip to content

Commit

Permalink
JWAVE_PREP updated to use CDO_ROOT defined in config config.waveprep …
Browse files Browse the repository at this point in the history
…updated to default to WCOSS rtofs operational cdo if no module found wave_prnc_cur.sh bug fixed now provides proper fhr in temp file names exwave_prep.sh adjusted for WCOSS and Hera.
  • Loading branch information
ajhenrique committed May 27, 2020
1 parent 70d7131 commit e87b5a1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 26 deletions.
3 changes: 1 addition & 2 deletions jobs/JWAVE_PREP
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export pgmout=OUTPUT.$$
export MP_PULSE=0

# CDO required for processing RTOFS currents
# export CDO=${COMROOTp2}/nwprod/rtofs_glo.v1.2.0/bin/cdo
export CDO=/gpfs/dell2/emc/verification/noscrub/Todd.Spindler/CDO/bin/cdo
export CDO=${CDO_ROOT}/bin/cdo

# Path to HOME Directory
export FIXwave=${FIXwave:-$HOMEwave/fix/fix_wave_${NET}}
Expand Down
3 changes: 3 additions & 0 deletions parm/config/config.waveprep
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export WAV_CUR_HF_DT=${WAV_CUR_HF_DT:-3}
export WAV_CUR_HF_FH=${WAV_CUR_HF_FH:-72}
export WAV_CUR_CDO_SMOOTH="NO"

# Location of CDO module
export CDO_ROOT=${CDO_ROOT:-/gpfs/dell1/nco/ops/nwprod/rtofs_shared/rtofs_cdo.v1.6.0}

if [ "${WW3ICEINP}" = "YES" ]; then
export WAVICEFILE=${CDUMP}.t${cyc}z.seaice.5min.grib2
fi
Expand Down
45 changes: 30 additions & 15 deletions scripts/exwave_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,15 @@
# 3.a Gather and pre-process grib2 files
ymdh=$ymdh_beg

if [ ${CFP_MP:-"NO"} = "YES" ]; then nm=0 ; fi # Counter for MP CFP
while [ "$ymdh" -le "$ymdh_end" ]
do
echo "$USHwave/wave_g2ges.sh $ymdh > grb_$ymdh.out 2>&1" >> cmdfile
if [ ${CFP_MP:-"NO"} = "YES" ]; then
echo "$nm $USHwave/wave_g2ges.sh $ymdh > grb_$ymdh.out 2>&1" >> cmdfile
nm=`expr $nm + 1`
else
echo "$USHwave/wave_g2ges.sh $ymdh > grb_$ymdh.out 2>&1" >> cmdfile
fi
ymdh=`$NDATE $WAV_WND_HOUR_INC $ymdh`
done

Expand All @@ -334,7 +340,11 @@

if [ "$wavenproc" -gt '1' ]
then
${wavempexec} ${wavenproc} ${wave_mpmd} cmdfile
if [ ${CFP_MP:-"NO"} = "YES" ]; then
${wavempexec} -n ${wavenproc} ${wave_mpmd} cmdfile
else
${wavempexec} ${wavenproc} ${wave_mpmd} cmdfile
fi
exit=$?
else
./cmdfile
Expand Down Expand Up @@ -626,30 +636,24 @@
# Prepare files for cfp process
rm -f cmdfile
touch cmdfile
chmod 744 cmfile
chmod 744 cmdfile

ymdh_rtofs=${PDY}00 # RTOFS runs once daily
ymdh_end=`$NDATE ${FHMAX_WAV_CUR} ${ymdh_rtofs}`
NDATE_DT=${WAV_CUR_HF_DT}
FLGHF='T'

if [ ${CFP_MP:-"NO"} = "YES" ]; then nm=0 ; fi # Counter for MP CFP
while [ "$ymdh_rtofs" -le "$ymdh_end" ]
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'

if [ ${fhr_rtofs} -lt 0 ]
then
# Data from nowcast phase
fhr_rtofs=`expr 48 + ${fhr_rtofs}`
fext='n'
fi
fh3_rtofs=`printf "%03d" "${fhr_rtofs#0}"`

fhr_rtofs=`printf "%03d\n" ${fhr_rtofs}`

curfile1h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fhr_rtofs}_1hrly_prog.nc
curfile3h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fhr_rtofs}_3hrly_prog.nc
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

if [ -s ${curfile1h} ] && [ "${FLGHF}" = "T" ] ; then
curfile=${curfile1h}
Expand All @@ -671,7 +675,13 @@
echo ' '
fi

echo "$USHwave/wave_prnc_cur.sh $ymdh_rtofs $curfile > cur_$ymdh_rtofs.out 2>&1" >> cmdfile
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
nm=`expr $nm + 1`
else
echo "$USHwave/wave_prnc_cur.sh $ymdh_rtofs $curfile $fhr_rtofs > cur_$ymdh_rtofs.out 2>&1" >> cmdfile
fi

if [ $fhr_rtofs -ge ${WAV_CUR_HF_FH} ] ; then
NDATE_DT=${WAV_CUR_DT}
fi
Expand All @@ -691,7 +701,11 @@

if [ $wavenproc -gt '1' ]
then
${wavempexec} ${wavenproc} ${wave_mpmd} cmdfile
if [ ${CFP_MP:-"NO"} = "YES" ]; then
${wavempexec} -n ${wavenproc} ${wave_mpmd} cmdfile
else
${wavempexec} ${wavenproc} ${wave_mpmd} cmdfile
fi
exit=$?
else
chmod 744 ./cmdfile
Expand Down Expand Up @@ -731,6 +745,7 @@

for file in $files
do
echo $file
cat $file >> cur.${WAVECUR_FID}
rm -f $file
done
Expand Down
21 changes: 12 additions & 9 deletions ush/wave_prnc_cur.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,41 @@ set -x

ymdh_rtofs=$1
curfile=$2
fhr=$3
fh3=`printf "%03d" "${fhr#0}"`

# Timing has to be made relative to the single 00z RTOFS cycle for that PDY

mkdir -p rtofs_${ymdh_rtofs}
cd rtofs_${ymdh_rtofs}

ncks -x -v sst,sss,layer_density $curfile cur_uv_${PDY}_${fext}${fhr}.nc
ncks -O -a -h -x -v Layer cur_uv_${PDY}_${fext}${fhr}.nc cur_temp1.nc
ncks -x -v sst,sss,layer_density $curfile cur_uv_${PDY}_${fext}${fh3}.nc
ncks -O -a -h -x -v Layer cur_uv_${PDY}_${fext}${fh3}.nc cur_temp1.nc
ncwa -h -O -a Layer cur_temp1.nc cur_temp2.nc
ncrename -h -O -v MT,time cur_temp2.nc
ncrename -h -O -d MT,time cur_temp2.nc
ncks -v u_velocity,v_velocity cur_temp2.nc cur_temp3.nc
mv -f cur_temp3.nc cur_uv_${PDY}_${fext}${fhr}_flat.nc
mv -f cur_temp3.nc cur_uv_${PDY}_${fext}${fh3}_flat.nc

# Convert to regular lat lon file

# If weights need to be regenerated due to CDO ver change, use:
# $CDO genbil,r4320x2160 rtofs_glo_2ds_f000_3hrly_prog.nc weights.nc
cp ${FIXwave}/weights_rtofs_to_r4320x2160.nc ./weights.nc

# Interpolate to regular 5 min grid
$CDO remap,r4320x2160,weights.nc cur_uv_${PDY}_${fext}${fhr}_flat.nc cur_5min_01.nc
$CDO remap,r4320x2160,weights.nc cur_uv_${PDY}_${fext}${fh3}_flat.nc cur_5min_01.nc

# Perform 9-point smoothing twice to make RTOFS data less noisy when
# interpolating from 1/12 deg RTOFS grid to 1/6 deg wave grid
if [ "WAV_CUR_CDO_SMOOTH" = "YES" ]; then
$CDO -f nc -smooth9 cur_5min_01.nc cur_5min_02.nc
$CDO -f nc -smooth9 cur_5min_02.nc cur_glo_uv_${PDY}_${fext}${fhr}_5min.nc
$CDO -f nc -smooth9 cur_5min_02.nc cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc
else
mv cur_5min_01.nc cur_glo_uv_${PDY}_${fext}${fhr}_5min.nc
mv cur_5min_01.nc cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc
fi

# Cleanup
rm -f cur_temp[123].nc cur_5min_??.nc cur_glo_uv_${PDY}_${fext}${fhr}.nc weights.nc
rm -f cur_temp[123].nc cur_5min_??.nc cur_glo_uv_${PDY}_${fext}${fh3}.nc weights.nc

if [ ${fhr} -gt ${WAVHINDH} ]
then
Expand All @@ -64,7 +67,7 @@ else
fi

rm -f cur.nc
ln -s cur_glo_uv_${PDY}_${fext}${fhr}_5min.nc cur.nc
ln -s cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc cur.nc
ln -s ${DATA}/mod_def.${WAVECUR_FID} ./mod_def.ww3

$EXECwave/ww3_prnc 1> prnc_${WAVECUR_FID}_${ymdh_rtofs}.out 2>&1
Expand Down

0 comments on commit e87b5a1

Please sign in to comment.