diff --git a/.gitmodules b/.gitmodules index 3f884a8..d9eb1ba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "sorc/upp.fd"] path = sorc/upp.fd url = https://github.com/NOAA-EMC/UPP + ignore = dirty diff --git a/dev/driver/run_JWAFS_UPP b/dev/driver/run_JWAFS_UPP index 8fdc5e5..49f1d34 100755 --- a/dev/driver/run_JWAFS_UPP +++ b/dev/driver/run_JWAFS_UPP @@ -15,9 +15,7 @@ set -x # specify computation resource -export threads=1 export MP_LABELIO=yes -export OMP_NUM_THREADS=$threads export MPIRUN='mpiexec -l -n 126 -ppn 126 --cpu-bind depth --depth 1' echo "starting time $PBS_JOBNAME" @@ -63,13 +61,11 @@ export envir=prod export NET=wafs export RUN=wafs -export RUNupp=gfs - ############################################ # user defined ############################################ #export PDY=`$NDATE -24 | cut -c 1-8` -export PDY=`cut -c 7-14 $COMROOT/date/t00z` +export PDY=$(cut -c 7-14 $COMROOT/date/t00z) export PDY=20240617 export cyc=${cyc:-00} @@ -83,7 +79,7 @@ export job=wafs_upp_${cyc} export pid=${pid:-$$} export jobid=${job}.${pid} -USER=`whoami` +USER=$(whoami) ############################################ # SENDCOM=YES--Copy output file to /com @@ -101,7 +97,7 @@ export KEEPDATA=YES export COMROOT=/lfs/h2/emc/ptmp/$USER/wafs_dwn/$envir/com -export COMPATH=${COMPATHgfs:-/lfs/h1/ops/prod/com/$RUNupp} +export COMPATH=${COMPATHgfs:-/lfs/h1/ops/prod/com/gfs} DATAroot=/lfs/h2/emc/ptmp/$USER/working_wafs @@ -112,4 +108,3 @@ export DATA=$DATAroot/upp.f$fhr.${jobid} $HOMEwafs/jobs/JWAFS_UPP echo $? - diff --git a/jobs/JWAFS_GCIP b/jobs/JWAFS_GCIP index c881ffe..a831855 100755 --- a/jobs/JWAFS_GCIP +++ b/jobs/JWAFS_GCIP @@ -1,121 +1,79 @@ #!/bin/bash - -############################################ +######################################## # WAFS GCIP PRODUCT GENERATION -############################################ +######################################## date -export PS4='$SECONDS + ' +export PS4='$SECONDS + ' set -x -# keep the working directory or not -export KEEPDATA=${KEEPDATA:-NO} - -############################################ -# Specify it is production or developmen -############################################ -export envir=${envir:-prod} -# print current environment -env - -############################################ -# Working Directory -############################################ +#################################### +# make temp directory +#################################### export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA - -############################################ -# Output for executables -############################################ -export pgmout=OUTPUT.$$ - -############################################ -# Load the UTILITIES module -############################################ -#### module load prod_util -#### module load grib_util +mkdir -p "${DATA}" && cd "${DATA}" -############################################ +########################################### # Run setpdy and initialize PDY variables -############################################ -export cycle=t${cyc}z +########################################### +export cycle=${cycle:-"t${cyc}z"} setpdy.sh . ./PDY -############################################ -# Set up the NET and RUN -############################################ +#################################### +# SEND to COM, DBN, etc +#################################### +export SENDCOM=${SENDCOM:-"YES"} +export SENDDBN=${SENDDBN:-"YES"} + +#################################### +# Specify NET and RUN Name and model +#################################### export NET=${NET:-wafs} export RUN=${RUN:-wafs} -############################################ -# Specify HOME Directory -############################################ -export HOMEwafs=${HOMEwafs:-${NWROOT}/wafs.${wafs_ver}} -export EXECwafs=$HOMEwafs/exec -export FIXwafs=$HOMEwafs/fix/wafs -export PARMwafs=$HOMEwafs/parm/wafs -export USHwafs=$HOMEwafs/ush -export SCRIPTSwafs=$HOMEwafs/scripts - -# For BUFR dump, TMPDIR must be defined -export TMPDIR=$DATA # will be overwritten in exwafs script for parallel runs on fhr -# For BUFR dump, these two environment variables are defined by module load -# HOMEobsproc_shared_bufr_dumplist <= module load bufr_dumplist/1.5.0 -# HOMEobsproc_dump <= module load dumpjb/4.0.0 - - -################################################ -# Set up the input/output directory -################################################ -# model data -export COMINgfs=${COMINgfs:-$(compath.py ${envir}/gfs/${gfs_ver})/gfs.${PDY}/${cyc}/atmos} - -# satellite data -#ftp://satepsanone.nesdis.noaa.gov/2day/gmosaic/ -# Have to change IP address to digital ones, which BSUB can identify -#export COMINsat=${COMINsat:-ftp://140.90.213.161/2day/gmosaic} -export COMINsat=${COMINsat:-$DCOMROOT/$PDY/mcidas} - -# radar data -export COMINradar=${COMINradar:-$(compath.py ${envir}/radarl2/$radarl2_ver)/radar.$PDY} - -# metar/ships/lightning/pireps -# data are dumped by $USHobsproc_dump/dumpjb -# - -# COMOUT -export COMOUT=${COMOUT:-$(compath.py -o $NET/$wafs_ver)/$RUN.$PDY/$cyc/gcip} - -mkdir -p $COMOUT +############################################## +# Define COM directories +############################################## +export COMINgfs=${COMINgfs:-$(compath.py "${envir}/gfs/${gfs_ver}")"/gfs.${PDY}/${cyc}/atmos"} +export COMINsat=${COMINsat:-"${DCOMROOT}/${PDY}/mcidas"} +export COMINradar=${COMINradar:-$(compath.py "${envir}/radarl2/${radarl2_ver}")"/radar.${PDY}"} +export COMOUT=${COMOUT:-$(compath.py -o "${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/gcip"} +mkdir -p "${COMOUT}" + +#################################### +# Determine Job Output Name on System +#################################### +export pgmout="OUTPUT.$$" + +#################################### +# Specify Execution Areas +#################################### +export EXECwafs="${HOMEwafs}/exec" +export PARMwafs="${HOMEwafs}/parm" +export FIXwafs="${HOMEwafs}/fix" + +######################################################### +# print current environment +######################################################### +env ############################################ -# Execute the script, parallel run for 000 003 +# Execute the script. ############################################ -${SCRIPTSwafs}/exwafs_gcip.sh $fhr +"${HOMEwafs}/scripts/exwafs_gcip.sh" export err=$? +err_chk -if [ $err -eq 0 ] ; then - echo "JOB $job HAS COMPLETED NORMALLY!" -elif [ $err -eq 1 ] ; then - echo "WARNING!!! JOB $job incomplete. Missing satellite data." -else - echo "JOB $job FAILED!!!!" -fi - -############################################ -# print exec output -############################################ -if [ -e "$pgmout" ] ; then - cat $pgmout +if [[ -e "${pgmout}" ]]; then + cat "${pgmout}" fi -############################################ -# remove temporary working directory -############################################ -if [ $KEEPDATA != YES ] ; then - rm -rf $DATA +############################## +# Remove the Temporary working directory +############################## +if [[ "${KEEPDATA^^}" != "YES" ]]; then + rm -rf "${DATA}" fi date diff --git a/jobs/JWAFS_GRIB b/jobs/JWAFS_GRIB index 0548779..6447cc8 100755 --- a/jobs/JWAFS_GRIB +++ b/jobs/JWAFS_GRIB @@ -1,97 +1,77 @@ #!/bin/bash - ######################################## -# WAFS GRIB AWIPS PRODUCT GENERATION +# WAFS GRIB AWIPS PRODUCT GENERATION ######################################## + date -export PS4='$SECONDS + ' +export PS4='$SECONDS + ' set -x -export KEEPDATA=${KEEPDATA:-NO} - -############################################ -# Specify it is production or developmen -############################################ -export envir=${envir:-prod} -# print current environment -env - -############################################ -# Working Directory -############################################ +#################################### +# make temp directory +#################################### export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA - -############################################ -# Output for executables -############################################ -export pgmout=OUTPUT.$$ - -############################################ -# Load the UTILITIES module -############################################ -#### module load prod_util -#### module load grib_util +mkdir -p "${DATA}" && cd "${DATA}" ########################################### # Run setpdy and initialize PDY variables ########################################### -export cycle=t${cyc}z +export cycle=${cycle:-"t${cyc}z"} setpdy.sh . ./PDY -export RERUN=${RERUN:-NO} +#################################### +# SEND to COM, DBN, etc +#################################### +export SENDCOM=${SENDCOM:-"YES"} +export SENDDBN=${SENDDBN:-"YES"} -############################################ -# Set up the NET and RUN -############################################ +#################################### +# Specify NET and RUN Name and model +#################################### export NET=${NET:-wafs} export RUN=${RUN:-wafs} -############################################ -# Specify HOME Directory -############################################ -export HOMEwafs=${HOMEwafs:-${NWROOT}/wafs.${wafs_ver}} -export EXECwafs=$HOMEwafs/exec -export FIXwafs=$HOMEwafs/fix/wafs -export PARMwafs=$HOMEwafs/parm/wafs -export USHwafs=$HOMEwafs/ush -export SCRIPTSwafs=$HOMEwafs/scripts - -################################################ -# Set up the input/output directory -################################################ -export COMOUT=${COMOUT:-$(compath.py -o $NET/$wafs_ver)/$RUN.$PDY/$cyc/grib} -export PCOM=${PCOM:-$COMOUT/wmo} - -export COMINgfs=${COMINgfs:-$(compath.py ${envir}/gfs/${gfs_ver})/gfs.${PDY}/${cyc}/atmos} - -if [ $SENDCOM = YES ] ; then - mkdir -p $COMOUT $PCOM -fi +############################################## +# Define COM directories +############################################## +export COMINgfs=${COMINgfs:-$(compath.py "${envir}/gfs/${gfs_ver}")"/gfs.${PDY}/${cyc}/atmos"} +export COMOUT=${COMOUT:-$(compath.py -o "${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/grib"} +export COMOUTwmo=${COMOUTwmo:-"${COMOUT}/wmo"} +mkdir -p "${COMOUT}" "${COMOUTwmo}" + +#################################### +# Determine Job Output Name on System +#################################### +export pgmout="OUTPUT.$$" + +#################################### +# Specify Execution Areas +#################################### +export EXECwafs="${HOMEwafs}/exec" +export USHwafs="${HOMEwafs}/ush" + +######################################################### +# print current environment +######################################################### +env ############################################ # Execute the script. ############################################ -${SCRIPTSwafs}/exwafs_grib.sh $fhr - -export err=$?; err_chk - -echo "JOB $job HAS COMPLETED NORMALLY!" +"${HOMEwafs}/scripts/exwafs_grib.sh" +export err=$? +err_chk -############################################ -# print exec output -############################################ -if [ -e "$pgmout" ] ; then - cat $pgmout +if [[ -e "${pgmout}" ]]; then + cat "${pgmout}" fi -############################################ -# remove temporary working directory -############################################ -if [ $KEEPDATA != YES ] ; then - rm -rf $DATA +############################## +# Remove the Temporary working directory +############################## +if [[ "${KEEPDATA^^}" != "YES" ]]; then + rm -rf "${DATA}" fi date diff --git a/jobs/JWAFS_GRIB2_0P25 b/jobs/JWAFS_GRIB2_0P25 index fd75a24..3860df7 100755 --- a/jobs/JWAFS_GRIB2_0P25 +++ b/jobs/JWAFS_GRIB2_0P25 @@ -1,93 +1,78 @@ #!/bin/bash ######################################## -# WAFS GRIB 0P25 PRODUCT GENERATION +# WAFS GRIB2 0P25 PRODUCT GENERATION ######################################## date -export PS4='$SECONDS + ' +export PS4='$SECONDS + ' set -x -# keep the working directory or not -export KEEPDATA=${KEEPDATA:-NO} - -############################################ -# Specify it is production or developmen -############################################ -export envir=${envir:-prod} -# print current environment -env - -############################################ -# Working Directory -############################################ +#################################### +# make temp directory +#################################### export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA - -############################################ -# Output for executables -############################################ -export pgmout=OUTPUT.$$ +mkdir -p "${DATA}" && cd "${DATA}" ########################################### # Run setpdy and initialize PDY variables ########################################### -export cycle=t${cyc}z +export cycle=${cycle:-"t${cyc}z"} setpdy.sh . ./PDY -############################################ -# Set up the NET and RUN -############################################ +#################################### +# SEND to COM, DBN, etc +#################################### +export SENDCOM=${SENDCOM:-"YES"} +export SENDDBN=${SENDDBN:-"YES"} + +#################################### +# Specify NET and RUN Name and model +#################################### export NET=${NET:-wafs} export RUN=${RUN:-wafs} -############################################ -# Specify HOME Directory -############################################ -export HOMEwafs=${HOMEwafs:-${NWROOT}/wafs.${wafs_ver}} -export EXECwafs=$HOMEwafs/exec -export FIXwafs=$HOMEwafs/fix/wafs -export PARMwafs=$HOMEwafs/parm/wafs -export USHwafs=$HOMEwafs/ush -export SCRIPTSwafs=$HOMEwafs/scripts - -################################################ -# Set up the input/output directory -################################################ -export COMIN=${COMIN:-$(compath.py $envir/$NET/$wafs_ver)/$RUN.$PDY/$cyc/upp} -export COMOUT=${COMOUT:-$(compath.py -o $NET/$wafs_ver)/$RUN.$PDY/$cyc/grib2/0p25} -export PCOM=${PCOM:-$COMOUT/wmo} - -export COMINgfs=${COMINgfs:-$(compath.py $envir/gfs/$gfs_ver)/gfs.$PDY/$cyc/atmos} - -if [ $SENDCOM = YES ] ; then - mkdir -p $COMOUT # $PCOM -fi +############################################## +# Define COM directories +############################################## +export COMINgfs=${COMINgfs:-$(compath.py "${envir}/gfs/${gfs_ver}")"/gfs.${PDY}/${cyc}/atmos"} +export COMIN=${COMOUT:-$(compath.py "${envir}/${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/upp"} +export COMOUT=${COMOUT:-$(compath.py -o "${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/grib2/0p25"} +export COMOUTwmo=${COMOUTwmo:-"${COMOUT}/wmo"} +mkdir -p "${COMOUT}" "${COMOUTwmo}" + +#################################### +# Determine Job Output Name on System +#################################### +export pgmout="OUTPUT.$$" + +#################################### +# Specify Execution Areas +#################################### +export FIXwafs="${HOMEwafs}/fix" + +######################################################### +# print current environment +######################################################### +env ############################################ # Execute the script. ############################################ -${SCRIPTSwafs}/exwafs_grib2_0p25.sh $fhr +"${HOMEwafs}/scripts/exwafs_grib2_0p25.sh" +export err=$? +err_chk -export err=$?; err_chk - -echo "JOB $job HAS COMPLETED NORMALLY!" - -############################################ -# print exec output -############################################ -if [ -e "$pgmout" ] ; then - cat $pgmout +if [[ -e "${pgmout}" ]]; then + cat "${pgmout}" fi -############################################ -# remove temporary working directory -############################################ -if [ $KEEPDATA != YES ] ; then - rm -rf $DATA +############################## +# Remove the Temporary working directory +############################## +if [[ "${KEEPDATA^^}" != "YES" ]]; then + rm -rf "${DATA}" fi date - diff --git a/jobs/JWAFS_GRIB2_0P25_BLENDING b/jobs/JWAFS_GRIB2_0P25_BLENDING index 67569a5..cd9b7e0 100755 --- a/jobs/JWAFS_GRIB2_0P25_BLENDING +++ b/jobs/JWAFS_GRIB2_0P25_BLENDING @@ -1,107 +1,80 @@ #!/bin/bash ######################################################## -# This job runs the code to blend US's and UK's WAFS products at 0.25 deg +# This job runs the code to blend US's and UK's WAFS products at 0.25 deg ######################################################## date -export PS4='$SECONDS + ' +export PS4='$SECONDS + ' set -x -# keep the working directory or not -export KEEPDATA=${KEEPDATA:-NO} - -############################################ -# Specify it is production or developmen -############################################ -export envir=${envir:-prod} -# print current environment -env - -############################################ -# Working Directory -############################################ +#################################### +# make temp directory +#################################### export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA - -############################################ -# Output for executables -############################################ -export pgmout=OUTPUT.$$ +mkdir -p "${DATA}" && cd "${DATA}" ########################################### # Run setpdy and initialize PDY variables ########################################### -export cycle=t${cyc}z +export cycle=${cycle:-"t${cyc}z"} setpdy.sh . ./PDY -export RERUN=${RERUN:-NO} +#################################### +# SEND to COM, DBN, etc +#################################### +export SENDCOM=${SENDCOM:-"YES"} +export SENDDBN=${SENDDBN:-"YES"} -############################################ -# Set up the NET and RUN -############################################ +#################################### +# Specify NET and RUN Name and model +#################################### export NET=${NET:-wafs} export RUN=${RUN:-wafs} -############################################ -# Specify HOME Directory -############################################ -export HOMEwafs=${HOMEwafs:-${NWROOT}/wafs.${wafs_ver}} -export EXECwafs=$HOMEwafs/exec -export FIXwafs=$HOMEwafs/fix/wafs -export PARMwafs=$HOMEwafs/parm/wafs -export USHwafs=$HOMEwafs/ush -export SCRIPTSwafs=$HOMEwafs/scripts - -################################################ -# Set up the INPUT and OUTPUT directories -################################################ -export COMIN=${COMIN:-$(compath.py $envir/$NET/$wafs_ver)/$RUN.$PDY/$cyc/grib2/0p25} -export COMOUT=${COMOUT:-$(compath.py -o $NET/$wafs_ver)/$RUN.$PDY/$cyc/grib2/0p25/blending} -export PCOM=${PCOM:-$COMOUT/wmo} - -if [ $SENDCOM = YES ] ; then - mkdir -p $COMOUT $PCOM -fi - -export COMINus=${COMINus:-$COMIN} -export COMINuk=${COMINuk:-$DCOMROOT/$PDY/wgrbbul/ukmet_wafs} - -############################################### -# Specify Timeout Behavior of WAFS blending -# -# SLEEP_TIME - Amount of time to wait for -# a input file before exiting -# SLEEP_INT - Amount of time to wait between -# checking for input files -############################################### -# export SLEEP_TIME=300 # changed to 60 to avoid hitting wall_clock when miss umket wafs files ... -# JY -0129: export SLEEP_TIME=600 -# Aug2024: export SLEEP_TIME=1200 (20 minutes, T+4:30 - T+4:50) -export SLEEP_TIME=1200 -export SLEEP_INT=10 +############################################## +# Define COM directories +############################################## +export COMIN=${COMOUT:-$(compath.py "${envir}/${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/grib2/0p25"} +export COMOUT=${COMOUT:-$(compath.py -o "${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/grib2/0p25/blending"} +export COMOUTwmo=${COMOUTwmo:-"${COMOUT}/wmo"} +mkdir -p "${COMOUT}" "${COMOUTwmo}" + +export COMINus=${COMINus:-"${COMIN}"} +export COMINuk=${COMINuk:-"${DCOMROOT}/${PDY}/wgrbbul/ukmet_wafs"} + +#################################### +# Determine Job Output Name on System +#################################### +export pgmout="OUTPUT.$$" + +#################################### +# Specify Execution Areas +#################################### +export EXECwafs="${HOMEwafs}/exec" +export FIXwafs="${HOMEwafs}/fix" + +######################################################### +# print current environment +######################################################### +env ############################################ # Execute the script. ############################################ -${SCRIPTSwafs}/exwafs_grib2_0p25_blending.sh -export err=$?; err_chk - -echo "JOB $job HAS COMPLETED NORMALLY." +"${HOMEwafs}/scripts/exwafs_grib2_0p25_blending.sh" +export err=$? +err_chk -############################################ -# print exec output -############################################ -if [ -e "$pgmout" ] ; then - cat $pgmout +if [[ -e "${pgmout}" ]]; then + cat "${pgmout}" fi -############################################ -# remove temporary working directory -############################################ -if [ $KEEPDATA != YES ] ; then - rm -rf $DATA +############################## +# Remove the Temporary working directory +############################## +if [[ "${KEEPDATA^^}" != "YES" ]]; then + rm -rf "${DATA}" fi date diff --git a/jobs/JWAFS_GRIB2_1P25 b/jobs/JWAFS_GRIB2_1P25 index 6d1af56..6a0de52 100755 --- a/jobs/JWAFS_GRIB2_1P25 +++ b/jobs/JWAFS_GRIB2_1P25 @@ -5,95 +5,74 @@ ######################################## date -export PS4='$SECONDS + ' +export PS4='$SECONDS + ' set -x -# keep the working directory or not -export KEEPDATA=${KEEPDATA:-NO} - -############################################ -# Specify it is production or developmen -############################################ -export envir=${envir:-prod} -# print current environment -env - -############################################ -# Working Directory -############################################ +#################################### +# make temp directory +#################################### export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA - -############################################ -# Output for executables -############################################ -export pgmout=OUTPUT.$$ - -############################################ -# Load the UTILITIES module -############################################ -#### module load prod_util -#### module load grib_util +mkdir -p "${DATA}" && cd "${DATA}" ########################################### # Run setpdy and initialize PDY variables ########################################### -export cycle=t${cyc}z +export cycle=${cycle:-"t${cyc}z"} setpdy.sh . ./PDY -############################################ -# Set up the NET and RUN -############################################ +#################################### +# SEND to COM, DBN, etc +#################################### +export SENDCOM=${SENDCOM:-"YES"} +export SENDDBN=${SENDDBN:-"YES"} + +#################################### +# Specify NET and RUN Name and model +#################################### export NET=${NET:-wafs} export RUN=${RUN:-wafs} -############################################ -# Specify HOME Directory -############################################ -export HOMEwafs=${HOMEwafs:-${NWROOT}/wafs.${wafs_ver}} -export EXECwafs=$HOMEwafs/exec -export FIXwafs=$HOMEwafs/fix/wafs -export PARMwafs=$HOMEwafs/parm/wafs -export USHwafs=$HOMEwafs/ush -export SCRIPTSwafs=$HOMEwafs/scripts - -################################################ -# Set up the input/output directory -################################################ - -export COMIN=${COMIN:-$(compath.py $envir/$NET/$wafs_ver)/$RUN.$PDY/$cyc/upp} -export COMOUT=${COMOUT:-$(compath.py -o $NET/$wafs_ver)/$RUN.$PDY/$cyc/grib2/1p25} -export PCOM=${PCOM:-$COMOUT/wmo} - -export COMINgfs=${COMINgfs:-$(compath.py $envir/gfs/$gfs_ver)/gfs.$PDY/$cyc/atmos} - -if [ $SENDCOM = YES ] ; then - mkdir -p $COMOUT $PCOM -fi +############################################## +# Define COM directories +############################################## +export COMINgfs=${COMINgfs:-$(compath.py "${envir}/gfs/${gfs_ver}")"/gfs.${PDY}/${cyc}/atmos"} +export COMIN=${COMOUT:-$(compath.py "${envir}/${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/upp"} +export COMOUT=${COMOUT:-$(compath.py -o "${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/grib2/1p25"} +export COMOUTwmo=${COMOUTwmo:-"${COMOUT}/wmo"} +mkdir -p "${COMOUT}" "${COMOUTwmo}" + +#################################### +# Determine Job Output Name on System +#################################### +export pgmout="OUTPUT.$$" + +#################################### +# Specify Execution Areas +#################################### +export FIXwafs="${HOMEwafs}/fix" + +######################################################### +# print current environment +######################################################### +env ############################################ # Execute the script. ############################################ -${SCRIPTSwafs}/exwafs_grib2_1p25.sh $fhr -export err=$?; err_chk +"${HOMEwafs}/scripts/exwafs_grib2_1p25.sh" +export err=$? +err_chk -echo "JOB $job HAS COMPLETED NORMALLY!" - -############################################ -# print exec output -############################################ -if [ -e "$pgmout" ] ; then - cat $pgmout +if [[ -e "${pgmout}" ]]; then + cat "${pgmout}" fi -############################################ -# remove temporary working directory -############################################ -if [ $KEEPDATA != YES ] ; then - rm -rf $DATA +############################## +# Remove the Temporary working directory +############################## +if [[ "${KEEPDATA^^}" != "YES" ]]; then + rm -rf "${DATA}" fi date - diff --git a/jobs/JWAFS_UPP b/jobs/JWAFS_UPP index 85f4296..aa788e2 100755 --- a/jobs/JWAFS_UPP +++ b/jobs/JWAFS_UPP @@ -4,93 +4,73 @@ # WAFS UPP PRODUCT GENERATION ######################################## -export PS4='$SECONDS + ' date +export PS4='$SECONDS + ' set -x -# keep the working directory or not -export KEEPDATA=${KEEPDATA:-NO} - -#################################### -# Specify whether the run is production or development -#################################### -export envir=${envir:-prod} -# print current environment -env - -#################################### -# Specify NET and RUN Name and model -#################################### -export NET=${NET:-wafs} -export RUN=${RUN:-wafs} - -export RUNupp=${RUNupp:-gfs} - #################################### -# obtain unique process id (pid) and make temp directory +# make temp directory #################################### -export pid=${pid:-$$} -export outid=${outid:-"LL$job"} export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA - -#################################### -# Determine Job Output Name on System -#################################### -export pgmout="OUTPUT.${pid}" +mkdir -p "${DATA}" && cd "${DATA}" ########################################### # Run setpdy and initialize PDY variables ########################################### -export cycle=t${cyc}z +export cycle=${cycle:-"t${cyc}z"} setpdy.sh . ./PDY - #################################### # SENDCOM - Copy Files From TMPDIR to $COMOUT -# SENDDBN - Issue DBNet Client Calls -# RERUN - Rerun posts from beginning (default no) -# VERBOSE - Specify Verbose Output in global_postgp.sh #################################### -export SENDCOM=${SENDCOM:-YES} -export SENDDBN=${SENDDBN:-YES} -export RERUN=${RERUN:-NO} -export VERBOSE=${VERBOSE:-YES} +export SENDCOM=${SENDCOM:-"YES"} #################################### -# Specify Execution Areas +# Specify NET and RUN Name and model #################################### -export HOMEwafs=${HOMEwafs:-${NWROOT}/wafs.${wafs_ver}} -export EXECwafs=$HOMEwafs/exec -export FIXwafs=$HOMEwafs/fix/upp -export PARMwafs=$HOMEwafs/parm/upp -export USHwafs=$HOMEwafs/ush -export SCRIPTSwafs=$HOMEwafs/scripts - -export POSTGPEXEC=${POSTGPEXEC:-$EXECwafs/ncep_post} -export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} +export NET=${NET:-wafs} +export RUN=${RUN:-wafs} ############################################## # Define COM directories ############################################## -export COMINgfs=${COMINgfs:-$(compath.py $envir/$RUNupp/$gfs_ver)/gfs.$PDY/$cyc/atmos} +export COMINgfs=${COMINgfs:-$(compath.py "${envir}/gfs/${gfs_ver}")"/gfs.${PDY}/${cyc}/atmos"} +export COMOUT=${COMOUT:-$(compath.py -o "${NET}/${wafs_ver}")"/${RUN}.${PDY}/${cyc}/upp"} +mkdir -p "${COMOUT}" -export COMOUT=${COMOUT:-$(compath.py -o $NET/$wafs_ver)/$RUN.$PDY/$cyc/upp} -mkdir -p $COMOUT +#################################### +# Determine Job Output Name on System +#################################### +export pgmout="OUTPUT.$$" + +#################################### +# Specify Execution Areas +#################################### +export EXECwafs="${HOMEwafs}/exec" +export PARMwafs="${HOMEwafs}/parm" + +######################################################### +# print current environment +######################################################### +env ######################################################### # Execute the Script ######################################################### -export MPIRUN=${MPIRUN:-'mpiexec -l -n 126 -ppn 126 --cpu-bind depth --depth 1'} -$SCRIPTSwafs/exwafs_upp.sh +"${HOMEwafs}/scripts/exwafs_upp.sh" +export err=$? +err_chk + +if [[ -e "${pgmout}" ]]; then + cat "${pgmout}" +fi ############################## # Remove the Temporary working directory ############################## -if [ $KEEPDATA = NO ]; then - rm -rf $DATA +if [[ "${KEEPDATA^^}" != "YES" ]]; then + rm -rf "${DATA}" fi date diff --git a/scripts/exwafs_gcip.sh b/scripts/exwafs_gcip.sh index 79053cb..272038a 100755 --- a/scripts/exwafs_gcip.sh +++ b/scripts/exwafs_gcip.sh @@ -4,7 +4,7 @@ # UTILITY SCRIPT NAME : exwafs_gcip.sh # DATE WRITTEN : 01/28/2015 # -# Abstract: This utility script produces the WAFS GCIP. +# Abstract: This utility script produces the WAFS GCIP. # # GCIP runs f000 f003 for each cycle, 4 times/day, # to make the output valid every 3 hours @@ -12,185 +12,152 @@ # History: 01/28/2015 # - GFS master file as first guess # /com/prod/gfs.YYYYMMDD -# - Nesdis composite global satellite data +# - Nesdis composite global satellite data # /dcom (ftp?) # - Metar/ships/lightning/pireps # dumpjb YYYYMMDDHH hours output >/dev/null # - Radar data over CONUS # /com/hourly/prod/radar.YYYYMMDD/refd3d.tHHz.grbf00 # - output of current icing potential -##################################################################### -echo "-----------------------------------------------------" -echo "JWAFS_GCIP at 00Z/06Z/12Z/18Z GFS postprocessing" -echo "-----------------------------------------------------" -echo "History: 2015 - First implementation of this new script." -echo "Oct 2021 - Remove jlogfile" -echo "May 2024 - WAFS separation" -echo " " +# - First implementation of this new script." +# Oct 2021 - Remove jlogfile +# May 2024 - WAFS separation ##################################################################### set -x -# Set up working dir for parallel runs based on fhr -fhr=$1 -DATA=$DATA/$fhr -mkdir -p $DATA -cd $DATA -# Overwrite TMPDIR for dumpjb -export TMPDIR=$DATA - -configFile=gcip.config - -echo 'before preparing data' `date` +cd "${DATA}" || err_exit "FATAL ERROR: Could not 'cd ${DATA}'; ABORT!" # valid time. no worry, it won't be across to another date -vhour=$(( $fhr + $cyc )) -vhour="$(printf "%02d" $(( 10#$vhour )) )" - -######################################################## -# Preparing data - -# model data -masterFile=$COMINgfs/gfs.t${cyc}z.master.grb2f$fhr -cp $PARMwafs/wafs_gcip_gfs.cfg $configFile - -modelFile=modelfile.grb -# ln -sf $masterFile $modelFile -$WGRIB2 $masterFile | egrep ":HGT:|:VVEL:|:CLWMR:|:TMP:|:SPFH:|:RWMR:|:SNMR:|:GRLE:|:ICMR:|:RH:" | egrep "00 mb:|25 mb:|50 mb:|75 mb:|:HGT:surface" | $WGRIB2 -i $masterFile -grib $modelFile +vhour=$((fhr + cyc)) +vhour="$(printf "%02d" $((10#$vhour)))" # metar / ships / lightning / pireps -# dumped data files' suffix is ".ibm" +export TMPDIR="${DATA}" # dumpjb uses TMPDIR obsfiles="metar ships ltngsr pirep" -for obsfile in $obsfiles ; do - $DUMPJB ${PDY}${vhour} 1.5 $obsfile +for obsfile in ${obsfiles}; do + ${DUMPJB} "${PDY}${vhour}" 1.5 "${obsfile}" done -metarFile=metar.ibm -shipFile=ships.ibm -lightningFile=ltngsr.ibm -pirepFile=pirep.ibm + +# dumped data files suffix is ".ibm" +metarFile="metar.ibm" +shipFile="ships.ibm" +lightningFile="ltngsr.ibm" +pirepFile="pirep.ibm" + +# Setup mailing list once +if [[ "${envir}" != "prod" ]]; then + maillist="nco.spa@noaa.gov" +fi +maillist=${maillist:-"nco.spa@noaa.gov,ncep.sos@noaa.gov"} satFiles="" channels="VIS SIR LIR SSR" # If one channel is missing, satFiles will be empty -for channel in $channels ; do - satFile=GLOBCOMP$channel.${PDY}${vhour} - if [[ $COMINsat == *ftp:* ]] ; then - curl -O $COMINsat/$satFile - else - # check the availability of satellite data file - if [ -s $COMINsat/$satFile ] ; then - cp $COMINsat/$satFile . +for channel in ${channels}; do + satFile="GLOBCOMP${channel}.${PDY}${vhour}" + if [[ "${COMINsat}" == *ftp:* ]]; then + curl -O "${COMINsat}/${satFile}" + else + # check the availability of satellite data file + if [[ -s "${COMINsat}/${satFile}" ]]; then + cpreq "${COMINsat}/${satFile}" . + else + msg="GCIP at ${vhour}z ABORTING, no satellite ${channel} file!" + echo "${msg}" + echo "${msg}" >>"${COMOUT}/${RUN}.gcip.log" + + subject="Missing GLOBCOMPVIS Satellite Data for ${PDY} t${cyc}z ${job}" + echo "*************************************************************" >mailmsg + echo "*** WARNING !! COULD NOT FIND GLOBCOMPVIS Satellite Data *** " >>mailmsg + echo "*************************************************************" >>mailmsg + echo >>mailmsg + echo "One or more GLOBCOMPVIS Satellite Data files are missing, including " >>mailmsg + echo " ${COMINsat}/${satFile} " >>mailmsg + echo >>mailmsg + echo "${job} will gracfully exit" >>mailmsg + cat mailmsg >"${COMOUT}/${RUN}.t${cyc}z.gcip.emailbody" + cat "${COMOUT}/${RUN}.t${cyc}z.gcip.emailbody" | mail.py -s "${subject}" "${maillist}" -v + + exit 1 + fi + fi + if [[ -s "${satFile}" ]]; then + satFiles="${satFiles} ${satFile}" else - msg="GCIP at ${vhour}z ABORTING, no satellite $channel file!" - echo "$msg" - echo $msg >> $COMOUT/${RUN}.gcip.log - - if [ $envir != prod ]; then - export maillist='nco.spa@noaa.gov' - fi - export maillist=${maillist:-'nco.spa@noaa.gov,ncep.sos@noaa.gov'} - - export subject="Missing GLOBCOMPVIS Satellite Data for $PDY t${cyc}z $job" - echo "*************************************************************" > mailmsg - echo "*** WARNING !! COULD NOT FIND GLOBCOMPVIS Satellite Data *** " >> mailmsg - echo "*************************************************************" >> mailmsg - echo >> mailmsg - echo "One or more GLOBCOMPVIS Satellite Data files are missing, including " >> mailmsg - echo " $COMINsat/$satFile " >> mailmsg - echo >> mailmsg - echo "$job will gracfully exited" >> mailmsg - cat mailmsg > $COMOUT/${RUN}.t${cyc}z.gcip.emailbody - cat $COMOUT/${RUN}.t${cyc}z.gcip.emailbody | mail.py -s "$subject" $maillist -v - - exit 1 + satFiles="" + break fi - fi - if [[ -s $satFile ]] ; then - satFiles="$satFiles $satFile" - else - satFiles="" - break - fi done -# radar data -sourceRadar=$COMINradar/refd3d.t${vhour}z.grb2f00 -radarFile=radarFile.grb -if [ -s $sourceRadar ] ; then - cp $sourceRadar $radarFile -fi +# Copy GFS master file and prepare modelFile +cpreq "${COMINgfs}/gfs.t${cyc}z.master.grb2f${fhr}" ./gfs_master.grib2 +modelFile="modelfile.grb" +${WGRIB2} "gfs_master.grib2" | grep -E ":HGT:|:VVEL:|:CLWMR:|:TMP:|:SPFH:|:RWMR:|:SNMR:|:GRLE:|:ICMR:|:RH:" | grep -E "00 mb:|25 mb:|50 mb:|75 mb:|:HGT:surface" | ${WGRIB2} -i "gfs_master.grib2" -grib "${modelFile}" -######################################################## # Composite gcip command options - -outputfile=wafs.t${vhour}z.gcip.f000.grib2 - -cmdoptions="-t ${PDY}${vhour} -c $configFile -model $modelFile" -if [[ -s $metarFile ]] ; then - cmdoptions="$cmdoptions -metar $metarFile" +configFile="gcip.config" +cmdoptions="-t ${PDY}${vhour} -c ${configFile} -model ${modelFile}" +if [[ -s "${metarFile}" ]]; then + cmdoptions="${cmdoptions} -metar ${metarFile}" else - err_exit "There are no METAR observations." + err_exit "FATAL ERROR: There are no METAR observations." fi -if [[ -s $shipFile ]] ; then - cmdoptions="$cmdoptions -ship $shipFile" +if [[ -s "${shipFile}" ]]; then + cmdoptions="${cmdoptions} -ship ${shipFile}" +else + echo "WARNING: There are no SHIP observations" fi # empty if a channel data is missing -if [[ -n $satFiles ]] ; then - cmdoptions="$cmdoptions -sat $satFiles" +if [[ -n "${satFiles}" ]]; then + cmdoptions="${cmdoptions} -sat ${satFiles}" else - err_exit "Satellite data are not available or completed." + err_exit "FATAL ERROR: Satellite data are not available or completed." fi -if [[ -s $lightningFile ]] ; then - cmdoptions="$cmdoptions -lightning $lightningFile" +if [[ -s "${lightningFile}" ]]; then + cmdoptions="${cmdoptions} -lightning ${lightningFile}" fi -if [[ -s $pirepFile ]] ; then - cmdoptions="$cmdoptions -pirep $pirepFile" +if [[ -s "${pirepFile}" ]]; then + cmdoptions="${cmdoptions} -pirep ${pirepFile}" +else + echo "WARNING: There are no PIREP observations" fi -if [[ -s $radarFile ]] ; then - cmdoptions="$cmdoptions -radar $radarFile" +# radar data +sourceRadar="${COMINradar}/refd3d.t${vhour}z.grb2f00" +radarFile="radarFile.grb" +if [[ -s "${sourceRadar}" ]]; then + cpreq "${sourceRadar}" "${radarFile}" + cmdoptions="${cmdoptions} -radar ${radarFile}" +else + echo "WARNING: There are no RADAR observations" fi -cmdoptions="$cmdoptions -o $outputfile" - -####################################################### -# Run GCIP -echo 'after preparing data' `date` +outputfile="wafs.t${vhour}z.gcip.f000.grib2" +cmdoptions="${cmdoptions} -o ${outputfile}" -export pgm=wafs_gcip.x +# Copy the configuration files and the executable +cpreq "${PARMwafs}/wafs_gcip_gfs.cfg" "${configFile}" +cpreq "${FIXwafs}/gcip_near_ir_refl.table" ./near_ir_refl.table +cpreq "${EXECwafs}/wafs_gcip.x" ./wafs_gcip.x -cp $FIXwafs/gcip_near_ir_refl.table near_ir_refl.table +export pgm="wafs_gcip.x" -startmsg -$EXECwafs/$pgm >> $pgmout $cmdoptions 2> errfile & -wait -export err=$?; err_chk +. prep_step +${pgm}${cmdoptions} >>"${pgmout}" 2>errfile +export err=$? +err_chk -if [[ -s $outputfile ]] ; then - ############################## - # Post Files to COM - ############################## - if [ $SENDCOM = "YES" ] ; then - cpfs $outputfile $COMOUT/$outputfile - if [ $SENDDBN = "YES" ] ; then - : - fi - fi -else - err_exit "Output $outputfile was not generated" +if [[ ! -f "${outputfile}" ]]; then + err_exit "FATAL ERROR: '${pgm}' failed to produce output '${outputfile}', ABORT!" fi +# Send output to COM +if [[ "${SENDCOM}" == "YES" ]]; then + cpfs "${outputfile}" "${COMOUT}/${outputfile}" +fi -################################################################################ -# GOOD RUN -set +x -echo "**************JOB EXWAFS_GCIP.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GCIP.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GCIP.SH COMPLETED NORMALLY ON THE IBM" -set -x -################################################################################ - -exit 0 - -############## END OF SCRIPT ####################### - +# Alert through DBN +if [[ "${SENDDBN}" == "YES" ]]; then + echo "TODO: DBN alert missing..." +fi diff --git a/scripts/exwafs_grib.sh b/scripts/exwafs_grib.sh index 3245249..aae23a1 100755 --- a/scripts/exwafs_grib.sh +++ b/scripts/exwafs_grib.sh @@ -13,48 +13,16 @@ # added variable of the a or b in the process accordingly. # The other fhrs, the a or b is dropped. # +# History: Oct 2004 - First implementation of this new script." +# Aug 2015 - Modified for Phase II" +# Dec 2015 - Modified for input model data in Grib2" +# Oct 2021 - Remove jlogfile" +# May 2024 - WAFS separation" ##################################################################### -echo "------------------------------------------------" -echo "JWAFS_00/06/12/18 GFS postprocessing" -echo "------------------------------------------------" -echo "History: OCT 2004 - First implementation of this new script." -echo " Aug 2015 - Modified for Phase II" -echo " Dec 2015 - Modified for input model data in Grib2" -echo " Oct 2021 - Remove jlogfile" -echo " May 2024 - WAFS separation" -echo " " -##################################################################### -set +x -fhr="$1" -num=$# - -if test "$num" -ge 1 -then - echo " Appropriate number of arguments were passed" - set -x - export DBNALERT_TYPE=${DBNALERT_TYPE:-GRIB} -# export job=${job:-interactive} -else - echo "" - echo "Usage: exwafs_grib.sh \$fhr " - echo "" - exit 16 -fi - -cd $DATA set -x -# To fix bugzilla 628 ( removing 'j' ahead of $job ) -export jobsuffix=gfs_atmos_wafs_f${fhr}_$cyc - -######################################## -echo "HAS BEGUN!" -######################################## - -echo " ------------------------------------------" -echo " BEGIN MAKING GFS WAFS PRODUCTS" -echo " ------------------------------------------" +ifhr=$((10#$fhr)) #################################################### # @@ -74,52 +42,29 @@ echo "#####################################" echo " " set -x -if test $fhr -eq 0 -then - echo " " -fi +cd "${DATA}" || err_exit "FATAL ERROR: Could not 'cd ${DATA}'; ABORT!" -# If we are processing fhrs 12-30, we have the -# added variable of the a or b in the process. -# The other fhrs, the a or b is dropped. +# If we are processing fhrs 12-30, we have the +# added variable of the a or b in the process. +# The other fhrs, the a or b is dropped. -if test $fhr -ge 12 -a $fhr -le 24 -then - $USHwafs/mkwfsgbl.sh $fhr a +if ((ifhr >= 12 && ifhr <= 24)); then + "${USHwafs}/mkwfsgbl.sh" "${fhr}" a fi -if test $fhr -eq 30 -then - $USHwafs/mkwfsgbl.sh $fhr a - for fhr in 12 18 24 30 - do - $USHwafs/mkwfsgbl.sh $fhr b +if ((ifhr == 30)); then + "${USHwafs}/mkwfsgbl.sh" "${fhr}" a + for hr in 12 18 24 30; do + "${USHwafs}/mkwfsgbl.sh" "${hr}" b done - $USHwafs/mkwfsgbl.sh 00 x - $USHwafs/mkwfsgbl.sh 06 x + "${USHwafs}/mkwfsgbl.sh" 00 x + "${USHwafs}/mkwfsgbl.sh" 06 x fi -if test $fhr -gt 30 -a $fhr -le 48 -then - $USHwafs/mkwfsgbl.sh $fhr x +if ((ifhr > 30 && ifhr <= 48)); then + "${USHwafs}/mkwfsgbl.sh" "${fhr}" x fi -if test $fhr -eq 60 -o $fhr -eq 72 -then - $USHwafs/mkwfsgbl.sh $fhr x +if ((ifhr == 60 || ifhr == 72)); then + "${USHwafs}/mkwfsgbl.sh" "${fhr}" x fi - -################################################################################ -# GOOD RUN -set +x -echo "**************JOB EXWAFS_GRIB.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GRIB.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GRIB.SH COMPLETED NORMALLY ON THE IBM" -set -x -################################################################################ - -echo "HAS COMPLETED NORMALLY!" - -exit 0 - -############## END OF SCRIPT ####################### diff --git a/scripts/exwafs_grib2_0p25.sh b/scripts/exwafs_grib2_0p25.sh index 323c475..9cf8f8b 100755 --- a/scripts/exwafs_grib2_0p25.sh +++ b/scripts/exwafs_grib2_0p25.sh @@ -6,7 +6,7 @@ # # Abstract: This utility script produces the WAFS GRIB2 at 0.25 degree. # The output GRIB files are posted on NCEP ftp server and the -# grib2 files are pushed via dbnet to TOC to WAFS (ICSC). +# grib2 files are pushed via dbnet to TOC to WAFS (ICSC). # This is a joint project of WAFC London and WAFC Washington. # # We are processing WAFS grib2 for fhr: @@ -14,163 +14,105 @@ # 3 hour: 027 - 048 # 6 hour: 054 - 120 (for U/V/T/RH, not for turbulence/icing/CB) # -# History: +# History: Mar 2020 - First implementation of this new script." +# Oct 2021 - Remove jlogfile" +# Aug 2022 - fhr expanded from 36 to 120" +# May 2024 - WAFS separation" ##################################################################### -echo "-----------------------------------------------------" -echo "JWAFS_GRIB2_0P25 at 00Z/06Z/12Z/18Z GFS&WAFS postprocessing" -echo "-----------------------------------------------------" -echo "History: MARCH 2020 - First implementation of this new script." -echo "Oct 2021 - Remove jlogfile" -echo "Aug 2022 - fhr expanded from 36 to 120" -echo "May 2024 - WAFS separation" -echo " " -##################################################################### - -cd $DATA set -x +GFS_MASTER="${COMINgfs}/gfs.t${cyc}z.master.grb2f${fhr}" +WAFS_MASTER="${COMIN}/${RUN}.t${cyc}z.master.f${fhr}.grib2" -fhr=$1 -export fhr="$(printf "%03d" $(( 10#$fhr )) )" - -DATA=$DATA/$fhr -mkdir -p $DATA -cd $DATA - - -if [ $fhr -le 48 ] ; then +ifhr="$((10#${fhr}))" +if ((ifhr <= 48)); then hazard_timewindow=yes else hazard_timewindow=no fi +cd "${DATA}" || err_exit "FATAL ERROR: Could not 'cd ${DATA}'; ABORT!" -########################################################## -# Wait for the availability of the gfs WAFS file -########################################################## - -# 3D data (on new ICAO model pressure levels) and 2D data (CB) -wafs2=$COMIN/${RUN}.${cycle}.master.f$fhr.grib2 -wafs2i=$COMIN/${RUN}.${cycle}.master.f$fhr.grib2.idx - -# 2D data from master file (U/V/H on max wind level, T/H at tropopause) -master2=$COMINgfs/gfs.${cycle}.master.grb2f${fhr} -master2i=$COMINgfs/gfs.${cycle}.master.grb2if${fhr} - -######################################## -echo "HAS BEGUN!" -######################################## - -echo " ------------------------------------------" -echo " BEGIN MAKING WAFS GRIB2 0.25 DEG PRODUCTS" -echo " ------------------------------------------" - -set +x -echo " " -echo "#####################################" -echo " Process GRIB2 WAFS 0.25 DEG PRODUCTS " -echo "#####################################" -echo " " -set -x - +# WGRIB2 options opt1=' -set_grib_type same -new_grid_winds earth ' opt21=' -new_grid_interpolation bilinear -if ' opt22="(:ICESEV|parm=37):" opt23=' -new_grid_interpolation neighbor -fi ' opt24=' -set_bitmap 1 -set_grib_max_bits 16 ' -opt25=":(UGRD|VGRD):max wind" newgrid="latlon 0:1440:0.25 90:721:-0.25" # WAFS 3D data -$WGRIB2 $wafs2 $opt1 $opt21 $opt22 $opt23 $opt24 -new_grid $newgrid tmp_wafs_0p25.grb2 -# Master 2D data -$WGRIB2 $master2 | grep -F -f $FIXwafs/grib2_0p25_gfs_master2d.list \ - | $WGRIB2 -i $master2 -set master_table 25 -grib tmp_master.grb2 -$WGRIB2 tmp_master.grb2 $opt1 $opt21 ":(UGRD|VGRD):max wind" $opt23 $opt24 -new_grid $newgrid tmp_master_0p25.grb2 +cpreq "${WAFS_MASTER}" ./wafs_master.grib2 +${WGRIB2} "./wafs_master.grib2" ${opt1} ${opt21} ${opt22} ${opt23} ${opt24} -new_grid ${newgrid} tmp_wafs_0p25.grb2 +# GFS 2D data +cpreq "${GFS_MASTER}" ./gfs_master.grib2 +${WGRIB2} "./gfs_master.grib2" | grep -F -f "${FIXwafs}/grib2_0p25_gfs_master2d.list" | + ${WGRIB2} -i "./gfs_master.grib2" -set master_table 25 -grib tmp_master.grb2 +${WGRIB2} tmp_master.grb2 ${opt1} ${opt21} ":(UGRD|VGRD):max wind" ${opt23} ${opt24} -new_grid ${newgrid} tmp_master_0p25.grb2 #--------------------------- # Product 1: WAFS u/v/t/rh wafs.tHHz.0p25.fFFF.grib2 #--------------------------- -$WGRIB2 tmp_wafs_0p25.grb2 | egrep "UGRD|VGRD|TMP|HGT|RH" \ - | $WGRIB2 -i tmp_wafs_0p25.grb2 -set master_table 25 -grib tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 -cat tmp_master_0p25.grb2 >> tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 +${WGRIB2} tmp_wafs_0p25.grb2 | grep -E "UGRD|VGRD|TMP|HGT|RH" | + ${WGRIB2} -i tmp_wafs_0p25.grb2 -set master_table 25 -grib "tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" +cat tmp_master_0p25.grb2 >>"tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" # Convert template 5 to 5.40 -#$WGRIB2 tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 -set_grib_type jpeg -grib_out gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 -mv tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 -$WGRIB2 -s gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 > gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2.idx - -if [ $hazard_timewindow = 'yes' ] ; then -#--------------------------- -# Product 2: For AWC and Delta airline: EDPARM CAT MWT ICESEV CB wafs.tHHz.awf.0p25.fFFF.grib2 -#--------------------------- +#${WGRIB2} "tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" -set_grib_type jpeg -grib_out "gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" +mv "tmp.gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" "gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" +${WGRIB2} -s "gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" >"gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2.idx" + +if [[ "${hazard_timewindow}" == "YES" ]]; then + #--------------------------- + # Product 2: For AWC and Delta airline: EDPARM CAT MWT ICESEV CB wafs.tHHz.awf.0p25.fFFF.grib2 + #--------------------------- criteria1=":EDPARM:|:ICESEV:|parm=37:" criteria2=":CATEDR:|:MWTURB:" criteria3=":CBHE:|:ICAHT:" - $WGRIB2 tmp_wafs_0p25.grb2 | egrep "${criteria1}|$criteria2|$criteria3" \ - | $WGRIB2 -i tmp_wafs_0p25.grb2 -grib ${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2 - $WGRIB2 -s ${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2 > ${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2.idx + ${WGRIB2} tmp_wafs_0p25.grb2 | grep -E "${criteria1}|$criteria2|$criteria3" | + ${WGRIB2} -i tmp_wafs_0p25.grb2 -grib "${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2" + ${WGRIB2} -s "${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2" >"${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2.idx" -#--------------------------- -# Product 3: WAFS unblended EDPARM, ICESEV, CB (No CAT MWT) wafs.tHHz.unblended.0p25.fFFF.grib2 -#--------------------------- - $WGRIB2 tmp_wafs_0p25.grb2 | grep -F -f $FIXwafs/grib2_0p25_wafs_hazard.list \ - | $WGRIB2 -i tmp_wafs_0p25.grb2 -set master_table 25 -grib tmp_wafs_0p25.grb2.forblend + #--------------------------- + # Product 3: WAFS unblended EDPARM, ICESEV, CB (No CAT MWT) wafs.tHHz.unblended.0p25.fFFF.grib2 + #--------------------------- + ${WGRIB2} tmp_wafs_0p25.grb2 | grep -F -f "${FIXwafs}/grib2_0p25_wafs_hazard.list" | + ${WGRIB2} -i tmp_wafs_0p25.grb2 -set master_table 25 -grib tmp_wafs_0p25.grb2.forblend # Convert template 5 to 5.40 - #$WGRIB2 tmp_wafs_0p25.grb2.forblend -set_grib_type jpeg -grib_out WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 - mv tmp_wafs_0p25.grb2.forblend WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 - $WGRIB2 -s WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 > WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2.idx + #${WGRIB2} tmp_wafs_0p25.grb2.forblend -set_grib_type jpeg -grib_out "WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" + mv tmp_wafs_0p25.grb2.forblend "WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" + ${WGRIB2} -s "WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2" >"WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2.idx" fi -if [ $SENDCOM = "YES" ] ; then +# Send data to COM +if [[ "${SENDCOM}" == "YES" ]]; then - ############################## - # Post Files to COM - ############################## + cpfs "gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" "${COMOUT}/gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" + cpfs "gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2.idx" "${COMOUT}/gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2.idx" - cpfs gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 $COMOUT/gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 - cpfs gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2.idx $COMOUT/gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2.idx + if [[ "${hazard_timewindow}" == "YES" ]]; then + cpfs "${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2" "${COMOUT}/${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2" + cpfs "${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2.idx" "${COMOUT}/${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2.idx" - if [ $hazard_timewindow = 'yes' ] ; then - cpfs ${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2 $COMOUT/${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2 - cpfs ${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2.idx $COMOUT/${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2.idx - - cpfs WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 $COMOUT/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 - cpfs WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2.idx $COMOUT/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2.idx - fi + cpfs "WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" "${COMOUT}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" + cpfs "WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2.idx" "${COMOUT}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2.idx" + fi fi -if [ $SENDDBN = "YES" ] ; then - ###################### - # Distribute Data - ###################### +# Alert via DBN +if [[ "${SENDDBN}" == "YES" ]]; then - if [ $hazard_timewindow = 'yes' ] ; then - # Hazard WAFS data (ICESEV EDR CAT MWT on 100mb to 1000mb or on new ICAO levels) sent to AWC and to NOMADS for US stakeholders - $DBNROOT/bin/dbn_alert MODEL WAFS_AWF.0P25_GB2 $job $COMOUT/${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2 + if [[ "${hazard_timewindow}" == "YES" ]]; then + # Hazard WAFS data (ICESEV EDR CAT MWT on 100mb to 1000mb or on new ICAO levels) sent to AWC and to NOMADS for US stakeholders + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_AWF.0P25_GB2 "${job}" "${COMOUT}/${RUN}.t${cyc}z.awf.0p25.f${fhr}.grib2" - # Unblended US WAFS data sent to UK for blending, to the same server as 1.25 deg unblended data: wmo/grib2.tCCz.wafs_grb_wifsfFF.45 - $DBNROOT/bin/dbn_alert MODEL WAFS_0P25_UBL_GB2 $job $COMOUT/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 + # Unblended US WAFS data sent to UK for blending, to the same server as 1.25 deg unblended data: wmo/grib2.tCCz.wafs_grb_wifsfFF.45 + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_0P25_UBL_GB2 "${job}" "${COMOUT}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" fi # WAFS U/V/T/RH data sent to the same server as the unblended data as above - $DBNROOT/bin/dbn_alert MODEL WAFS_0P25_GB2 $job $COMOUT/gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2 + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_0P25_GB2 "${job}" "${COMOUT}/gfs.t${cyc}z.wafs_0p25.f${fhr}.grib2" fi - -################################################################################ -# GOOD RUN -set +x -echo "**************JOB EXWAFS_GRIB2_0P25.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GRIB2_0P25.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GRIB2_0P25.SH COMPLETED NORMALLY ON THE IBM" -set -x -################################################################################ - -echo "HAS COMPLETED NORMALLY!" - -exit 0 - -############## END OF SCRIPT ####################### diff --git a/scripts/exwafs_grib2_0p25_blending.sh b/scripts/exwafs_grib2_0p25_blending.sh index 0ec6dbf..e9460bc 100755 --- a/scripts/exwafs_grib2_0p25_blending.sh +++ b/scripts/exwafs_grib2_0p25_blending.sh @@ -10,280 +10,224 @@ # # Author: Y Mao Org: EMC Date: 2020-04-02 # -# # Script history log: # 2020-04-02 Y Mao # Oct 2021 - Remove jlogfile # 2022-05-25 | Y Mao | Add ICAO new milestone Nov 2023 # May 2024 - WAFS separation +################################################################################ set -x -echo "JOB $job HAS BEGUN" -export SEND_AWC_US_ALERT=NO -export SEND_AWC_UK_ALERT=NO -export SEND_US_WAFS=NO -export SEND_UK_WAFS=NO -YYYY=`echo $PDY | cut -c1-4` -MM=`echo $PDY | cut -c5-6` -DD=`echo $PDY | cut -c7-8` +############################################### +# Specify Timeout Behavior for WAFS blending +############################################### +# SLEEP_TIME - Amount of time (secs) to wait for a input file before exiting +# SLEEP_INT - Amount of time (secs) to wait between checking for input files +SLEEP_TIME=${SLEEP_TIME:-1200} +SLEEP_INT=${SLEEP_INT:-10} -cd $DATA -export SLEEP_LOOP_MAX=`expr $SLEEP_TIME / $SLEEP_INT` +SLEEP_LOOP_MAX=$((SLEEP_TIME / SLEEP_INT)) -echo "start blending US and UK WAFS products at 1/4 degree for " $cyc " z cycle" +cd "${DATA}" || err_exit "FATAL ERROR: Could not 'cd ${DATA}'; ABORT!" -export ic_uk=1 - -fhr="$(printf "%03d" $(( 10#$fhr )) )" ########################## # look for US WAFS data ########################## - -export ic=1 -while [ $ic -le $SLEEP_LOOP_MAX ] -do - if [ -s $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 ] ; then +SEND_US_WAFS="NO" +for ((ic = 1; ic <= SLEEP_LOOP_MAX; ic++)); do + if [[ -s "${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" ]]; then + echo "Found US WAFS GRIB2 file '${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2', continue ..." break fi - if [ $ic -eq $SLEEP_LOOP_MAX ] ; then - echo "US WAFS GRIB2 file $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 not found after waiting over $SLEEP_TIME seconds" - echo "US WAFS GRIB2 file " $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 "not found after waiting ",$SLEEP_TIME, "exitting" - SEND_UK_WAFS=YES - break + if ((ic == SLEEP_LOOP_MAX)); then + echo "WARNING: US WAFS GRIB2 file '${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2' not found after waiting over ${SLEEP_TIME} seconds, exiting" + SEND_UK_WAFS="YES" + break else - ic=`expr $ic + 1` - sleep $SLEEP_INT + sleep "${SLEEP_INT}" fi done ########################## # look for UK WAFS data. ########################## - -SLEEP_LOOP_MAX_UK=$SLEEP_LOOP_MAX - -# export ic=1 -while [ $ic_uk -le $SLEEP_LOOP_MAX_UK ] -do +SEND_UK_WAFS="NO" +for ((ic = 1; ic <= SLEEP_LOOP_MAX; ic++)); do # Three(3) unblended UK files for each cycle+fhour: icing, turb, cb - #ukfiles=`ls $COMINuk/EGRR_WAFS_0p25_*_unblended_${PDY}_${cyc}z_t${fhr2}.grib2 | wc -l` - ukfiles=`ls $COMINuk/egrr_wafshzds_unblended_*_0p25_${YYYY}-${MM}-${DD}T${cyc}:00Z_t$fhr.grib2 | wc -l` - if [ $ukfiles -ge 3 ] ; then + ukfiles=$(find "${COMINuk}" -name "egrr_wafshzds_unblended_*_0p25_${PDY:0:4}-${PDY:4:2}-${PDY:6:2}T${cyc}:00Z_t${fhr}.grib2" | wc -l) + if ((ukfiles >= 3)); then + echo "Found all 3 UK WAFS GRIB2 files, continue ..." break fi - if [ $ic_uk -eq $SLEEP_LOOP_MAX_UK ] ; then - echo "UK WAFS GRIB2 unblended data is not completed" - products="cb ice turb" - for prod in $products ; do - ukfile=egrr_wafshzds_unblended_${prod}_0p25_${YYYY}-${MM}-${DD}T${cyc}:00Z_t$fhr.grib2 - if [ ! -f $COMINuk/$ukfile ] ; then - echo $ukfile >> missing_uk_files - fi - done - export SEND_US_WAFS=YES - break + if ((ic == SLEEP_LOOP_MAX)); then + products="cb ice turb" + for prod in ${products}; do + ukfile="egrr_wafshzds_unblended_${prod}_0p25_${PDY:0:4}-${PDY:4:2}-${PDY:6:2}T${cyc}:00Z_t${fhr}.grib2" + if [[ ! -f "${COMINuk}/${ukfile}" ]]; then + echo "WARNING: UK WAFS GRIB2 file '${ukfile}' not found after waiting over ${SLEEP_TIME} seconds" + echo "${ukfile}" >>missing_uk_files + fi + done + echo "WARNING: UK WAFS GRIB2 unblended data is not completely available, exiting" + SEND_US_WAFS="YES" + break else - ic_uk=`expr $ic_uk + 1` - sleep $SLEEP_INT + sleep "${SLEEP_INT}" fi done ########################## # If both UK and US data are missing. ########################## - -if [ $SEND_UK_WAFS = 'YES' -a $SEND_US_WAFS = 'YES' ] ; then +if [[ "${SEND_US_WAFS}" == "YES" ]] && [[ "${SEND_UK_WAFS}" == "YES" ]]; then SEND_US_WAFS=NO SEND_UK_WAFS=NO - echo "BOTH UK and US data are missing, no blended for $PDY$cyc$fhr" - export err=1; err_chk - exit 1 + export err=1 + err_exit "FATAL ERROR: Both US and UK data are missing, no blended products for '${PDY}${cyc}f${fhr}'" fi - + ########################## # Blending or unblended ########################## -if [ $SEND_US_WAFS = 'YES' ] ; then +if [[ "${SEND_US_WAFS}" == "YES" ]]; then echo "turning back on dbn alert for unblended US WAFS product" -elif [ $SEND_UK_WAFS = 'YES' ] ; then +elif [[ "${SEND_UK_WAFS}" == "YES" ]]; then echo "turning back on dbn alert for unblended UK WAFS product" # retrieve UK products # Three(3) unblended UK files for each cycle+fhour: icing, turb, cb - cat $COMINuk/egrr_wafshzds_unblended_*_0p25_${YYYY}-${MM}-${DD}T${cyc}:00Z_t$fhr.grib2 > EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2 -else # elif [ $SEND_US_WAFS = "NO" -a $SEND_UK_WAFS = "NO" ] ; then + cat "${COMINuk}/egrr_wafshzds_unblended_"*"_0p25_${PDY:0:4}-${PDY:4:2}-${PDY:6:2}T${cyc}:00Z_t${fhr}.grib2" >"EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2" +else # retrieve UK products # Three(3) unblended UK files for each cycle+fhour: icing, turb, cb - cat $COMINuk/egrr_wafshzds_unblended_*_0p25_${YYYY}-${MM}-${DD}T${cyc}:00Z_t$fhr.grib2 > EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2 - + cat "${COMINuk}/egrr_wafshzds_unblended_"*"_0p25_${PDY:0:4}-${PDY:4:2}-${PDY:6:2}T${cyc}:00Z_t${fhr}.grib2" >"EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2" + # pick up US data - cp $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 . + cpreq "${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" . + + # copy the blending executable + cpreq "${EXECwafs}/wafs_blending_0p25.x" . # run blending code - export pgm=wafs_blending_0p25.x - . prep_step + export pgm="wafs_blending_0p25.x" - startmsg - $EXECwafs/$pgm WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 \ - EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2 \ - 0p25_blended_${PDY}${cyc}f${fhr}.grib2 > f${fhr}.out + . prep_step - err1=$? - if test "$err1" -ne 0 - then - echo "WAFS blending 0p25 program failed at " ${PDY}${cyc}F${fhr} " turning back on dbn alert for unblended US WAFS product" - SEND_US_WAFS=YES + ${pgm} "WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" \ + "EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2" \ + "0p25_blended_${PDY}${cyc}f${fhr}.grib2 >f${fhr}.out" + export err=$? + if ((err != 0)); then + echo "WARNING: WAFS blending 0p25 program failed at '${PDY}${cyc}f${fhr}'. Turning back on dbn alert for unblended US WAFS product" + SEND_US_WAFS="YES" fi fi ########################## -# Date dissemination +# Data dissemination ########################## -if [ $SEND_US_WAFS = "YES" ] ; then +SEND_AWC_US_ALERT="NO" +SEND_AWC_UK_ALERT="NO" + +# Set up mailing list +if [[ "${envir}" != "prod" ]]; then + maillist="nco.spa@noaa.gov" +fi +maillist=${maillist:-"nco.spa@noaa.gov,ncep.sos@noaa.gov"} + +if [[ "${SEND_US_WAFS}" == "YES" ]]; then - ############################################################################################## - # # checking any US WAFS product was sent due to No UK WAFS GRIB2 file or WAFS blending program - # (Alert once for all forecast hours) - # - if [ $SEND_AWC_US_ALERT = "NO" ] ; then - echo "WARNING! Missing UK data for WAFS GRIB2 0P25 blending. Send alert message to AWC ......" - make_NTC_file.pl NOXX10 KKCI $PDY$cyc NONE $FIXwafs/wafs_blending_0p25_admin_msg $PCOM/wifs_0p25_admin_msg - make_NTC_file.pl NOXX10 KWBC $PDY$cyc NONE $FIXwafs/wafs_blending_0p25_admin_msg $PCOM/iscs_0p25_admin_msg - if [ $SENDDBN_NTC = "YES" ] ; then - $DBNROOT/bin/dbn_alert NTC_LOW WAFS $job $PCOM/wifs_0p25_admin_msg - $DBNROOT/bin/dbn_alert NTC_LOW WAFS $job $PCOM/iscs_0p25_admin_msg - fi - - if [ $envir != prod ]; then - export maillist='nco.spa@noaa.gov' + # (Alert once for each forecast hour) + if [[ "${SEND_AWC_US_ALERT}" == "NO" ]]; then + echo "WARNING: Missing UK data for WAFS GRIB2 0P25 blending. Send alert message to AWC ......" + make_NTC_file.pl NOXX10 KKCI "${PDY}${cyc}" NONE "${FIXwafs}/wafs_blending_0p25_admin_msg" "${COMOUTwmo}/wifs_0p25_admin_msg" + make_NTC_file.pl NOXX10 KWBC "${PDY}${cyc}" NONE "${FIXwafs}/wafs_blending_0p25_admin_msg" "${COMOUTwmo}/iscs_0p25_admin_msg" + if [[ "${SENDDBN_NTC}" == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" NTC_LOW WAFS "${job}" "${COMOUTwmo}/wifs_0p25_admin_msg" + "${DBNROOT}/bin/dbn_alert" NTC_LOW WAFS "${job}" "${COMOUTwmo}/iscs_0p25_admin_msg" fi - export maillist=${maillist:-'nco.spa@noaa.gov,ncep.sos@noaa.gov'} - export subject="WARNING! Missing UK data for WAFS GRIB2 0P25 blending, $PDY t${cyc}z f$fhr $job" - echo "*************************************************************" > mailmsg - echo "*** WARNING! Missing UK data for WAFS GRIB2 0P25 blending ***" >> mailmsg - echo "*************************************************************" >> mailmsg - echo "Missing data at $COMINuk:" >> mailmsg - cat missing_uk_files >> mailmsg - echo >> mailmsg - echo "Send alert message to AWC ...... " >> mailmsg - echo >> mailmsg - cat mailmsg > $COMOUT/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_usonly.emailbody - cat $COMOUT/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_usonly.emailbody | mail.py -s "$subject" $maillist -v - - export SEND_AWC_US_ALERT=YES - fi - ############################################################################################## - # - # Distribute US WAFS unblend Data to NCEP FTP Server (WOC) and TOC - # - echo "altering the unblended US WAFS products - $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 " - echo "and $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2.idx " - - if [ $SENDDBN = "YES" ] ; then - $DBNROOT/bin/dbn_alert MODEL WAFS_0P25_UBL_GB2 $job $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 - $DBNROOT/bin/dbn_alert MODEL WAFS_0P25_UBL_GB2_WIDX $job $COMINus/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2.idx + + subject="WARNING! Missing UK data for WAFS GRIB2 0P25 blending, ${PDY} t${cyc}z f${fhr} ${job}" + echo "*************************************************************" >mailmsg + echo "*** WARNING! Missing UK data for WAFS GRIB2 0P25 blending ***" >>mailmsg + echo "*************************************************************" >>mailmsg + echo "Missing data at ${COMINuk}:" >>mailmsg + cat missing_uk_files >>mailmsg + echo >>mailmsg + echo "Send alert message to AWC ...... " >>mailmsg + echo >>mailmsg + cat mailmsg >"${COMOUT}/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_usonly.emailbody" + cat "${COMOUT}/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_usonly.emailbody" | mail.py -s "${subject}" "${maillist}" -v + + SEND_AWC_US_ALERT="YES" fi -# if [ $SENDDBN_NTC = "YES" ] ; then -# $DBNROOT/bin/dbn_alert NTC_LOW $NET $job $COMOUT/WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 -# fi + # Distribute US WAFS unblend Data to NCEP FTP Server (WOC) and TOC + echo "altering the unblended US WAFS products:" + echo " - ${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" + echo " - ${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2.idx" + + if [[ "${SENDDBN}" == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_0P25_UBL_GB2 "${job}" "${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_0P25_UBL_GB2_WIDX "${job}" "${COMINus}/WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2.idx" + fi + SEND_US_WAFS="NO" - export SEND_US_WAFS=NO +elif [[ "${SEND_UK_WAFS}" == "YES" ]]; then -elif [ $SEND_UK_WAFS = "YES" ] ; then - ############################################################################################## - # # checking any UK WAFS product was sent due to No US WAFS GRIB2 file - # (Alert once for all forecast hours) - # - if [ $SEND_AWC_UK_ALERT = "NO" ] ; then - echo "WARNING: Missing US data for WAFS GRIB2 0P25 blending. Send alert message to AWC ......" - make_NTC_file.pl NOXX10 KKCI $PDY$cyc NONE $FIXwafs/wafs_blending_0p25_admin_msg $PCOM/wifs_0p25_admin_msg - make_NTC_file.pl NOXX10 KWBC $PDY$cyc NONE $FIXwafs/wafs_blending_0p25_admin_msg $PCOM/iscs_0p25_admin_msg - if [ $SENDDBN_NTC = "YES" ] ; then - $DBNROOT/bin/dbn_alert NTC_LOW WAFS $job $PCOM/wifs_0p25_admin_msg - $DBNROOT/bin/dbn_alert NTC_LOW WAFS $job $PCOM/iscs_0p25_admin_msg - fi - - if [ $envir != prod ]; then - export maillist='nco.spa@noaa.gov' + # (Alert once for each forecast hour) + if [[ "${SEND_AWC_UK_ALERT}" == "NO" ]]; then + echo "WARNING: Missing US data for WAFS GRIB2 0P25 blending. Send alert message to AWC ......" + make_NTC_file.pl NOXX10 KKCI "${PDY}${cyc}" NONE "${FIXwafs}/wafs_blending_0p25_admin_msg" "${COMOUTwmo}/wifs_0p25_admin_msg" + make_NTC_file.pl NOXX10 KWBC "${PDY}${cyc}" NONE "${FIXwafs}/wafs_blending_0p25_admin_msg" "${COMOUTwmo}/iscs_0p25_admin_msg" + if [[ "${SENDDBN_NTC}" == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" NTC_LOW WAFS "${job}" "${COMOUTwmo}/wifs_0p25_admin_msg" + "${DBNROOT}/bin/dbn_alert" NTC_LOW WAFS "${job}" "${COMOUTwmo}/iscs_0p25_admin_msg" fi - export maillist=${maillist:-'nco.spa@noaa.gov,ncep.sos@noaa.gov'} - export subject="WARNING! Missing US data for WAFS GRIB2 0P25 blending, $PDY t${cyc}z $fhr $job" - echo "*************************************************************" > mailmsg - echo "*** WARNING! Missing US data for WAFS GRIB2 0P25 blending ***" >> mailmsg - echo "*************************************************************" >> mailmsg - echo "Missing data at $COMINus:" >> mailmsg - echo WAFS_0p25_unblended_$PDY${cyc}f${fhr}.grib2 >> mailmsg - echo >> mailmsg - echo "Send alert message to AWC ...... " >> mailmsg - echo >> mailmsg - cat mailmsg > $COMOUT/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_ukonly.emailbody - cat $COMOUT/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_ukonly.emailbody | mail.py -s "$subject" $maillist -v - - export SEND_AWC_UK_ALERT=YES + + export subject="WARNING! Missing US data for WAFS GRIB2 0P25 blending, ${PDY} t${cyc}z ${fhr} ${job}" + echo "*************************************************************" >mailmsg + echo "*** WARNING! Missing US data for WAFS GRIB2 0P25 blending ***" >>mailmsg + echo "*************************************************************" >>mailmsg + echo "Missing data at ${COMINus}:" >>mailmsg + echo "WAFS_0p25_unblended_${PDY}${cyc}f${fhr}.grib2" >>mailmsg + echo >>mailmsg + echo "Send alert message to AWC ...... " >>mailmsg + echo >>mailmsg + cat mailmsg >"${COMOUT}/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_ukonly.emailbody" + cat "${COMOUT}/${RUN}.t${cyc}z.f${fhr}.wafs_blend_0p25_ukonly.emailbody" | mail.py -s "${subject}" "${maillist}" -v + + SEND_AWC_UK_ALERT="YES" fi - ############################################################################################## - # # Distribute UK WAFS unblend Data to NCEP FTP Server (WOC) and TOC - # echo "altering the unblended UK WAFS products - EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2" - if [ $SENDDBN = "YES" ] ; then - $DBNROOT/bin/dbn_alert MODEL WAFS_UKMET_0P25_UBL_GB2 $job EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2 + if [[ "${SENDDBN}" == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_UKMET_0P25_UBL_GB2 "${job}" "EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2" fi -# if [ $SENDDBN_NTC = "YES" ] ; then -# $DBNROOT/bin/dbn_alert NTC_LOW $NET $job EGRR_WAFS_0p25_unblended_${PDY}_${cyc}z_t${fhr}.grib2 -# fi - export SEND_UK_WAFS=NO - + SEND_UK_WAFS="NO" else - ############################################################################################## - # - # TOCGRIB2 Processing WAFS Blending GRIB2 (Icing, CB, GTG) - - # As in August 2020, no WMO header is needed for WAFS data at 1/4 deg - ## . prep_step - ## export pgm=$TOCGRIB2 - ## startmsg - - ## export FORT11=0p25_blended_${PDY}${cyc}f${fhr}.grib2 - ## export FORT31=" " - ## export FORT51=grib2.t${cyc}z.WAFS_0p25_blended_f${fhr} - - ## $TOCGRIB2 < $FIXwafs/grib2_blended_wafs_wifs_f${fhr}.0p25 >> $pgmout 2> errfile - - ## err=$?;export err ;err_chk - ## echo " error from tocgrib=",$err - - ############################################################################################## - # - # Distribute US WAFS unblend Data to NCEP FTP Server (WOC) and TOC - # - if [ $SENDCOM = YES ]; then - cpfs 0p25_blended_${PDY}${cyc}f${fhr}.grib2 $COMOUT/WAFS_0p25_blended_$PDY${cyc}f$fhr.grib2 - ## cp grib2.t${cyc}z.WAFS_0p25_blended_f${fhr} $PCOM/grib2.t${cyc}z.WAFS_0p25_blended_f${fhr} + # Distribute US WAFS unblend Data to NCEP FTP Server (WOC) and TOC + if [[ "${SENDCOM}" == "YES" ]]; then + cpfs "0p25_blended_${PDY}${cyc}f${fhr}.grib2" "${COMOUT}/WAFS_0p25_blended_${PDY}${cyc}f${fhr}.grib2" + #cpfs "grib2.t${cyc}z.WAFS_0p25_blended_f${fhr}" "${COMOUTwmo}/grib2.t${cyc}z.WAFS_0p25_blended_f${fhr}" fi - if [ $SENDDBN_NTC = "YES" ] ; then - # Distribute Data to NCEP FTP Server (WOC) and TOC - echo "No WMO header yet" - ## $DBNROOT/bin/dbn_alert NTC_LOW $NET $job $PCOM/grib2.t${cyc}z.WAFS_0p25_blended_f${fhr} + if [[ "${SENDDBN_NTC}" == "YES" ]]; then + # Distribute Data to NCEP FTP Server (WOC) and TOC + echo "No WMO header yet" + #"${DBNROOT}/bin/dbn_alert" NTC_LOW $NET "${job}" "${COMOUTwmo}/grib2.t${cyc}z.WAFS_0p25_blended_f${fhr}" fi - if [ $SENDDBN = "YES" ] ; then - $DBNROOT/bin/dbn_alert MODEL WAFS_0P25_BL_GB2 $job $COMOUT/WAFS_0p25_blended_$PDY${cyc}f$fhr.grib2 - fi + if [[ "${SENDDBN}" == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_0P25_BL_GB2 "${job}" "${COMOUT}/WAFS_0p25_blended_${PDY}${cyc}f${fhr}.grib2" + fi fi - -################################################################################ - -exit 0 -# diff --git a/scripts/exwafs_grib2_1p25.sh b/scripts/exwafs_grib2_1p25.sh index 2382134..8902b89 100755 --- a/scripts/exwafs_grib2_1p25.sh +++ b/scripts/exwafs_grib2_1p25.sh @@ -4,12 +4,12 @@ # UTILITY SCRIPT NAME : exwafs_grib2.sh # DATE WRITTEN : 07/15/2009 # -# Abstract: This utility script produces the WAFS GRIB2. The output +# Abstract: This utility script produces the WAFS GRIB2. The output # GRIB files are posted on NCEP ftp server and the grib2 files -# are pushed via dbnet to TOC to WAFS (ICSC). +# are pushed via dbnet to TOC to WAFS (ICSC). # This is a joint project of WAFC London and WAFC Washington. # -# We are processing WAFS grib2 for fhr from 06 - 36 +# We are processing WAFS grib2 for fhr from 06 - 36 # with 3-hour time increment. # # History: 08/20/2014 @@ -22,190 +22,144 @@ # - Add grib2 data requested by FAA # - Stop generating grib1 data for WAFS ##################################################################### -echo "-----------------------------------------------------" -echo "JWAFS_GRIB2 at 00Z/06Z/12Z/18Z GFS&WAFS postprocessing" -echo "-----------------------------------------------------" -echo "History: AUGUST 2009 - First implementation of this new script." -echo "Oct 2021 - Remove jlogfile" -echo "Feb 2022 - Add FAA data, stop grib1 data" -echo "May 2024 - WAFS separation" -echo " " -##################################################################### - -set -x -fhr=$1 -export fhr="$(printf "%03d" $(( 10#$fhr )) )" - -DATA=$DATA/$fhr -mkdir -p $DATA -cd $DATA - -########################################################## -# Wait for the availability of the gfs master pgrib file -########################################################## -# file name and forecast hour of GFS model data in Grib2 are 3 digits - -# 2D data -master2=$COMINgfs/gfs.${cycle}.master.grb2f${fhr} -master2i=$COMINgfs/gfs.${cycle}.master.grb2if${fhr} -# 3D data -wafs2=$COMIN/${RUN}.${cycle}.master.f$fhr.grib2 -wafs2i=$COMIN/${RUN}.${cycle}.master.f$fhr.grib2.idx - -######################################## -echo "HAS BEGUN!" -######################################## - -echo " ------------------------------------------" -echo " BEGIN MAKING GFS WAFS GRIB2 PRODUCTS" -echo " ------------------------------------------" - -set +x -echo " " -echo "#####################################" -echo " Process GRIB WAFS PRODUCTS " -echo " FORECAST HOURS 06 - 36." -echo "#####################################" -echo " " set -x +GFS_MASTER="${COMINgfs}/gfs.t${cyc}z.master.grb2f${fhr}" +WAFS_MASTER="${COMIN}/${RUN}.t${cyc}z.master.f${fhr}.grib2" -if [ $fhr -le 36 -a $fhr -gt 0 ] ; then - wafs_timewindow=yes +ifhr="$((10#${fhr}))" +if ((ifhr > 0 && ifhr <= 36)); then + wafs_timewindow="YES" else - wafs_timewindow=no + wafs_timewindow="NO" fi +cd "${DATA}" || err_exit "FATAL ERROR: Could not 'cd ${DATA}'; ABORT!" + #--------------------------- # 1) Grib2 data for FAA #--------------------------- -$WGRIB2 $master2 | grep -F -f $FIXwafs/grib2_gfs_awf_master.list | $WGRIB2 -i $master2 -grib tmpfile_wafsf${fhr} +cpreq "${GFS_MASTER}" ./gfs_master.grib2 +${WGRIB2} "./gfs_master.grib2" | grep -F -f "${FIXwafs}/grib2_gfs_awf_master.list" | ${WGRIB2} -i "./gfs_master.grib2" -grib "tmpfile_wafsf${fhr}" + # F006 master file has two records of 0-6 hour APCP and ACPCP each, keep only one -# FAA APCP ACPCP: included every 6 forecast hour (0, 48], every 12 forest hour [48, 72] (controlled by $FIXwafs/grib2_gfs_awf_master.list) -if [ $fhr -eq 6 ] ; then - $WGRIB2 tmpfile_wafsf${fhr} -not "(APCP|ACPCP)" -grib tmp.grb2 - $WGRIB2 tmpfile_wafsf${fhr} -match APCP -append -grib tmp.grb2 -quit - $WGRIB2 tmpfile_wafsf${fhr} -match ACPCP -append -grib tmp.grb2 -quit - mv tmp.grb2 tmpfile_wafsf${fhr} +# FAA APCP ACPCP: included every 6 forecast hour (0, 48], every 12 forest hour [48, 72] (controlled by ${FIXwafs}/grib2_gfs_awf_master.list) +if ((ifhr == 6)); then + ${WGRIB2} "tmpfile_wafsf${fhr}" -not "(APCP|ACPCP)" -grib tmp.grb2 + ${WGRIB2} "tmpfile_wafsf${fhr}" -match APCP -append -grib tmp.grb2 -quit + ${WGRIB2} "tmpfile_wafsf${fhr}" -match ACPCP -append -grib tmp.grb2 -quit + mv tmp.grb2 "tmpfile_wafsf${fhr}" fi + # U V will have the same grid message number by using -ncep_uv. # U V will have the different grid message number without -ncep_uv. -$WGRIB2 tmpfile_wafsf${fhr} \ - -set master_table 6 \ - -new_grid_winds earth -set_grib_type jpeg \ - -new_grid_interpolation bilinear -if ":(UGRD|VGRD):max wind" -new_grid_interpolation neighbor -fi \ - -new_grid latlon 0:288:1.25 90:145:-1.25 ${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2 -$WGRIB2 -s ${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2 > ${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2.idx +${WGRIB2} "tmpfile_wafsf${fhr}" \ + -set master_table 6 \ + -new_grid_winds earth -set_grib_type jpeg \ + -new_grid_interpolation bilinear -if ":(UGRD|VGRD):max wind" -new_grid_interpolation neighbor -fi \ + -new_grid latlon 0:288:1.25 90:145:-1.25 "${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2" +${WGRIB2} -s "${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2" >"${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2.idx" -# For FAA, add WMO header. The header is different from WAFS -export pgm=$TOCGRIB2 +# WMO header (This header is different from WAFS) +cpreq "${FIXwafs}/grib2_gfs_awff${fhr}.45" gfs_wmo_header45 + +export pgm="${TOCGRIB2}" + +# Clean out any existing output files . prep_step -startmsg -export FORT11=${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2 + +export FORT11="${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2" export FORT31=" " -export FORT51=grib2.wafs.t${cyc}z.awf_grid45.f${fhr} -$TOCGRIB2 < $FIXwafs/grib2_gfs_awff${fhr}.45 >> $pgmout 2> errfile -err=$?;export err ;err_chk -echo " error from tocgrib=",$err +export FORT51="grib2.wafs.t${cyc}z.awf_grid45.f${fhr}" -if [ $wafs_timewindow = 'yes' ] ; then -#--------------------------- -# 2) traditional WAFS fields -#--------------------------- - # 3D data from $wafs2, on exact model pressure levels - $WGRIB2 $wafs2 | grep -F -f $FIXwafs/grib2_wafs.gfs_master.list | $WGRIB2 -i $wafs2 -grib tmpfile_wafsf${fhr} - # 2D data from $master2 - tail -5 $FIXwafs/grib2_wafs.gfs_master.list > grib2_wafs.gfs_master.list.2D - $WGRIB2 $master2 | grep -F -f grib2_wafs.gfs_master.list.2D | $WGRIB2 -i $master2 -grib tmpfile_wafsf${fhr}.2D +# For FAA, add WMO header. The header is different from WAFS +${pgm} >"${pgmout}" 2>errfile +export err=$? +err_chk + +# Check if TOCGRIB2 succeeded in creating the output file +if [[ ! -f "${FORT51}" ]]; then + err_exit "FATAL ERROR: '${pgm}' failed to create '${FORT51}', ABORT!" +fi + +if [[ "${wafs_timewindow}" == "YES" ]]; then + #--------------------------- + # 2) traditional WAFS fields + #--------------------------- + # 3D data from "./wafs_master.grib2", on exact model pressure levels + cpreq "${WAFS_MASTER}" ./wafs_master.grib2 + ${WGRIB2} "./wafs_master.grib2" | grep -F -f "${FIXwafs}/grib2_wafs.gfs_master.list" | ${WGRIB2} -i "./wafs_master.grib2" -grib "tmpfile_wafsf${fhr}" + # 2D data from "./gfs_master.grib2" + tail -5 "${FIXwafs}/grib2_wafs.gfs_master.list" >grib2_wafs.gfs_master.list.2D + ${WGRIB2} "./gfs_master.grib2" | grep -F -f grib2_wafs.gfs_master.list.2D | ${WGRIB2} -i "./gfs_master.grib2" -grib "tmpfile_wafsf${fhr}.2D" # Complete list of WAFS data - cat tmpfile_wafsf${fhr}.2D >> tmpfile_wafsf${fhr} - # WMO header - cp $FIXwafs/grib2_wafsf${fhr}.45 wafs_wmo_header45 + cat tmpfile_wafsf${fhr}.2D >>tmpfile_wafsf${fhr} + # U V will have the same grid message number by using -ncep_uv. # U V will have the different grid message number without -ncep_uv. - $WGRIB2 tmpfile_wafsf${fhr} \ - -set master_table 6 \ - -new_grid_winds earth -set_grib_type jpeg \ - -new_grid_interpolation bilinear -if ":(UGRD|VGRD):max wind" -new_grid_interpolation neighbor -fi \ - -new_grid latlon 0:288:1.25 90:145:-1.25 gfs.t${cyc}z.wafs_grb45f${fhr}.grib2 - $WGRIB2 -s gfs.t${cyc}z.wafs_grb45f${fhr}.grib2 > gfs.t${cyc}z.wafs_grb45f${fhr}.grib2.idx + ${WGRIB2} "tmpfile_wafsf${fhr}" \ + -set master_table 6 \ + -new_grid_winds earth -set_grib_type jpeg \ + -new_grid_interpolation bilinear -if ":(UGRD|VGRD):max wind" -new_grid_interpolation neighbor -fi \ + -new_grid latlon 0:288:1.25 90:145:-1.25 "gfs.t${cyc}z.wafs_grb45f${fhr}.grib2" + ${WGRIB2} -s "gfs.t${cyc}z.wafs_grb45f${fhr}.grib2" >"gfs.t${cyc}z.wafs_grb45f${fhr}.grib2.idx" - # For WAFS, add WMO header. Processing WAFS GRIB2 grid 45 for ISCS and WIFS - export pgm=$TOCGRIB2 + export pgm="${TOCGRIB2}" + + # WMO header + cpreq "${FIXwafs}/grib2_wafsf${fhr}.45" wafs_wmo_header45 + + # Clean out any existing output files . prep_step - startmsg - export FORT11=gfs.t${cyc}z.wafs_grb45f${fhr}.grib2 + + export FORT11="gfs.t${cyc}z.wafs_grb45f${fhr}.grib2" export FORT31=" " - export FORT51=grib2.wafs.t${cyc}z.grid45.f${fhr} - $TOCGRIB2 < wafs_wmo_header45 >> $pgmout 2> errfile - err=$?;export err ;err_chk - echo " error from tocgrib=",$err + export FORT51="grib2.wafs.t${cyc}z.grid45.f${fhr}" -fi # wafs_timewindow + # For WAFS, add WMO header. Processing WAFS GRIB2 grid 45 for ISCS and WIFS + ${pgm} >"${pgmout}" 2>errfile + export err=$? + err_chk -if [ $SENDCOM = "YES" ] ; then + # Check if TOCGRIB2 succeeded in creating the output file + if [[ ! -f "${FORT51}" ]]; then + err_exit "FATAL ERROR: '${pgm}' failed to create '${FORT51}', ABORT!" + fi + +fi # wafs_timewindow - ############################## - # Post Files to COM - ############################## +# Send data to COM +if [[ "${SENDCOM}" == "YES" ]]; then # FAA data - cpfs ${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2 $COMOUT/${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2 - cpfs ${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2.idx $COMOUT/${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2.idx + cpfs "${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2" "${COMOUT}/${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2" + cpfs "${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2.idx" "${COMOUT}/${RUN}.t${cyc}z.awf_grid45.f${fhr}.grib2.idx" # WAFS data - if [ $wafs_timewindow = 'yes' ] ; then - cpfs gfs.t${cyc}z.wafs_grb45f${fhr}.grib2 $COMOUT/gfs.t${cyc}z.wafs_grb45f${fhr}.grib2 - cpfs gfs.t${cyc}z.wafs_grb45f${fhr}.grib2.idx $COMOUT/gfs.t${cyc}z.wafs_grb45f${fhr}.grib2.idx + if [[ "${wafs_timewindow}" == "YES" ]]; then + cpfs "gfs.t${cyc}z.wafs_grb45f${fhr}.grib2" "${COMOUT}/gfs.t${cyc}z.wafs_grb45f${fhr}.grib2" + cpfs "gfs.t${cyc}z.wafs_grb45f${fhr}.grib2.idx" "${COMOUT}/gfs.t${cyc}z.wafs_grb45f${fhr}.grib2.idx" fi - ############################## - # Post Files to PCOM - ############################## + cpfs "grib2.wafs.t${cyc}z.awf_grid45.f${fhr}" "${COMOUTwmo}/grib2.wafs.t${cyc}z.awf_grid45.f${fhr}" - cpfs grib2.wafs.t${cyc}z.awf_grid45.f${fhr} $PCOM/grib2.wafs.t${cyc}z.awf_grid45.f${fhr} - - if [ $wafs_timewindow = 'yes' ] ; then - cpfs grib2.wafs.t${cyc}z.grid45.f${fhr} $PCOM/grib2.wafs.t${cyc}z.grid45.f${fhr} + if [[ "${wafs_timewindow}" == "YES" ]]; then + cpfs "grib2.wafs.t${cyc}z.grid45.f${fhr}" "${COMOUTwmo}/grib2.wafs.t${cyc}z.grid45.f${fhr}" fi fi -###################### -# Distribute Data -###################### - -if [ $SENDDBN = "YES" ] ; then +# Alert via DBN +if [[ "${SENDDBN}" == "YES" ]]; then -# -# Distribute Data to WOC -# - if [ $wafs_timewindow = 'yes' ] ; then - $DBNROOT/bin/dbn_alert MODEL WAFS_1P25_GB2 $job $COMOUT/gfs.t${cyc}z.wafs_grb45f${fhr}.grib2 -# -# Distribute Data to TOC TO WIFS FTP SERVER (AWC) -# - $DBNROOT/bin/dbn_alert NTC_LOW $NET $job $PCOM/grib2.wafs.t${cyc}z.grid45.f${fhr} + # Distribute Data to WOC + if [[ "${wafs_timewindow}" == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL WAFS_1P25_GB2 "${job}" "${COMOUT}/gfs.t${cyc}z.wafs_grb45f${fhr}.grib2" + # Distribute Data to TOC TO WIFS FTP SERVER (AWC) + "${DBNROOT}/bin/dbn_alert" NTC_LOW "${NET}" "${job}" "${COMOUTwmo}/grib2.wafs.t${cyc}z.grid45.f${fhr}" fi -# -# Distribute data to FAA -# - $DBNROOT/bin/dbn_alert NTC_LOW $NET $job $PCOM/grib2.wafs.t${cyc}z.awf_grid45.f${fhr} + # Distribute data to FAA + "${DBNROOT}/bin/dbn_alert" NTC_LOW "${NET}" "${job}" "${COMOUTwmo}/grib2.wafs.t${cyc}z.awf_grid45.f${fhr}" fi - -################################################################################ -# GOOD RUN -set +x -echo "**************JOB EXWAFS_GRIB2.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GRIB2.SH COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXWAFS_GRIB2.SH COMPLETED NORMALLY ON THE IBM" -set -x -################################################################################ - -echo "HAS COMPLETED NORMALLY!" - -exit 0 - -############## END OF SCRIPT ####################### diff --git a/scripts/exwafs_upp.sh b/scripts/exwafs_upp.sh index fb068ac..ec3928b 100755 --- a/scripts/exwafs_upp.sh +++ b/scripts/exwafs_upp.sh @@ -1,129 +1,108 @@ #!/bin/bash ##################################################################### -echo "-----------------------------------------------------" -echo " exwafs_upp.sh" -echo " Jun 24 - Mao - script for wafs upp" -echo "-----------------------------------------------------" +# TODO: need ex-script docblock, see Implementation Standards ##################################################################### set -x -cd $DATA - -msg="HAS BEGUN on `hostname`" -postmsg "$msg" - -POSTGPSH=${POSTGPSH:-$USHwafs/wafs_upp.sh} -PREFIX=${PREFIX:-${RUNupp}.t${cyc}z} - -SUFFIX=".nc" -export MODEL_OUT_FORM=${MODEL_OUT_FORM:-netcdfpara} - -export PGBOUT=wafsfile # For UPP Fortran code -export PGIOUT=wafsifile - -############################################################ -# Post Analysis Files before starting the Forecast Post -############################################################ -if [ $fhr = "anl" ]; then -#---------------------------------- - export VDATE=${PDY}${cyc} - - loganl=$COMINgfs/${PREFIX}.atmanl${SUFFIX} - - if test -f $loganl ; then - - [[ -f flxfile ]] && rm flxfile ; [[ -f atmfile ]] && rm atmfile - ln -fs $COMINgfs/${PREFIX}.atmanl${SUFFIX} atmfile - export ATMINP=atmfile - ln -fs $COMINgfs/${PREFIX}.sfcanl${SUFFIX} flxfile - export FLXINP=flxfile - -########################## WAFS U/V/T analysis start ########################## -# U/V/T on ICAO pressure levels for WAFS verification - if [[ $RUNupp = gfs ]] ; then - - #For MDL2P.f, WAFS pressure levels are different from master file - export POSTGPVARS="KPO=56,PO=84310.,81200.,78190.,75260.,72430.,69680.,67020.,64440.,61940.,59520.,57180.,54920.,52720.,50600.,48550.,46560.,44650.,42790.,41000.,39270.,37600.,35990.,34430.,32930.,31490.,30090.,28740.,27450.,26200.,25000.,23840.,22730.,21660.,20650.,19680.,18750.,17870.,17040.,16240.,15470.,14750.,14060.,13400.,12770.,12170.,11600.,11050.,10530.,10040.,9570.,9120.,8700.,8280.,7900.,7520.,7170.,popascal=.true.," - - export PostFlatFile=$PARMwafs/postxconfig-NT-GFS-WAFS-ANL.txt - export CTLFILE=$PARMwafs/postcntrl_gfs_wafs_anl.xml - - $POSTGPSH - export err=$? - - if [ $err -ne 0 ] ; then - echo " *** GFS POST WARNING: WAFS output failed for analysis, err=$err" - else - - # Need to be saved for WAFS U/V/T verification, - # resolution higher than WAFS 1.25 deg for future compatibility - wafsgrid="latlon 0:1440:0.25 90:721:-0.25" - $WGRIB2 $PGBOUT -set_grib_type same -new_grid_winds earth \ - -new_grid_interpolation bilinear -set_bitmap 1 \ - -new_grid $wafsgrid ${PGBOUT}.tmp - - if test $SENDCOM = "YES" - then - cpfs ${PGBOUT}.tmp $COMOUT/$RUN.t${cyc}z.0p25.anl.grib2 - $WGRIB2 -s ${PGBOUT}.tmp > $COMOUT/$RUN.t${cyc}z.0p25.anl.grib2.idx - fi - rm $PGBOUT ${PGBOUT}.tmp - fi - fi - fi -########################## WAFS U/V/T analysis end ########################## -else -########################## WAFS forecast start ########################## - export VDATE=`${NDATE} +${fhr} ${PDY}${cyc}` - [[ -f flxfile ]] && rm flxfile ; [[ -f atmfile ]] && rm atmfile - ln -fs $COMINgfs/${PREFIX}.atmf${fhr}${SUFFIX} atmfile - export ATMINP=atmfile - ln -fs $COMINgfs/${PREFIX}.sfcf${fhr}${SUFFIX} flxfile - export FLXINP=flxfile - - # Generate WAFS products on ICAO standard level. - # Do not need to be sent out to public, WAFS package will process the data. - if [[ $RUNupp = gfs || $RUNupp = gefs ]] ; then - - #For MDL2P.f, WAFS pressure levels are different from master file - export POSTGPVARS="KPO=58,PO=97720.,90810.,84310.,81200.,78190.,75260.,72430.,69680.,67020.,64440.,61940.,59520.,57180.,54920.,52720.,50600.,48550.,46560.,44650.,42790.,41000.,39270.,37600.,35990.,34430.,32930.,31490.,30090.,28740.,27450.,26200.,25000.,23840.,22730.,21660.,20650.,19680.,18750.,17870.,17040.,16240.,15470.,14750.,14060.,13400.,12770.,12170.,11600.,11050.,10530.,10040.,9570.,9120.,8700.,8280.,7900.,7520.,7170.,popascal=.true.," - - run=`echo $RUNupp | tr '[a-z]' '[A-Z]'` - # Extend WAFS u/v/t up to 120 hours - if [ $fhr -le 48 ] ; then - export PostFlatFile=$PARMwafs/postxconfig-NT-${run}-WAFS.txt - export CTLFILE=$PARMwafs/postcntrl_${RUNupp}_wafs.xml - else - export PostFlatFile=$PARMwafs/postxconfig-NT-GFS-WAFS-EXT.txt - export CTLFILE=$PARMwafs/postcntrl_gfs_wafs_ext.xml - fi - - # gtg has its own configurations - #cp $HOMEwafs/sorc/ncep_post.fd/post_gtg.fd/gtg.config.$RUNupp . - #cp $HOMEwafs/sorc/ncep_post.fd/post_gtg.fd/imprintings.gtg_${RUNupp}.txt . - #cp $HOMEwafs/sorc/ncep_post.fd/post_gtg.fd/gtg.input.$RUNupp . - cp $PARMwafs/gtg.config.$RUNupp gtg.config - cp $PARMwafs/gtg_imprintings.txt gtg_imprintings.txt - - $POSTGPSH - - export err=$? - - if [ $err -ne 0 ] ; then - echo " *** GFS POST WARNING: WAFS output failed for f${fhr}, err=$err" - else - if [ -e $PGBOUT ] ; then - if [ $SENDCOM = "YES" ] ; then - cpfs $PGBOUT $COMOUT/$RUN.t${cyc}z.master.f$fhr.grib2 - $WGRIB2 -s $PGBOUT > $PGIOUT # WAFS products exist from ush/gfs_nceppost.sh before running anything else - cpfs $PGIOUT $COMOUT/$RUN.t${cyc}z.master.f$fhr.grib2.idx - fi - fi - fi - fi - [[ -f wafsfile ]] && rm wafsfile ; [[ -f wafsifile ]] && rm wafsifile +POSTGRB2TBL=${POSTGRB2TBL:-"${g2tmpl_ROOT}/share/params_grib2_tbl_new"} +UPPEXEC=${UPPEXEC:-"${EXECwafs}/ncep_post.x"} +MPIRUN=${MPIRUN:-"mpiexec -l -n 126 -ppn 126 --cpu-bind depth --depth 1"} +if [[ "${fhr}" == "anl" ]]; then # Analysis + + VDATE="${PDY}${cyc}" + ATMINP="${COMINgfs}/gfs.t${cyc}z.atmanl.nc" + FLXINP="${COMINgfs}/gfs.t${cyc}z.sfcanl.nc" + PostFlatFile="${PARMwafs}/upp/postxconfig-NT-GFS-WAFS-ANL.txt" + +else # Forecast + + VDATE=$(${NDATE} +${fhr} ${PDY}${cyc}) + ATMINP="${COMINgfs}/gfs.t${cyc}z.atmf${fhr}.nc" + FLXINP="${COMINgfs}/gfs.t${cyc}z.sfcf${fhr}.nc" + ifhr="$((10#${fhr}))" + if ((ifhr <= 48)); then + PostFlatFile="${PARMwafs}/upp/postxconfig-NT-GFS-WAFS.txt" + else + PostFlatFile="${PARMwafs}/upp/postxconfig-NT-GFS-WAFS-EXT.txt" + fi + +fi + +cd "${DATA}" || err_exit "FATAL ERROR: Could not 'cd ${DATA}'; ABORT!" + +# Copy required inputs to local directory +cpreq "${ATMINP}" ./atmfile +cpreq "${FLXINP}" ./flxfile +cpreq "${POSTGRB2TBL}" . +cpreq "${PostFlatFile}" ./postxconfig-NT.txt +cpreq "${PARMwafs}/upp/nam_micro_lookup.dat" ./eta_micro_lookup.dat +cpreq "${UPPEXEC}" . +if [[ "${fhr}" != "anl" ]]; then + cpreq "${PARMwafs}/upp/gtg.config.gfs" gtg.config + cpreq "${PARMwafs}/upp/gtg_imprintings.txt" gtg_imprintings.txt +fi + +# Create the itag file +rm -f itag +cat >itag <>${pgmout} 2>errfile +export err=$? +err_chk + +# Check if UPP succeeded in creating the master file +if [[ ! -f "${PGBOUT}" ]]; then + err_exit "FATAL ERROR: UPP failed to create '${PGBOUT}', ABORT!" +fi + +# Copy relevant files to COMOUT +if [[ "${fhr}" == "anl" ]]; then # Analysis interpolated file for verification (EVS) + + # Interpolate to 0.25-degree grid + ${WGRIB2} "${PGBOUT}" \ + -set_grib_type same -new_grid_winds earth \ + -new_grid_interpolation bilinear -set_bitmap 1 \ + -new_grid latlon 0:1440:0.25 90:721:-0.25 "${PGBOUT}.0p25" + export err=$? + ((err != 0)) && err_exit "FATAL ERROR: 'wgrib2' failed to interpolate '${PGBOUT}' to 0.25-deg grid, ABORT!" + + # Copy interpolated file to COMOUT and index the file + if [[ "${SENDCOM}" == "YES" ]]; then + cpfs "${PGBOUT}.0p25" "${COMOUT}/${RUN}.t${cyc}z.0p25.anl.grib2" + ${WGRIB2} -s "${PGBOUT}.0p25" >"${COMOUT}/${RUN}.t${cyc}z.0p25.anl.grib2.idx" + fi + +else # Forecast master files + + # Copy master files to COMOUT and index the file + if [[ "${SENDCOM}" == "YES" ]]; then + cpfs "${PGBOUT}" "${COMOUT}/${RUN}.t${cyc}z.master.f${fhr}.grib2" + ${WGRIB2} -s "${PGBOUT}" >"${COMOUT}/${RUN}.t${cyc}z.master.f${fhr}.grib2.idx" + fi fi -########################### WAFS forecast end ########################### -echo "PROGRAM IS COMPLETE!!!!!" diff --git a/sorc/build_upp.sh b/sorc/build_upp.sh index 419196b..d3343e4 100755 --- a/sorc/build_upp.sh +++ b/sorc/build_upp.sh @@ -26,6 +26,6 @@ cd "${DIR_ROOT}/sorc/upp.fd/sorc" # Copy upp to WAFS/exec rm -rf "${DIR_ROOT}/exec/ncep_post" -cp "${DIR_ROOT}/sorc/upp.fd/exec/ncep_post" "${DIR_ROOT}/exec/ncep_post" +cp "${DIR_ROOT}/sorc/upp.fd/exec/ncep_post" "${DIR_ROOT}/exec/ncep_post.x" exit diff --git a/ush/mkwfsgbl.sh b/ush/mkwfsgbl.sh index c1d5376..d419f97 100755 --- a/ush/mkwfsgbl.sh +++ b/ush/mkwfsgbl.sh @@ -5,67 +5,52 @@ # DATE WRITTEN : 11/06/96 # # Abstract: This utility script produces the GFS WAFS -# bulletins. +# bulletins. # -# Input: 2 arguments are passed to this script. +# Input: 2 arguments are passed to this script. # 1st argument - Forecast Hour - format of 2I -# 2nd argument - In hours 12-30, the designator of +# 2nd argument - In hours 12-30, the designator of # a or b. # # Logic: If we are processing hours 12-30, we have the # added variable of the a or b, and process # accordingly. The other hours, the a or b is dropped. # -echo "History: SEPT 1996 - First implementation of this utility script" -echo "History: AUG 1999 - Modified for implementation on IBM SP" -echo " - Allows users to run interactively" -# +# History: SEPT 1996 - First implementation of this utility script" +# AUG 1999 - Modified for implementation on IBM SP" +# - Allows users to run interactively" set -x -fhr="$1" -sets_key=$2 -num=$# - -if test $num -ge 2 -then - echo " Appropriate number of arguments were passed" - set -x - if [ -z "$DATA" ] - then - export DATA=`pwd` - cd $DATA - setpdy.sh - . PDY - fi -else - echo "" - echo "Usage: mkwfsgbl.sh \$hour [a|b]" - echo "" - exit 16 -fi +fhr=${1:-?"fhr is missing"} +sets_key=${2:-?"sets_key is missing"} + +set +x echo " ------------------------------------------" echo " BEGIN MAKING gfs WAFS PRODUCTS" echo " ------------------------------------------" echo "Enter Make WAFS utility." +set -x + +ifhr=$((10#$fhr)) +fhr3=$(printf "%03i" "${ifhr}") +GFS_MASTER="${COMINgfs}/gfs.t${cyc}z.master.grb2f${fhr3}" ############################## # Copy Input Field to $DATA ############################## -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${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 - +if [[ ! -f "pgrbf${fhr}" ]]; then + + # 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${fhr} + # $WGRIB2 pgrb2f${fhr} | grep -F -f $FIXwafs/grib_wafs.grb2to1.list | $WGRIB2 -i pgrb2f${fhr} -grib pgrb2f${fhr}.tmp + cpreq "${GFS_MASTER}" "./gfs_masterf${fhr}.grib2" + ${WGRIB2} "./gfs_master${fhr}.grib2" | grep -F -f "${FIXwafs}/grib_wafs.grb2to1.list" | ${WGRIB2} -i "./gfs_master${fhr}.grib2" -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 ' @@ -75,32 +60,31 @@ then 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 + ${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} + ${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 # # 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} +${COPYGB} -g3 -i0 -N${FIXwafs}/grib_wafs.namelist -x "pgrbf${fhr}" tmp +mv tmp "pgrbf${fhr}" +${GRBINDEX} "pgrbf${fhr}" "pgrbif${fhr}" ############################## # Process WAFS ############################## -if test $fhr -ge '12' -a $fhr -le '30' -then - sets=$sets_key +if ((ifhr >= 12 && ifhr <= 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." @@ -110,7 +94,10 @@ else unset sets fi -export pgm=wafs_makewafs +cpreq "${EXECwafs}/wafs_makewafs.x" "./wafs_makewafs.x" + +export pgm="wafs_makewafs.x" + . prep_step export FORT11="pgrbf${fhr}" @@ -118,30 +105,23 @@ 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 -############################## +${pgm} <"${FIXwafs}/grib_wfsgfs${fhr}${sets}" >>"${pgmout}" 2>errfile +export err=$? +err_chk -if test "$SENDCOM" = 'YES' -then - cpfs xtrn.wfsgfs${fhr}${sets} $PCOM/xtrn.wfsgfs${cyc}${fhr}${sets}.$jobsuffix +if [[ ! -f "xtrn.wfsgfs${fhr}${sets}" ]]; then + err_exit "FATAL ERROR: '${pgm}' failed to create 'xtrn.wfsgfs${fhr}${sets}'" fi -############################## -# Distribute Data -############################## +# Send data to COM +jobsuffix="gfs_atmos_wafs_f${fhr}_$cyc" +if [[ "${SENDCOM}" == "YES" ]]; then + cpfs "xtrn.wfsgfs${fhr}${sets}" "${COMOUTwmo}/xtrn.wfsgfs${cyc}${fhr}${sets}.${jobsuffix}" +fi -if [ "$SENDDBN_NTC" = 'YES' ] ; then - $DBNROOT/bin/dbn_alert GRIB_LOW gfs $job $PCOM/xtrn.wfsgfs${cyc}${fhr}${sets}.$jobsuffix +# Alert via DBN +if [[ "${SENDDBN_NTC}" == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" GRIB_LOW gfs "${job}" "${COMOUTwmo}/xtrn.wfsgfs${cyc}${fhr}${sets}.${jobsuffix}" else - echo "xtrn.wfsgfs${cyc}${fhr}${sets}.$job file not posted to db_net." + echo "xtrn.wfsgfs${cyc}${fhr}${sets}.${job} file not posted to db_net." fi - -echo "Wafs Processing $fhr hour completed normally" - -exit diff --git a/ush/wafs_upp.sh b/ush/wafs_upp.sh deleted file mode 100755 index 2658a5e..0000000 --- a/ush/wafs_upp.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -x - -# making the time stamp format for ncep post -export YY=`echo $VDATE | cut -c1-4` -export MM=`echo $VDATE | cut -c5-6` -export DD=`echo $VDATE | cut -c7-8` -export HH=`echo $VDATE | cut -c9-10` - -run=`echo $RUNupp | tr '[a-z]' '[A-Z]'` -cat > itag < outpost_gfs_${VDATE}_${CTL} - -export ERR=$? -export err=$ERR - -exit $err