Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For WAFS grib1 job, change input dependency from GFS pgrb2.1p00 to master file. #34

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions scripts/exwafs_grib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,6 @@ set -x
# To fix bugzilla 628 ( removing 'j' ahead of $job )
export jobsuffix=gfs_atmos_wafs_f${fhr}_$cyc

###############################################
# Wait for the availability of the pgrib file
###############################################
# file name and forecast hour of GFS model data in Grib2 are 3 digits
export fhr000="$(printf "%03d" $(( 10#$fhr )) )"
icnt=1
while [ $icnt -lt 1000 ]
do
# if [ -s $COMIN/${RUN}.${cycle}.pgrbf$fhr ]
if [ -s $COMINgfs/gfs.${cycle}.pgrb2.1p00.f$fhr000 ]
then
break
fi

sleep 10
icnt=$((icnt + 1))
if [ $icnt -ge 180 ]
then
msg="ABORTING after 30 min of waiting for the pgrib filei!"
err_exit $msg
fi
done

########################################
echo "HAS BEGUN!"
########################################
Expand Down
141 changes: 77 additions & 64 deletions ush/mkwfsgbl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ echo " - Allows users to run interactively"
#

set -x
hour_list="$1"
fhr="$1"
sets_key=$2
num=$#

Expand Down Expand Up @@ -50,85 +50,98 @@ echo " ------------------------------------------"

echo "Enter Make WAFS utility."

for hour in $hour_list
do
##############################
# Copy Input Field to $DATA
##############################
##############################
# Copy Input Field to $DATA
##############################

if test ! -f pgrbf${hour}
then
fhr3="$(printf "%03d" $(( 10#$hour )) )"
if test ! -f pgrbf${fhr}
then
fhr3="$(printf "%03d" $(( 10#$fhr )) )"

# To solve Bugzilla #408: remove the dependency of grib1 files in gfs wafs job in next GFS upgrade
# Reason: It's not efficent if simply converting from grib2 to grib1 (costs 6 seconds with 415 records)
# Solution: Need to grep 'selected fields on selected levels' before CNVGRIB (costs 1 second with 92 records)
ln -s $COMINgfs/gfs.${cycle}.pgrb2.1p00.f$fhr3 pgrb2f${hour}
$WGRIB2 pgrb2f${hour} | grep -F -f $FIXwafs/grib_wafs.grb2to1.list | $WGRIB2 -i pgrb2f${hour} -grib pgrb2f${hour}.tmp
# on Cray, IOBUF_PARAMS has to used to speed up CNVGRIB
# export IOBUF_PARAMS='*:size=32M:count=4:verbose'
$CNVGRIB -g21 pgrb2f${hour}.tmp pgrbf${hour}
# unset IOBUF_PARAMS
fi

#
# BAG - Put in fix on 20070925 to force the percision of U and V winds
# to default to 1 through the use of the grib_wafs.namelist file.
#
$COPYGB -g3 -i0 -N$FIXwafs/grib_wafs.namelist -x pgrbf${hour} tmp
mv tmp pgrbf${hour}
$GRBINDEX pgrbf${hour} pgrbif${hour}
# ln -s $COMINgfs/gfs.${cycle}.pgrb2.1p00.f$fhr3 pgrb2f${fhr}
# $WGRIB2 pgrb2f${fhr} | grep -F -f $FIXwafs/grib_wafs.grb2to1.list | $WGRIB2 -i pgrb2f${fhr} -grib pgrb2f${fhr}.tmp
masterfile=$COMINgfs/gfs.${cycle}.master.grb2f${fhr3}
$WGRIB2 $masterfile | grep -F -f $FIXwafs/grib_wafs.grb2to1.list | $WGRIB2 -i $masterfile -grib masterf$fhr

# Change data input from 1p00 files to master files
export opt1=' -set_grib_type same -new_grid_winds earth '
export opt21=' -new_grid_interpolation bilinear '
export opt24=' -set_bitmap 1 -set_grib_max_bits 16 -if '
export opt25=":(APCP|ACPCP):"
export opt26=' -set_grib_max_bits 25 -fi -if '
export opt27=":(APCP|ACPCP):"
export opt28=' -new_grid_interpolation budget -fi '
export grid1p0="latlon 0:360:1.0 90:181:-1.0"
$WGRIB2 masterf$fhr $opt1 $opt21 $opt24 $opt25 $opt26 $opt27 $opt28 \
-new_grid $grid1p0 pgb2file_${fhr}1p00

# trim RH vaule larger than 100.
$WGRIB2 pgb2file_${fhr}1p00 -not_if ':RH:' -grib pgrb2f${fhr}.tmp \
-if ':RH:' -rpn "10:*:0.5:+:floor:1000:min:10:/" -set_grib_type same \
-set_scaling -1 0 -grib_out pgrb2f${fhr}.tmp

$CNVGRIB -g21 pgrb2f${fhr}.tmp pgrbf${fhr}
fi

##############################
# Process WAFS
##############################
#
# BAG - Put in fix on 20070925 to force the percision of U and V winds
# to default to 1 through the use of the grib_wafs.namelist file.
#
$COPYGB -g3 -i0 -N$FIXwafs/grib_wafs.namelist -x pgrbf${fhr} tmp
mv tmp pgrbf${fhr}
$GRBINDEX pgrbf${fhr} pgrbif${fhr}

if test $hour -ge '12' -a $hour -le '30'
then
sets=$sets_key
set +x
echo "We are processing the primary and secondary sets of hours."
echo "These sets are the a and b of hours 12-30."
set -x
else
# This is for hours 00/06 and 36-72.
unset sets
fi
##############################
# Process WAFS
##############################

export pgm=wafs_makewafs
. prep_step
if test $fhr -ge '12' -a $fhr -le '30'
then
sets=$sets_key
set +x
echo "We are processing the primary and secondary sets of hours."
echo "These sets are the a and b of hours 12-30."
set -x
else
# This is for hours 00/06 and 36-72.
unset sets
fi

export FORT11="pgrbf${hour}"
export FORT31="pgrbif${hour}"
export FORT51="xtrn.wfsgfs${hour}${sets}"
export FORT53="com.wafs${hour}${sets}"
export pgm=wafs_makewafs
. prep_step

startmsg
$EXECwafs/wafs_makewafs.x < $FIXwafs/grib_wfsgfs${hour}${sets} >>$pgmout 2>errfile
export err=$?;err_chk
export FORT11="pgrbf${fhr}"
export FORT31="pgrbif${fhr}"
export FORT51="xtrn.wfsgfs${fhr}${sets}"
export FORT53="com.wafs${fhr}${sets}"

startmsg
$EXECwafs/wafs_makewafs.x < $FIXwafs/grib_wfsgfs${fhr}${sets} >>$pgmout 2>errfile
export err=$?;err_chk

##############################
# Post Files to PCOM
##############################

if test "$SENDCOM" = 'YES'
then
cp xtrn.wfsgfs${hour}${sets} $PCOM/xtrn.wfsgfs${cyc}${hour}${sets}.$jobsuffix
fi
##############################
# Post Files to PCOM
##############################

##############################
# Distribute Data
##############################
if test "$SENDCOM" = 'YES'
then
cp xtrn.wfsgfs${fhr}${sets} $PCOM/xtrn.wfsgfs${cyc}${fhr}${sets}.$jobsuffix
fi

if [ "$SENDDBN_NTC" = 'YES' ] ; then
$DBNROOT/bin/dbn_alert GRIB_LOW gfs $job $PCOM/xtrn.wfsgfs${cyc}${hour}${sets}.$jobsuffix
else
echo "xtrn.wfsgfs${cyc}${hour}${sets}.$job file not posted to db_net."
fi
##############################
# Distribute Data
##############################

echo "Wafs Processing $hour hour completed normally"
if [ "$SENDDBN_NTC" = 'YES' ] ; then
$DBNROOT/bin/dbn_alert GRIB_LOW gfs $job $PCOM/xtrn.wfsgfs${cyc}${fhr}${sets}.$jobsuffix
else
echo "xtrn.wfsgfs${cyc}${fhr}${sets}.$job file not posted to db_net."
fi

done
echo "Wafs Processing $fhr hour completed normally"

exit