From 2da9604475f046ae374412e479535ef294db8d67 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Tue, 27 Sep 2022 09:44:56 +0000 Subject: [PATCH 01/13] Rename post scripts Rename post scripts to remove the unnecessary "ncep" qualifier. --- ...OBAL_ATMOS_NCEPPOST => JGLOBAL_ATMOS_POST} | 2 +- jobs/rocoto/post.sh | 2 +- parm/config/config.post | 8 +- ...atmos_nceppost.sh => exgdas_atmos_post.sh} | 2 +- ..._atmos_nceppost.sh => exgfs_atmos_post.sh} | 2 +- sorc/link_workflow.sh | 4 +- ush/{gfs_nceppost.sh => gfs_post.sh} | 16 +- ush/global_nceppost.sh | 476 ------------------ 8 files changed, 18 insertions(+), 494 deletions(-) rename jobs/{JGLOBAL_ATMOS_NCEPPOST => JGLOBAL_ATMOS_POST} (99%) rename scripts/{exgdas_atmos_nceppost.sh => exgdas_atmos_post.sh} (99%) rename scripts/{exgfs_atmos_nceppost.sh => exgfs_atmos_post.sh} (99%) rename ush/{gfs_nceppost.sh => gfs_post.sh} (96%) delete mode 100755 ush/global_nceppost.sh diff --git a/jobs/JGLOBAL_ATMOS_NCEPPOST b/jobs/JGLOBAL_ATMOS_POST similarity index 99% rename from jobs/JGLOBAL_ATMOS_NCEPPOST rename to jobs/JGLOBAL_ATMOS_POST index 56d6ca602e5..73b8c72876b 100755 --- a/jobs/JGLOBAL_ATMOS_NCEPPOST +++ b/jobs/JGLOBAL_ATMOS_POST @@ -117,7 +117,7 @@ export SLEEP_INT=5 ############################################################### # Run relevant exglobal script -$SCRgfs/ex${RUN}_atmos_nceppost.sh +$SCRgfs/ex${RUN}_atmos_post.sh status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/rocoto/post.sh b/jobs/rocoto/post.sh index b32e8c511d7..a6dfb0fbaf4 100755 --- a/jobs/rocoto/post.sh +++ b/jobs/rocoto/post.sh @@ -27,7 +27,7 @@ fi #--------------------------------------------------------------- for fhr in $fhrlst; do export post_times=$fhr - $HOMEgfs/jobs/JGLOBAL_ATMOS_NCEPPOST + $HOMEgfs/jobs/JGLOBAL_ATMOS_POST status=$? [[ $status -ne 0 ]] && exit $status done diff --git a/parm/config/config.post b/parm/config/config.post index a545f0fafcf..cdea64e2a31 100755 --- a/parm/config/config.post +++ b/parm/config/config.post @@ -19,13 +19,13 @@ if [ $OUTPUT_FILE = "netcdf" ]; then export MODEL_OUT_FORM=netcdfpara fi -# Post driver job that calls gfs_nceppost.sh and downstream jobs -export POSTJJOBSH="$HOMEpost/jobs/JGLOBAL_NCEPPOST" +# Post driver job that calls gfs_post.sh and downstream jobs +export POSTJJOBSH="$HOMEpost/jobs/JGLOBAL_POST" export GFSDOWNSH="$HOMEpost/ush/fv3gfs_downstream_nems.sh" export GFSDWNSH="$HOMEpost/ush/fv3gfs_dwn_nems.sh" -export POSTGPSH="$HOMEpost/ush/gfs_nceppost.sh" -export POSTGPEXEC="$HOMEpost/exec/gfs_ncep_post" +export POSTGPSH="$HOMEpost/ush/gfs_post.sh" +export POSTGPEXEC="$HOMEpost/exec/upp.x" export GOESF=NO # goes image export FLXF=YES # grib2 flux file written by post diff --git a/scripts/exgdas_atmos_nceppost.sh b/scripts/exgdas_atmos_post.sh similarity index 99% rename from scripts/exgdas_atmos_nceppost.sh rename to scripts/exgdas_atmos_post.sh index 005911db6ae..4de4ffaf717 100755 --- a/scripts/exgdas_atmos_nceppost.sh +++ b/scripts/exgdas_atmos_post.sh @@ -28,7 +28,7 @@ source "$HOMEgfs/ush/preamble.sh" cd $DATA -export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_nceppost.sh} +export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_post.sh} export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh} export GFSDWNSH=${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh} export TRIMRH=${TRIMRH:-$USHgfs/trim_rh.sh} diff --git a/scripts/exgfs_atmos_nceppost.sh b/scripts/exgfs_atmos_post.sh similarity index 99% rename from scripts/exgfs_atmos_nceppost.sh rename to scripts/exgfs_atmos_post.sh index ae94472aeba..92bb8b5463a 100755 --- a/scripts/exgfs_atmos_nceppost.sh +++ b/scripts/exgfs_atmos_post.sh @@ -41,7 +41,7 @@ source "$HOMEgfs/ush/preamble.sh" cd $DATA # specify model output format type: 4 for nemsio, 3 for sigio -export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_nceppost.sh} +export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_post.sh} export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh} export GFSDOWNSHF=${GFSDOWNSHF:-$USHgfs/inter_flux.sh} export GFSDWNSH=${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh} diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 6ce9775dd2b..4656c4aaa26 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -205,8 +205,8 @@ done [[ -s ufs_model.x ]] && rm -f ufs_model.x $LINK ../sorc/ufs_model.fd/tests/ufs_model.x . -[[ -s gfs_ncep_post ]] && rm -f gfs_ncep_post -$LINK ../sorc/upp.fd/exec/upp.x gfs_ncep_post +[[ -s upp.x ]] && rm -f upp.x +$LINK ../sorc/upp.fd/exec/upp.x . if [ -d ${pwd}/gfs_wafs.fd ]; then for wafsexe in \ diff --git a/ush/gfs_nceppost.sh b/ush/gfs_post.sh similarity index 96% rename from ush/gfs_nceppost.sh rename to ush/gfs_post.sh index a8bee62d4d7..c38edfe4ec2 100755 --- a/ush/gfs_nceppost.sh +++ b/ush/gfs_post.sh @@ -3,7 +3,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: gfs_nceppost.sh +# Script name: gfs_post.sh # Script description: Posts the global pressure GRIB file # # Author: Mark Iredell Org: NP23 Date: 1999-05-01 @@ -19,8 +19,8 @@ # 2012-06-04 Jun Wang: add grib2 option # 2015-03-20 Lin Gan: add Perl for Post XML performance upgrade # 2016-02-08 Lin Gan: Modify to use Vertical Structure -# 2018-02-05 Wen Meng: For EE2 standard, create gfs_nceppost.sh based -# global_nceppost.sh and change EXECglobal to EXECgfs; +# 2018-02-05 Wen Meng: For EE2 standard, create gfs_post.sh based +# global_post.sh and change EXECglobal to EXECgfs; # Remove legacy setting for reading non-nemsio model output # and generating grib1 data # 2019-06-02 Wen Meng: Remove the links of gfs fix files. @@ -63,7 +63,7 @@ # default to to ${USHglobal}/global_chgres.sh # SIGLEVEL optional: the coordinate text file # default to to /nwprod/fix/global_hyblev.l${LEVS}.txt -##### Chuang: Add new imported Shell Variable for ncep post +##### Chuang: Add new imported Shell Variable for post # OUTTYP Output file type read in by post # 1: if user has a sigma file and needs post to run chgres to convert to gfs io file # 2: if user already has a gfs io file @@ -71,7 +71,7 @@ # 0: if user wishes to generate both gfsio and sigma files # 4: if user uses post to read nemsio file directly # VDATE Verifying date 10 digits yyyymmddhh -# GFSOUT Optional, output file name from chgres which is input file name to nceppost +# GFSOUT Optional, output file name from chgres which is input file name to post # if model already runs gfs io, make sure GFSOUT is linked to the gfsio file # CTLFILE Optional, Your version of control file if not using operational one # OVERPARMEXEC Optional, the executable for changing Grib KPDS ID @@ -106,7 +106,7 @@ # XC Suffix to add to executables # defaults to none # POSTGPEXEC Global post executable -# defaults to ${EXECglobal}/ncep_post +# defaults to ${EXECglobal}/upp.x # GRBINDEX GRIB index maker # defaults to ${EXECUTIL}/grbindex$XC # POSTGPLIST File containing further namelist inputs @@ -210,7 +210,7 @@ export DATA=${DATA:-$(pwd)} # Filenames. export MP=${MP:-$([[ ${LOADL_STEP_TYPE:-SERIAL} = PARALLEL ]]&&echo "p"||echo "s")} export XC=${XC:-} -export POSTGPEXEC=${POSTGPEXEC:-${EXECgfs}/gfs_ncep_post} +export POSTGPEXEC=${POSTGPEXEC:-${EXECgfs}/upp.x} export OVERPARMEXEC=${OVERPARMEXEC:-${EXECgfs}/overparm_grib} export POSTGPLIST=${POSTGPLIST:-/dev/null} export INISCRIPT=${INISCRIPT:-} @@ -340,7 +340,7 @@ export CTL=$(basename $CTLFILE) ln -sf griddef.out fort.110 cp ${PARMpost}/nam_micro_lookup.dat ./eta_micro_lookup.dat -echo "gfs_nceppost.sh OMP_NUM_THREADS= $OMP_NUM_THREADS" +echo "gfs_post.sh OMP_NUM_THREADS= $OMP_NUM_THREADS" ${APRUN:-mpirun.lsf} $POSTGPEXEC < itag > outpost_gfs_${VDATE}_${CTL} export ERR=$? diff --git a/ush/global_nceppost.sh b/ush/global_nceppost.sh deleted file mode 100755 index 2c0711c57f4..00000000000 --- a/ush/global_nceppost.sh +++ /dev/null @@ -1,476 +0,0 @@ -#! /usr/bin/env bash - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: global_nceppost.sh -# Script description: Posts the global pressure GRIB file -# -# Author: Mark Iredell Org: NP23 Date: 1999-05-01 -# -# Abstract: This script reads a single global GFS IO file and (optionally) -# a global flux file and creates a global pressure GRIB file. -# The resolution and generating code of the output GRIB file can also -# be set in the argument list. -# -# Script history log: -# 1999-05-01 Mark Iredell -# 2007-04-04 Huiya Chuang: Modify the script to run unified post -# 2012-06-04 Jun Wang: add grib2 option -# 2015-03-20 Lin Gan: add Perl for Post XML performance upgrade -# 2016-02-08 Lin Gan: Modify to use Vertical Structure -# -# Usage: global_postgp.sh SIGINP FLXINP FLXIOUT PGBOUT PGIOUT IGEN -# -# Input script positional parameters: -# 1 Input sigma file -# defaults to $SIGINP -# 2 Input flux file -# defaults to $FLXINP -# 3 Output flux index file -# defaults to $FLXIOUT -# 4 Output pressure GRIB file -# defaults to $PGBOUT -# 5 Output pressure GRIB index file -# defaults to $PGIOUT, then to none -# 8 Model generating code, -# defaults to $IGEN, then to input sigma generating code -# -# Imported Shell Variables: -# SIGINP Input sigma file -# overridden by $1 -# FLXINP Input flux file -# overridden by $2 -# FLXIOUT Output flux index file -# overridden by $3 -# PGBOUT Output pressure GRIB file -# overridden by $4. If not defined, -# post will use the filename specified in -# the control file -# PGIOUT Output pressure GRIB index file -# overridden by $5; defaults to none -# IGEN Model generating code -# overridden by $8; defaults to input sigma generating code -##### Moorthi: Add new imported shell variable for running chgres -# CHGRESSH optional: the script to run chgres -# default to to ${USHglobal}/global_chgres.sh -# SIGLEVEL optional: the coordinate text file -# default to to $HOMEgfs/fix/global_hyblev.l${LEVS}.txt -##### Chuang: Add new imported Shell Variable for ncep post -# OUTTYP Output file type read in by post -# 1: if user has a sigma file and needs post to run chgres to convert to gfs io file -# 2: if user already has a gfs io file -# 3: if user uses post to read sigma file directly -# 0: if user wishes to generate both gfsio and sigma files -# 4: if user uses post to read nemsio file directly -# VDATE Verifying date 10 digits yyyymmddhh -# GFSOUT Optional, output file name from chgres which is input file name to nceppost -# if model already runs gfs io, make sure GFSOUT is linked to the gfsio file -# CTLFILE Optional, Your version of control file if not using operational one -# OVERPARMEXEC Optional, the executable for changing Grib KPDS ID -# default to to ${EXECglobal}/overparm_grib -# CHGRESTHREAD Optional, speed up chgres by using multiple threads -# default to 1 -# FILTER Optional, set to 1 to filter SLP and 500 mb height using copygb -# D3DINP Optional, Inout D3D file, if not defined, post will run -# without processing D3D file -# D3DOUT Optional, output D3D file, if not defined, post will -# use the file name specified in the control file -# IPVOUT Optional, output IPV file, if not defined, post will -# use the file name specified in the control file -# GENPSICHI Optional, set to YES will generate psi and chi and -# append it to the end of PGBOUT. Default to NO -# GENPSICHIEXE Optional, specify where executable is for generating -# psi and chi. -######################################################################## -# EXECglobal Directory for global executables -# defaults to $HOMEgfs/exec -# USHglobal Directory for global scripts -# defaults to $HOMEgfs/ush -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# MP Multi-processing type ("p" or "s") -# defaults to "p", or "s" if LOADL_STEP_TYPE is not PARALLEL -# XC Suffix to add to executables -# defaults to none -# POSTGPEXEC Global post executable -# defaults to ${EXECglobal}/ncep_post -# GRBINDEX GRIB index maker -# ANOMCATSH Global anomaly GRIB script -# defaults to ${USHglobal/global_anomcat.sh -# POSTGPLIST File containing further namelist inputs -# defaults to /dev/null -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# POSTGPVARS Other namelist inputs to the global post executable -# such as IDRT,KO,PO,KTT,KT,PT,KZZ,ZZ, -# NCPUS,MXBIT,IDS,POB,POT,MOO,MOOA,MOW,MOWA, -# ICEN,ICEN2,IENST,IENSI -# defaults to none set -# NTHREADS Number of threads -# defaults to 1 -# NTHSTACK Size of stack per thread -# defaults to 64000000 -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# $ANOMCATSH -# -# programs : $POSTGPEXEC -# $GRBINDEX -# -# input data : $1 or $SIGINP -# $2 or $SFCINP -# $POSTGPLIST -# -# output data: $3 or $FLXIOUT -# $4 or $PGBOUT -# $5 or $PGIOUT -# $PGMOUT -# $PGMERR -# -# scratch : ${DATA}/postgp.inp.sig -# ${DATA}/postgp.inp.flx -# ${DATA}/postgp.out.pgb -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -#### -################################################################################ -# Set environment. -source "$HOMEgfs/ush/preamble.sh" - -# Command line arguments. -export SIGINP=${1:-${SIGINP}} -export FLXINP=${2:-${FLXINP}} -export FLXIOUT=${3:-${FLXIOUT}} -export PGBOUT=${4:-${PGBOUT}} -#export PGIOUT=${5:-${PGIOUT}} -export PGIOUT=${PGIOUT:-pgb.idx} -export IO=${6:-${IO:-0}} -export JO=${7:-${JO:-0}} -export IGEN=${8:-${IGEN:-0}} -# Directories. -export EXECglobal=${EXECglobal:-$HOMEgfs/exec} -export USHglobal=${USHglobal:-$HOMEgfs/ush} -export DATA=${DATA:-$(pwd)} -# Filenames. -export MP=${MP:-$([[ $LOADL_STEP_TYPE = PARALLEL ]]&&echo "p"||echo "s")} -export XC=${XC} -export POSTGPEXEC=${POSTGPEXEC:-${EXECglobal}/ncep_post} -export OVERPARMEXEC=${OVERPARMEXEC:-${EXECglobal}/overparm_grib} -export ANOMCATSH=${ANOMCATSH:-${USHglobal}/global_anomcat.sh} -export CHGRESSH=${CHGRESSH:-${USHglobal}/global_chgres.sh} -export POSTGPLIST=${POSTGPLIST:-/dev/null} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} -export GFSOUT=${GFSOUT:-gfsout} -export CTLFILE=${CTLFILE:-$HOMEgfs/parm/post/postcntrl_gfs.xml} -export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} -export GRIBVERSION=${GRIBVERSION:-'grib1'} -# Other variables. -export POSTGPVARS=${POSTGPVARS} -export NTHREADS=${NTHREADS:-1} -export NTHSTACK=${NTHSTACK:-64000000} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export CHGRESTHREAD=${CHGRESTHREAD:-1} -export FILTER=${FILTER:-1} -export GENPSICHI=${GENPSICHI:-NO} -export GENPSICHIEXE=${GENPSICHIEXE:-${EXECglobal}/genpsiandchi} -export ens=${ens:-NO} -#export D3DINP=${D3DINP:-/dev/null} -l=$(echo $PGMOUT | xargs | cut -c1) -[[ $l = '&' ]]&&a=''||a='>' -export REDOUT=${REDOUT:-'1>'$a} -l=$(echo $PGMERR | xargs | cut -c1) -[[ $l = '&' ]]&&a=''||a='>' -export REDERR=${REDERR:-'2>'$a} -################################################################################ - -# Chuang: Run chgres if OUTTYP=1 or 0 - -export APRUN=${APRUNP:-${APRUN:-""}} - -# exit if SIGINP does not exist -if [ ${OUTTYP} -le 3 ] ; then - if [ ! -s $SIGINP ] ; then - echo "sigma file not found, exitting" - exit 111 - fi -fi - -export SIGHDR=${SIGHDR:-$HOMEgfs/exec/global_sighdr} -export IDRT=${IDRT:-4} - -if [ ${OUTTYP} -le 1 ] ; then - export JCAP=${JCAP:-$(echo jcap|$SIGHDR ${SIGINP})} - export LEVS=${LEVS:-$(echo levs|$SIGHDR ${SIGINP})} - export IDVC=${IDVC:-$(echo idvc|$SIGHDR ${SIGINP})} - export IDVM=${IDVM:-$(echo idvm|$SIGHDR ${SIGINP})} - export NVCOORD=${NVCOORD:-$(echo nvcoord|$SIGHDR ${SIGINP})} - export IVSSIG=${IVSSIG:-$(echo ivs|$SIGHDR ${SIGINP})} - export LATCH=${LATCH:-8} - if [ ${OUTTYP} -eq 1 ] ; then - export CHGRESVARS="IDVC=$IDVC,IDVM=$IDVM,NVCOORD=$NVCOORD,IVSSIG=$IVSSIG,LATCH=$LATCH," - elif [ ${OUTTYP} -eq 0 ] ; then - export CHGRESVARS="LATCH=$LATCH,$CHGRESVARS" - fi - #export SIGLEVEL=${SIGLEVEL:-""} - export SIGLEVEL=${SIGLEVEL:-"$HOMEgfs/fix/global_hyblev.l${LEVS}.txt"} - # specify threads for running chgres - export OMP_NUM_THREADS=$CHGRESTHREAD - export NTHREADS=$OMP_NUM_THREADS - if [ ${JCAP} -eq 574 -a ${IDRT} -eq 4 ]; then - export NTHSTACK=1024000000 - fi - export XLSMPOPTS="parthds=$NTHREADS:stack=$NTHSTACK" - - $CHGRESSH - - export ERR=$? - export err=$ERR - $ERRSCRIPT||exit 1 - -# run post to read sigma file directly if OUTTYP=3 -elif [ ${OUTTYP} -eq 3 ] ; then - export LONB=${LONB:-$(echo lonb|$SIGHDR ${SIGINP})} - export LATB=${LATB:-$(echo latb|$SIGHDR ${SIGINP})} - export MODEL_OUT_FORM=sigio - export GFSOUT=${SIGINP} - -# run post to read nemsio file if OUTTYP=4 -elif [ ${OUTTYP} -eq 4 ] ; then - export nemsioget=${nemsioget:-$EXECglobal/nemsio_get} - export LONB=${LONB:-$($nemsioget $NEMSINP dimx | awk '{print $2}')} - export LATB=${LATB:-$($nemsioget $NEMSINP dimy | awk '{print $2}')} - export JCAP=${JCAP:-$(expr $LATB - 2)} - # export LONB=${LONB:-$($nemsioget $NEMSINP lonf |grep -i "lonf" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - # export LATB=${LATB:-$($nemsioget $NEMSINP latg |grep -i "latg" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - # export JCAP=${JCAP:-$($nemsioget $NEMSINP jcap |grep -i "jcap" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - - export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} - export GFSOUT=${NEMSINP} - ln -sf $FIXglobal/fix_am/global_lonsperlat.t${JCAP}.${LONB}.${LATB}.txt ./lonsperlat.dat - ln -sf $FIXglobal/fix_am/global_hyblev.l${LEVS}.txt ./global_hyblev.txt -fi - -# allow threads to use threading in Jim's sp lib -# but set default to 1 -export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} - -pwd=$(pwd) -if [[ -d $DATA ]]; then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 -################################################################################ -# Post GRIB -export PGM=$POSTGPEXEC -export pgm=$PGM -$LOGSCRIPT -cat <<-EOF >postgp.inp.nml$$ - &NAMPGB - $POSTGPVARS -EOF - -cat <<-EOF >>postgp.inp.nml$$ - / -EOF - -if [[ "$VERBOSE" = "YES" ]]; then - cat postgp.inp.nml$$ -fi - -# 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) - -cat > itag <<-EOF - $GFSOUT - ${MODEL_OUT_FORM} - ${GRIBVERSION} - ${YY}-${MM}-${DD}_${HH}:00:00 - GFS - $FLXINP - $D3DINP -EOF - -cat postgp.inp.nml$$ >> itag - -cat itag - -rm -f fort.* - -#ln -sf $SIGINP postgp.inp.sig$$ -#ln -sf $FLXINP postgp.inp.flx$$ -#ln -sf $PGBOUT postgp.out.pgb$$ - -# change model generating Grib number -if [ ${GRIBVERSION} = grib1 ]; then - if [ ${IGEN} -le 9 ] ; then - cat ${CTLFILE}|sed s:00082:0000${IGEN}:>./gfs_cntrl.parm - elif [ ${IGEN} -le 99 ] ; then - cat ${CTLFILE}|sed s:00082:000${IGEN}:>./gfs_cntrl.parm - elif [ ${IGEN} -le 999 ] ; then - cat ${CTLFILE}|sed s:00082:00${IGEN}:>./gfs_cntrl.parm - else - ln -sf ${CTLFILE} ./gfs_cntrl.parm - fi - ln -sf ./gfs_cntrl.parm fort.14 -elif [ ${GRIBVERSION} = grib2 ]; then - cp ${POSTGRB2TBL} . - cp ${PostFlatFile} ./postxconfig-NT.txt - if [ ${ens} = "YES" ] ; then - sed < ${PostFlatFile} -e "s#negatively_pert_fcst#${ens_pert_type}#" > ./postxconfig-NT.txt - fi - # cp ${CTLFILE} postcntrl.xml -fi -export CTL=$(basename $CTLFILE) - -ln -sf griddef.out fort.110 -cp ${PARMglobal}/nam_micro_lookup.dat ./eta_micro_lookup.dat - -${APRUN:-mpirun.lsf} $POSTGPEXEC < itag > outpost_gfs_${VDATE}_${CTL} - -export ERR=$? -export err=$ERR -$ERRSCRIPT||exit 2 - -if [ $FILTER = "1" ] ; then - # Filter SLP and 500 mb height using copygb, change GRIB ID, and then - # cat the filtered fields to the pressure GRIB file, from Iredell - - if [ $GRIBVERSION = grib1 ]; then - $COPYGB -x -i'4,0,80' -k'4*-1,1,102' $PGBOUT tfile - ln -s -f tfile fort.11 - ln -s -f prmsl fort.51 - echo 0 2|$OVERPARMEXEC - $COPYGB -x -i'4,1,5' -k'4*-1,7,100,500' $PGBOUT tfile - ln -s -f tfile fort.11 - ln -s -f h5wav fort.51 - echo 0 222|$OVERPARMEXEC - - #cat $PGBOUT prmsl h5wav >> $PGBOUT - cat prmsl h5wav >> $PGBOUT - elif [ $GRIBVERSION = grib2 ]; then - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,0,80' -k'1 3 0 7*-9999 101 0 0' $PGBOUT tfile - else - $COPYGB2 -x -i'4,0,80' -k'0 3 0 7*-9999 101 0 0' $PGBOUT tfile - fi - $WGRIB2 tfile -set_byte 4 11 1 -grib prmsl - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,1,5' -k'1 3 5 7*-9999 100 0 50000' $PGBOUT tfile - else - $COPYGB2 -x -i'4,1,5' -k'0 3 5 7*-9999 100 0 50000' $PGBOUT tfile - fi - $WGRIB2 tfile -set_byte 4 11 193 -grib h5wav - - #cat $PGBOUT prmsl h5wav >> $PGBOUT - - cat prmsl h5wav >> $PGBOUT - fi -fi - -################################################################################ -# Anomaly concatenation -# for now just do anomaly concentration for grib1 -if [ $GRIBVERSION = grib1 ]; then - if [[ -x $ANOMCATSH ]]; then - if [[ -n $PGIOUT ]]; then - $GRBINDEX $PGBOUT $PGIOUT - fi - export PGM=$ANOMCATSH - export pgm=$PGM - $LOGSCRIPT - - eval $ANOMCATSH $PGBOUT $PGIOUT - - export ERR=$? - export err=$ERR - $ERRSCRIPT||exit 3 - fi -fi -################################################################################ -# Make GRIB index file -if [[ -n $PGIOUT ]]; then - if [ $GRIBVERSION = grib2 ]; then - # JY $GRBINDEX2 $PGBOUT $PGIOUT - $GRB2INDEX $PGBOUT $PGIOUT - else - $GRBINDEX $PGBOUT $PGIOUT - fi -fi -if [[ -r $FLXINP && -n $FLXIOUT && $OUTTYP -le 3 ]]; then - $GRBINDEX $FLXINP $FLXIOUT -fi -################################################################################ -# generate psi and chi -echo "GENPSICHI= " $GENPSICHI -if [ $GENPSICHI = YES ] ; then - #echo "PGBOUT PGIOUT=" $PGBOUT $PGIOUT - #echo "YY MM=" $YY $MM - export psichifile=./psichi.grb - $GENPSICHIEXE < postgp.inp.nml$$ - rc=$? - if [[ $rc -ne 0 ]] ; then - echo 'Nonzero return code rc= '$rc - exit 3 - fi - cat ./psichi.grb >> $PGBOUT -fi -################################################################################ -# Postprocessing -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA - -exit $err From 1b8a12367a15278507f84ac7be63c6eec05e8a8d Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 15:23:44 +0000 Subject: [PATCH 02/13] Linter fixes for post rename --- jobs/JGLOBAL_ATMOS_POST | 3 ++- scripts/exgdas_atmos_post.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jobs/JGLOBAL_ATMOS_POST b/jobs/JGLOBAL_ATMOS_POST index 73b8c72876b..3d10b0f2507 100755 --- a/jobs/JGLOBAL_ATMOS_POST +++ b/jobs/JGLOBAL_ATMOS_POST @@ -11,6 +11,7 @@ configs="base post" export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} config_path=${EXPDIR:-$PACKAGEROOT/gfs.${gfs_ver}/parm/config} for config in $configs; do + # shellcheck source-path=parm/config . $config_path/config.$config status=$? [[ $status -ne 0 ]] && exit $status @@ -117,7 +118,7 @@ export SLEEP_INT=5 ############################################################### # Run relevant exglobal script -$SCRgfs/ex${RUN}_atmos_post.sh +"${SCRgfs}/ex${RUN}_atmos_post.sh" status=$? [[ $status -ne 0 ]] && exit $status diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index 4de4ffaf717..818480ff41f 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -28,7 +28,7 @@ source "$HOMEgfs/ush/preamble.sh" cd $DATA -export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_post.sh} +export POSTGPSH=${POSTGPSH:-${USHgfs}/gfs_post.sh} export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh} export GFSDWNSH=${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh} export TRIMRH=${TRIMRH:-$USHgfs/trim_rh.sh} From 6f870e2c15c38745d07a7e7a0bc6d5299b9c9d11 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 15:43:24 +0000 Subject: [PATCH 03/13] Linter corrections for post j-job --- jobs/JGLOBAL_ATMOS_POST | 58 +++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/jobs/JGLOBAL_ATMOS_POST b/jobs/JGLOBAL_ATMOS_POST index 3d10b0f2507..bc6b83b6a5b 100755 --- a/jobs/JGLOBAL_ATMOS_POST +++ b/jobs/JGLOBAL_ATMOS_POST @@ -1,6 +1,7 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +# shellcheck source=ush/preamble.sh +source "${HOMEgfs:?}/ush/preamble.sh" export RUN_ENVIR=${RUN_ENVIR:-"nco"} @@ -8,40 +9,43 @@ export RUN_ENVIR=${RUN_ENVIR:-"nco"} # Source relevant config files ############################# configs="base post" -export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} -config_path=${EXPDIR:-$PACKAGEROOT/gfs.${gfs_ver}/parm/config} -for config in $configs; do +export EXPDIR=${EXPDIR:-${HOMEgfs}/parm/config} +config_path=${EXPDIR:-${PACKAGEROOT}/gfs.${gfs_ver}/parm/config} +for config in ${configs}; do # shellcheck source-path=parm/config - . $config_path/config.$config + . "${config_path}/config.${config}" status=$? - [[ $status -ne 0 ]] && exit $status + (( status != 0 )) && exit "${status}" done ########################################## # Source machine runtime environment ########################################## -. $HOMEgfs/env/${machine}.env post +# shellcheck source-path=env +. ${HOMEgfs}/env/${machine}.env post status=$? -[[ $status -ne 0 ]] && exit $status +(( status != 0 )) && exit "${status}" ############################################## # Obtain unique process id (pid) and make temp directory ############################################## export pid=${pid:-$$} -export outid=${outid:-"LL$job"} +export outid=${outid:-"LL${job}"} export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA +mkdir -p "${DATA}" +cd "${DATA}" || exit 1 ############################################## # Run setpdy and initialize PDY variables ############################################## -export cycle="t${cyc}z" +export cycle="t${cyc:?}z" setpdy.sh +# shellcheck disable=SC1091 . ./PDY +# shellcheck disable= ############################################## @@ -69,22 +73,24 @@ export COMPONENT=${COMPONENT:-atmos} ############################################## # Begin JOB SPECIFIC work ############################################## -export APRUNP=${APRUN:-$APRUN_NP} +export APRUNP=${APRUN:-${APRUN_NP}} export RERUN=${RERUN:-NO} export HOMECRTM=${HOMECRTM:-${PACKAGEROOT:?}/lib/crtm/${crtm_ver:?}} export FIXCRTM=${CRTM_FIX:-${HOMECRTM}/fix} -export PARMpost=${PARMpost:-$HOMEgfs/parm/post} +export PARMpost=${PARMpost:-${HOMEgfs}/parm/post} export INLINE_POST=${WRITE_DOPOST:-".false."} -export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} -export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} +export COMIN=${COMIN:-${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT}} +export COMOUT=${COMOUT:-${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT}} -[[ ! -d $COMOUT ]] && mkdir -m 775 -p $COMOUT +# shellcheck disable=SC2174 +[[ ! -d "${COMOUT}" ]] && mkdir -m 775 -p "${COMOUT}" +# shellcheck disable= -if [ $RUN = gfs ];then +if [ "${RUN}" = gfs ];then export FHOUT_PGB=${FHOUT_GFS:-3} #Output frequency of gfs pgb file at 1.0 and 0.5 deg. fi -if [ $RUN = gdas ]; then +if [ "${RUN}" = gdas ]; then export IGEN_GFS="gfs_avn" export IGEN_ANL="anal_gfs" export IGEN_FCST="gfs_avn" @@ -92,7 +98,7 @@ if [ $RUN = gdas ]; then export FHOUT_PGB=${FHOUT:-1} #Output frequency of gfs pgb file at 1.0 and 0.5 deg. fi -if [ $GRIBVERSION = grib2 ]; then +if [ "${GRIBVERSION:?}" = grib2 ]; then export IGEN_ANL="anal_gfs" export IGEN_FCST="gfs_avn" export IGEN_GFS="gfs_avn" @@ -101,7 +107,7 @@ fi ####################################### # Specify Restart File Name to Key Off ####################################### -export restart_file=$COMIN/${RUN}.t${cyc}z.logf +export restart_file=${COMIN}/${RUN}.t${cyc}z.logf #################################### # Specify Timeout Behavior of Post @@ -120,7 +126,7 @@ export SLEEP_INT=5 "${SCRgfs}/ex${RUN}_atmos_post.sh" status=$? -[[ $status -ne 0 ]] && exit $status +(( status != 0 )) && exit "${status}" ############################################## # End JOB SPECIFIC work @@ -129,15 +135,15 @@ status=$? ############################################## # Final processing ############################################## -if [ -e "$pgmout" ]; then - cat $pgmout +if [ -e "${pgmout}" ]; then + cat "${pgmout}" fi ########################################## # Remove the Temporary working directory ########################################## -cd $DATAROOT -[[ $KEEPDATA = "NO" ]] && rm -rf $DATA +cd "${DATAROOT}" || exit 1 +[[ "${KEEPDATA:-NO}" = "NO" ]] && rm -rf "${DATA}" exit 0 From 8ed0dfbdf0ccb02e2444f3b9fec887c8aa0c67d9 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 16:50:24 +0000 Subject: [PATCH 04/13] Linter corrections for gdas post exscript --- jobs/JGLOBAL_ATMOS_POST | 4 +- scripts/exgdas_atmos_post.sh | 213 ++++++++++++++++++----------------- 2 files changed, 109 insertions(+), 108 deletions(-) diff --git a/jobs/JGLOBAL_ATMOS_POST b/jobs/JGLOBAL_ATMOS_POST index bc6b83b6a5b..004afd6e86f 100755 --- a/jobs/JGLOBAL_ATMOS_POST +++ b/jobs/JGLOBAL_ATMOS_POST @@ -23,7 +23,7 @@ done # Source machine runtime environment ########################################## # shellcheck source-path=env -. ${HOMEgfs}/env/${machine}.env post +. "${HOMEgfs}/env/${machine:?}.env" post status=$? (( status != 0 )) && exit "${status}" @@ -124,7 +124,7 @@ export SLEEP_INT=5 ############################################################### # Run relevant exglobal script -"${SCRgfs}/ex${RUN}_atmos_post.sh" +"${SCRgfs:?}/ex${RUN}_atmos_post.sh" status=$? (( status != 0 )) && exit "${status}" diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index 818480ff41f..7f056d5bfbe 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -24,15 +24,16 @@ # echo "-----------------------------------------------------" ##################################################################### -source "$HOMEgfs/ush/preamble.sh" +# shellcheck source=ush/preamble.sh +source "${HOMEgfs:?}/ush/preamble.sh" -cd $DATA +cd "${DATA:?}" || exit 1 export POSTGPSH=${POSTGPSH:-${USHgfs}/gfs_post.sh} -export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh} -export GFSDWNSH=${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh} -export TRIMRH=${TRIMRH:-$USHgfs/trim_rh.sh} -export MODICEC=${MODICEC:-$USHgfs/mod_icec.sh} +export GFSDOWNSH=${GFSDOWNSH:-${USHgfs}/fv3gfs_downstream_nems.sh} +export GFSDWNSH=${GFSDWNSH:-${USHgfs}/fv3gfs_dwn_nems.sh} +export TRIMRH=${TRIMRH:-${USHgfs}/trim_rh.sh} +export MODICEC=${MODICEC:-${USHgfs}/mod_icec.sh} export INLINE_POST=${INLINE_POST:-".false."} ############################################################ @@ -52,8 +53,8 @@ export OUTTYP=${OUTTYP:-4} export OUTPUT_FILE=${OUTPUT_FILE:-"nemsio"} export TCYC=${TCYC:-".t${cyc}z."} export PREFIX=${PREFIX:-${RUN}${TCYC}} -if [ $OUTTYP -eq 4 ] ; then - if [ $OUTPUT_FILE = "netcdf" ]; then +if (( OUTTYP == 4 )) ; then + if [ "${OUTPUT_FILE}" = "netcdf" ]; then export SUFFIX=".nc" else export SUFFIX=".nemsio" @@ -77,19 +78,19 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Post Analysis Files before starting the Forecast Post ############################################################ # Chuang: modify to process analysis when post_times is 00 -export stime=$(echo $post_times | cut -c1-3) -if [ $OUTTYP -eq 4 ] ; then - export loganl=$COMIN/${PREFIX}atmanl${SUFFIX} +export stime="$(echo ${post_times:?} | cut -c1-3)" +if (( OUTTYP == 4 )) ; then + export loganl="${COMIN:?}/${PREFIX}atmanl${SUFFIX}" else - export loganl=$COMIN/${PREFIX}sanl + export loganl="${COMIN:?}/${PREFIX}sanl" fi -if [ ${stime} = "anl" ]; then - if [ -f $loganl ]; then +if [ "${stime}" = "anl" ]; then + if [ -f "${loganl}" ]; then # add new environmental variables for running new ncep post # Validation date - export VDATE=${PDY}${cyc} + export VDATE=${PDY:?}${cyc} # set outtyp to 1 because we need to run chgres in the post before model start running chgres # otherwise set to 0, then chgres will not be executed in global_nceppost.sh @@ -100,68 +101,68 @@ if [ ${stime} = "anl" ]; then # if model already runs gfs io, make sure GFSOUT is linked to the gfsio file # new imported variable for global_nceppost.sh - export GFSOUT=${RUN}.${cycle}.gfsioanl + export GFSOUT=${RUN}.${cycle:?}.gfsioanl # specify smaller control file for GDAS because GDAS does not # produce flux file, the default will be /nwprod/parm/gfs_cntrl.parm - if [ $GRIBVERSION = 'grib2' ]; then + if [ "${GRIBVERSION:?}" = 'grib2' ]; then export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} - export PostFlatFile=${PostFlatFile:-$PARMpost/postxconfig-NT-GFS-ANL.txt} - export CTLFILE=$PARMpost/postcntrl_gfs_anl.xml + export PostFlatFile=${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS-ANL.txt} + export CTLFILE=${PARMpost}/postcntrl_gfs_anl.xml fi [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile - if [ $OUTTYP -eq 4 ] ; then - ln -fs $COMIN/${PREFIX}atmanl${SUFFIX} nemsfile + if (( OUTTYP == 4 )) ; then + ln -fs "${COMIN}/${PREFIX}atmanl${SUFFIX}" nemsfile export NEMSINP=nemsfile - ln -fs $COMIN/${PREFIX}sfcanl${SUFFIX} flxfile + ln -fs "${COMIN}/${PREFIX}sfcanl${SUFFIX}" flxfile export FLXINP=flxfile fi export PGBOUT=pgbfile export PGIOUT=pgifile export PGBOUT2=pgbfile.grib2 export PGIOUT2=pgifile.grib2.idx - export IGEN=$IGEN_ANL + export IGEN="${IGEN_ANL:?}" export FILTER=0 # specify fhr even for analysis because postgp uses it # export fhr=00 - $POSTGPSH + ${POSTGPSH} export err=$?; err_chk - if [ $GRIBVERSION = 'grib2' ]; then - mv $PGBOUT $PGBOUT2 + if [ "${GRIBVERSION}" = 'grib2' ]; then + mv "${PGBOUT}" "${PGBOUT2}" #Proces pgb files export FH=-1 export downset=${downset:-1} - $GFSDOWNSH + ${GFSDOWNSH} export err=$?; err_chk export fhr3=anl fi - if [ $SENDCOM = 'YES' ]; then + if [ "${SENDCOM:-YES}" = 'YES' ]; then export fhr3=anl - if [ $GRIBVERSION = 'grib2' ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then MASTERANL=${PREFIX}master.grb2${fhr3} ##########XXW Accord to Boi, fortran index should use *if${fhr}, wgrib index use .idx #MASTERANLIDX=${RUN}.${cycle}.master.grb2${fhr3}.idx MASTERANLIDX=${PREFIX}master.grb2i${fhr3} - cp $PGBOUT2 $COMOUT/${MASTERANL} - $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERANLIDX} + cp "${PGBOUT2}" "${COMOUT:?}/${MASTERANL}" + ${GRB2INDEX:?} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" fi - if [ $SENDDBN = 'YES' ]; then - run=$(echo $RUN | tr '[a-z]' '[A-Z]') - if [ $GRIBVERSION = 'grib2' ]; then - $DBNROOT/bin/dbn_alert MODEL ${run}_MSC_sfcanl $job $COMOUT/${PREFIX}sfc${fhr3}${SUFFIX} - $DBNROOT/bin/dbn_alert MODEL ${run}_SA $job $COMIN/${PREFIX}atm${fhr3}${SUFFIX} - $DBNROOT/bin/dbn_alert MODEL GDAS_PGA_GB2 $job $COMOUT/${PREFIX}pgrb2.1p00.${fhr3} - $DBNROOT/bin/dbn_alert MODEL GDAS_PGA_GB2_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.${fhr3}.idx + if [ "${SENDDBN:-YES}" = 'YES' ]; then + run=$(echo ${RUN} | tr 'a-z' 'A-Z') + if [ "${GRIBVERSION}" = 'grib2' ]; then + "${DBNROOT:?}/bin/dbn_alert" MODEL "${run}_MSC_sfcanl" "${job:?}" "${COMOUT}/${PREFIX}sfc${fhr3}${SUFFIX}" + "${DBNROOT:?}/bin/dbn_alert" MODEL "${run}_SA" "${job:?}" "${COMIN}/${PREFIX}atm${fhr3}${SUFFIX}" + "${DBNROOT:?}/bin/dbn_alert" MODEL "GDAS_PGA_GB2" "${job:?}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}" + "${DBNROOT:?}/bin/dbn_alert" MODEL "GDAS_PGA_GB2_WIDX" "${job:?}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}.idx" fi fi fi @@ -173,32 +174,32 @@ if [ ${stime} = "anl" ]; then err_chk fi else ## not_anl if_stimes - SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) + SLEEP_LOOP_MAX=$(( ${SLEEP_TIME:?} / ${SLEEP_INT:?} )) ############################################################ # Loop Through the Post Forecast Files ############################################################ - for fhr in $post_times; do + for fhr in ${post_times}; do ############################### # Start Looping for the # existence of the restart files ############################### export pgm="postcheck" ic=1 - while [ $ic -le $SLEEP_LOOP_MAX ]; do - if [ -f ${restart_file}${fhr}.txt ]; then + while (( ic <= SLEEP_LOOP_MAX )); do + if [ -f "${restart_file:?}${fhr}.txt" ]; then break else - ic=$(expr $ic + 1) - sleep $SLEEP_INT + ic=$(( ic + 1 )) + sleep "${SLEEP_INT}" fi ############################### # If we reach this point assume # fcst job never reached restart # period and error exit ############################### - if [ $ic -eq $SLEEP_LOOP_MAX ]; then + if (( ic == SLEEP_LOOP_MAX )); then echo " *** FATAL ERROR: No model output in nemsio for f${fhr} " export err=9 err_chk @@ -211,51 +212,51 @@ else ## not_anl if_stimes ############################### [[ -f flxfile ]] && rm flxfile [[ -f nemsfile ]] && rm nemsfile - if [ $OUTTYP -eq 4 ] ; then - ln -sf $COMIN/${PREFIX}atmf$fhr${SUFFIX} nemsfile + if (( OUTTYP == 4 )) ; then + ln -sf "${COMIN}/${PREFIX}atmf$fhr${SUFFIX}" nemsfile export NEMSINP=nemsfile - ln -sf $COMIN/${PREFIX}sfcf$fhr${SUFFIX} flxfile + ln -sf "${COMIN}/${PREFIX}sfcf$fhr${SUFFIX}" flxfile export FLXINP=flxfile fi - if [ $fhr -gt 0 ]; then - export IGEN=$IGEN_FCST + if (( fhr > 0 )); then + export IGEN=${IGEN_FCST:?} else - export IGEN=$IGEN_ANL + export IGEN=${IGEN_ANL:?} fi # add new environmental variables for running new ncep post # Validation date - export VDATE=$(${NDATE} +${fhr} ${PDY}${cyc}) + export VDATE="$(${NDATE:?} "+${fhr}" "${PDY}${cyc}")" # set to 3 to output lat/lon grid export OUTTYP=${OUTTYP:-4} - if [ $GRIBVERSION = 'grib2' ]; then - export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} - export PostFlatFile=$PARMpost/postxconfig-NT-GFS.txt - if [ $RUN = gfs ]; then - export IGEN=$IGEN_GFS - if [ $fhr -gt 0 ]; then export IGEN=$IGEN_FCST ; fi + if [ "${GRIBVERSION}" = 'grib2' ]; then + export POSTGRB2TBL="${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new}" + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS.txt" + if [ "${RUN}" = gfs ]; then + export IGEN="${IGEN_GFS:?}" + if (( fhr > 0 )); then export IGEN="${IGEN_FCST}" ; fi else - export IGEN=$IGEN_GDAS_ANL - if [ $fhr -gt 0 ]; then export IGEN=$IGEN_FCST ; fi + export IGEN="${IGEN_GDAS_ANL:?}" + if (( fhr > 0 )); then export IGEN="${IGEN_FCST}" ; fi fi - if [[ $RUN = gfs ]]; then - if [ $fhr -eq 0 ]; then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-F00.txt - export CTLFILE=$PARMpost/postcntrl_gfs_f00.xml + if [[ "${RUN}" = gfs ]]; then + if (( fhr == 0 )); then + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-F00.txt" + export CTLFILE="${PARMpost}/postcntrl_gfs_f00.xml" else - export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs.xml} + export CTLFILE="${CTLFILEGFS:-${PARMpost}/postcntrl_gfs.xml}" fi else - if [ $fhr -eq 0 ]; then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-F00.txt - export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs_f00.xml} + if (( fhr == 0 )); then + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-F00.txt" + export CTLFILE="${CTLFILEGFS:-${PARMpost}/postcntrl_gfs_f00.xml}" else - export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs.xml} + export CTLFILE="${CTLFILEGFS:-${PARMpost}/postcntrl_gfs.xml}" fi fi fi @@ -266,77 +267,77 @@ else ## not_anl if_stimes export PGBOUT2=pgbfile.grib2 export PGIOUT2=pgifile.grib2.idx export FILTER=0 - export fhr3=$fhr - if [ $GRIBVERSION = 'grib2' ]; then + export fhr3=${fhr} + if [ "${GRIBVERSION}" = 'grib2' ]; then MASTERFHR=${PREFIX}master.grb2f${fhr} MASTERFHRIDX=${PREFIX}master.grb2if${fhr} fi - if [ $INLINE_POST = ".false." ]; then - $POSTGPSH + if [ "${INLINE_POST}" = ".false." ]; then + ${POSTGPSH} else - cp $COMOUT/${MASTERFHR} $PGBOUT + cp "${COMOUT}/${MASTERFHR}" "${PGBOUT}" fi export err=$?; err_chk - if [ $GRIBVERSION = 'grib2' ]; then - mv $PGBOUT $PGBOUT2 + if [ "${GRIBVERSION}" = 'grib2' ]; then + mv "${PGBOUT}" "${PGBOUT2}" fi #wm Process pgb files - export FH=$(expr $fhr + 0) + export FH=$(( fhr + 0 )) export downset=${downset:-1} - $GFSDOWNSH + ${GFSDOWNSH} export err=$?; err_chk - if [ $SENDDBN = YES ]; then - run=$(echo $RUN | tr '[a-z]' '[A-Z]') - $DBNROOT/bin/dbn_alert MODEL ${run}_PGB2_0P25 $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr} - $DBNROOT/bin/dbn_alert MODEL ${run}_PGB2_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr}.idx - $DBNROOT/bin/dbn_alert MODEL ${run}_PGB_GB2 $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr} - $DBNROOT/bin/dbn_alert MODEL ${run}_PGB_GB2_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr}.idx + if [ "${SENDDBN}" = YES ]; then + run=$(echo ${RUN} | tr 'a-z' 'A-Z') + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25" "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25_WIDX ""${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2_WIDX" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}.idx" fi - if [ $SENDCOM = 'YES' ]; then - if [ $GRIBVERSION = 'grib2' ] ; then - if [ $INLINE_POST = ".false." ]; then - cp $PGBOUT2 $COMOUT/${MASTERFHR} + if [ "${SENDCOM}" = 'YES' ]; then + if [ "${GRIBVERSION}" = 'grib2' ] ; then + if [ "${INLINE_POST}" = ".false." ]; then + cp "${PGBOUT2}" "${COMOUT}/${MASTERFHR}" fi - $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERFHRIDX} + ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERFHRIDX}" fi # Model generated flux files will be in nemsio after FY17 upgrade # use post to generate Grib2 flux files - if [ $OUTTYP -eq 4 ] ; then - export NEMSINP=$COMIN/${PREFIX}atmf${fhr}${SUFFIX} - export FLXINP=$COMIN/${PREFIX}sfcf${fhr}${SUFFIX} - if [ $fhr -eq 0 ]; then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX-F00.txt - export CTLFILE=$PARMpost/postcntrl_gfs_flux_f00.xml + if (( OUTTYP == 4 )) ; then + export NEMSINP=${COMIN}/${PREFIX}atmf${fhr}${SUFFIX} + export FLXINP=${COMIN}/${PREFIX}sfcf${fhr}${SUFFIX} + if (( fhr == 0 )); then + export PostFlatFile=${PARMpost}/postxconfig-NT-GFS-FLUX-F00.txt + export CTLFILE=${PARMpost}/postcntrl_gfs_flux_f00.xml else - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX.txt - export CTLFILE=$PARMpost/postcntrl_gfs_flux.xml + export PostFlatFile=${PARMpost}/postxconfig-NT-GFS-FLUX.txt + export CTLFILE=${PARMpost}/postcntrl_gfs_flux.xml fi export PGBOUT=fluxfile export FILTER=0 FLUXFL=${PREFIX}sfluxgrbf${fhr}.grib2 FLUXFLIDX=${PREFIX}sfluxgrbf${fhr}.grib2.idx - if [ $INLINE_POST = ".false." ]; then - $POSTGPSH + if [ "${INLINE_POST}" = ".false." ]; then + ${POSTGPSH} export err=$?; err_chk - mv fluxfile $COMOUT/${FLUXFL} + mv fluxfile "${COMOUT}/${FLUXFL}" fi - $WGRIB2 -s $COMOUT/${FLUXFL} > $COMOUT/${FLUXFLIDX} + ${WGRIB2:?} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}" fi - if [ "$SENDDBN" = 'YES' -a \( "$RUN" = 'gdas' \) -a $(expr $fhr % 3) -eq 0 ]; then - $DBNROOT/bin/dbn_alert MODEL ${run}_SF $job $COMOUT/${PREFIX}atmf${fhr}${SUFFIX} - $DBNROOT/bin/dbn_alert MODEL ${run}_BF $job $COMOUT/${PREFIX}sfcf${fhr}${SUFFIX} - $DBNROOT/bin/dbn_alert MODEL ${run}_SGB_GB2 $job $COMOUT/${PREFIX}sfluxgrbf${fhr}.grib2 - $DBNROOT/bin/dbn_alert MODEL ${run}_SGB_GB2_WIDX $job $COMOUT/${PREFIX}sfluxgrbf${fhr}.grib2.idx + if [ "${SENDDBN}" = 'YES' ] -a [ "${RUN}" = 'gdas' ] -a (( fhr % 3 == 0 )); then + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SF" "${job}" "${COMOUT}/${PREFIX}atmf${fhr}${SUFFIX}" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_BF" "${job}" "${COMOUT}/${PREFIX}sfcf${fhr}${SUFFIX}" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SGB_GB2" "${job}" "${COMOUT}/${PREFIX}sfluxgrbf${fhr}.grib2" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SGB_GB2_WIDX ""${job}" "${COMOUT}/${PREFIX}sfluxgrbf${fhr}.grib2.idx" fi fi From 137463f74c1d85d1748aafa39a4d9fc84fdcd3d0 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 18:06:00 +0000 Subject: [PATCH 05/13] Linter corrections for gfs post exscript --- scripts/exgdas_atmos_post.sh | 6 +- scripts/exgfs_atmos_post.sh | 359 +++++++++++++++++------------------ 2 files changed, 182 insertions(+), 183 deletions(-) diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index 7f056d5bfbe..cb6b55a6218 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -78,7 +78,7 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Post Analysis Files before starting the Forecast Post ############################################################ # Chuang: modify to process analysis when post_times is 00 -export stime="$(echo ${post_times:?} | cut -c1-3)" +export stime="$(echo "${post_times:?}" | cut -c1-3)" if (( OUTTYP == 4 )) ; then export loganl="${COMIN:?}/${PREFIX}atmanl${SUFFIX}" else @@ -300,7 +300,7 @@ else ## not_anl if_stimes if [ "${SENDCOM}" = 'YES' ]; then - if [ "${GRIBVERSION}" = 'grib2' ] ; then + if [ "${GRIBVERSION}" = 'grib2' ]; then if [ "${INLINE_POST}" = ".false." ]; then cp "${PGBOUT2}" "${COMOUT}/${MASTERFHR}" fi @@ -333,7 +333,7 @@ else ## not_anl if_stimes ${WGRIB2:?} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}" fi - if [ "${SENDDBN}" = 'YES' ] -a [ "${RUN}" = 'gdas' ] -a (( fhr % 3 == 0 )); then + if [ "${SENDDBN}" = 'YES' ] && [ "${RUN}" = 'gdas' ] && (( fhr % 3 == 0 )); then "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SF" "${job}" "${COMOUT}/${PREFIX}atmf${fhr}${SUFFIX}" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_BF" "${job}" "${COMOUT}/${PREFIX}sfcf${fhr}${SUFFIX}" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SGB_GB2" "${job}" "${COMOUT}/${PREFIX}sfluxgrbf${fhr}.grib2" diff --git a/scripts/exgfs_atmos_post.sh b/scripts/exgfs_atmos_post.sh index 92bb8b5463a..d88f2f241f3 100755 --- a/scripts/exgfs_atmos_post.sh +++ b/scripts/exgfs_atmos_post.sh @@ -36,17 +36,17 @@ # echo "-----------------------------------------------------" ##################################################################### -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs:?}/ush/preamble.sh" -cd $DATA +cd "${DATA:?}" || exit 1 # specify model output format type: 4 for nemsio, 3 for sigio -export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_post.sh} -export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh} -export GFSDOWNSHF=${GFSDOWNSHF:-$USHgfs/inter_flux.sh} -export GFSDWNSH=${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh} -export TRIMRH=${TRIMRH:-$USHgfs/trim_rh.sh} -export MODICEC=${MODICEC:-$USHgfs/mod_icec.sh} +export POSTGPSH=${POSTGPSH:-${USHgfs}/gfs_post.sh} +export GFSDOWNSH=${GFSDOWNSH:-${USHgfs}/fv3gfs_downstream_nems.sh} +export GFSDOWNSHF=${GFSDOWNSHF:-${USHgfs}/inter_flux.sh} +export GFSDWNSH=${GFSDWNSH:-${USHgfs}/fv3gfs_dwn_nems.sh} +export TRIMRH=${TRIMRH:-${USHgfs}/trim_rh.sh} +export MODICEC=${MODICEC:-${USHgfs}/mod_icec.sh} export INLINE_POST=${INLINE_POST:-".false."} ############################################################ @@ -68,8 +68,8 @@ export PGBF=${PGBF:-"YES"} export TCYC=${TCYC:-".t${cyc}z."} export OUTPUT_FILE=${OUTPUT_FILE:-"nemsio"} export PREFIX=${PREFIX:-${RUN}${TCYC}} -if [ $OUTTYP -eq 4 ]; then - if [ $OUTPUT_FILE = "netcdf" ]; then +if (( OUTTYP == 4 )); then + if [ "${OUTPUT_FILE}" = "netcdf" ]; then export SUFFIX=".nc" else export SUFFIX=".nemsio" @@ -77,7 +77,7 @@ if [ $OUTTYP -eq 4 ]; then else export SUFFIX= fi -export machine=${machine:-WCOSS_C} +export machine=${machine:-WCOSS2} ########################### # Specify Output layers @@ -93,18 +93,18 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Post Analysis Files before starting the Forecast Post ############################################################ # Process analysis when post_times is 00 -export stime=$(echo $post_times | cut -c1-3) -if [ $OUTTYP -eq 4 ]; then - export loganl=$COMIN/${PREFIX}atmanl${SUFFIX} +export stime="$(echo ${post_times:?} | cut -c1-3)" +if (( OUTTYP == 4 )); then + export loganl="${COMIN:?}/${PREFIX}atmanl${SUFFIX}" else - export loganl=$COMIN/${PREFIX}sanl + export loganl="${COMIN:?}/${PREFIX}sanl" fi -if [ ${stime} = "anl" ]; then - if [ -f $loganl ]; then +if [ "${stime}" = "anl" ]; then + if [ -f "${loganl}" ]; then # add new environmental variables for running new ncep post # Validation date - export VDATE=${PDY}${cyc} + export VDATE=${PDY:?}${cyc} # specify output file name from chgres which is input file name to nceppost # if model already runs gfs io, make sure GFSOUT is linked to the gfsio file # new imported variable for global_nceppost.sh @@ -112,18 +112,18 @@ if [ ${stime} = "anl" ]; then # specify smaller control file for GDAS because GDAS does not # produce flux file, the default will be /nwprod/parm/gfs_cntrl.parm - if [ $GRIBVERSION = 'grib2' ]; then + if [ "${GRIBVERSION:?}" = 'grib2' ]; then # use grib2 nomonic table in product g2tmpl directory as default export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} - export PostFlatFile=${PostFlatFile:-$PARMpost/postxconfig-NT-GFS-ANL.txt} - export CTLFILE=$PARMpost/postcntrl_gfs_anl.xml + export PostFlatFile=${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS-ANL.txt} + export CTLFILE=${PARMpost}/postcntrl_gfs_anl.xml fi [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile - if [ $OUTTYP -eq 4 ]; then - ln -fs $COMIN/${PREFIX}atmanl${SUFFIX} nemsfile + if (( OUTTYP == 4 )); then + ln -fs "${COMIN}/${PREFIX}atmanl${SUFFIX}" nemsfile export NEMSINP=nemsfile - ln -fs $COMIN/${PREFIX}sfcanl${SUFFIX} flxfile + ln -fs "${COMIN}/${PREFIX}sfcanl${SUFFIX}" flxfile export FLXINP=flxfile fi @@ -131,52 +131,51 @@ if [ ${stime} = "anl" ]; then export PGIOUT=pgifile export PGBOUT2=pgbfile.grib2 export PGIOUT2=pgifile.grib2.idx - export IGEN=$IGEN_ANL + export IGEN=${IGEN_ANL:?} export FILTER=0 - $POSTGPSH + ${POSTGPSH} export err=$?; err_chk - if [ $GRIBVERSION = 'grib2' ]; then - mv $PGBOUT $PGBOUT2 + if [ "${GRIBVERSION}" = 'grib2' ]; then + mv "${PGBOUT}" "${PGBOUT2}" fi # Process pgb files - if [ "$PGBF" = 'YES' ]; then + if [ "${PGBF}" = 'YES' ]; then export FH=-1 export downset=${downset:-2} - $GFSDOWNSH + ${GFSDOWNSH} export err=$?; err_chk fi - if [ "$SENDCOM" = 'YES' ]; then + if [ "${SENDCOM:-YES}" = 'YES' ]; then export fhr3=anl - if [ $GRIBVERSION = 'grib2' ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then MASTERANL=${PREFIX}master.grb2${fhr3} MASTERANLIDX=${PREFIX}master.grb2i${fhr3} - cp $PGBOUT2 $COMOUT/${MASTERANL} - $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERANLIDX} + cp "${PGBOUT2}" "${COMOUT:?}/${MASTERANL}" + ${GRB2INDEX:?} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" fi - if [ "$SENDDBN" = 'YES' ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_MSC_sfcanl $job $COMOUT/${PREFIX}sfcanl${SUFFIX} - $DBNROOT/bin/dbn_alert MODEL GFS_SA $job $COMOUT/${PREFIX}atmanl${SUFFIX} - #alert removed in v15.0 $DBNROOT/bin/dbn_alert MODEL GFS_MASTER $job $COMOUT/${MASTERANL} + if [ "${SENDDBN:-YES}" = 'YES' ]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_MSC_sfcanl "${job}" "${COMOUT}/${PREFIX}sfcanl${SUFFIX}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SA "${job}" "${COMOUT}/${PREFIX}atmanl${SUFFIX}" if [ "$PGBF" = 'YES' ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25 $job $COMOUT/${PREFIX}pgrb2.0p25.anl - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2.0p25.anl.idx - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25 $job $COMOUT/${PREFIX}pgrb2b.0p25.anl - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p25.anl.idx - - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5 $job $COMOUT/${PREFIX}pgrb2.0p50.anl - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2.0p50.anl.idx - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5 $job $COMOUT/${PREFIX}pgrb2b.0p50.anl - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p50.anl.idx - - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0 $job $COMOUT/${PREFIX}pgrb2.1p00.anl - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.anl.idx - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0 $job $COMOUT/${PREFIX}pgrb2b.1p00.anl - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2b.1p00.anl.idx + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.anl.idx" + + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.anl.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.anl.idx" + + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.anl.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.anl.idx" fi fi fi @@ -185,39 +184,39 @@ if [ ${stime} = "anl" ]; then ########################## WAFS U/V/T analysis start ########################## # U/V/T on ICAO standard atmospheric pressure levels for WAFS verification - if [ $WAFSF = "YES" ]; then - if [[ $RUN = gfs && $GRIBVERSION = 'grib2' ]]; then + if [ "${WAFSF}" = "YES" ]; then + if [[ "${RUN}" = gfs && "${GRIBVERSION}" = 'grib2' ]]; then export OUTTYP=${OUTTYP:-4} - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-WAFS-ANL.txt - export CTLFILE=$PARMpost/postcntrl_gfs_wafs_anl.xml + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-WAFS-ANL.txt" + export CTLFILE="${PARMpost}/postcntrl_gfs_wafs_anl.xml" export PGBOUT=wafsfile export PGIOUT=wafsifile $POSTGPSH export err=$? - if [ $err -ne 0 ]; then + if (( err != 0 )); then echo " *** GFS POST WARNING: WAFS output failed for analysis, err=$err" else # WAFS package doesn't process this part. # 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 \ + ${WGRIB2:?} "${PGBOUT}" -set_grib_type same -new_grid_winds earth \ -new_grid_interpolation bilinear -set_bitmap 1 \ - -new_grid $wafsgrid ${PGBOUT}.tmp + -new_grid "${wafsgrid}" "${PGBOUT}.tmp" - if [ $SENDCOM = "YES" ]; then - cp ${PGBOUT}.tmp $COMOUT/${PREFIX}wafs.0p25.anl - $WGRIB2 -s ${PGBOUT}.tmp > $COMOUT/${PREFIX}wafs.0p25.anl.idx + if [ "${SENDCOM}" = "YES" ]; then + cp "${PGBOUT}.tmp" "${COMOUT}/${PREFIX}wafs.0p25.anl" + ${WGRIB2} -s "${PGBOUT}.tmp" > "${COMOUT}/${PREFIX}wafs.0p25.anl.idx" # if [ $SENDDBN = YES ]; then # $DBNROOT/bin/dbn_alert MODEL GFS_WAFS_GB2 $job $COMOUT/${PREFIX}wafs.0p25.anl # $DBNROOT/bin/dbn_alert MODEL GFS_WAFS_GB2__WIDX $job $COMOUT/${PREFIX}wafs.0p25.anl.idx # fi fi - rm $PGBOUT ${PGBOUT}.tmp + rm "${PGBOUT}" "${PGBOUT}.tmp" fi fi fi @@ -229,33 +228,33 @@ if [ ${stime} = "anl" ]; then err_chk fi else ## not_anl if_stime - SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) + SLEEP_LOOP_MAX=$(( ${SLEEP_TIME:?} / ${SLEEP_INT:?} )) ############################################################ # Loop Through the Post Forecast Files ############################################################ - for fhr in $post_times; do - echo 'Start processing fhr='$post_times + for fhr in ${post_times}; do + echo "Start processing fhr=${post_times}" ############################### # Start Looping for the # existence of the restart files ############################### export pgm="postcheck" ic=1 - while [ $ic -le $SLEEP_LOOP_MAX ]; do - if [ -f $restart_file${fhr}.txt ]; then + while (( ic <= SLEEP_LOOP_MAX )); do + if [ -f "${restart_file:?}${fhr}.txt" ]; then break else - ic=$(expr $ic + 1) - sleep $SLEEP_INT + ic=$(( ic + 1 )) + sleep ${SLEEP_INT} fi ############################### # If we reach this point assume # fcst job never reached restart # period and error exit ############################### - if [ $ic -eq $SLEEP_LOOP_MAX ]; then + if (( ic == SLEEP_LOOP_MAX )); then echo " *** FATAL ERROR: No model output in nemsio for f${fhr} " export err=9 err_chk @@ -267,47 +266,47 @@ else ## not_anl if_stime # for backup to start Model Fcst ############################### [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile - if [ $OUTTYP -eq 4 ]; then - ln -fs $COMIN/${PREFIX}atmf${fhr}${SUFFIX} nemsfile + if (( OUTTYP == 4 )); then + ln -fs "${COMIN}/${PREFIX}atmf${fhr}${SUFFIX}" nemsfile export NEMSINP=nemsfile - ln -fs $COMIN/${PREFIX}sfcf${fhr}${SUFFIX} flxfile + ln -fs "${COMIN}/${PREFIX}sfcf${fhr}${SUFFIX}" flxfile export FLXINP=flxfile fi - if [ $fhr -gt 0 ]; then - export IGEN=$IGEN_FCST + if (( fhr > 0 )); then + export IGEN=${IGEN_FCST:?} else - export IGEN=$IGEN_ANL + export IGEN=${IGEN_ANL} fi - export VDATE=$(${NDATE} +${fhr} ${PDY}${cyc}) + export VDATE=$(${NDATE:?} +${fhr} "${PDY}${cyc}") export OUTTYP=${OUTTYP:-4} - export GFSOUT=${PREFIX}gfsio${fhr} + export GFSOUT="${PREFIX}gfsio${fhr}" if [ $GRIBVERSION = 'grib2' ]; then - export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} - export PostFlatFile=${PostFlatFile:-$PARMpost/postxconfig-NT-GFS.txt} + export POSTGRB2TBL="${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new}" + export PostFlatFile="${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS.txt}" - if [ $RUN = gfs ]; then - export IGEN=$IGEN_GFS - if [ $fhr -gt 0 ]; then export IGEN=$IGEN_FCST ; fi + if [ "${RUN}" = "gfs" ]; then + export IGEN=${IGEN_GFS:?} + if (( fhr > 0 )); then export IGEN=${IGEN_FCST} ; fi else - export IGEN=$IGEN_GDAS_ANL - if [ $fhr -gt 0 ]; then export IGEN=$IGEN_FCST ; fi + export IGEN=${IGEN_GDAS_ANL:?} + if (( fhr > 0 )); then export IGEN=${IGEN_FCST} ; fi fi - if [[ $RUN = gfs ]]; then - if [ $fhr -eq 0 ]; then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-F00.txt - export CTLFILE=$PARMpost/postcntrl_gfs_f00.xml + if [[ "${RUN}" = "gfs" ]]; then + if (( fhr == 0 )); then + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-F00.txt" + export CTLFILE="${PARMpost}/postcntrl_gfs_f00.xml" else - export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs.xml} + export CTLFILE="${CTLFILEGFS:-${PARMpost}/postcntrl_gfs.xml}" fi else - if [ $fhr -eq 0 ]; then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-F00.txt - export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs_f00.xml} + if (( fhr == 0 )); then + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-F00.txt" + export CTLFILE="${CTLFILEGFS:-${PARMpost}/postcntrl_gfs_f00.xml}" else - export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs.xml} + export CTLFILE="${CTLFILEGFS:-${PARMpost}/postcntrl_gfs.xml}" fi fi fi @@ -318,78 +317,78 @@ else ## not_anl if_stime export PGBOUT2=pgbfile.grib2 export PGIOUT2=pgifile.grib2.idx export FILTER=0 - if [ $GRIBVERSION = 'grib2' ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then MASTERFL=${PREFIX}master.grb2f${fhr} MASTERFLIDX=${PREFIX}master.grb2if${fhr} fi - if [ $INLINE_POST = ".false." ]; then - $POSTGPSH + if [ "${INLINE_POST}" = ".false." ]; then + ${POSTGPSH} else - cp -p $COMOUT/${MASTERFL} $PGBOUT + cp -p "${COMOUT}/${MASTERFL}" "${PGBOUT}" fi export err=$?; err_chk - if [ $GRIBVERSION = 'grib2' ]; then - mv $PGBOUT $PGBOUT2 + if [ "${GRIBVERSION}" = 'grib2' ]; then + mv "${PGBOUT}" "${PGBOUT2}" fi # Process pgb files - if [ "$PGBF" = 'YES' ]; then - export FH=$(expr $fhr + 0) + if [ "${PGBF}" = 'YES' ]; then + export FH=$(( fhr + 0 )) export downset=${downset:-2} - $GFSDOWNSH + ${GFSDOWNSH} export err=$?; err_chk fi - if [ $SENDCOM = "YES" ]; then - if [ $GRIBVERSION = 'grib2' ]; then - if [ $INLINE_POST = ".false." ]; then - cp $PGBOUT2 $COMOUT/${MASTERFL} + if [ "${SENDCOM}" = "YES" ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then + if [ "${INLINE_POST}" = ".false." ]; then + cp "${PGBOUT2}" "${COMOUT}/${MASTERFL}" fi - $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERFLIDX} + ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERFLIDX}" fi - if [ "$SENDDBN" = 'YES' ]; then - if [ $GRIBVERSION = 'grib2' ]; then - if [ "$PGBF" = 'YES' ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25 $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr} - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr}.idx - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25 $job $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr} - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr}.idx - - if [ -s $COMOUT/${PREFIX}pgrb2.0p50.f${fhr} ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5 $job $COMOUT/${PREFIX}pgrb2.0p50.f${fhr} - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2.0p50.f${fhr}.idx - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5 $job $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr} - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr}.idx + if [ "${SENDDBN}" = 'YES' ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then + if [ "${PGBF}" = 'YES' ]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.f${fhr}.idx" + + if [ -s "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}" ]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.f${fhr}.idx" fi - if [ -s $COMOUT/${PREFIX}pgrb2.1p00.f${fhr} ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0 $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr} - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr}.idx - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0 $job $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr} - $DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr}.idx + if [ -s "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" ]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.f${fhr}.idx" fi fi fi fi export fhr - $USHgfs/gfs_transfer.sh + "${USHgfs}/gfs_transfer.sh" fi [[ -f pgbfile.grib2 ]] && rm pgbfile.grib2 # use post to generate GFS Grib2 Flux file as model generated Flux file # will be in nemsio format after FY17 upgrade. - if [ $OUTTYP -eq 4 -a $FLXF = "YES" ]; then - if [ $fhr -eq 0 ]; then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX-F00.txt - export CTLFILE=$PARMpost/postcntrl_gfs_flux_f00.xml + if (( OUTTYP == 4 )) && [[ "${FLXF}" == "YES" ]]; then + if (( fhr == 0 )); then + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-FLUX-F00.txt" + export CTLFILE="${PARMpost}/postcntrl_gfs_flux_f00.xml" else - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX.txt - export CTLFILE=$PARMpost/postcntrl_gfs_flux.xml + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-FLUX.txt" + export CTLFILE="${PARMpost}/postcntrl_gfs_flux.xml" fi export PGBOUT=fluxfile export FILTER=0 @@ -398,43 +397,43 @@ else ## not_anl if_stime #Add extra flux.1p00 file for coupled if [ "$FLXGF" = 'YES' ]; then - export FH=$(expr $fhr + 0) - $GFSDOWNSHF + export FH=$(( fhr + 0 )) + ${GFSDOWNSHF} export err=$?; err_chk fi - if [ $INLINE_POST = ".false." ]; then - $POSTGPSH + if [ "${INLINE_POST}" = ".false." ]; then + ${POSTGPSH} export err=$?; err_chk - mv fluxfile $COMOUT/${FLUXFL} + mv fluxfile "${COMOUT}/${FLUXFL}" fi - $WGRIB2 -s $COMOUT/${FLUXFL} > $COMOUT/${FLUXFLIDX} + ${WGRIB2} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}" - if [ "$SENDDBN" = 'YES' ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_SGB_GB2 $job $COMOUT/${FLUXFL} - $DBNROOT/bin/dbn_alert MODEL GFS_SGB_GB2_WIDX $job $COMOUT/${FLUXFLIDX} + if [ "${SENDDBN}" = 'YES' ]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2 "${job}" "${COMOUT}/${FLUXFL}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2_WIDX "${job}" "${COMOUT}/${FLUXFLIDX}" fi fi # process satellite look alike separately so that master pgb gets out in time # set outtyp to 2 because master post already generates gfs io files - if [ $GOESF = "YES" ]; then - export OUTTYP=${OUTTYP:-4} + if [ "${GOESF}" = "YES" ]; then + export OUTTYP=${OUTTYP:-4} # specify output file name from chgres which is input file name to nceppost # if model already runs gfs io, make sure GFSOUT is linked to the gfsio file - # new imported variable for global_nceppost.sh + # new imported variable for global_post.sh export GFSOUT=${PREFIX}gfsio${fhr} # link satellite coefficients files, use hwrf version as ops crtm 2.0.5 # does not new coefficient files used by post export FIXCRTM=${FIXCRTM:-${CRTM_FIX}} - $USHgfs/link_crtm_fix.sh $FIXCRTM + "${USHgfs}/link_crtm_fix.sh" ${FIXCRTM} - if [ $GRIBVERSION = 'grib2' ]; then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-GOES.txt - export CTLFILE=$PARMpost/postcntrl_gfs_goes.xml + if [ "${GRIBVERSION}" = 'grib2' ]; then + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-GOES.txt " + export CTLFILE="${PARMpost}/postcntrl_gfs_goes.xml" fi export FLXINP=flxfile export FLXIOUT=flxifile @@ -445,25 +444,25 @@ else ## not_anl if_stime export JO=0 export IGEN=0 - if [ $NET = gfs ]; then - $POSTGPSH + if [ "${NET:?}" = "gfs" ]; then + ${POSTGPSH} export err=$?; err_chk fi - if [ $GRIBVERSION = 'grib2' ]; then - SPECIALFL=${PREFIX}special.grb2 - SPECIALFLIDX=${PREFIX}special.grb2i + if [ "${GRIBVERSION}" = 'grib2' ]; then + SPECIALFL="${PREFIX}special.grb2" + SPECIALFLIDX="${PREFIX}special.grb2i" fi - fhr3=$fhr + fhr3=${fhr} - if [ $SENDCOM = "YES" ]; then + if [ "${SENDCOM}" = "YES" ]; then # echo "$PDY$cyc$pad$fhr" > $COMOUT/${RUN}.t${cyc}z.master.control - mv goesfile $COMOUT/${SPECIALFL}f$fhr - mv goesifile $COMOUT/${SPECIALFLIDX}f$fhr + mv goesfile "${COMOUT}/${SPECIALFL}f${fhr}" + mv goesifile "${COMOUT}/${SPECIALFLIDX}f${fhr}" - if [ $SENDDBN = YES ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_SPECIAL_GB2 $job $COMOUT/${SPECIALFL}f$fhr + if [ "${SENDDBN}" = "YES" ]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SPECIAL_GB2 "${job}" "${COMOUT}/${SPECIALFL}f${fhr}" fi fi fi @@ -472,17 +471,17 @@ else ## not_anl if_stime ########################## WAFS start ########################## # Generate WAFS products on ICAO standard level. # Do not need to be sent out to public, WAFS package will process the data. - if [[ $WAFSF = "YES" && 10#$fhr -le 120 ]]; then - if [[ $RUN = gfs && $GRIBVERSION = 'grib2' ]]; then + if [[ "${WAFSF}" = "YES" ]] && (( 10#${fhr} <= 120 )); then + if [[ "${RUN}" = gfs && "${GRIBVERSION}" = 'grib2' ]]; then export OUTTYP=${OUTTYP:-4} # Extend WAFS icing and gtg up to 120 hours - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-WAFS.txt - export CTLFILE=$PARMpost/postcntrl_gfs_wafs.xml + export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-WAFS.txt" + export CTLFILE="${PARMpost}/postcntrl_gfs_wafs.xml" # gtg has its own configurations - cp $PARMpost/gtg.config.gfs gtg.config - cp $PARMpost/gtg_imprintings.txt gtg_imprintings.txt + cp "${PARMpost}/gtg.config.gfs" gtg.config + cp "${PARMpost}/gtg_imprintings.txt" gtg_imprintings.txt export PGBOUT=wafsfile export PGIOUT=wafsifile @@ -491,24 +490,24 @@ else ## not_anl if_stime # hourly if fhr<=24 # every 3 forecast hour if 24 Date: Thu, 29 Sep 2022 19:01:00 +0000 Subject: [PATCH 06/13] Disable variable assigned but not defined shellcheck Disables SC2154 (variable assigned but not defined). --- .shellcheckrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.shellcheckrc b/.shellcheckrc index 1c80a97072f..a34e63a71a8 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -1,2 +1,3 @@ # Global settings for Spellcheck (https://github.com/koalaman/shellcheck) enable=all +disable=SC2154 From 6153acfeaf02839f3e4a7991462b3bb363cf4e31 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 19:24:40 +0000 Subject: [PATCH 07/13] Remove excess default variable setting With SC2154 turned off, the excessive usage of :? can be removed. --- jobs/JGLOBAL_ATMOS_POST | 14 ++++---- scripts/exgdas_atmos_post.sh | 62 +++++++++++++++++++----------------- scripts/exgfs_atmos_post.sh | 62 +++++++++++++++++++----------------- 3 files changed, 71 insertions(+), 67 deletions(-) diff --git a/jobs/JGLOBAL_ATMOS_POST b/jobs/JGLOBAL_ATMOS_POST index 004afd6e86f..1a19a72bfff 100755 --- a/jobs/JGLOBAL_ATMOS_POST +++ b/jobs/JGLOBAL_ATMOS_POST @@ -1,7 +1,7 @@ #! /usr/bin/env bash # shellcheck source=ush/preamble.sh -source "${HOMEgfs:?}/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" export RUN_ENVIR=${RUN_ENVIR:-"nco"} @@ -23,7 +23,7 @@ done # Source machine runtime environment ########################################## # shellcheck source-path=env -. "${HOMEgfs}/env/${machine:?}.env" post +. "${HOMEgfs}/env/${machine}.env" post status=$? (( status != 0 )) && exit "${status}" @@ -33,7 +33,7 @@ status=$? ############################################## export pid=${pid:-$$} export outid=${outid:-"LL${job}"} -export DATA=${DATA:-${DATAROOT}/${jobid:?}} +export DATA=${DATA:-${DATAROOT}/${jobid}} mkdir -p "${DATA}" cd "${DATA}" || exit 1 @@ -41,7 +41,7 @@ cd "${DATA}" || exit 1 ############################################## # Run setpdy and initialize PDY variables ############################################## -export cycle="t${cyc:?}z" +export cycle="t${cyc}z" setpdy.sh # shellcheck disable=SC1091 . ./PDY @@ -75,7 +75,7 @@ export COMPONENT=${COMPONENT:-atmos} ############################################## export APRUNP=${APRUN:-${APRUN_NP}} export RERUN=${RERUN:-NO} -export HOMECRTM=${HOMECRTM:-${PACKAGEROOT:?}/lib/crtm/${crtm_ver:?}} +export HOMECRTM=${HOMECRTM:-${PACKAGEROOT}/lib/crtm/${crtm_ver}} export FIXCRTM=${CRTM_FIX:-${HOMECRTM}/fix} export PARMpost=${PARMpost:-${HOMEgfs}/parm/post} export INLINE_POST=${WRITE_DOPOST:-".false."} @@ -98,7 +98,7 @@ if [ "${RUN}" = gdas ]; then export FHOUT_PGB=${FHOUT:-1} #Output frequency of gfs pgb file at 1.0 and 0.5 deg. fi -if [ "${GRIBVERSION:?}" = grib2 ]; then +if [ "${GRIBVERSION}" = grib2 ]; then export IGEN_ANL="anal_gfs" export IGEN_FCST="gfs_avn" export IGEN_GFS="gfs_avn" @@ -124,7 +124,7 @@ export SLEEP_INT=5 ############################################################### # Run relevant exglobal script -"${SCRgfs:?}/ex${RUN}_atmos_post.sh" +"${SCRgfs}/ex${RUN}_atmos_post.sh" status=$? (( status != 0 )) && exit "${status}" diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index cb6b55a6218..b4d960d01b8 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -25,9 +25,9 @@ ##################################################################### # shellcheck source=ush/preamble.sh -source "${HOMEgfs:?}/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" -cd "${DATA:?}" || exit 1 +cd "${DATA}" || exit 1 export POSTGPSH=${POSTGPSH:-${USHgfs}/gfs_post.sh} export GFSDOWNSH=${GFSDOWNSH:-${USHgfs}/fv3gfs_downstream_nems.sh} @@ -78,11 +78,12 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Post Analysis Files before starting the Forecast Post ############################################################ # Chuang: modify to process analysis when post_times is 00 -export stime="$(echo "${post_times:?}" | cut -c1-3)" +stime="$(echo "${post_times}" | cut -c1-3)" +export stime if (( OUTTYP == 4 )) ; then - export loganl="${COMIN:?}/${PREFIX}atmanl${SUFFIX}" + export loganl="${COMIN}/${PREFIX}atmanl${SUFFIX}" else - export loganl="${COMIN:?}/${PREFIX}sanl" + export loganl="${COMIN}/${PREFIX}sanl" fi if [ "${stime}" = "anl" ]; then @@ -90,7 +91,7 @@ if [ "${stime}" = "anl" ]; then # add new environmental variables for running new ncep post # Validation date - export VDATE=${PDY:?}${cyc} + export VDATE=${PDY}${cyc} # set outtyp to 1 because we need to run chgres in the post before model start running chgres # otherwise set to 0, then chgres will not be executed in global_nceppost.sh @@ -101,12 +102,12 @@ if [ "${stime}" = "anl" ]; then # if model already runs gfs io, make sure GFSOUT is linked to the gfsio file # new imported variable for global_nceppost.sh - export GFSOUT=${RUN}.${cycle:?}.gfsioanl + export GFSOUT=${RUN}.${cycle}.gfsioanl # specify smaller control file for GDAS because GDAS does not # produce flux file, the default will be /nwprod/parm/gfs_cntrl.parm - if [ "${GRIBVERSION:?}" = 'grib2' ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} export PostFlatFile=${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS-ANL.txt} export CTLFILE=${PARMpost}/postcntrl_gfs_anl.xml @@ -123,7 +124,7 @@ if [ "${stime}" = "anl" ]; then export PGIOUT=pgifile export PGBOUT2=pgbfile.grib2 export PGIOUT2=pgifile.grib2.idx - export IGEN="${IGEN_ANL:?}" + export IGEN="${IGEN_ANL}" export FILTER=0 # specify fhr even for analysis because postgp uses it @@ -145,24 +146,24 @@ if [ "${stime}" = "anl" ]; then export fhr3=anl fi - if [ "${SENDCOM:-YES}" = 'YES' ]; then + if [ "${SENDCOM}" = 'YES' ]; then export fhr3=anl if [ "${GRIBVERSION}" = 'grib2' ]; then MASTERANL=${PREFIX}master.grb2${fhr3} ##########XXW Accord to Boi, fortran index should use *if${fhr}, wgrib index use .idx #MASTERANLIDX=${RUN}.${cycle}.master.grb2${fhr3}.idx MASTERANLIDX=${PREFIX}master.grb2i${fhr3} - cp "${PGBOUT2}" "${COMOUT:?}/${MASTERANL}" - ${GRB2INDEX:?} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" + cp "${PGBOUT2}" "${COMOUT}/${MASTERANL}" + ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" fi - if [ "${SENDDBN:-YES}" = 'YES' ]; then - run=$(echo ${RUN} | tr 'a-z' 'A-Z') + if [ "${SENDDBN}" = 'YES' ]; then + run="$(echo ${RUN} | tr '[:lower:]' '[:upper:]')" if [ "${GRIBVERSION}" = 'grib2' ]; then - "${DBNROOT:?}/bin/dbn_alert" MODEL "${run}_MSC_sfcanl" "${job:?}" "${COMOUT}/${PREFIX}sfc${fhr3}${SUFFIX}" - "${DBNROOT:?}/bin/dbn_alert" MODEL "${run}_SA" "${job:?}" "${COMIN}/${PREFIX}atm${fhr3}${SUFFIX}" - "${DBNROOT:?}/bin/dbn_alert" MODEL "GDAS_PGA_GB2" "${job:?}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}" - "${DBNROOT:?}/bin/dbn_alert" MODEL "GDAS_PGA_GB2_WIDX" "${job:?}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_MSC_sfcanl" "${job}" "${COMOUT}/${PREFIX}sfc${fhr3}${SUFFIX}" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SA" "${job}" "${COMIN}/${PREFIX}atm${fhr3}${SUFFIX}" + "${DBNROOT}/bin/dbn_alert" MODEL "GDAS_PGA_GB2" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}" + "${DBNROOT}/bin/dbn_alert" MODEL "GDAS_PGA_GB2_WIDX" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}.idx" fi fi fi @@ -174,7 +175,7 @@ if [ "${stime}" = "anl" ]; then err_chk fi else ## not_anl if_stimes - SLEEP_LOOP_MAX=$(( ${SLEEP_TIME:?} / ${SLEEP_INT:?} )) + SLEEP_LOOP_MAX=$(( SLEEP_TIME / SLEEP_INT )) ############################################################ # Loop Through the Post Forecast Files @@ -188,7 +189,7 @@ else ## not_anl if_stimes export pgm="postcheck" ic=1 while (( ic <= SLEEP_LOOP_MAX )); do - if [ -f "${restart_file:?}${fhr}.txt" ]; then + if [ -f "${restart_file}${fhr}.txt" ]; then break else ic=$(( ic + 1 )) @@ -213,22 +214,23 @@ else ## not_anl if_stimes [[ -f flxfile ]] && rm flxfile [[ -f nemsfile ]] && rm nemsfile if (( OUTTYP == 4 )) ; then - ln -sf "${COMIN}/${PREFIX}atmf$fhr${SUFFIX}" nemsfile + ln -sf "${COMIN}/${PREFIX}atmf${fhr}${SUFFIX}" nemsfile export NEMSINP=nemsfile - ln -sf "${COMIN}/${PREFIX}sfcf$fhr${SUFFIX}" flxfile + ln -sf "${COMIN}/${PREFIX}sfcf${fhr}${SUFFIX}" flxfile export FLXINP=flxfile fi if (( fhr > 0 )); then - export IGEN=${IGEN_FCST:?} + export IGEN=${IGEN_FCST} else - export IGEN=${IGEN_ANL:?} + export IGEN=${IGEN_ANL} fi # add new environmental variables for running new ncep post # Validation date - export VDATE="$(${NDATE:?} "+${fhr}" "${PDY}${cyc}")" + VDATE="$(${NDATE} "+${fhr}" "${PDY}${cyc}")" + export VDATE # set to 3 to output lat/lon grid @@ -238,10 +240,10 @@ else ## not_anl if_stimes export POSTGRB2TBL="${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new}" export PostFlatFile="${PARMpost}/postxconfig-NT-GFS.txt" if [ "${RUN}" = gfs ]; then - export IGEN="${IGEN_GFS:?}" + export IGEN="${IGEN_GFS}" if (( fhr > 0 )); then export IGEN="${IGEN_FCST}" ; fi else - export IGEN="${IGEN_GDAS_ANL:?}" + export IGEN="${IGEN_GDAS_ANL}" if (( fhr > 0 )); then export IGEN="${IGEN_FCST}" ; fi fi if [[ "${RUN}" = gfs ]]; then @@ -290,8 +292,8 @@ else ## not_anl if_stimes ${GFSDOWNSH} export err=$?; err_chk - if [ "${SENDDBN}" = YES ]; then - run=$(echo ${RUN} | tr 'a-z' 'A-Z') + if [ "${SENDDBN}" = "YES" ]; then + run="$(echo ${RUN} | tr '[:lower:]' '[:upper:]')" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25" "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25_WIDX ""${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}.idx" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" @@ -330,7 +332,7 @@ else ## not_anl if_stimes export err=$?; err_chk mv fluxfile "${COMOUT}/${FLUXFL}" fi - ${WGRIB2:?} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}" + ${WGRIB2} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}" fi if [ "${SENDDBN}" = 'YES' ] && [ "${RUN}" = 'gdas' ] && (( fhr % 3 == 0 )); then diff --git a/scripts/exgfs_atmos_post.sh b/scripts/exgfs_atmos_post.sh index d88f2f241f3..8daf328d963 100755 --- a/scripts/exgfs_atmos_post.sh +++ b/scripts/exgfs_atmos_post.sh @@ -36,9 +36,9 @@ # echo "-----------------------------------------------------" ##################################################################### -source "${HOMEgfs:?}/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" -cd "${DATA:?}" || exit 1 +cd "${DATA}" || exit 1 # specify model output format type: 4 for nemsio, 3 for sigio export POSTGPSH=${POSTGPSH:-${USHgfs}/gfs_post.sh} @@ -93,18 +93,19 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Post Analysis Files before starting the Forecast Post ############################################################ # Process analysis when post_times is 00 -export stime="$(echo ${post_times:?} | cut -c1-3)" +stime="$(echo ${post_times} | cut -c1-3)" +export stime if (( OUTTYP == 4 )); then - export loganl="${COMIN:?}/${PREFIX}atmanl${SUFFIX}" + export loganl="${COMIN}/${PREFIX}atmanl${SUFFIX}" else - export loganl="${COMIN:?}/${PREFIX}sanl" + export loganl="${COMIN}/${PREFIX}sanl" fi if [ "${stime}" = "anl" ]; then if [ -f "${loganl}" ]; then # add new environmental variables for running new ncep post # Validation date - export VDATE=${PDY:?}${cyc} + export VDATE=${PDY}${cyc} # specify output file name from chgres which is input file name to nceppost # if model already runs gfs io, make sure GFSOUT is linked to the gfsio file # new imported variable for global_nceppost.sh @@ -112,7 +113,7 @@ if [ "${stime}" = "anl" ]; then # specify smaller control file for GDAS because GDAS does not # produce flux file, the default will be /nwprod/parm/gfs_cntrl.parm - if [ "${GRIBVERSION:?}" = 'grib2' ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then # use grib2 nomonic table in product g2tmpl directory as default export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} export PostFlatFile=${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS-ANL.txt} @@ -131,7 +132,7 @@ if [ "${stime}" = "anl" ]; then export PGIOUT=pgifile export PGBOUT2=pgbfile.grib2 export PGIOUT2=pgifile.grib2.idx - export IGEN=${IGEN_ANL:?} + export IGEN=${IGEN_ANL} export FILTER=0 ${POSTGPSH} @@ -149,19 +150,19 @@ if [ "${stime}" = "anl" ]; then export err=$?; err_chk fi - if [ "${SENDCOM:-YES}" = 'YES' ]; then + if [ "${SENDCOM}" = 'YES' ]; then export fhr3=anl if [ "${GRIBVERSION}" = 'grib2' ]; then MASTERANL=${PREFIX}master.grb2${fhr3} MASTERANLIDX=${PREFIX}master.grb2i${fhr3} - cp "${PGBOUT2}" "${COMOUT:?}/${MASTERANL}" - ${GRB2INDEX:?} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" + cp "${PGBOUT2}" "${COMOUT}/${MASTERANL}" + ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" fi - if [ "${SENDDBN:-YES}" = 'YES' ]; then + if [ "${SENDDBN}" = 'YES' ]; then "${DBNROOT}/bin/dbn_alert" MODEL GFS_MSC_sfcanl "${job}" "${COMOUT}/${PREFIX}sfcanl${SUFFIX}" "${DBNROOT}/bin/dbn_alert" MODEL GFS_SA "${job}" "${COMOUT}/${PREFIX}atmanl${SUFFIX}" - if [ "$PGBF" = 'YES' ]; then + if [ "${PGBF}" = 'YES' ]; then "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl" "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl.idx" "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.anl" @@ -185,7 +186,7 @@ if [ "${stime}" = "anl" ]; then ########################## WAFS U/V/T analysis start ########################## # U/V/T on ICAO standard atmospheric pressure levels for WAFS verification if [ "${WAFSF}" = "YES" ]; then - if [[ "${RUN}" = gfs && "${GRIBVERSION}" = 'grib2' ]]; then + if [[ "${RUN}" = "gfs" && "${GRIBVERSION}" = 'grib2' ]]; then export OUTTYP=${OUTTYP:-4} export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-WAFS-ANL.txt" @@ -194,16 +195,16 @@ if [ "${stime}" = "anl" ]; then export PGBOUT=wafsfile export PGIOUT=wafsifile - $POSTGPSH + ${POSTGPSH} export err=$? if (( err != 0 )); then - echo " *** GFS POST WARNING: WAFS output failed for analysis, err=$err" + echo " *** GFS POST WARNING: WAFS output failed for analysis, err=${err}" else # WAFS package doesn't process this part. # 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 \ + ${WGRIB2} "${PGBOUT}" -set_grib_type same -new_grid_winds earth \ -new_grid_interpolation bilinear -set_bitmap 1 \ -new_grid "${wafsgrid}" "${PGBOUT}.tmp" @@ -228,7 +229,7 @@ if [ "${stime}" = "anl" ]; then err_chk fi else ## not_anl if_stime - SLEEP_LOOP_MAX=$(( ${SLEEP_TIME:?} / ${SLEEP_INT:?} )) + SLEEP_LOOP_MAX=$(( ${SLEEP_TIME} / ${SLEEP_INT} )) ############################################################ # Loop Through the Post Forecast Files @@ -243,7 +244,7 @@ else ## not_anl if_stime export pgm="postcheck" ic=1 while (( ic <= SLEEP_LOOP_MAX )); do - if [ -f "${restart_file:?}${fhr}.txt" ]; then + if [ -f "${restart_file}${fhr}.txt" ]; then break else ic=$(( ic + 1 )) @@ -274,24 +275,25 @@ else ## not_anl if_stime fi if (( fhr > 0 )); then - export IGEN=${IGEN_FCST:?} + export IGEN=${IGEN_FCST} else export IGEN=${IGEN_ANL} fi - export VDATE=$(${NDATE:?} +${fhr} "${PDY}${cyc}") + VDATE="$(${NDATE} +${fhr} "${PDY}${cyc}")" + export VDATE export OUTTYP=${OUTTYP:-4} export GFSOUT="${PREFIX}gfsio${fhr}" - if [ $GRIBVERSION = 'grib2' ]; then + if [ "${GRIBVERSION}" = 'grib2' ]; then export POSTGRB2TBL="${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new}" export PostFlatFile="${PostFlatFile:-${PARMpost}/postxconfig-NT-GFS.txt}" if [ "${RUN}" = "gfs" ]; then - export IGEN=${IGEN_GFS:?} + export IGEN=${IGEN_GFS} if (( fhr > 0 )); then export IGEN=${IGEN_FCST} ; fi else - export IGEN=${IGEN_GDAS_ANL:?} + export IGEN=${IGEN_GDAS_ANL} if (( fhr > 0 )); then export IGEN=${IGEN_FCST} ; fi fi if [[ "${RUN}" = "gfs" ]]; then @@ -396,7 +398,7 @@ else ## not_anl if_stime FLUXFLIDX=${PREFIX}sfluxgrbf${fhr}.grib2.idx #Add extra flux.1p00 file for coupled - if [ "$FLXGF" = 'YES' ]; then + if [ "${FLXGF}" = 'YES' ]; then export FH=$(( fhr + 0 )) ${GFSDOWNSHF} export err=$?; err_chk @@ -428,7 +430,7 @@ else ## not_anl if_stime # link satellite coefficients files, use hwrf version as ops crtm 2.0.5 # does not new coefficient files used by post - export FIXCRTM=${FIXCRTM:-${CRTM_FIX}} + export FIXCRTM="${FIXCRTM:-${CRTM_FIX}}" "${USHgfs}/link_crtm_fix.sh" ${FIXCRTM} if [ "${GRIBVERSION}" = 'grib2' ]; then @@ -444,7 +446,7 @@ else ## not_anl if_stime export JO=0 export IGEN=0 - if [ "${NET:?}" = "gfs" ]; then + if [ "${NET}" = "gfs" ]; then ${POSTGPSH} export err=$?; err_chk fi @@ -490,9 +492,9 @@ else ## not_anl if_stime # hourly if fhr<=24 # every 3 forecast hour if 24 Date: Thu, 29 Sep 2022 19:56:41 +0000 Subject: [PATCH 08/13] Linter corrections for gfs_pos --- .shellcheckrc | 4 + scripts/exgdas_atmos_post.sh | 4 +- scripts/exgfs_atmos_post.sh | 8 +- ush/gfs_post.sh | 143 ++++++++++++++++++----------------- 4 files changed, 83 insertions(+), 76 deletions(-) diff --git a/.shellcheckrc b/.shellcheckrc index a34e63a71a8..3628e97e586 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -1,3 +1,7 @@ # Global settings for Spellcheck (https://github.com/koalaman/shellcheck) enable=all + +# Disable variable referenced but not assigned disable=SC2154 + + diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index b4d960d01b8..aa3f7989905 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -158,7 +158,7 @@ if [ "${stime}" = "anl" ]; then fi if [ "${SENDDBN}" = 'YES' ]; then - run="$(echo ${RUN} | tr '[:lower:]' '[:upper:]')" + run="$(echo "${RUN}" | tr '[:lower:]' '[:upper:]')" if [ "${GRIBVERSION}" = 'grib2' ]; then "${DBNROOT}/bin/dbn_alert" MODEL "${run}_MSC_sfcanl" "${job}" "${COMOUT}/${PREFIX}sfc${fhr3}${SUFFIX}" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SA" "${job}" "${COMIN}/${PREFIX}atm${fhr3}${SUFFIX}" @@ -293,7 +293,7 @@ else ## not_anl if_stimes export err=$?; err_chk if [ "${SENDDBN}" = "YES" ]; then - run="$(echo ${RUN} | tr '[:lower:]' '[:upper:]')" + run="$(echo "${RUN}" | tr '[:lower:]' '[:upper:]')" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25" "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25_WIDX ""${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}.idx" "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" diff --git a/scripts/exgfs_atmos_post.sh b/scripts/exgfs_atmos_post.sh index 8daf328d963..e9772b396a8 100755 --- a/scripts/exgfs_atmos_post.sh +++ b/scripts/exgfs_atmos_post.sh @@ -93,7 +93,7 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Post Analysis Files before starting the Forecast Post ############################################################ # Process analysis when post_times is 00 -stime="$(echo ${post_times} | cut -c1-3)" +stime="$(echo "${post_times}" | cut -c1-3)" export stime if (( OUTTYP == 4 )); then export loganl="${COMIN}/${PREFIX}atmanl${SUFFIX}" @@ -229,7 +229,7 @@ if [ "${stime}" = "anl" ]; then err_chk fi else ## not_anl if_stime - SLEEP_LOOP_MAX=$(( ${SLEEP_TIME} / ${SLEEP_INT} )) + SLEEP_LOOP_MAX=$(( SLEEP_TIME / SLEEP_INT )) ############################################################ # Loop Through the Post Forecast Files @@ -248,7 +248,7 @@ else ## not_anl if_stime break else ic=$(( ic + 1 )) - sleep ${SLEEP_INT} + sleep "${SLEEP_INT}" fi ############################### # If we reach this point assume @@ -431,7 +431,7 @@ else ## not_anl if_stime # link satellite coefficients files, use hwrf version as ops crtm 2.0.5 # does not new coefficient files used by post export FIXCRTM="${FIXCRTM:-${CRTM_FIX}}" - "${USHgfs}/link_crtm_fix.sh" ${FIXCRTM} + "${USHgfs}/link_crtm_fix.sh" "${FIXCRTM}" if [ "${GRIBVERSION}" = 'grib2' ]; then export PostFlatFile="${PARMpost}/postxconfig-NT-GFS-GOES.txt " diff --git a/ush/gfs_post.sh b/ush/gfs_post.sh index c38edfe4ec2..e36276a3868 100755 --- a/ush/gfs_post.sh +++ b/ush/gfs_post.sh @@ -188,7 +188,7 @@ #### ################################################################################ # Set environment. -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" # Command line arguments. export SIGINP=${1:-${SIGINP:-}} @@ -202,10 +202,10 @@ export JO=${7:-${JO:-0}} export IGEN=${8:-${IGEN:-0}} # Directories. export NWPROD=${NWPROD:-/nwprod} -#export EXECUTIL=${EXECUTIL:-$NWPROD/util/exec} -export USHUTIL=${USHUTIL:-$NWPROD/util/ush} -export EXECgfs=${EXECgfs:-$NWPROD/exec} -export USHgfs=${USHgfs:-$NWPROD/ush} +#export EXECUTIL=${EXECUTIL:-${NWPROD}/util/exec} +export USHUTIL=${USHUTIL:-${NWPROD}/util/ush} +export EXECgfs=${EXECgfs:-${NWPROD}/exec} +export USHgfs=${USHgfs:-${NWPROD}/ush} export DATA=${DATA:-$(pwd)} # Filenames. export MP=${MP:-$([[ ${LOADL_STEP_TYPE:-SERIAL} = PARALLEL ]]&&echo "p"||echo "s")} @@ -214,11 +214,13 @@ export POSTGPEXEC=${POSTGPEXEC:-${EXECgfs}/upp.x} export OVERPARMEXEC=${OVERPARMEXEC:-${EXECgfs}/overparm_grib} export POSTGPLIST=${POSTGPLIST:-/dev/null} export INISCRIPT=${INISCRIPT:-} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} +# shellcheck disable=SC2016 +export ERRSCRIPT=${ERRSCRIPT:-'eval (( err == 0 ))'} +# shellcheck disable= export LOGSCRIPT=${LOGSCRIPT:-} export ENDSCRIPT=${ENDSCRIPT:-} export GFSOUT=${GFSOUT:-gfsout} -export CTLFILE=${CTLFILE:-$NWPROD/parm/gfs_cntrl.parm} +export CTLFILE=${CTLFILE:-${NWPROD}/parm/gfs_cntrl.parm} #export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} export OUTPUT_FILE=${OUTPUT_FILE:-"nemsio"} export GRIBVERSION=${GRIBVERSION:-'grib1'} @@ -234,12 +236,12 @@ export GENPSICHI=${GENPSICHI:-NO} export GENPSICHIEXE=${GENPSICHIEXE:-${EXECgfs}/genpsiandchi} export ens=${ens:-NO} #export D3DINP=${D3DINP:-/dev/null} -l=$(echo $PGMOUT | xargs | cut -c1) -[[ $l = '&' ]]&&a=''||a='>' -export REDOUT=${REDOUT:-'1>'$a} -l=$(echo $PGMERR | xargs | cut -c1) -[[ $l = '&' ]]&&a=''||a='>' -export REDERR=${REDERR:-'2>'$a} +l="$(echo "${PGMOUT}" | xargs | cut -c1)" +[[ ${l} = '&' ]]&&a=''||a='>' +export REDOUT=${REDOUT:-'1>'${a}} +l="$(echo "${PGMERR}" | xargs | cut -c1)" +[[ ${l} = '&' ]]&&a=''||a='>' +export REDERR=${REDERR:-'2>'${a}} ################################################################################ # Chuang: Run chgres if OUTTYP=1 or 0 @@ -247,21 +249,21 @@ export REDERR=${REDERR:-'2>'$a} export APRUN=${APRUNP:-${APRUN:-""}} # exit if NEMSINP does not exist -if [ ${OUTTYP} -eq 4 ] ; then - if [ ! -s $NEMSINP -o ! -s $FLXINP ] ; then +if (( OUTTYP == 4 )) ; then + if [ ! -s "${NEMSINP}" ] || [ ! -s "${FLXINP}" ] ; then echo "model files not found, exitting" exit 111 fi fi -export SIGHDR=${SIGHDR:-$NWPROD/exec/global_sighdr} +export SIGHDR=${SIGHDR:-${NWPROD}/exec/global_sighdr} export IDRT=${IDRT:-4} # run post to read nemsio file if OUTTYP=4 -if [ ${OUTTYP} -eq 4 ] ; then - if [ ${OUTPUT_FILE} = "netcdf" ]; then +if (( OUTTYP == 4 )) ; then + if [ "${OUTPUT_FILE}" = "netcdf" ]; then export MODEL_OUT_FORM=${MODEL_OUT_FORM:-netcdfpara} - elif [ ${OUTPUT_FILE} = "nemsio" ]; then + elif [ "${OUTPUT_FILE}" = "nemsio" ]; then export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} else export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} @@ -274,36 +276,37 @@ fi export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} pwd=$(pwd) -if [[ -d $DATA ]]; then +if [[ -d "${DATA}" ]]; then mkdata=NO else - mkdir -p $DATA + mkdir -p "${DATA}" mkdata=YES fi -cd $DATA||exit 99 +cd "${DATA}" || exit 99 ################################################################################ # Post GRIB -export PGM=$POSTGPEXEC -export pgm=$PGM -$LOGSCRIPT +export PGM=${POSTGPEXEC} +export pgm=${PGM} +${LOGSCRIPT} cat <<-EOF >postgp.inp.nml$$ &NAMPGB - $POSTGPVARS + ${POSTGPVARS} EOF cat <<-EOF >>postgp.inp.nml$$ / EOF -if [[ "$VERBOSE" = "YES" ]]; then +if [[ "${VERBOSE}" = "YES" ]]; then cat postgp.inp.nml$$ fi # 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) +YY=$(echo "${VDATE}" | cut -c1-4) +MM=$(echo "${VDATE}" | cut -c5-6) +DD=$(echo "${VDATE}" | cut -c7-8) +HH=$(echo "${VDATE}" | cut -c9-10) +export YY MM DD HH cat > itag <<-EOF &model_inputs @@ -327,54 +330,55 @@ rm -f fort.* #ln -sf $PGBOUT postgp.out.pgb$$ # change model generating Grib number -if [ ${GRIBVERSION} = grib2 ]; then - cp ${POSTGRB2TBL} . - cp ${PostFlatFile} ./postxconfig-NT.txt - if [ ${ens} = "YES" ] ; then - sed < ${PostFlatFile} -e "s#negatively_pert_fcst#${ens_pert_type}#" > ./postxconfig-NT.txt +if [ "${GRIBVERSION}" = "grib2" ]; then + cp "${POSTGRB2TBL}" . + cp "${PostFlatFile}" ./postxconfig-NT.txt + if [ "${ens}" = "YES" ] ; then + sed < "${PostFlatFile}" -e "s#negatively_pert_fcst#${ens_pert_type}#" > ./postxconfig-NT.txt fi # cp ${CTLFILE} postcntrl.xml fi -export CTL=$(basename $CTLFILE) +CTL=$(basename "${CTLFILE}") +export CTL ln -sf griddef.out fort.110 -cp ${PARMpost}/nam_micro_lookup.dat ./eta_micro_lookup.dat +cp "${PARMpost}/nam_micro_lookup.dat" ./eta_micro_lookup.dat -echo "gfs_post.sh OMP_NUM_THREADS= $OMP_NUM_THREADS" -${APRUN:-mpirun.lsf} $POSTGPEXEC < itag > outpost_gfs_${VDATE}_${CTL} +echo "gfs_post.sh OMP_NUM_THREADS= ${OMP_NUM_THREADS}" +${APRUN:-mpirun.lsf} "${POSTGPEXEC}" < itag > "outpost_gfs_${VDATE}_${CTL}" export ERR=$? -export err=$ERR +export err=${ERR} -if [ $err -ne 0 ] ; then - if [ $PGBOUT = "wafsfile" ] ; then - exit $err +if (( err != 0 )) ; then + if [ "${PGBOUT}" = "wafsfile" ] ; then + exit "${err}" fi fi -$ERRSCRIPT||exit 2 +${ERRSCRIPT} || exit 2 -if [ $FILTER = "1" ] ; then +if [ "${FILTER}" = "1" ] ; then # Filter SLP and 500 mb height using copygb, change GRIB ID, and then # cat the filtered fields to the pressure GRIB file, from Iredell - if [ $GRIBVERSION = grib2 ]; then - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,0,80' -k'1 3 0 7*-9999 101 0 0' $PGBOUT tfile + if [ "${GRIBVERSION}" = "grib2" ]; then + if [ "${ens}" = "YES" ] ; then + "${COPYGB2}" -x -i'4,0,80' -k'1 3 0 7*-9999 101 0 0' "${PGBOUT}" tfile export err=$?; err_chk else - $COPYGB2 -x -i'4,0,80' -k'0 3 0 7*-9999 101 0 0' $PGBOUT tfile + "${COPYGB2}" -x -i'4,0,80' -k'0 3 0 7*-9999 101 0 0' "${PGBOUT}" tfile export err=$?; err_chk fi - $WGRIB2 tfile -set_byte 4 11 1 -grib prmsl + ${WGRIB2} tfile -set_byte 4 11 1 -grib prmsl export err=$?; err_chk - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,1,5' -k'1 3 5 7*-9999 100 0 50000' $PGBOUT tfile + if [ "${ens}" = "YES" ] ; then + "${COPYGB2}" -x -i'4,1,5' -k'1 3 5 7*-9999 100 0 50000' "${PGBOUT}" tfile export err=$?; err_chk else - $COPYGB2 -x -i'4,1,5' -k'0 3 5 7*-9999 100 0 50000' $PGBOUT tfile + "${COPYGB2}" -x -i'4,1,5' -k'0 3 5 7*-9999 100 0 50000' "${PGBOUT}" tfile export err=$?; err_chk fi - $WGRIB2 tfile -set_byte 4 11 193 -grib h5wav + ${WGRIB2} tfile -set_byte 4 11 193 -grib h5wav export err=$?; err_chk #cat $PGBOUT prmsl h5wav >> $PGBOUT @@ -388,33 +392,32 @@ fi ################################################################################ # Make GRIB index file -if [[ -n $PGIOUT ]]; then - if [ $GRIBVERSION = grib2 ]; then - # JY $GRBINDEX2 $PGBOUT $PGIOUT - $GRB2INDEX $PGBOUT $PGIOUT +if [[ -n "${PGIOUT}" ]]; then + if [ "${GRIBVERSION}" = "grib2" ]; then + ${GRB2INDEX} "${PGBOUT}" "${PGIOUT}" fi fi -if [[ -r $FLXINP && -n $FLXIOUT && $OUTTYP -le 3 ]]; then - $GRBINDEX $FLXINP $FLXIOUT +if [[ -r ${FLXINP} && -n ${FLXIOUT} && ${OUTTYP} -le 3 ]]; then + ${GRBINDEX} "${FLXINP}" "${FLXIOUT}" fi ################################################################################ # generate psi and chi -echo "GENPSICHI= " $GENPSICHI -if [ $GENPSICHI = YES ] ; then +echo "GENPSICHI = ${GENPSICHI}" +if [ "${GENPSICHI}" = "YES" ] ; then #echo "PGBOUT PGIOUT=" $PGBOUT $PGIOUT #echo "YY MM=" $YY $MM export psichifile=./psichi.grb - $GENPSICHIEXE < postgp.inp.nml$$ + ${GENPSICHIEXE} < postgp.inp.nml$$ rc=$? - if [[ $rc -ne 0 ]] ; then - echo 'Nonzero return code rc= '$rc + if (( rc != 0 )); then + echo "Nonzero return code rc=${rc}" exit 3 fi - cat ./psichi.grb >> $PGBOUT + cat ./psichi.grb >> "${PGBOUT}" fi ################################################################################ # Postprocessing -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA +cd "${pwd}" || exit 2 +[[ "${mkdata}" = "YES" ]] && rmdir "${DATA}" -exit $err +exit "${err}" From d2ac3e38d9af5e78ebfe80d47324b623a9f560cd Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 20:03:19 +0000 Subject: [PATCH 09/13] Last linter cleanup for post rename --- scripts/exgfs_atmos_post.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/exgfs_atmos_post.sh b/scripts/exgfs_atmos_post.sh index e9772b396a8..ab0a84ba097 100755 --- a/scripts/exgfs_atmos_post.sh +++ b/scripts/exgfs_atmos_post.sh @@ -280,7 +280,7 @@ else ## not_anl if_stime export IGEN=${IGEN_ANL} fi - VDATE="$(${NDATE} +${fhr} "${PDY}${cyc}")" + VDATE="$(${NDATE} "+${fhr}" "${PDY}${cyc}")" export VDATE export OUTTYP=${OUTTYP:-4} export GFSOUT="${PREFIX}gfsio${fhr}" From 9c199afa4b9700e7122e7590c33d79be7bd01962 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 20:10:54 +0000 Subject: [PATCH 10/13] Disable shellcheck on sourced scripts Turns off shellcheck parsing sourced scripts and removes some shellcheck directives that are no longer necessary. --- .shellcheckrc | 4 ++-- jobs/JGLOBAL_ATMOS_POST | 5 ----- scripts/exgdas_atmos_post.sh | 1 - ush/gfs_post.sh | 1 + 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.shellcheckrc b/.shellcheckrc index 3628e97e586..1a4c5fdd63f 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -1,7 +1,7 @@ # Global settings for Spellcheck (https://github.com/koalaman/shellcheck) enable=all +external-sources=false + # Disable variable referenced but not assigned disable=SC2154 - - diff --git a/jobs/JGLOBAL_ATMOS_POST b/jobs/JGLOBAL_ATMOS_POST index 1a19a72bfff..ab75918aa63 100755 --- a/jobs/JGLOBAL_ATMOS_POST +++ b/jobs/JGLOBAL_ATMOS_POST @@ -1,6 +1,5 @@ #! /usr/bin/env bash -# shellcheck source=ush/preamble.sh source "${HOMEgfs}/ush/preamble.sh" export RUN_ENVIR=${RUN_ENVIR:-"nco"} @@ -12,7 +11,6 @@ configs="base post" export EXPDIR=${EXPDIR:-${HOMEgfs}/parm/config} config_path=${EXPDIR:-${PACKAGEROOT}/gfs.${gfs_ver}/parm/config} for config in ${configs}; do - # shellcheck source-path=parm/config . "${config_path}/config.${config}" status=$? (( status != 0 )) && exit "${status}" @@ -22,7 +20,6 @@ done ########################################## # Source machine runtime environment ########################################## -# shellcheck source-path=env . "${HOMEgfs}/env/${machine}.env" post status=$? (( status != 0 )) && exit "${status}" @@ -43,9 +40,7 @@ cd "${DATA}" || exit 1 ############################################## export cycle="t${cyc}z" setpdy.sh -# shellcheck disable=SC1091 . ./PDY -# shellcheck disable= ############################################## diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index aa3f7989905..a1753b7fe85 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -24,7 +24,6 @@ # echo "-----------------------------------------------------" ##################################################################### -# shellcheck source=ush/preamble.sh source "${HOMEgfs}/ush/preamble.sh" cd "${DATA}" || exit 1 diff --git a/ush/gfs_post.sh b/ush/gfs_post.sh index e36276a3868..7fbb19bb707 100755 --- a/ush/gfs_post.sh +++ b/ush/gfs_post.sh @@ -214,6 +214,7 @@ export POSTGPEXEC=${POSTGPEXEC:-${EXECgfs}/upp.x} export OVERPARMEXEC=${OVERPARMEXEC:-${EXECgfs}/overparm_grib} export POSTGPLIST=${POSTGPLIST:-/dev/null} export INISCRIPT=${INISCRIPT:-} +# Ignore warning about single quote not subtituting now # shellcheck disable=SC2016 export ERRSCRIPT=${ERRSCRIPT:-'eval (( err == 0 ))'} # shellcheck disable= From a0bb6cb11a01983b31a45aae571134f4bff1e657 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 20:16:17 +0000 Subject: [PATCH 11/13] Disable more shellcheck errors --- .shellcheckrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.shellcheckrc b/.shellcheckrc index 1a4c5fdd63f..45e13c2e048 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -5,3 +5,9 @@ external-sources=false # Disable variable referenced but not assigned disable=SC2154 + +# Disable following non-constant source +disable=SC1090 + +# Disable non-existent binary +disable=SC1091 From f6bd60a36fcd86a294fd93842487ab430cdcfa4f Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Thu, 29 Sep 2022 20:24:36 +0000 Subject: [PATCH 12/13] Suppress possible typo warning on NDATE --- scripts/exgdas_atmos_post.sh | 3 +++ scripts/exgfs_atmos_post.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index a1753b7fe85..d7533b1ae7e 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -228,7 +228,10 @@ else ## not_anl if_stimes # add new environmental variables for running new ncep post # Validation date + # No shellcheck, NDATE is not a typo + # shellcheck disable=SC2153 VDATE="$(${NDATE} "+${fhr}" "${PDY}${cyc}")" + # shellcheck disable= export VDATE # set to 3 to output lat/lon grid diff --git a/scripts/exgfs_atmos_post.sh b/scripts/exgfs_atmos_post.sh index ab0a84ba097..3975da594dc 100755 --- a/scripts/exgfs_atmos_post.sh +++ b/scripts/exgfs_atmos_post.sh @@ -280,7 +280,10 @@ else ## not_anl if_stime export IGEN=${IGEN_ANL} fi + # No shellcheck, NDATE is not a typo + # shellcheck disable=SC2153 VDATE="$(${NDATE} "+${fhr}" "${PDY}${cyc}")" + # shellcheck disable= export VDATE export OUTTYP=${OUTTYP:-4} export GFSOUT="${PREFIX}gfsio${fhr}" From bdfa1497d8f57a1df95ffe50eb07023d806e768a Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Mon, 3 Oct 2022 01:39:34 +0000 Subject: [PATCH 13/13] Fix decimal treated as octal issue in post After linter modifications, a variable was being treated as an octal, resulting in the wrong result when adding. --- scripts/exgdas_atmos_post.sh | 2 +- scripts/exgfs_atmos_post.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index d7533b1ae7e..98f109c29a8 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -289,7 +289,7 @@ else ## not_anl if_stimes fi #wm Process pgb files - export FH=$(( fhr + 0 )) + export FH=$(( 10#${fhr} + 0 )) export downset=${downset:-1} ${GFSDOWNSH} export err=$?; err_chk diff --git a/scripts/exgfs_atmos_post.sh b/scripts/exgfs_atmos_post.sh index 3975da594dc..6777b1a3801 100755 --- a/scripts/exgfs_atmos_post.sh +++ b/scripts/exgfs_atmos_post.sh @@ -340,7 +340,7 @@ else ## not_anl if_stime # Process pgb files if [ "${PGBF}" = 'YES' ]; then - export FH=$(( fhr + 0 )) + export FH=$(( 10#${fhr} + 0 )) export downset=${downset:-2} ${GFSDOWNSH} export err=$?; err_chk @@ -402,7 +402,7 @@ else ## not_anl if_stime #Add extra flux.1p00 file for coupled if [ "${FLXGF}" = 'YES' ]; then - export FH=$(( fhr + 0 )) + export FH=$(( 10#${fhr} + 0 )) ${GFSDOWNSHF} export err=$?; err_chk fi