diff --git a/.gitignore b/.gitignore index 60151e3ab07..df54a098920 100644 --- a/.gitignore +++ b/.gitignore @@ -190,6 +190,7 @@ ush/radmon_verf_bcoef.sh ush/radmon_verf_bcor.sh ush/radmon_verf_time.sh ush/ufsda +ush/rstprod.sh ush/wafs_blending.sh ush/wafs_grib2.regrid.sh ush/wafs_intdsk.sh diff --git a/env/HERA.env b/env/HERA.env index f5c0a5efcd7..124b3e8b9a2 100755 --- a/env/HERA.env +++ b/env/HERA.env @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash if [ $# -ne 1 ]; then @@ -261,9 +261,17 @@ elif [ $step = "postsnd" ]; then elif [ $step = "awips" ]; then - echo "WARNING: $step is not enabled on $machine!" + nth_max=$(($npe_node_max / $npe_node_awips)) + + export NTHREADS_AWIPS=${nth_awips:-2} + [[ $NTHREADS_AWIPS -gt $nth_max ]] && export NTHREADS_AWIPS=$nth_max + export APRUN_AWIPSCFP="$launcher -n $npe_awips --multi-prog" elif [ $step = "gempak" ]; then - echo "WARNING: $step is not enabled on $machine!" + nth_max=$(($npe_node_max / $npe_node_gempak)) + + export NTHREADS_GEMPAK=${nth_gempak:-1} + [[ $NTHREADS_GEMPAK -gt $nth_max ]] && export NTHREADS_GEMPAK=$nth_max + export APRUN="$launcher -n $npe_gempak --multi-prog" fi diff --git a/env/ORION.env b/env/ORION.env index f3b58d987c7..bef0661f476 100755 --- a/env/ORION.env +++ b/env/ORION.env @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash if [ $# -ne 1 ]; then @@ -259,9 +259,17 @@ elif [ $step = "postsnd" ]; then elif [ $step = "awips" ]; then - echo "WARNING: $step is not enabled on $machine!" + nth_max=$(($npe_node_max / $npe_node_awips)) + + export NTHREADS_AWIPS=${nth_awips:-2} + [[ $NTHREADS_AWIPS -gt $nth_max ]] && export NTHREADS_AWIPS=$nth_max + export APRUN_AWIPSCFP="$launcher -n $npe_awips --multi-prog" elif [ $step = "gempak" ]; then - echo "WARNING: $step is not enabled on $machine!" + nth_max=$(($npe_node_max / $npe_node_gempak)) + + export NTHREADS_GEMPAK=${nth_gempak:-1} + [[ $NTHREADS_GEMPAK -gt $nth_max ]] && export NTHREADS_GEMPAK=$nth_max + export APRUN="$launcher -n $npe_gempak --multi-prog" fi diff --git a/jobs/JGDAS_ATMOS_ANALYSIS_DIAG b/jobs/JGDAS_ATMOS_ANALYSIS_DIAG index da16176ab3b..4b2728e13f4 100755 --- a/jobs/JGDAS_ATMOS_ANALYSIS_DIAG +++ b/jobs/JGDAS_ATMOS_ANALYSIS_DIAG @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -112,11 +110,6 @@ fi ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - - ${ANALDIAGSH:-$SCRgfs/exglobal_diag.sh} status=$? [[ $status -ne 0 ]] && exit $status @@ -133,15 +126,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ATMOS_CHGRES_FORENKF b/jobs/JGDAS_ATMOS_CHGRES_FORENKF index cf69bdd770f..d2268df7672 100755 --- a/jobs/JGDAS_ATMOS_CHGRES_FORENKF +++ b/jobs/JGDAS_ATMOS_CHGRES_FORENKF @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -97,11 +95,6 @@ export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - - ${CHGRESFCSTSH:-$SCRgfs/exgdas_atmos_chgres_forenkf.sh} status=$? [[ $status -ne 0 ]] && exit $status @@ -118,15 +111,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ATMOS_GEMPAK b/jobs/JGDAS_ATMOS_GEMPAK index e2d3d89da77..88654324501 100755 --- a/jobs/JGDAS_ATMOS_GEMPAK +++ b/jobs/JGDAS_ATMOS_GEMPAK @@ -1,8 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################################ # GDAS GEMPAK PRODUCT GENERATION @@ -73,7 +71,6 @@ fi export pgmout=OUTPUT.$$ -env if [ -f $DATA/poescrip ]; then rm $DATA/poescript @@ -107,11 +104,6 @@ APRUNCFP=$(eval echo $APRUN_GEMPAKCFP) $APRUNCFP $DATA/poescript export err=$?; err_chk -######################################################## - -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -126,4 +118,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC b/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC index 12951c2c53a..ffb46db0f92 100755 --- a/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC +++ b/jobs/JGDAS_ATMOS_GEMPAK_META_NCDC @@ -1,8 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################################ # GDAS GEMPAK META NCDC PRODUCT GENERATION @@ -86,7 +84,6 @@ fi export pgmout=OUTPUT.$$ -env ######################################################## # Execute the script. @@ -107,9 +104,6 @@ $SRCgfs/exgdas_atmos_gempak_gif_ncdc.sh export err=$?; err_chk ######################################################## -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -124,4 +118,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGDAS_EFSOI b/jobs/JGDAS_EFSOI index af60ddeb7b3..6c90468989f 100755 --- a/jobs/JGDAS_EFSOI +++ b/jobs/JGDAS_EFSOI @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -97,10 +95,6 @@ mkdir -p $OSENSE_SAVE_DIR ############################################################### # Run relevant exglobal script -env -msg="HAS BEGUN on `hostname`" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT ${EFSOIUPDSH:-$SCRgfs/exgdas_efsoi.sh} status=$? @@ -117,11 +111,6 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## @@ -129,5 +118,5 @@ cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_EFSOI_ECEN b/jobs/JGDAS_EFSOI_ECEN index 28d04b9f5cf..864bb1ae4a0 100755 --- a/jobs/JGDAS_EFSOI_ECEN +++ b/jobs/JGDAS_EFSOI_ECEN @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -106,11 +104,6 @@ export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc/$COMPONENT" ############################################################### # Run relevant script -env -msg="HAS BEGUN on `hostname`" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${ENKFRECENSH:-$SCRgfs/exgdas_enkf_ecen.sh} status=$? @@ -129,15 +122,11 @@ if [ -e "$pgmout" ] ; then fi -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_EFSOI_FCST b/jobs/JGDAS_EFSOI_FCST index a9e4fc78f1c..2794ee9c93f 100755 --- a/jobs/JGDAS_EFSOI_FCST +++ b/jobs/JGDAS_EFSOI_FCST @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -93,11 +91,6 @@ export ENSBEG=$((ENSEND - NMEM_EFCSGRP + 1)) ############################################################### # Run relevant script -env -msg="HAS BEGUN on `hostname`" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${ENKFFCSTSH:-$SCRgfs/exgdas_enkf_fcst.sh} status=$? @@ -129,16 +122,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_EFSOI_POST b/jobs/JGDAS_EFSOI_POST index f71f865b7e4..aca5bd51ed6 100755 --- a/jobs/JGDAS_EFSOI_POST +++ b/jobs/JGDAS_EFSOI_POST @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -84,11 +82,6 @@ export LEVS=$((LEVS-1)) ############################################################### # Run relevant script -env -msg="HAS BEGUN on `hostname`" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${ENKFPOSTSH:-$SCRgfs/exgdas_enkf_post.sh} status=$? @@ -106,16 +99,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_EFSOI_SFC b/jobs/JGDAS_EFSOI_SFC index 5924393c33d..5ba5fb63939 100755 --- a/jobs/JGDAS_EFSOI_SFC +++ b/jobs/JGDAS_EFSOI_SFC @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -118,11 +116,6 @@ export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc/$COMPONENT" ############################################################### # Run relevant script -env -msg="HAS BEGUN on `hostname`" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${ENKFRESFCSH:-$SCRgfs/exgdas_enkf_sfc.sh} status=$? @@ -140,16 +133,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_EFSOI_UPDATE b/jobs/JGDAS_EFSOI_UPDATE index 3d730eab7e5..e5efd6241a5 100755 --- a/jobs/JGDAS_EFSOI_UPDATE +++ b/jobs/JGDAS_EFSOI_UPDATE @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -92,10 +90,6 @@ mkdir -p $COMOUT_ANL_ENSFSOI ############################################################### # Run relevant exglobal script -env -msg="HAS BEGUN on `hostname`" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT ${EFSOIUPDSH:-$SCRgfs/exgdas_efsoi_update.sh} status=$? @@ -121,11 +115,6 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## @@ -133,5 +122,5 @@ cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ENKF_DIAG b/jobs/JGDAS_ENKF_DIAG index 1c26192569a..5ce8d86b78d 100755 --- a/jobs/JGDAS_ENKF_DIAG +++ b/jobs/JGDAS_ENKF_DIAG @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -147,10 +145,6 @@ done ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${ANALDIAGSH:-$SCRgfs/exglobal_diag.sh} status=$? @@ -168,15 +162,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ENKF_ECEN b/jobs/JGDAS_ENKF_ECEN index f52abfe4203..1e7a51b5ae7 100755 --- a/jobs/JGDAS_ENKF_ECEN +++ b/jobs/JGDAS_ENKF_ECEN @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -103,10 +101,6 @@ export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc/$COMPONENT" ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${ENKFRECENSH:-$SCRgfs/exgdas_enkf_ecen.sh} status=$? @@ -124,15 +118,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ENKF_FCST b/jobs/JGDAS_ENKF_FCST index 88d61c08704..68b3a532045 100755 --- a/jobs/JGDAS_ENKF_FCST +++ b/jobs/JGDAS_ENKF_FCST @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -83,10 +81,6 @@ export ENSBEG=$((ENSEND - NMEM_EFCSGRP + 1)) ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${ENKFFCSTSH:-$SCRgfs/exgdas_enkf_fcst.sh} status=$? @@ -126,15 +120,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ENKF_POST b/jobs/JGDAS_ENKF_POST index 7309305c0fb..dcc6335e449 100755 --- a/jobs/JGDAS_ENKF_POST +++ b/jobs/JGDAS_ENKF_POST @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -77,10 +75,6 @@ export LEVS=$((LEVS-1)) ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${ENKFPOSTSH:-$SCRgfs/exgdas_enkf_post.sh} status=$? @@ -98,15 +92,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ENKF_SELECT_OBS b/jobs/JGDAS_ENKF_SELECT_OBS index 919eec5bc5e..92bd78b04c0 100755 --- a/jobs/JGDAS_ENKF_SELECT_OBS +++ b/jobs/JGDAS_ENKF_SELECT_OBS @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -149,10 +147,6 @@ done ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${INVOBSSH:-$SCRgfs/exgdas_enkf_select_obs.sh} status=$? @@ -178,15 +172,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ENKF_SFC b/jobs/JGDAS_ENKF_SFC index a0383f2cf0a..54f196234af 100755 --- a/jobs/JGDAS_ENKF_SFC +++ b/jobs/JGDAS_ENKF_SFC @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -104,10 +102,6 @@ export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc/$COMPONENT" ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${ENKFRESFCSH:-$SCRgfs/exgdas_enkf_sfc.sh} status=$? @@ -125,15 +119,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_ENKF_UPDATE b/jobs/JGDAS_ENKF_UPDATE index 07bf37f7f8e..dafd9b13f26 100755 --- a/jobs/JGDAS_ENKF_UPDATE +++ b/jobs/JGDAS_ENKF_UPDATE @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -81,9 +79,6 @@ export COMOUT_ANL_ENS="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT ${ENKFUPDSH:-$SCRgfs/exgdas_enkf_update.sh} status=$? @@ -109,15 +104,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_POST b/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_POST index 77846954453..d8cd0416cdd 100755 --- a/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_POST +++ b/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_POST @@ -1,11 +1,6 @@ #!/bin/bash -##set -ex -set -x -set -u - -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################# # Source relevant config files @@ -119,5 +114,4 @@ fi cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date exit 0 diff --git a/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_PREP b/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_PREP index cde886e36b3..01895d4d5c9 100755 --- a/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_PREP +++ b/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_PREP @@ -1,11 +1,6 @@ #!/bin/bash -##set -ex -set -x -set -u - -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################# # Source relevant config files @@ -119,5 +114,4 @@ fi cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date exit 0 diff --git a/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_RUN b/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_RUN index aadf4d7a420..79986238518 100755 --- a/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_RUN +++ b/jobs/JGDAS_GLOBAL_ATMOS_ANALYSIS_RUN @@ -1,11 +1,6 @@ #!/bin/bash -##set -ex -set -x -set -u - -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################# # Source relevant config files @@ -119,5 +114,4 @@ fi cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date exit 0 diff --git a/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_POST b/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_POST index f1e85447d25..871ba7a35f6 100755 --- a/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_POST +++ b/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_POST @@ -1,11 +1,6 @@ #!/bin/bash -##set -ex -set -x -set -u - -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################# # Source relevant config files @@ -122,5 +117,4 @@ fi cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date exit 0 diff --git a/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_PREP b/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_PREP index 618984bcab1..b284e90e67f 100755 --- a/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_PREP +++ b/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_PREP @@ -1,11 +1,6 @@ #!/bin/bash -##set -ex -set -x -set -u - -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################# # Source relevant config files @@ -122,5 +117,4 @@ fi cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date exit 0 diff --git a/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_RUN b/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_RUN index d3b2c7f90ea..b3f5c0fa90a 100755 --- a/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_RUN +++ b/jobs/JGDAS_GLOBAL_ATMOS_ENSANAL_RUN @@ -1,11 +1,6 @@ #!/bin/bash -##set -ex -set -x -set -u - -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################# # Source relevant config files @@ -122,5 +117,4 @@ fi cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date exit 0 diff --git a/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG b/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG index ea70ae7b148..2528013e39f 100755 --- a/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG +++ b/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG @@ -1,9 +1,8 @@ -#!/bin/sh +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -set -xa -export PS4='$SECONDS + ' export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} -date ########################################### # GFS_AWIPS_20KM AWIPS PRODUCT GENERATION @@ -62,7 +61,6 @@ fi export pgmout=OUTPUT.$$ -env ######################################################## # Execute the script. @@ -76,9 +74,6 @@ $HOMEgfs/scripts/exgfs_atmos_awips_20km_1p0deg.sh $fcsthrs export err=$?; err_chk ######################################################## -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -93,4 +88,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_AWIPS_G2 b/jobs/JGFS_ATMOS_AWIPS_G2 index 634cf07cdd8..9dd2fdca636 100755 --- a/jobs/JGFS_ATMOS_AWIPS_G2 +++ b/jobs/JGFS_ATMOS_AWIPS_G2 @@ -1,8 +1,7 @@ -#!/bin/sh +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -set -xa -export PS4='$SECONDS + ' -date export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} ######################################## @@ -63,7 +62,6 @@ fi export pgmout=OUTPUT.$$ -env ######################################################## # Execute the script. @@ -73,9 +71,6 @@ cd $DATA/awips_g1 $HOMEgfs/scripts/exgfs_atmos_grib_awips.sh $fcsthrs export err=$?; err_chk -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -90,4 +85,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_CYCLONE_GENESIS b/jobs/JGFS_ATMOS_CYCLONE_GENESIS index 090e1e1bfb9..79d43ebb1ed 100755 --- a/jobs/JGFS_ATMOS_CYCLONE_GENESIS +++ b/jobs/JGFS_ATMOS_CYCLONE_GENESIS @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -99,8 +97,6 @@ export COMOUT=${ROTDIR}/${RUN}.${PDY}/${cyc}/$COMPONENT export JYYYY=$(echo ${PDY} | cut -c1-4) export COMINgenvit=${COMINgenvit:-${COMOUT}/genesis_vital_${JYYYY}} export COMOUTgenvit=${COMOUTgenvit:-${COMOUT}/genesis_vital_${JYYYY}} -#export COMINgenvit=${COMINgenvit:-${DATA}/genesis_vital_${JYYYY}} -#export COMOUTgenvit=${COMOUTgenvit:-${DATA}/genesis_vital_${JYYYY}} export COMINsyn=${COMINsyn:-$(compath.py gfs/prod/syndat)} @@ -109,11 +105,6 @@ mkdir -m 775 -p $COMOUTgenvit ############################################## # Run relevant script ############################################## -env -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${SCRIPTens_tracker}/exgfs_tc_genesis.sh export err=$?; err_chk @@ -125,15 +116,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGFS_ATMOS_CYCLONE_TRACKER b/jobs/JGFS_ATMOS_CYCLONE_TRACKER index d2e44e115be..4b05ea0b802 100755 --- a/jobs/JGFS_ATMOS_CYCLONE_TRACKER +++ b/jobs/JGFS_ATMOS_CYCLONE_TRACKER @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -115,10 +113,6 @@ fi ############################################## # Run relevant script ############################################## -env -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT ############################################################# # Execute the script @@ -153,16 +147,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGFS_ATMOS_FBWIND b/jobs/JGFS_ATMOS_FBWIND index 0c43bf26434..42e459dd0bc 100755 --- a/jobs/JGFS_ATMOS_FBWIND +++ b/jobs/JGFS_ATMOS_FBWIND @@ -1,8 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################################ # GFS FBWIND PRODUCT GENERATION @@ -62,7 +60,6 @@ fi export pgmout=OUTPUT.$$ -env ######################################################## # Execute the script. @@ -70,9 +67,6 @@ $HOMEgfs/scripts/exgfs_atmos_fbwind.sh export err=$?;err_chk ######################################################## -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -87,4 +81,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_FSU_GENESIS b/jobs/JGFS_ATMOS_FSU_GENESIS index 57aa709e069..eb3069bfcb9 100755 --- a/jobs/JGFS_ATMOS_FSU_GENESIS +++ b/jobs/JGFS_ATMOS_FSU_GENESIS @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -119,10 +117,6 @@ fi ############################################## # Run relevant script ############################################## -env -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT ############################################################# # Execute the script @@ -136,14 +130,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGFS_ATMOS_GEMPAK b/jobs/JGFS_ATMOS_GEMPAK index 173fad7d512..502bb96a7a8 100755 --- a/jobs/JGFS_ATMOS_GEMPAK +++ b/jobs/JGFS_ATMOS_GEMPAK @@ -1,13 +1,30 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################################ # GFS GEMPAK PRODUCT GENERATION ############################################ +############################# +# Source relevant config files +############################# +configs="base gempak" +export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} +config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} +for config in $configs; do + . $config_path/config.$config + status=$? + [[ $status -ne 0 ]] && exit $status +done + +########################################## +# Source machine runtime environment +########################################## +. $HOMEgfs/env/${machine}.env gempak +status=$? +[[ $status -ne 0 ]] && exit $status + ########################################################## # obtain unique process id (pid) and make temp directory ########################################################## @@ -73,7 +90,6 @@ fi export pgmout=OUTPUT.$$ -env rm -f poescript @@ -129,6 +145,10 @@ echo "time $SRCgfs/exgfs_atmos_nawips.sh gfs35_atl 180 GFS_GEMPAK_WWB &> $DATA/g echo "time $SRCgfs/exgfs_atmos_nawips.sh gfs40 180 GFS_GEMPAK_WWB &> $DATA/gfs40.$$.1 " >>poescript echo "time $SRCgfs/exgfs_atmos_nawips.sh gfs40 180 GFS_GEMPAK_WWB &> $DATA/gfs40.$$.2 " >>poescript +# Add task number to the MPMD script +nl -n ln -v 0 poescript > poescript.new +mv poescript.new poescript + cat poescript chmod 775 $DATA/poescript @@ -139,7 +159,7 @@ ntasks=${NTASKS_GEMPAK:-$(cat $DATA/poescript | wc -l)} ptile=${PTILE_GEMPAK:-4} threads=${NTHREADS_GEMPAK:-1} export OMP_NUM_THREADS=$threads -APRUN="mpirun -n $ntasks cfp " +APRUN=${APRUN:-"mpirun -n $ntasks cfp "} APRUN_GEMPAKCFP=${APRUN_GEMPAKCFP:-$APRUN} APRUNCFP=$(eval echo $APRUN_GEMPAKCFP) @@ -147,11 +167,6 @@ APRUNCFP=$(eval echo $APRUN_GEMPAKCFP) $APRUNCFP $DATA/poescript export err=$?; err_chk -cat $DATA/gfs*.$$.? - -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -166,4 +181,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_GEMPAK_META b/jobs/JGFS_ATMOS_GEMPAK_META index d3590b88bfb..9d6683a521b 100755 --- a/jobs/JGFS_ATMOS_GEMPAK_META +++ b/jobs/JGFS_ATMOS_GEMPAK_META @@ -1,8 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################################ # GFS GEMPAK META PRODUCT GENERATION @@ -83,16 +81,12 @@ export COMINnam=${COMINnam:-$(compath.py nam/prod/nam)} export SENDDBN=${SENDDBN:-NO} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" - if [ $SENDCOM = YES ] ; then mkdir -m 775 -p $COMOUT fi export pgmout=OUTPUT.$$ -env ######################################################## # Execute the script. @@ -100,9 +94,6 @@ $SRCgfs/exgfs_atmos_gempak_meta.sh export err=$?; err_chk ######################################################## -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -117,4 +108,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF b/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF index cc245568925..4b8a04e6a94 100755 --- a/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF +++ b/jobs/JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF @@ -1,8 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################################ # GFS GEMPAK NCDC PRODUCT GENERATION @@ -84,10 +82,6 @@ fi export pgmout=OUTPUT.$$ -env - -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" ######################################################## # Execute the script. @@ -95,9 +89,6 @@ $SRCgfs/exgfs_atmos_gempak_gif_ncdc_skew_t.sh export err=$?; err_chk ######################################################## -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -112,4 +103,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC b/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC index 0f57c6adb28..d8d05b27f2c 100755 --- a/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC +++ b/jobs/JGFS_ATMOS_GEMPAK_PGRB2_SPEC @@ -1,8 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" ############################################ # GFS_PGRB2_SPEC_GEMPAK PRODUCT GENERATION @@ -63,13 +61,9 @@ if [ $SENDCOM = YES ] ; then mkdir -m 775 -p $COMOUT fi -env export DATA_HOLD=$DATA -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" - ################################################################# # Execute the script for the regular grib ################################################################# @@ -85,7 +79,6 @@ export finc=3 export fstart=000 echo "RUNS the Program" -set -xa ######################################################## # Execute the script. @@ -107,7 +100,6 @@ export finc=3 export fstart=000 echo "RUNS the Program" -set -xa ######################################################## # Execute the script. @@ -115,9 +107,6 @@ $SRCgfs/exgfs_atmos_goes_nawips.sh export err=$?; err_chk ######################################################## -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - echo "end of program" cd $DATA_HOLD echo "######################################" @@ -138,4 +127,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS b/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS index 7cc9f693098..8ae1170800d 100755 --- a/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS +++ b/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS @@ -1,8 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash -set -xa -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} @@ -65,7 +63,6 @@ fi export pgmout=OUTPUT.$$ -env #################################### # Specify Forecast Hour Range @@ -124,9 +121,6 @@ $HOMEgfs/scripts/exgfs_atmos_grib2_special_npoess.sh export err=$?;err_chk ############################################################# -msg="JOB $job HAS COMPLETED NORMALLY!" -postmsg $jlogfile "$msg" - ############################################ # print exec I/O output ############################################ @@ -141,4 +135,3 @@ if [ "$KEEPDATA" != "YES" ] ; then rm -rf $DATA fi -date diff --git a/jobs/JGFS_ATMOS_POSTSND b/jobs/JGFS_ATMOS_POSTSND index 5faf16f7786..013e6d16486 100755 --- a/jobs/JGFS_ATMOS_POSTSND +++ b/jobs/JGFS_ATMOS_POSTSND @@ -1,9 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date ############################# # Source relevant config files @@ -92,7 +91,6 @@ export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} [[ ! -d $pcom ]] && mkdir -p $pcom [[ ! -d $COMAWP ]] && mkdir -p $COMAWP -env ######################################################## # Execute the script. @@ -112,15 +110,12 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_ATMOS_ANALYSIS b/jobs/JGLOBAL_ATMOS_ANALYSIS index af28afe3b6b..df1f4ab474d 100755 --- a/jobs/JGLOBAL_ATMOS_ANALYSIS +++ b/jobs/JGLOBAL_ATMOS_ANALYSIS @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -140,10 +138,6 @@ fi ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${ANALYSISSH:-$SCRgfs/exglobal_atmos_analysis.sh} status=$? @@ -171,15 +165,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC b/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC index 63c143200fe..39438e32b7c 100755 --- a/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC +++ b/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -127,10 +125,6 @@ export DOGAUSFCANL=${DOGAUSFCANL:-"YES"} ############################################################### # Run relevant script -env -echo "HAS BEGUN on $(hostname)" -$LOGSCRIPT - ${ANALCALCSH:-$SCRgfs/exglobal_atmos_analysis_calc.sh} status=$? @@ -148,15 +142,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -echo "ENDED NORMALLY." - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_ATMOS_EMCSFC_SFC_PREP b/jobs/JGLOBAL_ATMOS_EMCSFC_SFC_PREP index 22389d6f05a..c0aab4e9215 100755 --- a/jobs/JGLOBAL_ATMOS_EMCSFC_SFC_PREP +++ b/jobs/JGLOBAL_ATMOS_EMCSFC_SFC_PREP @@ -1,9 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date ############################# # Source relevant config files @@ -73,10 +72,6 @@ export BLENDED_ICE_FILE_m6hrs=${BLENDED_ICE_FILE_m6hrs:-${COMINgfs_m6hrs}/${RUN} # Run relevant script ############################################################### -env -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" - ${EMCSFCPREPSH:-$SCRgfs/exemcsfc_global_sfc_prep.sh} status=$? [[ $status -ne 0 ]] && exit $status @@ -92,15 +87,11 @@ if [ -e ${pgmout} ]; then cat $pgmout fi -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date exit 0 diff --git a/jobs/JGLOBAL_ATMOS_NCEPPOST b/jobs/JGLOBAL_ATMOS_NCEPPOST index d4b0983605b..4014ebf5e6c 100755 --- a/jobs/JGLOBAL_ATMOS_NCEPPOST +++ b/jobs/JGLOBAL_ATMOS_NCEPPOST @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -72,7 +70,7 @@ export COMPONENT=${COMPONENT:-atmos} ############################################## export APRUNP=${APRUN:-$APRUN_NP} export RERUN=${RERUN:-NO} -export HOMECRTM=${HOMECRTM:-${NWROOT}/lib/crtm/${crtm_ver}} +export HOMECRTM=${HOMECRTM:-${NWROOT:-}/lib/crtm/${crtm_ver:-}} export FIXCRTM=${CRTM_FIX:-${HOMECRTM}/fix} export PARMpost=${PARMpost:-$HOMEgfs/parm/post} export INLINE_POST=${WRITE_DOPOST:-".false."} @@ -118,11 +116,6 @@ export SLEEP_INT=5 ############################################################### # Run relevant exglobal script -env -msg="HAS BEGUN on $(hostname)" -postmsg "$msg" -$LOGSCRIPT - $SCRgfs/ex${RUN}_atmos_nceppost.sh status=$? @@ -139,15 +132,11 @@ if [ -e "$pgmout" ]; then cat $pgmout fi -msg="ENDED NORMALLY." -postmsg "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_ATMOS_POST_MANAGER b/jobs/JGLOBAL_ATMOS_POST_MANAGER index 94c848627f5..b931a7aa90e 100755 --- a/jobs/JGLOBAL_ATMOS_POST_MANAGER +++ b/jobs/JGLOBAL_ATMOS_POST_MANAGER @@ -1,17 +1,16 @@ -#!/bin/sh +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ######################################## # GFS post manager ######################################## export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date ############################# # Source relevant config files ############################# -set -x configs="base post" export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} @@ -101,4 +100,3 @@ export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} $HOMEgfs/scripts/exglobal_atmos_pmgr.sh ######################################################## -date diff --git a/jobs/JGLOBAL_ATMOS_SFCANL b/jobs/JGLOBAL_ATMOS_SFCANL index b5c7c7b9531..7d0e70782b3 100755 --- a/jobs/JGLOBAL_ATMOS_SFCANL +++ b/jobs/JGLOBAL_ATMOS_SFCANL @@ -1,10 +1,8 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -18,7 +16,6 @@ for config in $configs; do [[ $status -ne 0 ]] && exit $status done - ########################################## # Source machine runtime environment ########################################## @@ -105,10 +102,6 @@ fi ############################################################### # Run relevant script -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${SFCANALSH:-$SCRgfs/exglobal_atmos_sfcanl.sh} status=$? @@ -126,16 +119,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC b/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC index e49e6a0244e..5496861e5f5 100755 --- a/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC +++ b/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC @@ -1,10 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date +source "$HOMEgfs/ush/preamble.sh" +export RUN_ENVIR=${RUN_ENVIR:-"nco"} ############################# # Source relevant config files @@ -104,11 +102,6 @@ export BKGFREQ=1 # for hourly relocation ############################################## # Run relevant script ############################################## -env -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${TROPCYQCRELOSH:-$SCRgfs/exglobal_atmos_tropcy_qc_reloc.sh} status=$? @@ -122,15 +115,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_FORECAST b/jobs/JGLOBAL_FORECAST index d72a07614f9..40e8f46051a 100755 --- a/jobs/JGLOBAL_FORECAST +++ b/jobs/JGLOBAL_FORECAST @@ -1,9 +1,8 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date #-------------------------------- if [ $RUN_ENVIR = "emc" ]; then @@ -135,11 +134,6 @@ fi ############################################################### # Run relevant exglobal script -env -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - ${FORECASTSH:-$SCRgfs/exglobal_forecast.sh} status=$? @@ -157,14 +151,11 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - ########################################## # Remove the Temporary working directory ########################################## cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_WAVE_GEMPAK b/jobs/JGLOBAL_WAVE_GEMPAK index aee0207acd2..591dcff3930 100755 --- a/jobs/JGLOBAL_WAVE_GEMPAK +++ b/jobs/JGLOBAL_WAVE_GEMPAK @@ -1,9 +1,6 @@ -#!/bin/bash +#! /usr/bin/env bash - -date -set -xa -export PS4='$SECONDS + ' +source "$HOMEgfs/ush/preamble.sh" # JY - 10/29, move the block in the front, otherwise PDY is not defined for COMIN export DATA=${DATA:-${DATAROOT}/${jobid:?}} @@ -18,10 +15,6 @@ export cycle=${cycle:-t${cyc}z} setpdy.sh . PDY -env -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" - # export NET=${NET:-gfs} @@ -63,5 +56,5 @@ if [ "$KEEPDATA" != "YES" ]; then rm -rf $DATA fi -date + exit 0 diff --git a/jobs/JGLOBAL_WAVE_INIT b/jobs/JGLOBAL_WAVE_INIT index bab8f047422..013dff7e707 100755 --- a/jobs/JGLOBAL_WAVE_INIT +++ b/jobs/JGLOBAL_WAVE_INIT @@ -1,9 +1,8 @@ -#!/bin/bash +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -date export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4=' $SECONDS + ' -set -x -e ############################# # Source relevant config files @@ -79,5 +78,5 @@ $HOMEgfs/scripts/exgfs_wave_init.sh cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_WAVE_POST_BNDPNT b/jobs/JGLOBAL_WAVE_POST_BNDPNT index 93b690ad1dd..0821a9fdaf8 100755 --- a/jobs/JGLOBAL_WAVE_POST_BNDPNT +++ b/jobs/JGLOBAL_WAVE_POST_BNDPNT @@ -1,9 +1,8 @@ -#!/bin/bash +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -date export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4=' $SECONDS + ' -set -x -e ############################# # Source relevant config files @@ -68,12 +67,9 @@ export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/$COMPONENT} mkdir -p $COMOUT/station -env | sort # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic -# Set wave model ID tag to include member number -# if ensemble; waveMEMB var empty in deterministic membTAG='p' if [ "${waveMEMB}" == "00" ]; then membTAG='c'; fi export membTAG @@ -91,11 +87,9 @@ export DOBNDPNT_WAV='YES' #not boundary points $HOMEgfs/scripts/exgfs_wave_post_pnt.sh err=$? if [ $err -ne 0 ]; then - msg="FATAL ERROR: ex-script of GWES_POST failed!" -else - msg="$job completed normally!" + echo "FATAL ERROR: ex-script of GWES_POST failed!" + exit ${err} fi -postmsg "$jlogfile" "$msg" ########################################## # Remove the Temporary working directory @@ -103,5 +97,5 @@ postmsg "$jlogfile" "$msg" cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL b/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL index 5d37dd35fcd..404ab14d9ef 100755 --- a/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL +++ b/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL @@ -1,9 +1,8 @@ -#!/bin/bash +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -date export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4=' $SECONDS + ' -set -x -e ############################# # Source relevant config files @@ -69,7 +68,6 @@ export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/$COMPONENT} mkdir -p $COMOUT/station -env | sort # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic @@ -92,11 +90,9 @@ export DOBNDPNT_WAV='YES' #boundary points $HOMEgfs/scripts/exgfs_wave_post_pnt.sh err=$? if [ $err -ne 0 ]; then - msg="FATAL ERROR: ex-script of GFS_WAVE_POST_PNT failed!" -else - msg="$job completed normally!" + echo "FATAL ERROR: ex-script of GFS_WAVE_POST_PNT failed!" + exit ${err} fi -postmsg "$jlogfile" "$msg" ########################################## # Remove the Temporary working directory @@ -104,5 +100,5 @@ postmsg "$jlogfile" "$msg" cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_WAVE_POST_PNT b/jobs/JGLOBAL_WAVE_POST_PNT index 092916b7f6f..acde66e7a58 100755 --- a/jobs/JGLOBAL_WAVE_POST_PNT +++ b/jobs/JGLOBAL_WAVE_POST_PNT @@ -1,16 +1,15 @@ -#!/bin/bash +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -date export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4=' $SECONDS + ' -set -x -e ############################# # Source relevant config files ############################# configs="base wave wavepostsbs wavepostpnt" export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} -config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} +config_path=${EXPDIR:-${NWROOT:-}/gfs.${gfs_ver}/parm/config} for config in $configs; do . $config_path/config.$config status=$? @@ -29,8 +28,8 @@ export NET=${NET:-gfs} export RUN=${RUN:-gfs} export COMPONENT=${COMPONENT:-wave} -export HOMEgefs=${HOMEgefs:-$NWROOT/$NET.${gefs_ver}} -export HOMEgfs=${HOMEgfs:-$NWROOT/$NET.${gfs_ver}} +export HOMEgefs=${HOMEgefs:-${NWROOT:-}/$NET.${gefs_ver:-}} +export HOMEgfs=${HOMEgfs:-${NWROOT:-}/$NET.${gfs_ver}} # Add default errchk = err_chk export errchk=${errchk:-err_chk} @@ -68,7 +67,6 @@ export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/$COMPONENT} mkdir -p $COMOUT/station -env | sort # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic @@ -91,11 +89,9 @@ export DOBNDPNT_WAV='NO' #not boundary points $HOMEgfs/scripts/exgfs_wave_post_pnt.sh err=$? if [ $err -ne 0 ]; then - msg="FATAL ERROR: ex-script of GWES_POST failed!" -else - msg="$job completed normally!" + echo "FATAL ERROR: ex-script of GWES_POST failed!" + exir ${err} fi -postmsg "$jlogfile" "$msg" ########################################## # Remove the Temporary working directory @@ -103,5 +99,5 @@ postmsg "$jlogfile" "$msg" cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_WAVE_POST_SBS b/jobs/JGLOBAL_WAVE_POST_SBS index d798e28deff..868cf8b2424 100755 --- a/jobs/JGLOBAL_WAVE_POST_SBS +++ b/jobs/JGLOBAL_WAVE_POST_SBS @@ -1,16 +1,15 @@ -#!/bin/bash +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -date export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4=' $SECONDS + ' -set -x -e ############################# # Source relevant config files ############################# configs="base wave wavepostsbs" export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} -config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} +config_path=${EXPDIR:-${NWROOT:-}/gfs.${gfs_ver}/parm/config} for config in $configs; do . $config_path/config.$config status=$? @@ -29,8 +28,8 @@ export NET=${NET:-gfs} export RUN=${RUN:-gfs} export COMPONENT=${COMPONENT:-wave} -export HOMEgefs=${HOMEgefs:-$NWROOT/$NET.${gefs_ver}} -export HOMEgfs=${HOMEgfs:-$NWROOT/$NET.${gfs_ver}} +export HOMEgefs=${HOMEgefs:-${NWROOT:-}/$NET.${gefs_ver:-}} +export HOMEgfs=${HOMEgfs:-${NWROOT:-}/$NET.${gfs_ver}} # Add default errchk = err_chk export errchk=${errchk:-err_chk} @@ -66,13 +65,12 @@ fi export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/$COMPONENT} export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/$COMPONENT} -export COMINice=${COMINice:-${COMROOTp2}/omb/prod} +export COMINice=${COMINice:-${COMROOTp2:-${COMROOT}}/omb/prod} export COMINwnd=${COMINwnd:-${COMROOT}/gfs/prod} -export COMIN_WAV_CUR=${COMIN_WAV_CUR:-${COMROOTp2}/rtofs/prod} +export COMIN_WAV_CUR=${COMIN_WAV_CUR:-${COMROOTp2:-${COMROOT}}/rtofs/prod} mkdir -p $COMOUT/gridded -env | sort # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic @@ -89,11 +87,9 @@ export CFP_VERBOSE=1 $HOMEgfs/scripts/exgfs_wave_post_gridded_sbs.sh err=$? if [ $err -ne 0 ]; then - msg="FATAL ERROR: ex-script of GWES_POST failed!" -else - msg="$job completed normally!" + echo "FATAL ERROR: ex-script of GWES_POST failed!" + exit $err fi -postmsg "$jlogfile" "$msg" ########################################## # Remove the Temporary working directory @@ -101,5 +97,5 @@ postmsg "$jlogfile" "$msg" cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/JGLOBAL_WAVE_PRDGEN_BULLS b/jobs/JGLOBAL_WAVE_PRDGEN_BULLS index db8738dcb9d..617217dfac9 100755 --- a/jobs/JGLOBAL_WAVE_PRDGEN_BULLS +++ b/jobs/JGLOBAL_WAVE_PRDGEN_BULLS @@ -1,8 +1,6 @@ -#!/bin/bash +#! /usr/bin/env bash -date -export PS4=' $SECONDS + ' -set -xa +source "$HOMEgfs/ush/preamble.sh" export DATA=${DATA:-${DATAROOT}/${jobid:?}} mkdir -p $DATA @@ -16,7 +14,6 @@ export cycle=${cycle:-t${cyc}z} # Set PDY setpdy.sh . PDY -env export NET=${NET:-gfs} export RUN=${RUN:-gfs} @@ -56,6 +53,7 @@ if [ "$KEEPDATA" != "YES" ]; then cd $DATAROOT rm -rf $DATA fi -date + + exit 0 diff --git a/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED b/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED index 6e9f8ea5c27..45cea6d4e2c 100755 --- a/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED +++ b/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED @@ -1,8 +1,6 @@ -#!/bin/bash +#! /usr/bin/env bash -date -export PS4=' $SECONDS + ' -set -xa +source "$HOMEgfs/ush/preamble.sh" export DATA=${DATA:-${DATAROOT}/${jobid:?}} mkdir -p $DATA @@ -16,7 +14,6 @@ export cycle=${cycle:-t${cyc}z} # Set PDY setpdy.sh . PDY - env # PATH for working directory export NET=${NET:-gfs} @@ -45,21 +42,6 @@ if [ $SENDCOM = YES ]; then mkdir -p $COMOUT $PCOM fi -# JY - move up -#export DATA=${DATA:-${DATAROOT}/${jobid:?}} -#mkdir -p $DATA -#cd $DATA -# -####################################### -### Set up the cycle variable -####################################### -#export cycle=${cycle:-t${cyc}z} - -## Set PDY -# setpdy.sh -# . PDY -# env - ################################### # Execute the Script ################################### @@ -73,6 +55,7 @@ if [ "$KEEPDATA" != "YES" ]; then cd $DATAROOT rm -rf $DATA fi -date + + exit 0 diff --git a/jobs/JGLOBAL_WAVE_PREP b/jobs/JGLOBAL_WAVE_PREP index 666ecb3b9e3..5878e36444f 100755 --- a/jobs/JGLOBAL_WAVE_PREP +++ b/jobs/JGLOBAL_WAVE_PREP @@ -1,9 +1,8 @@ -#!/bin/bash +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -date export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4=' $SECONDS + ' -set -x -e ############################# # Source relevant config files @@ -101,5 +100,5 @@ $HOMEgfs/scripts/exgfs_wave_prep.sh cd $DATAROOT [[ $KEEPDATA = "NO" ]] && rm -rf $DATA -date + exit 0 diff --git a/jobs/rocoto/aerosol_init.sh b/jobs/rocoto/aerosol_init.sh index d95f043e706..34ccc0fe262 100755 --- a/jobs/rocoto/aerosol_init.sh +++ b/jobs/rocoto/aerosol_init.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#! /usr/bin/env bash -set -x +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -34,5 +34,5 @@ fi ############################################################## # Exit cleanly -set +x + exit 0 diff --git a/jobs/rocoto/anal.sh b/jobs/rocoto/anal.sh index 5f39309dbb0..cd7fdc932a1 100755 --- a/jobs/rocoto/anal.sh +++ b/jobs/rocoto/anal.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_ATMOS_ANALYSIS status=$? -exit $status + + +exit ${status} diff --git a/jobs/rocoto/analcalc.sh b/jobs/rocoto/analcalc.sh index df5915086e3..d80756cfc76 100755 --- a/jobs/rocoto/analcalc.sh +++ b/jobs/rocoto/analcalc.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC status=$? + + exit $status diff --git a/jobs/rocoto/analdiag.sh b/jobs/rocoto/analdiag.sh index 6e29a696002..f9d97360c65 100755 --- a/jobs/rocoto/analdiag.sh +++ b/jobs/rocoto/analdiag.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ATMOS_ANALYSIS_DIAG status=$? + + exit $status diff --git a/jobs/rocoto/arch.sh b/jobs/rocoto/arch.sh index e6ce577d1cc..c9441b5a755 100755 --- a/jobs/rocoto/arch.sh +++ b/jobs/rocoto/arch.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -60,9 +62,11 @@ PDY_MOS=$(echo $CDATE_MOS | cut -c1-8) COMIN=${COMINatmos:-"$ROTDIR/$CDUMP.$PDY/$cyc/atmos"} cd $COMIN +source "${HOMEgfs}/ush/file_utils.sh" + [[ ! -d $ARCDIR ]] && mkdir -p $ARCDIR -$NCP ${APREFIX}gsistat $ARCDIR/gsistat.${CDUMP}.${CDATE} -$NCP ${APREFIX}pgrb2.1p00.anl $ARCDIR/pgbanl.${CDUMP}.${CDATE}.grib2 +nb_copy ${APREFIX}gsistat $ARCDIR/gsistat.${CDUMP}.${CDATE} +nb_copy ${APREFIX}pgrb2.1p00.anl $ARCDIR/pgbanl.${CDUMP}.${CDATE}.grib2 # Archive 1 degree forecast GRIB2 files for verification if [ $CDUMP = "gfs" ]; then @@ -71,16 +75,16 @@ if [ $CDUMP = "gfs" ]; then while [ $fhr -le $fhmax ]; do fhr2=$(printf %02i $fhr) fhr3=$(printf %03i $fhr) - $NCP ${APREFIX}pgrb2.1p00.f$fhr3 $ARCDIR/pgbf${fhr2}.${CDUMP}.${CDATE}.grib2 - (( fhr = 10#$fhr + 10#$FHOUT_GFS )) + nb_copy ${APREFIX}pgrb2.1p00.f$fhr3 $ARCDIR/pgbf${fhr2}.${CDUMP}.${CDATE}.grib2 + fhr=$((10#$fhr + 10#$FHOUT_GFS )) done fi if [ $CDUMP = "gdas" ]; then flist="000 003 006 009" for fhr in $flist; do fname=${APREFIX}pgrb2.1p00.f${fhr} - fhr2=$(printf %02i $fhr) - $NCP $fname $ARCDIR/pgbf${fhr2}.${CDUMP}.${CDATE}.grib2 + fhr2=$(printf %02i $((10#$fhr))) + nb_copy $fname $ARCDIR/pgbf${fhr2}.${CDUMP}.${CDATE}.grib2 done fi @@ -97,15 +101,17 @@ if [ $CDUMP = "gdas" -a -s gdas.t${cyc}z.cyclone.trackatcfunix ]; then fi if [ $CDUMP = "gfs" ]; then - $NCP storms.gfso.atcf_gen.$CDATE ${ARCDIR}/. - $NCP storms.gfso.atcf_gen.altg.$CDATE ${ARCDIR}/. - $NCP trak.gfso.atcfunix.$CDATE ${ARCDIR}/. - $NCP trak.gfso.atcfunix.altg.$CDATE ${ARCDIR}/. + nb_copy storms.gfso.atcf_gen.$CDATE ${ARCDIR}/. + nb_copy storms.gfso.atcf_gen.altg.$CDATE ${ARCDIR}/. + nb_copy trak.gfso.atcfunix.$CDATE ${ARCDIR}/. + nb_copy trak.gfso.atcfunix.altg.$CDATE ${ARCDIR}/. mkdir -p ${ARCDIR}/tracker.$CDATE/$CDUMP blist="epac natl" for basin in $blist; do - cp -rp $basin ${ARCDIR}/tracker.$CDATE/$CDUMP + if [[ -f $basin ]]; then + cp -rp $basin ${ARCDIR}/tracker.$CDATE/$CDUMP + fi done fi @@ -121,8 +127,8 @@ if [ $CDUMP = "gfs" -a $FITSARC = "YES" ]; then fhr3=$(printf %03i $fhr) sfcfile=${prefix}.sfcf${fhr3}${ASUFFIX} sigfile=${prefix}.atmf${fhr3}${ASUFFIX} - $NCP $sfcfile $VFYARC/${CDUMP}.$PDY/$cyc/ - $NCP $sigfile $VFYARC/${CDUMP}.$PDY/$cyc/ + nb_copy $sfcfile $VFYARC/${CDUMP}.$PDY/$cyc/ + nb_copy $sigfile $VFYARC/${CDUMP}.$PDY/$cyc/ (( fhr = 10#$fhr + 6 )) done fi @@ -228,12 +234,14 @@ if [ $CDUMP = "gfs" ]; then #--save mdl gfsmos output from all cycles in the 18Z archive directory if [ -d gfsmos.$PDY_MOS -a $cyc -eq 18 ]; then + set +e $TARCMD -P -cvf $ATARDIR/$CDATE_MOS/gfsmos.tar ./gfsmos.$PDY_MOS status=$? if [ $status -ne 0 -a $CDATE -ge $firstday ]; then echo "$(echo $TARCMD | tr 'a-z' 'A-Z') $CDATE gfsmos.tar failed" exit $status fi + ${ERR_EXIT_ON:-set -e} fi elif [ $CDUMP = "gdas" ]; then @@ -260,12 +268,14 @@ fi # Turn on extended globbing options shopt -s extglob for targrp in $targrp_list; do + set +e $TARCMD -P -cvf $ATARDIR/$CDATE/${targrp}.tar $(cat $ARCH_LIST/${targrp}.txt) status=$? if [ $status -ne 0 -a $CDATE -ge $firstday ]; then echo "$(echo $TARCMD | tr 'a-z' 'A-Z') $CDATE ${targrp}.tar failed" exit $status fi + ${ERR_EXIT_ON:-set -e} done # Turn extended globbing back off shopt -u extglob @@ -396,4 +406,6 @@ COMIN="$ROTDIR/$CDUMP.$rPDY" ############################################################### + + exit 0 diff --git a/jobs/rocoto/awips.sh b/jobs/rocoto/awips.sh index 8d94cdef20f..f8e5646aa67 100755 --- a/jobs/rocoto/awips.sh +++ b/jobs/rocoto/awips.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -73,7 +75,7 @@ for fhr in $fhrlst; do fhmax=84 if [ $fhr -ge $fhmin -a $fhr -le $fhmax ] ; then if [[ $(expr $fhr % 3) -eq 0 ]]; then - fhr3=$(printf %03i $fhr) + fhr3=$(printf %03d $((10#$fhr))) # Check for input file existence. If not present, sleep # Loop SLEEP_LOOP_MAX times. Abort if not found. @@ -145,4 +147,6 @@ done ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi + + exit 0 diff --git a/jobs/rocoto/coupled_ic.sh b/jobs/rocoto/coupled_ic.sh index 973d6b4ad41..1be2a216b5c 100755 --- a/jobs/rocoto/coupled_ic.sh +++ b/jobs/rocoto/coupled_ic.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#! /usr/bin/env bash -set -x +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -55,7 +55,7 @@ rc=$? if [[ $rc -ne 0 ]] ; then echo "FATAL: Unable to copy $BASE_CPLIC/$CPL_ATMIC/$CDATE/$CDUMP/* to $ICSDIR/$CDATE/atmos/ (Error code $rc)" fi -((err+=$rc)) +err=$((err + rc)) # Setup Ocean IC files @@ -64,7 +64,7 @@ rc=$? if [[ $rc -ne 0 ]] ; then echo "FATAL: Unable to copy $BASE_CPLIC/$CPL_OCNIC/$CDATE/ocn/$OCNRES/MOM*.nc to $ICSDIR/$CDATE/ocn/ (Error code $rc)" fi -((err+=$rc)) +err=$((err + rc)) #Setup Ice IC files cp $BASE_CPLIC/$CPL_ICEIC/$CDATE/ice/$ICERES/cice5_model_${ICERESdec}.res_$CDATE.nc $ICSDIR/$CDATE/ice/cice_model_${ICERESdec}.res_$CDATE.nc @@ -72,7 +72,7 @@ rc=$? if [[ $rc -ne 0 ]] ; then echo "FATAL: Unable to copy $BASE_CPLIC/$CPL_ICEIC/$CDATE/ice/$ICERES/cice5_model_${ICERESdec}.res_$CDATE.nc to $ICSDIR/$CDATE/ice/cice_model_${ICERESdec}.res_$CDATE.nc (Error code $rc)" fi -((err+=$rc)) +err=$((err + rc)) if [ $DO_WAVE = "YES" ]; then [[ ! -d $ICSDIR/$CDATE/wav ]] && mkdir -p $ICSDIR/$CDATE/wav @@ -83,7 +83,7 @@ if [ $DO_WAVE = "YES" ]; then if [[ $rc -ne 0 ]] ; then echo "FATAL: Unable to copy $BASE_CPLIC/$CPL_WAVIC/$CDATE/wav/$grdID/*restart.$grdID to $ICSDIR/$CDATE/wav/ (Error code $rc)" fi - ((err+=$rc)) + err=$((err + rc)) done fi @@ -112,5 +112,5 @@ fi ############################################################## # Exit cleanly -set +x + exit 0 diff --git a/jobs/rocoto/earc.sh b/jobs/rocoto/earc.sh index 5d57abf26e5..8b80b4b9e88 100755 --- a/jobs/rocoto/earc.sh +++ b/jobs/rocoto/earc.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -56,6 +58,7 @@ fi cd $ROTDIR +source "${HOMEgfs}/ush/file_utils.sh" ################################################################### # ENSGRP > 0 archives a group of ensemble members @@ -134,24 +137,26 @@ if [ $ENSGRP -eq 0 ]; then [ ! -d $ATARDIR/$CDATE ] && mkdir -p $ATARDIR/$CDATE fi + set +e $TARCMD -P -cvf $ATARDIR/$CDATE/enkf${CDUMP}.tar $(cat $ARCH_LIST/enkf${CDUMP}.txt) status=$? if [ $status -ne 0 -a $CDATE -ge $firstday ]; then echo "$(echo $TARCMD | tr 'a-z' 'A-Z') $CDATE enkf${CDUMP}.tar failed" exit $status fi + ${ERR_EXIT_ON:-set -eu} fi #-- Archive online for verification and diagnostics [[ ! -d $ARCDIR ]] && mkdir -p $ARCDIR cd $ARCDIR - $NCP $ROTDIR/enkf${CDUMP}.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.enkfstat enkfstat.${CDUMP}.$CDATE - $NCP $ROTDIR/enkf${CDUMP}.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.gsistat.ensmean gsistat.${CDUMP}.${CDATE}.ensmean + nb_copy $ROTDIR/enkf${CDUMP}.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.enkfstat enkfstat.${CDUMP}.$CDATE + nb_copy $ROTDIR/enkf${CDUMP}.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.gsistat.ensmean gsistat.${CDUMP}.${CDATE}.ensmean if [ $CDUMP_ENKF != "GDAS" ]; then - $NCP $ROTDIR/enkfgfs.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.enkfstat enkfstat.gfs.$CDATE - $NCP $ROTDIR/enkfgfs.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.gsistat.ensmean gsistat.gfs.${CDATE}.ensmean + nb_copy $ROTDIR/enkfgfs.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.enkfstat enkfstat.gfs.$CDATE + nb_copy $ROTDIR/enkfgfs.$PDY/$cyc/$COMPONENT/${CDUMP}.t${cyc}z.gsistat.ensmean gsistat.gfs.${CDATE}.ensmean fi fi @@ -219,4 +224,6 @@ for ctype in $clist; do done ############################################################### + + exit 0 diff --git a/jobs/rocoto/ecen.sh b/jobs/rocoto/ecen.sh index 8c88a63ef59..dd4a8ac8a69 100755 --- a/jobs/rocoto/ecen.sh +++ b/jobs/rocoto/ecen.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -24,4 +26,6 @@ done ############################################################### # Exit out cleanly + + exit 0 diff --git a/jobs/rocoto/echgres.sh b/jobs/rocoto/echgres.sh index 733257349e9..3171388f6ad 100755 --- a/jobs/rocoto/echgres.sh +++ b/jobs/rocoto/echgres.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ATMOS_CHGRES_FORENKF status=$? -exit $status + + +exit ${status} diff --git a/jobs/rocoto/ediag.sh b/jobs/rocoto/ediag.sh index cb9df99b9be..b09a7f49637 100755 --- a/jobs/rocoto/ediag.sh +++ b/jobs/rocoto/ediag.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ENKF_DIAG status=$? + + exit $status diff --git a/jobs/rocoto/efcs.sh b/jobs/rocoto/efcs.sh index 04d5eb3c3eb..4454ad6c8b7 100755 --- a/jobs/rocoto/efcs.sh +++ b/jobs/rocoto/efcs.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,5 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ENKF_FCST status=$? + exit $status diff --git a/jobs/rocoto/eobs.sh b/jobs/rocoto/eobs.sh index c635f9ed448..f6dc275578d 100755 --- a/jobs/rocoto/eobs.sh +++ b/jobs/rocoto/eobs.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ENKF_SELECT_OBS status=$? + + exit $status diff --git a/jobs/rocoto/eomg.sh b/jobs/rocoto/eomg.sh index a0519c53182..de981c02bb4 100755 --- a/jobs/rocoto/eomg.sh +++ b/jobs/rocoto/eomg.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ENKF_INNOVATE_OBS status=$? + + exit $status diff --git a/jobs/rocoto/epos.sh b/jobs/rocoto/epos.sh index e7ad93e69e7..1039b8ab20c 100755 --- a/jobs/rocoto/epos.sh +++ b/jobs/rocoto/epos.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -25,4 +27,6 @@ done ############################################################### # Exit out cleanly + + exit 0 diff --git a/jobs/rocoto/esfc.sh b/jobs/rocoto/esfc.sh index 50ee46e97a1..d830c59c50e 100755 --- a/jobs/rocoto/esfc.sh +++ b/jobs/rocoto/esfc.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ENKF_SFC status=$? + + exit $status diff --git a/jobs/rocoto/eupd.sh b/jobs/rocoto/eupd.sh index 1d8dc3b119a..d202c45aef3 100755 --- a/jobs/rocoto/eupd.sh +++ b/jobs/rocoto/eupd.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGDAS_ENKF_UPDATE status=$? + + exit $status diff --git a/jobs/rocoto/fcst.sh b/jobs/rocoto/fcst.sh index 199c89724a9..d59872c60ca 100755 --- a/jobs/rocoto/fcst.sh +++ b/jobs/rocoto/fcst.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_FORECAST status=$? + + exit $status diff --git a/jobs/rocoto/gempak.sh b/jobs/rocoto/gempak.sh index 2b119ab3f42..5b7f43ce47c 100755 --- a/jobs/rocoto/gempak.sh +++ b/jobs/rocoto/gempak.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -66,4 +68,6 @@ $GEMPAKSH ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi + + exit 0 diff --git a/jobs/rocoto/getic.sh b/jobs/rocoto/getic.sh index 700799b6770..84008e6ca01 100755 --- a/jobs/rocoto/getic.sh +++ b/jobs/rocoto/getic.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -158,4 +160,6 @@ cd $DATAROOT ############################################################### # Exit out cleanly + + exit 0 diff --git a/jobs/rocoto/gldas.sh b/jobs/rocoto/gldas.sh index 87fba5a2110..db16dd883f1 100755 --- a/jobs/rocoto/gldas.sh +++ b/jobs/rocoto/gldas.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -12,4 +14,5 @@ status=$? $HOMEgfs/jobs/JGDAS_ATMOS_GLDAS status=$? + exit $status diff --git a/jobs/rocoto/init.sh b/jobs/rocoto/init.sh index ed03799e2b3..0432750e72c 100755 --- a/jobs/rocoto/init.sh +++ b/jobs/rocoto/init.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -53,7 +55,7 @@ export RUNICSH=${RUNICSH:-${GDASINIT_DIR}/run_v16.chgres.sh} # Check if init is needed and run if so if [[ $gfs_ver = "v16" && $EXP_WARM_START = ".true." && $CASE = $OPS_RES ]]; then echo "Detected v16 $OPS_RES warm starts, will not run init. Exiting..." - exit 0 + else # Run chgres_cube if [ ! -d $OUTDIR ]; then mkdir -p $OUTDIR ; fi @@ -70,4 +72,6 @@ cd $DATAROOT ############################################################### # Exit out cleanly + + exit 0 diff --git a/jobs/rocoto/metp.sh b/jobs/rocoto/metp.sh index e18d35fc20f..80138b90265 100755 --- a/jobs/rocoto/metp.sh +++ b/jobs/rocoto/metp.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -73,4 +75,6 @@ fi ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi + + exit 0 diff --git a/jobs/rocoto/ocnpost.sh b/jobs/rocoto/ocnpost.sh index ad42680dbac..0f6413ec43e 100755 --- a/jobs/rocoto/ocnpost.sh +++ b/jobs/rocoto/ocnpost.sh @@ -1,5 +1,6 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## CICE5/MOM6 post driver script @@ -155,4 +156,6 @@ status=$? if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATA ; fi ############################################################### # Exit out cleanly + + exit 0 diff --git a/jobs/rocoto/post.sh b/jobs/rocoto/post.sh index 55cf654b4a3..b32e8c511d7 100755 --- a/jobs/rocoto/post.sh +++ b/jobs/rocoto/post.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## NCEP post driver script @@ -24,27 +26,10 @@ fi #--------------------------------------------------------------- for fhr in $fhrlst; do - - if [ ! -f $restart_file${fhr}.nemsio -a ! -f $restart_file${fhr}.nc -a ! -f $restart_file${fhr}.txt ]; then - echo "Nothing to process for FHR = $fhr, cycle, wait for 5 minutes" - sleep 300 - fi - if [ ! -f $restart_file${fhr}.nemsio -a ! -f $restart_file${fhr}.nc -a ! -f $restart_file${fhr}.txt ]; then - echo "Nothing to process for FHR = $fhr, cycle, skip" - continue - fi - - #master=$ROTDIR/${CDUMP}.${PDY}/${cyc}/$COMPONENT/${CDUMP}.t${cyc}z.master.grb2f${fhr} - pgb0p25=$ROTDIR/${CDUMP}.${PDY}/${cyc}/$COMPONENT/${CDUMP}.t${cyc}z.pgrb2.0p25.f${fhr} - if [ ! -s $pgb0p25 ]; then - export post_times=$fhr - $HOMEgfs/jobs/JGLOBAL_ATMOS_NCEPPOST - status=$? - [[ $status -ne 0 ]] && exit $status - fi - + export post_times=$fhr + $HOMEgfs/jobs/JGLOBAL_ATMOS_NCEPPOST + status=$? + [[ $status -ne 0 ]] && exit $status done -############################################################### -# Exit out cleanly exit 0 diff --git a/jobs/rocoto/postsnd.sh b/jobs/rocoto/postsnd.sh index 5472a9206bd..fadfaa6d9ed 100755 --- a/jobs/rocoto/postsnd.sh +++ b/jobs/rocoto/postsnd.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -12,5 +14,7 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGFS_ATMOS_POSTSND status=$? + + exit $status diff --git a/jobs/rocoto/prep.sh b/jobs/rocoto/prep.sh index 3c960787475..7d22adc7aae 100755 --- a/jobs/rocoto/prep.sh +++ b/jobs/rocoto/prep.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -126,4 +128,6 @@ fi ################################################################################ # Exit out cleanly + + exit 0 diff --git a/jobs/rocoto/sfcanl.sh b/jobs/rocoto/sfcanl.sh index 457b205c436..7b9812f37be 100755 --- a/jobs/rocoto/sfcanl.sh +++ b/jobs/rocoto/sfcanl.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules @@ -10,4 +12,6 @@ status=$? # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_ATMOS_SFCANL status=$? + + exit $status diff --git a/jobs/rocoto/vrfy.sh b/jobs/rocoto/vrfy.sh index ccc4f013886..57bf1814b98 100755 --- a/jobs/rocoto/vrfy.sh +++ b/jobs/rocoto/vrfy.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### ## Abstract: @@ -180,4 +182,6 @@ fi ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi + + exit 0 diff --git a/jobs/rocoto/wafs.sh b/jobs/rocoto/wafs.sh index f50f1b6801e..8aab955cc8a 100755 --- a/jobs/rocoto/wafs.sh +++ b/jobs/rocoto/wafs.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -52,4 +54,6 @@ done ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi + + exit 0 diff --git a/jobs/rocoto/wafsblending.sh b/jobs/rocoto/wafsblending.sh index bbdb9f82050..2793986e80c 100755 --- a/jobs/rocoto/wafsblending.sh +++ b/jobs/rocoto/wafsblending.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -32,9 +34,10 @@ echo "=============== START TO RUN WAFSBLENDING ===============" # Execute the JJOB $HOMEgfs/jobs/JGFS_ATMOS_WAFS_BLENDING status=$? -exit $status ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi -exit 0 + + +exit $status diff --git a/jobs/rocoto/wafsblending0p25.sh b/jobs/rocoto/wafsblending0p25.sh index 70f7c690055..fb06284f558 100755 --- a/jobs/rocoto/wafsblending0p25.sh +++ b/jobs/rocoto/wafsblending0p25.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -32,9 +34,10 @@ echo "=============== START TO RUN WAFSBLENDING0P25 ===============" # Execute the JJOB $HOMEgfs/jobs/JGFS_ATMOS_WAFS_BLENDING_0P25 status=$? -exit $status ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi -exit 0 + + +exit $status diff --git a/jobs/rocoto/wafsgcip.sh b/jobs/rocoto/wafsgcip.sh index 8ecc6fb922e..f3e98a03dac 100755 --- a/jobs/rocoto/wafsgcip.sh +++ b/jobs/rocoto/wafsgcip.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -32,9 +34,10 @@ echo "=============== START TO RUN WAFSGCIP ===============" # Execute the JJOB $HOMEgfs/jobs/JGFS_ATMOS_WAFS_GCIP status=$? -exit $status ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi -exit 0 + + +exit $status diff --git a/jobs/rocoto/wafsgrib2.sh b/jobs/rocoto/wafsgrib2.sh index d6c379db8e7..c7dbead30da 100755 --- a/jobs/rocoto/wafsgrib2.sh +++ b/jobs/rocoto/wafsgrib2.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -32,9 +34,10 @@ echo "=============== START TO RUN WAFSGRIB2 ===============" # Execute the JJOB $HOMEgfs/jobs/JGFS_ATMOS_WAFS_GRIB2 status=$? -exit $status ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi -exit 0 + + +exit $status diff --git a/jobs/rocoto/wafsgrib20p25.sh b/jobs/rocoto/wafsgrib20p25.sh index ef95f478679..e99ee210d91 100755 --- a/jobs/rocoto/wafsgrib20p25.sh +++ b/jobs/rocoto/wafsgrib20p25.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -32,9 +34,10 @@ echo "=============== START TO RUN WAFSGRIB20p25 ===============" # Execute the JJOB $HOMEgfs/jobs/JGFS_ATMOS_WAFS_GRIB2_0P25 status=$? -exit $status ############################################################### # Force Exit out cleanly if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi -exit 0 + + +exit $status diff --git a/jobs/rocoto/waveawipsbulls.sh b/jobs/rocoto/waveawipsbulls.sh index 6461a7aac90..1e1e1cd4e20 100755 --- a/jobs/rocoto/waveawipsbulls.sh +++ b/jobs/rocoto/waveawipsbulls.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -32,5 +34,6 @@ echo "=============== START TO RUN WAVE PRDGEN BULLS ===============" # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_WAVE_PRDGEN_BULLS status=$? -exit $status + +exit $status diff --git a/jobs/rocoto/waveawipsgridded.sh b/jobs/rocoto/waveawipsgridded.sh index 70e85dc2c77..3627ba62c4d 100755 --- a/jobs/rocoto/waveawipsgridded.sh +++ b/jobs/rocoto/waveawipsgridded.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -32,4 +34,6 @@ echo "=============== START TO RUN WAVE PRDGEN GRIDDED ===============" # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED status=$? + + exit $status diff --git a/jobs/rocoto/wavegempak.sh b/jobs/rocoto/wavegempak.sh index 870f6281b4c..d4cf1667fc6 100755 --- a/jobs/rocoto/wavegempak.sh +++ b/jobs/rocoto/wavegempak.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -30,4 +32,6 @@ echo "=============== START TO RUN WAVE GEMPAK ===============" # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_WAVE_GEMPAK status=$? + + exit $status diff --git a/jobs/rocoto/waveinit.sh b/jobs/rocoto/waveinit.sh index 14a6a5cdebd..5995b85302a 100755 --- a/jobs/rocoto/waveinit.sh +++ b/jobs/rocoto/waveinit.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -15,7 +17,4 @@ $HOMEgfs/jobs/JGLOBAL_WAVE_INIT status=$? [[ $status -ne 0 ]] && exit $status -############################################################### -# Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi exit 0 diff --git a/jobs/rocoto/wavepostbndpnt.sh b/jobs/rocoto/wavepostbndpnt.sh index 52c5d9fafed..fe0e2a07233 100755 --- a/jobs/rocoto/wavepostbndpnt.sh +++ b/jobs/rocoto/wavepostbndpnt.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -15,7 +17,4 @@ $HOMEgfs/jobs/JGLOBAL_WAVE_POST_BNDPNT status=$? [[ $status -ne 0 ]] && exit $status -############################################################### -# Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi exit 0 diff --git a/jobs/rocoto/wavepostbndpntbll.sh b/jobs/rocoto/wavepostbndpntbll.sh index 72fb77bd1e8..cea3c0bc6b2 100755 --- a/jobs/rocoto/wavepostbndpntbll.sh +++ b/jobs/rocoto/wavepostbndpntbll.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -15,7 +17,4 @@ $HOMEgfs/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL status=$? [[ $status -ne 0 ]] && exit $status -############################################################### -# Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi exit 0 diff --git a/jobs/rocoto/wavepostpnt.sh b/jobs/rocoto/wavepostpnt.sh index f00c09550b8..1b1d8c97650 100755 --- a/jobs/rocoto/wavepostpnt.sh +++ b/jobs/rocoto/wavepostpnt.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -15,7 +17,4 @@ $HOMEgfs/jobs/JGLOBAL_WAVE_POST_PNT status=$? [[ $status -ne 0 ]] && exit $status -############################################################### -# Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi exit 0 diff --git a/jobs/rocoto/wavepostsbs.sh b/jobs/rocoto/wavepostsbs.sh index d8ec7cc2683..fb4fdfbd8b6 100755 --- a/jobs/rocoto/wavepostsbs.sh +++ b/jobs/rocoto/wavepostsbs.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -15,7 +17,4 @@ $HOMEgfs/jobs/JGLOBAL_WAVE_POST_SBS status=$? [[ $status -ne 0 ]] && exit $status -############################################################### -# Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi exit 0 diff --git a/jobs/rocoto/waveprep.sh b/jobs/rocoto/waveprep.sh index 9705fbc31ae..c55c8526d98 100755 --- a/jobs/rocoto/waveprep.sh +++ b/jobs/rocoto/waveprep.sh @@ -1,4 +1,6 @@ -#!/bin/bash -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" ############################################################### echo @@ -15,7 +17,4 @@ $HOMEgfs/jobs/JGLOBAL_WAVE_PREP status=$? [[ $status -ne 0 ]] && exit $status -############################################################### -# Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi exit 0 diff --git a/parm/config/config.aero b/parm/config/config.aero index 9b6b2a5ca6a..74c5cb7fa56 100644 --- a/parm/config/config.aero +++ b/parm/config/config.aero @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash # UFS-Aerosols settings diff --git a/parm/config/config.aerosol_init b/parm/config/config.aerosol_init index 430640ad946..0e586e02315 100644 --- a/parm/config/config.aerosol_init +++ b/parm/config/config.aerosol_init @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.aerosol_init ########## diff --git a/parm/config/config.anal b/parm/config/config.anal index 01955c2da9a..6d3a48c82eb 100755 --- a/parm/config/config.anal +++ b/parm/config/config.anal @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.anal ########## # Analysis specific @@ -33,7 +33,7 @@ fi # Set parameters specific to L127 if [ $LEVS = "128" ]; then export GRIDOPTS="nlayers(63)=1,nlayers(64)=1," - export SETUP="gpstop=55,nsig_ext=56,$SETUP" + export SETUP="gpstop=55,nsig_ext=56,${SETUP:-}" fi # Set namelist option for LETKF diff --git a/parm/config/config.analcalc b/parm/config/config.analcalc index 5866ce5ac69..c02aafc2c34 100755 --- a/parm/config/config.analcalc +++ b/parm/config/config.analcalc @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.analcalc ########## # GFS post-anal specific (non-diag) diff --git a/parm/config/config.analdiag b/parm/config/config.analdiag index 285e614d373..7b128d3bad5 100755 --- a/parm/config/config.analdiag +++ b/parm/config/config.analdiag @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.analdiag ########## # GFS post-anal specific (diag) diff --git a/parm/config/config.arch b/parm/config/config.arch index fca519c414b..c705e0b7ed1 100755 --- a/parm/config/config.arch +++ b/parm/config/config.arch @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.arch ########## # Archive specific diff --git a/parm/config/config.awips b/parm/config/config.awips index 6167b91f7e0..9003e9f6b0d 100755 --- a/parm/config/config.awips +++ b/parm/config/config.awips @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.awips ########## # GFS awips step specific diff --git a/parm/config/config.base.emc.dyn b/parm/config/config.base.emc.dyn index 722818b22a6..63da678301a 100755 --- a/parm/config/config.base.emc.dyn +++ b/parm/config/config.base.emc.dyn @@ -1,4 +1,4 @@ -#!/bin/bash -x +#! /usr/bin/env bash ########## config.base ########## # Common to all steps diff --git a/parm/config/config.base.nco.static b/parm/config/config.base.nco.static index 7dae9d5dd9c..4612e828145 100755 --- a/parm/config/config.base.nco.static +++ b/parm/config/config.base.nco.static @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.base ########## # Common to all steps diff --git a/parm/config/config.coupled_ic b/parm/config/config.coupled_ic index 7b4b6f51aa9..3ba878621d1 100755 --- a/parm/config/config.coupled_ic +++ b/parm/config/config.coupled_ic @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.coupled_ic ########## diff --git a/parm/config/config.defaults.s2sw b/parm/config/config.defaults.s2sw index a2926ffff50..5032a998ad5 100644 --- a/parm/config/config.defaults.s2sw +++ b/parm/config/config.defaults.s2sw @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash # Empty variables must include a space otherwise they will be overwritten diff --git a/parm/config/config.earc b/parm/config/config.earc index 7cb1de235f0..de73a93731d 100755 --- a/parm/config/config.earc +++ b/parm/config/config.earc @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.earc ########## # Ensemble archive specific diff --git a/parm/config/config.ecen b/parm/config/config.ecen index c9609e3ff89..2b686c6b481 100755 --- a/parm/config/config.ecen +++ b/parm/config/config.ecen @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.ecen ########## # Ensemble recentering specific diff --git a/parm/config/config.echgres b/parm/config/config.echgres index cbf176c92f9..478c6b4bcf0 100755 --- a/parm/config/config.echgres +++ b/parm/config/config.echgres @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.echgres ########## # regrid full-res forecast for use in ensemble-res analysis generation diff --git a/parm/config/config.ediag b/parm/config/config.ediag index 192b5d0b48b..12b142088db 100755 --- a/parm/config/config.ediag +++ b/parm/config/config.ediag @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.ediag ########## # GFS ensemble post-eobs specific diff --git a/parm/config/config.efcs b/parm/config/config.efcs index af84dc730fb..a1f0fe49cc1 100755 --- a/parm/config/config.efcs +++ b/parm/config/config.efcs @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.efcs ########## # Ensemble forecast specific, dependency: config.fcst diff --git a/parm/config/config.eobs b/parm/config/config.eobs index e46dde2f341..21f982addc2 100755 --- a/parm/config/config.eobs +++ b/parm/config/config.eobs @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.eobs config.eomg ########## # Ensemble innovation specific, dependency config.anal diff --git a/parm/config/config.epos b/parm/config/config.epos index 441a1ff995e..8026a2ba2ea 100755 --- a/parm/config/config.epos +++ b/parm/config/config.epos @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.epos ########## # Ensemble post processing specific diff --git a/parm/config/config.esfc b/parm/config/config.esfc index 53cbb091757..2bb3d48bb49 100755 --- a/parm/config/config.esfc +++ b/parm/config/config.esfc @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.esfc ########## # Ensemble surface specific diff --git a/parm/config/config.eupd b/parm/config/config.eupd index 0e9d42e0935..1ac90d2b75f 100755 --- a/parm/config/config.eupd +++ b/parm/config/config.eupd @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.eupd ########## # Ensemble update specific, dependency config.anal diff --git a/parm/config/config.fcst b/parm/config/config.fcst index e73c35d15da..2c380b9111b 100755 --- a/parm/config/config.fcst +++ b/parm/config/config.fcst @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.fcst ########## # Forecast specific diff --git a/parm/config/config.fv3 b/parm/config/config.fv3 index 93f836f6421..c8c959362ef 100755 --- a/parm/config/config.fv3 +++ b/parm/config/config.fv3 @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.fv3 ########## # FV3 model resolution specific parameters diff --git a/parm/config/config.fv3.nco.static b/parm/config/config.fv3.nco.static index 619ef6399ba..9181ca88e97 100755 --- a/parm/config/config.fv3.nco.static +++ b/parm/config/config.fv3.nco.static @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.fv3 ########## # FV3 model resolution specific parameters diff --git a/parm/config/config.gempak b/parm/config/config.gempak index 2bc49dcf175..a2b5ecbaf58 100755 --- a/parm/config/config.gempak +++ b/parm/config/config.gempak @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.gempak ########## # GFS gempak step specific diff --git a/parm/config/config.getic b/parm/config/config.getic index 4671cc9c4ad..fce3f9ecf6b 100755 --- a/parm/config/config.getic +++ b/parm/config/config.getic @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.getic ########## # Fetching GFS initial conditions specific diff --git a/parm/config/config.gldas b/parm/config/config.gldas index 4410c2ceabd..8d503d03683 100755 --- a/parm/config/config.gldas +++ b/parm/config/config.gldas @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.gldas ########## # GDAS gldas step specific diff --git a/parm/config/config.ice b/parm/config/config.ice index 101fc824524..3a6916600f1 100644 --- a/parm/config/config.ice +++ b/parm/config/config.ice @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash export NX_GLB="1440" export NY_GLB="1080" diff --git a/parm/config/config.init b/parm/config/config.init index eeb04a7d409..2301b1cdc1f 100755 --- a/parm/config/config.init +++ b/parm/config/config.init @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.init ########## # Prepare initial conditions diff --git a/parm/config/config.metp b/parm/config/config.metp index 2c39d9b431f..4be7151ffa6 100755 --- a/parm/config/config.metp +++ b/parm/config/config.metp @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.metp ########## # METplus verification step specific diff --git a/parm/config/config.nsst b/parm/config/config.nsst index ef8767834d1..b4c58eedb3a 100755 --- a/parm/config/config.nsst +++ b/parm/config/config.nsst @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.nsst ########## # NSST specific diff --git a/parm/config/config.ocn b/parm/config/config.ocn index fbb750d90ba..1675713e7c3 100644 --- a/parm/config/config.ocn +++ b/parm/config/config.ocn @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash # OCNRES is currently being set in config.base # case "$CASE" in diff --git a/parm/config/config.ocnpost b/parm/config/config.ocnpost index b734bab758f..89304df7f4f 100755 --- a/parm/config/config.ocnpost +++ b/parm/config/config.ocnpost @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.ocnpost ########## diff --git a/parm/config/config.post b/parm/config/config.post index 2ca6c3d753f..a545f0fafcf 100755 --- a/parm/config/config.post +++ b/parm/config/config.post @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.post ########## # Post specific diff --git a/parm/config/config.postsnd b/parm/config/config.postsnd index d64b401cdbc..53d66bf4f60 100755 --- a/parm/config/config.postsnd +++ b/parm/config/config.postsnd @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.postsnd ########## # GFS bufr sounding step specific diff --git a/parm/config/config.prep b/parm/config/config.prep index c04be70a095..ac172bf5b87 100755 --- a/parm/config/config.prep +++ b/parm/config/config.prep @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.prep ########## # Prep step specific diff --git a/parm/config/config.prepbufr b/parm/config/config.prepbufr index b86cb89d121..2d6ececc5bb 100755 --- a/parm/config/config.prepbufr +++ b/parm/config/config.prepbufr @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.prepbufr ########## # PREPBUFR specific configuration diff --git a/parm/config/config.resources b/parm/config/config.resources index cda6f2edced..b2390970ae4 100755 --- a/parm/config/config.resources +++ b/parm/config/config.resources @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.resources ########## # Set resource information for job tasks @@ -563,7 +563,7 @@ elif [ $step = "awips" ]; then elif [ $step = "gempak" ]; then export wtime_gempak="02:00:00" - export npe_gempak=17 + export npe_gempak=28 export npe_node_gempak=4 export nth_gempak=3 diff --git a/parm/config/config.sfcanl b/parm/config/config.sfcanl index 76da647eef5..9592fb77c91 100644 --- a/parm/config/config.sfcanl +++ b/parm/config/config.sfcanl @@ -1,4 +1,4 @@ -#!/bin/bash -x +#! /usr/bin/env bash ########## config.sfcanl ########## # GFS surface analysis specific diff --git a/parm/config/config.vrfy b/parm/config/config.vrfy index cd3b7150ce2..312c6fe9ad2 100755 --- a/parm/config/config.vrfy +++ b/parm/config/config.vrfy @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.vrfy ########## # Verification step specific diff --git a/parm/config/config.wafs b/parm/config/config.wafs index 8bf55770303..fe2ba8cae7f 100755 --- a/parm/config/config.wafs +++ b/parm/config/config.wafs @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wafs ########## diff --git a/parm/config/config.wafsblending b/parm/config/config.wafsblending index dfd7d1715eb..e49ffbdb88e 100755 --- a/parm/config/config.wafsblending +++ b/parm/config/config.wafsblending @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wafsblending ########## diff --git a/parm/config/config.wafsblending0p25 b/parm/config/config.wafsblending0p25 index 28a2de90ff9..947baab2bb2 100755 --- a/parm/config/config.wafsblending0p25 +++ b/parm/config/config.wafsblending0p25 @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wafsblending0p25 ########## diff --git a/parm/config/config.wafsgcip b/parm/config/config.wafsgcip index 793dae1694c..4909795c30e 100755 --- a/parm/config/config.wafsgcip +++ b/parm/config/config.wafsgcip @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wafsgcip ########## diff --git a/parm/config/config.wafsgrib2 b/parm/config/config.wafsgrib2 index 27b137cd8ce..0d657788e0c 100755 --- a/parm/config/config.wafsgrib2 +++ b/parm/config/config.wafsgrib2 @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wafsgrib2 ########## # Post specific diff --git a/parm/config/config.wafsgrib20p25 b/parm/config/config.wafsgrib20p25 index 8b55333c000..40cf80df220 100755 --- a/parm/config/config.wafsgrib20p25 +++ b/parm/config/config.wafsgrib20p25 @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wafsgrib20p25 ########## diff --git a/parm/config/config.wave b/parm/config/config.wave index a3b06a8041b..f69adda3ec4 100755 --- a/parm/config/config.wave +++ b/parm/config/config.wave @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wave ########## # Wave steps specific diff --git a/parm/config/config.waveawipsbulls b/parm/config/config.waveawipsbulls index ec39bfb646a..e3748e9cd11 100755 --- a/parm/config/config.waveawipsbulls +++ b/parm/config/config.waveawipsbulls @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.waveawipsbulls ########## # Wave steps specific diff --git a/parm/config/config.waveawipsgridded b/parm/config/config.waveawipsgridded index 7f2972bb24b..e84352558ed 100755 --- a/parm/config/config.waveawipsgridded +++ b/parm/config/config.waveawipsgridded @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.waveawipsgridded ########## # Wave steps specific diff --git a/parm/config/config.wavegempak b/parm/config/config.wavegempak index ec1f59d25c2..66af59f2a46 100755 --- a/parm/config/config.wavegempak +++ b/parm/config/config.wavegempak @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wavegempak ########## # Wave steps specific diff --git a/parm/config/config.waveinit b/parm/config/config.waveinit index 93960e5e252..61715f7f019 100755 --- a/parm/config/config.waveinit +++ b/parm/config/config.waveinit @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.waveinit ########## # Wave steps specific diff --git a/parm/config/config.wavepostbndpnt b/parm/config/config.wavepostbndpnt index eb3bb72ef88..eaa1626e628 100755 --- a/parm/config/config.wavepostbndpnt +++ b/parm/config/config.wavepostbndpnt @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wavepostbndpnt ########## # Wave steps specific diff --git a/parm/config/config.wavepostbndpntbll b/parm/config/config.wavepostbndpntbll index d26d70fa7ab..bb7224cc704 100755 --- a/parm/config/config.wavepostbndpntbll +++ b/parm/config/config.wavepostbndpntbll @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wavepostbndpntbll ########## # Wave steps specific diff --git a/parm/config/config.wavepostpnt b/parm/config/config.wavepostpnt index 276ca230a6d..8befb91760f 100755 --- a/parm/config/config.wavepostpnt +++ b/parm/config/config.wavepostpnt @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wavepostpnt ########## # Wave steps specific diff --git a/parm/config/config.wavepostsbs b/parm/config/config.wavepostsbs index 7eea92f1004..12880dd020b 100755 --- a/parm/config/config.wavepostsbs +++ b/parm/config/config.wavepostsbs @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.wavepostsbs ########## # Wave steps specific diff --git a/parm/config/config.waveprep b/parm/config/config.waveprep index 1a9770bf4ea..1c9a40c1d81 100755 --- a/parm/config/config.waveprep +++ b/parm/config/config.waveprep @@ -1,4 +1,4 @@ -#!/bin/ksh -x +#! /usr/bin/env bash ########## config.waveprep ########## # Wave steps specific diff --git a/scripts/exgdas_atmos_chgres_forenkf.sh b/scripts/exgdas_atmos_chgres_forenkf.sh index 97f323b00f5..afc7cc9f5e1 100755 --- a/scripts/exgdas_atmos_chgres_forenkf.sh +++ b/scripts/exgdas_atmos_chgres_forenkf.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#! /usr/bin/env bash ################################################################################ #### UNIX Script Documentation Block # . . @@ -17,12 +17,7 @@ # ################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -149,7 +144,7 @@ if [ $DO_CALC_ANALYSIS == "YES" ]; then [[ -f $DATA/mp_chgres.sh ]] && rm $DATA/mp_chgres.sh fi - nfhrs=`echo $IAUFHRS_ENKF | sed 's/,/ /g'` + nfhrs=$(echo $IAUFHRS_ENKF | sed 's/,/ /g') for FHR in $nfhrs; do echo "Regridding deterministic forecast for forecast hour $FHR" rm -f chgres_nc_gauss0$FHR.nml @@ -203,8 +198,5 @@ fi cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err diff --git a/scripts/exgdas_atmos_gempak_gif_ncdc.sh b/scripts/exgdas_atmos_gempak_gif_ncdc.sh index 884ae1cf25a..3671d5511fa 100755 --- a/scripts/exgdas_atmos_gempak_gif_ncdc.sh +++ b/scripts/exgdas_atmos_gempak_gif_ncdc.sh @@ -1,16 +1,14 @@ -#!/bin/sh +#! /usr/bin/env bash ############################################################## # Add the NCDC GIF processing to the end of the gempak_gif job # There is no timing issue with the NCDC GIF, so it is # okay to just add it here. If timing becomes a problem # in the future, we should move it above somewhere else. ############################################################## -export PS4='exgempakgif_ncdc:$SECONDS + ' -set -xa + +source "$HOMEgfs/ush/preamble.sh" cd $DATA -msg="The NCDC GIF processing has begun" -postmsg "$jlogfile" "$msg" export NTS=$USHgempak/restore @@ -60,4 +58,5 @@ then done fi + exit diff --git a/scripts/exgdas_atmos_nawips.sh b/scripts/exgdas_atmos_nawips.sh index 48146edf60a..4836065aa72 100755 --- a/scripts/exgdas_atmos_nawips.sh +++ b/scripts/exgdas_atmos_nawips.sh @@ -1,30 +1,26 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################### -echo "----------------------------------------------------" -echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" -echo "----------------------------------------------------" -echo "History: Mar 2000 - First implementation of this new script." -echo "S Lilly: May 2008 - add logic to make sure that all of the " -echo " data produced from the restricted ECMWF" -echo " data on the CCS is properly protected." +# echo "----------------------------------------------------" +# echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" +# echo "----------------------------------------------------" +# echo "History: Mar 2000 - First implementation of this new script." +# echo "S Lilly: May 2008 - add logic to make sure that all of the " +# echo " data produced from the restricted ECMWF" +# echo " data on the CCS is properly protected." ##################################################################### -set -xa +source "$HOMEgfs/ush/preamble.sh" "${2}" cd $DATA RUN=$1 fend=$2 DBN_ALERT_TYPE=$3 -export 'PS4=$RUN:$SECONDS + ' - DATA_RUN=$DATA/$RUN mkdir -p $DATA_RUN cd $DATA_RUN -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" - cp $FIXgempak/g2varswmo2.tbl g2varswmo2.tbl export err=$? if [[ $err -ne 0 ]] ; then @@ -74,13 +70,10 @@ pdsext=no maxtries=180 fhcnt=$fstart while [ $fhcnt -le $fend ] ; do - typeset -Z3 fhr - - fhr=$fhcnt + fhr=$(printf "%03d" $fhcnt) fhcnt3=$(expr $fhr % 3) - fhr3=$fhcnt - typeset -Z3 fhr3 + fhr3=$(printf "%03d" $fhcnt) GEMGRD=${RUN}_${PDY}${cyc}f${fhr3} @@ -173,16 +166,6 @@ done $GEMEXE/gpend ##################################################################### -# GOOD RUN -set +x -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -set -x -##################################################################### -msg='Job completed normally.' -echo $msg -postmsg "$jlogfile" "$msg" ############################### END OF SCRIPT ####################### diff --git a/scripts/exgdas_atmos_nceppost.sh b/scripts/exgdas_atmos_nceppost.sh index 403cdb4bcaf..005911db6ae 100755 --- a/scripts/exgdas_atmos_nceppost.sh +++ b/scripts/exgdas_atmos_nceppost.sh @@ -1,34 +1,33 @@ +#! /usr/bin/env bash + ##################################################################### -echo "-----------------------------------------------------" -echo " exgdas_nceppost.sh" -echo " Sep 07 - Chuang - Modified script to run unified post" -echo " July 14 - Carlis - Changed to 0.25 deg grib2 master file" -echo " Feb 16 - Lin - Modify to use Vertical Structure" -echo " Aug 17 - Meng - Modify to use 3-digit forecast hour naming" -echo " master and flux files" -echo " Dec 17 - Meng - Link sfc data file to flxfile " -echo " since fv3gfs does not output sfc files any more." -echo " Dec 17 - Meng - Add fv3gfs_downstream_nems.sh for pgb processing " -echo " and remove writing data file to /nwges" -echo " Jan 18 - Meng - For EE2 standard, move IDRT POSTGPVARS setting" -echo " from j-job script." -echo " Feb 18 - Meng - Removed legacy setting for generating grib1 data" -echo " and reading sigio model outputs." -echo " Aug 20 - Meng - Remove .ecf extentsion per EE2 review." -echo " Sep 20 - Meng - Update clean up files per EE2 review." -echo " Mar 21 - Meng - Update POSTGRB2TBL default setting." -echo " Oct 21 - Meng - Remove jlogfile for wcoss2 transition." -echo " Feb 22 - Lin - Exception handling if anl input not found." -echo "-----------------------------------------------------" +# echo "-----------------------------------------------------" +# echo " exgdas_nceppost.sh" +# echo " Sep 07 - Chuang - Modified script to run unified post" +# echo " July 14 - Carlis - Changed to 0.25 deg grib2 master file" +# echo " Feb 16 - Lin - Modify to use Vertical Structure" +# echo " Aug 17 - Meng - Modify to use 3-digit forecast hour naming" +# echo " master and flux files" +# echo " Dec 17 - Meng - Link sfc data file to flxfile " +# echo " since fv3gfs does not output sfc files any more." +# echo " Dec 17 - Meng - Add fv3gfs_downstream_nems.sh for pgb processing " +# echo " and remove writing data file to /nwges" +# echo " Jan 18 - Meng - For EE2 standard, move IDRT POSTGPVARS setting" +# echo " from j-job script." +# echo " Feb 18 - Meng - Removed legacy setting for generating grib1 data" +# echo " and reading sigio model outputs." +# echo " Aug 20 - Meng - Remove .ecf extentsion per EE2 review." +# echo " Sep 20 - Meng - Update clean up files per EE2 review." +# echo " Mar 21 - Meng - Update POSTGRB2TBL default setting." +# echo " Oct 21 - Meng - Remove jlogfile for wcoss2 transition." +# echo " Feb 22 - Lin - Exception handling if anl input not found." +# echo "-----------------------------------------------------" ##################################################################### -set -x +source "$HOMEgfs/ush/preamble.sh" cd $DATA -msg="HAS BEGUN on $(hostname)" -postmsg "$msg" - export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_nceppost.sh} export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh} export GFSDWNSH=${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh} @@ -185,7 +184,6 @@ else ## not_anl if_stimes # Start Looping for the # existence of the restart files ############################### - set -x export pgm="postcheck" ic=1 while [ $ic -le $SLEEP_LOOP_MAX ]; do @@ -206,10 +204,6 @@ else ## not_anl if_stimes err_chk fi done - set -x - - msg="Starting post for fhr=$fhr" - postmsg "$msg" ############################### # Put restart files into /nwges @@ -351,10 +345,6 @@ else ## not_anl if_stimes done fi ## end_if_times -#cat $pgmout -#msg='ENDED NORMALLY.' -#postmsg "$jlogfile" "$msg" - exit 0 ################## END OF SCRIPT ####################### diff --git a/scripts/exgdas_efsoi.sh b/scripts/exgdas_efsoi.sh index f730634c83f..95d20bb46ea 100755 --- a/scripts/exgdas_efsoi.sh +++ b/scripts/exgdas_efsoi.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -16,12 +17,7 @@ # ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -140,7 +136,7 @@ $NLN $VLOCALEIG vlocal_eig.dat ################################################################################ # Ensemble guess, observational data and analyses/increments -nfhrs=`echo $IAUFHRS_ENKF | sed 's/,/ /g'` +nfhrs=$(echo $IAUFHRS_ENKF | sed 's/,/ /g') for imem in $(seq 1 $NMEM_ENKF); do memchar="mem"$(printf %03i $imem) mkdir ${memchar} @@ -257,8 +253,6 @@ $NCP osense_${CDATE}.dat $OSENSE_SAVE_DIR/$OSENSEOUT cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_efsoi_update.sh b/scripts/exgdas_efsoi_update.sh index cf1542cc572..7e755f4ecf8 100755 --- a/scripts/exgdas_efsoi_update.sh +++ b/scripts/exgdas_efsoi_update.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -17,12 +18,7 @@ # ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -174,7 +170,6 @@ for ftype in \$flist; do tar -xvf \$fname done EOFuntar - set -x chmod 755 $DATA/untar.sh fi @@ -193,7 +188,7 @@ else tar -xvf $fname done fi -nfhrs=`echo $IAUFHRS_ENKF | sed 's/,/ /g'` +nfhrs=$(echo $IAUFHRS_ENKF | sed 's/,/ /g') for imem in $(seq 1 $NMEM_ENKF); do memchar="mem"$(printf %03i $imem) if [ $lobsdiag_forenkf = ".false." ]; then @@ -421,8 +416,6 @@ cat stdout stderr > $COMOUT_ANL_ENSFSOI/$ENKFSTAT cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_enkf_ecen.sh b/scripts/exgdas_enkf_ecen.sh index eaa120ca47e..91e7483be9f 100755 --- a/scripts/exgdas_enkf_ecen.sh +++ b/scripts/exgdas_enkf_ecen.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -16,12 +17,7 @@ # ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -369,8 +365,6 @@ done # loop over analysis times in window # Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_enkf_fcst.sh b/scripts/exgdas_enkf_fcst.sh index 2dfcaa419a7..cd796818870 100755 --- a/scripts/exgdas_enkf_fcst.sh +++ b/scripts/exgdas_enkf_fcst.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -17,12 +18,7 @@ #### ################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -176,7 +172,7 @@ for imem in $(seq $ENSBEG $ENSEND); do err_exit "FATAL ERROR: forecast of member $cmem FAILED. Aborting job" fi - ((rc+=ra)) + rc=$((rc+ra)) fi @@ -227,8 +223,6 @@ export err=$rc; err_chk # Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATATOP -set +x -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_enkf_post.sh b/scripts/exgdas_enkf_post.sh index 5e8ecc7298e..2ef2895d199 100755 --- a/scripts/exgdas_enkf_post.sh +++ b/scripts/exgdas_enkf_post.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -16,12 +17,7 @@ # ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -112,7 +108,7 @@ for fhr in $(seq $FHMIN $FHOUT $FHMAX); do $APRUN_EPOS ${DATA}/$(basename $GETSFCENSMEANEXEC) ./ sfcf${fhrchar}.ensmean sfcf${fhrchar} $NMEM_ENKF ra=$? - ((rc+=ra)) + rc=$((rc+ra)) export_pgm=$GETATMENSMEANEXEC . prep_step @@ -123,7 +119,7 @@ for fhr in $(seq $FHMIN $FHOUT $FHMAX); do $APRUN_EPOS ${DATA}/$(basename $GETATMENSMEANEXEC) ./ atmf${fhrchar}.ensmean atmf${fhrchar} $NMEM_ENKF fi ra=$? - ((rc+=ra)) + rc=$((rc+ra)) done export err=$rc; err_chk @@ -161,8 +157,6 @@ fi # Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_enkf_select_obs.sh b/scripts/exgdas_enkf_select_obs.sh index 488bec6c2a9..92e1fd8c60d 100755 --- a/scripts/exgdas_enkf_select_obs.sh +++ b/scripts/exgdas_enkf_select_obs.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -16,12 +17,7 @@ # ################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -119,8 +115,6 @@ export err=$?; err_chk # Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_enkf_sfc.sh b/scripts/exgdas_enkf_sfc.sh index 4595f843245..4589a593561 100755 --- a/scripts/exgdas_enkf_sfc.sh +++ b/scripts/exgdas_enkf_sfc.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -16,12 +17,7 @@ # ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -196,8 +192,6 @@ fi # Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_enkf_update.sh b/scripts/exgdas_enkf_update.sh index c76cc479316..422b2e54e2c 100755 --- a/scripts/exgdas_enkf_update.sh +++ b/scripts/exgdas_enkf_update.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -16,12 +17,7 @@ # ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -171,7 +167,6 @@ for ftype in \$flist; do tar -xvf \$fname done EOFuntar - set -x chmod 755 $DATA/untar.sh fi @@ -190,7 +185,7 @@ else tar -xvf $fname done fi -nfhrs=`echo $IAUFHRS_ENKF | sed 's/,/ /g'` +nfhrs=$(echo $IAUFHRS_ENKF | sed 's/,/ /g') for imem in $(seq 1 $NMEM_ENKF); do memchar="mem"$(printf %03i $imem) if [ $lobsdiag_forenkf = ".false." ]; then @@ -398,8 +393,6 @@ cat stdout stderr > $COMOUT_ANL_ENS/$ENKFSTAT # Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + + exit $err diff --git a/scripts/exgdas_global_atmos_analysis_run.sh b/scripts/exgdas_global_atmos_analysis_run.sh index b5aaf24cbc2..0f2edbd7464 100755 --- a/scripts/exgdas_global_atmos_analysis_run.sh +++ b/scripts/exgdas_global_atmos_analysis_run.sh @@ -19,11 +19,7 @@ ################################################################################ # Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories pwd=$(pwd) @@ -155,7 +151,7 @@ err_chk ################################################################################ # Create log file noting creating of analysis increment file -echo "$CDUMP $CDATE atminc and tiled sfcanl done at `date`" > $COMOUT/${CDUMP}.${cycle}.loginc.txt +echo "$CDUMP $CDATE atminc and tiled sfcanl done at $(date)" > $COMOUT/${CDUMP}.${cycle}.loginc.txt ################################################################################ # Copy diags and YAML to $COMOUT @@ -172,10 +168,7 @@ for abias in $alist; do done ################################################################################ -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err ################################################################################ diff --git a/scripts/exgdas_global_atmos_ensanal_run.sh b/scripts/exgdas_global_atmos_ensanal_run.sh index 27f3339b588..68d53d3695d 100755 --- a/scripts/exgdas_global_atmos_ensanal_run.sh +++ b/scripts/exgdas_global_atmos_ensanal_run.sh @@ -19,11 +19,7 @@ ################################################################################ # Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" # Directories pwd=$(pwd) @@ -154,7 +150,7 @@ done ################################################################################ # Create log file noting creating of analysis increment file -echo "$CDUMP $CDATE atminc done at `date`" > $COMOUT_ENS/${CDUMP}.${cycle}.loginc.txt +echo "$CDUMP $CDATE atminc done at $(date)" > $COMOUT_ENS/${CDUMP}.${cycle}.loginc.txt ################################################################################ # Copy diags and YAML to $COMOUT @@ -163,10 +159,7 @@ cp -rf $DATA/diags $COMOUT_ENS/ ################################################################################ -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err ################################################################################ diff --git a/scripts/exgfs_atmos_awips_20km_1p0deg.sh b/scripts/exgfs_atmos_awips_20km_1p0deg.sh index 1f4414c1b4a..3f9f84f2372 100755 --- a/scripts/exgfs_atmos_awips_20km_1p0deg.sh +++ b/scripts/exgfs_atmos_awips_20km_1p0deg.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ############################################################################## # UTILITY SCRIPT NAME : exgfs_awips_20km_1p0deg.sh # DATE WRITTEN : 11/01/2017 @@ -10,13 +11,16 @@ # 1st argument - Forecast Hour - format of 3I (3 digits) # ############################################################################### -echo "------------------------------------------------" -echo "JGFS_AWIPS_00/06/12/18 GFS postprocessing" -echo "------------------------------------------------" -echo "History: NOV 2017 - First implementation of this new script to " -echo " process GFS AWIPS 20km and 1.0 deg grids products " -echo " " +# echo "------------------------------------------------" +# echo "JGFS_AWIPS_00/06/12/18 GFS postprocessing" +# echo "------------------------------------------------" +# echo "History: NOV 2017 - First implementation of this new script to " +# echo " process GFS AWIPS 20km and 1.0 deg grids products " +# echo " " ############################################################################### + +source "$HOMEgfs/ush/preamble.sh" + fcsthrs="$1" num=$# job_name=$(echo $job|sed 's/[jpt]gfs/gfs/') @@ -38,8 +42,6 @@ fi cd $DATA -set -x - ############################################### # Wait for the availability of the pgrb file ############################################### @@ -60,9 +62,6 @@ do fi done -######################################## -msg="HAS BEGUN!" -postmsg "$jlogfile" "$msg" ######################################## echo " ------------------------------------------" @@ -75,7 +74,7 @@ echo "#######################################" echo " Process GRIB AWIP GRIB2 PRODUCTS " echo "#######################################" echo " " -set -x +${TRACE_ON:-set -x} # Set type of Interpolation for WGRIB2 export opt1=' -set_grib_type same -new_grid_winds earth ' @@ -251,16 +250,5 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi -############################################################################################ -# GOOD RUN -set +x -echo "**************JOB EXGFS_AWIPS_20KM_1P0DEG.SH.ECF COMPLETED NORMALLY ON THE WCOSS" -echo "**************JOB EXGFS_AWIPS_20KM_1P0DEG.SH.ECF COMPLETED NORMALLY ON THE WCOSS" -echo "**************JOB EXGFS_AWIPS_20KM_1P0DEG.SH.ECF COMPLETED NORMALLY ON THE WCOSS" -set -x -############################################################################################ - -msg="HAS COMPLETED NORMALLY!" -postmsg "$jlogfile" "$msg" ############## END OF SCRIPT ####################### diff --git a/scripts/exgfs_atmos_fbwind.sh b/scripts/exgfs_atmos_fbwind.sh index 2ca5870cbff..a4ecd248f00 100755 --- a/scripts/exgfs_atmos_fbwind.sh +++ b/scripts/exgfs_atmos_fbwind.sh @@ -1,27 +1,27 @@ -#!/bin/ksh -echo "------------------------------------------------" -echo "JGFS_BULLS - 24hr GFS processing" -echo "------------------------------------------------" -echo "History: Jul 2004 - First implementation of this new script." -echo " FBWNDGFS (FB Winds) program for 15 sites outside" -echo " the Hawaiian Islands." -echo " Feb 2006 - L Sager Send bulletins to TOC via NTC. " -echo " Jul 2014 - B Vuong Modified to use GFS master GRIB2" -echo " and Add bulletins WINTEMV process." -echo " Sep 2016 - B Vuong Modified to use GFS 0p25 deg GRIB2" -echo " Nov 2019 - B Vuong Removed WINTEMV bulletin (retired)" +#! /usr/bin/env bash + +##################################################################### +# echo "------------------------------------------------" +# echo "JGFS_BULLS - 24hr GFS processing" +# echo "------------------------------------------------" +# echo "History: Jul 2004 - First implementation of this new script." +# echo " FBWNDGFS (FB Winds) program for 15 sites outside" +# echo " the Hawaiian Islands." +# echo " Feb 2006 - L Sager Send bulletins to TOC via NTC. " +# echo " Jul 2014 - B Vuong Modified to use GFS master GRIB2" +# echo " and Add bulletins WINTEMV process." +# echo " Sep 2016 - B Vuong Modified to use GFS 0p25 deg GRIB2" +# echo " Nov 2019 - B Vuong Removed WINTEMV bulletin (retired)" ##################################################################### +source "$HOMEgfs/ush/preamble.sh" + cd $DATA ###################### # Set up Here Files. ###################### -set -x -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" - job_name=$(echo $job|sed 's/[jpt]gfs/gfs/') set +x @@ -31,7 +31,7 @@ echo " Process Bulletins of forecast winds and temps for Hawaii " echo " and 15 sites outside of the Hawaiian Islands. " echo "#############################################################" echo " " -set -x +${TRACE_ON:-set -x} export pgm=bulls_fbwndgfs . prep_step @@ -82,35 +82,7 @@ then ${UTILgfs}/ush/make_ntc_bull.pl WMOBH NONE KWNO NONE tran.fbwnd_pacific ${COMOUTwmo}/tran.fbwnd_pacific.$job_name fi -# -# EMC is proposing to retire WINTEMV bulletin in GFS v16.0 -# - -# if test ${cycle} = 't00z' -o ${cycle} = 't12z' -# then -# -# set +x -# echo " " -# echo "#################################################" -# echo " Process 06, 12, 18 and 24 fcsthrs WINTEM Bulletins. " -# echo "#################################################" -# echo " " -# set -x -# sh $USHgfs/mkwintem.sh -# -#fi - -##################################################################### -# GOOD RUN -set +x -echo "**************JOB JGFS_FBWIND COMPLETED NORMALLY ON IBM-SP" -echo "**************JOB JGFS_FBWIND COMPLETED NORMALLY ON IBM-SP" -echo "**************JOB JGFS_FBWIND COMPLETED NORMALLY ON IBM-SP" -set -x ##################################################################### -msg='Job completed normally.' -echo $msg -postmsg "$jlogfile" "$msg" ############################### END OF SCRIPT ####################### diff --git a/scripts/exgfs_atmos_gempak_gif_ncdc_skew_t.sh b/scripts/exgfs_atmos_gempak_gif_ncdc_skew_t.sh index 4de9d33736e..394c5c30d88 100755 --- a/scripts/exgfs_atmos_gempak_gif_ncdc_skew_t.sh +++ b/scripts/exgfs_atmos_gempak_gif_ncdc_skew_t.sh @@ -1,16 +1,15 @@ -#!/bin/sh +#! /usr/bin/env bash + ############################################################## # Add the NCDC GIF processing to the end of the gempak_gif job # There is no timing issue with the NCDC GIF, so it is # okay to just add it here. If timing becomes a problem # in the future, we should move it above somewhere else. ############################################################## -export PS4='exgempakgif_ncdc_skewt:$SECONDS + ' -set -xa + +source "$HOMEgfs/ush/preamble.sh" cd $DATA -msg="The NCDC GIF processing has begun" -postmsg "$jlogfile" "$msg" export NTS=$USHgempak/restore @@ -58,21 +57,19 @@ then fi #################################################################################### -echo "-----------------------------------------------------------------------------" -echo "GFS MAG postprocessing script exmag_sigman_skew_k_gfs_gif_ncdc_skew_t.sh " -echo "-----------------------------------------------------------------------------" -echo "History: Mar 2012 added to processing for enhanced MAG skew_t" -echo "2012-03-11 Mabe -- reworked script to add significant level " -echo " data to existing mandatory level data in a new file" -echo "2013-04-24 Mabe -- Reworked to remove unneeded output with " -echo " conversion to WCOSS" +# echo "-----------------------------------------------------------------------------" +# echo "GFS MAG postprocessing script exmag_sigman_skew_k_gfs_gif_ncdc_skew_t.sh " +# echo "-----------------------------------------------------------------------------" +# echo "History: Mar 2012 added to processing for enhanced MAG skew_t" +# echo "2012-03-11 Mabe -- reworked script to add significant level " +# echo " data to existing mandatory level data in a new file" +# echo "2013-04-24 Mabe -- Reworked to remove unneeded output with " +# echo " conversion to WCOSS" # Add ms to filename to make it different since it has both mandatory # and significant level data $COMOUT/${RUN}.${cycle}.msupperair # $COMOUT/${RUN}.${cycle}.msupperairtble ##################################################################################### -set -x - cd $DATA export RSHPDY=$(echo $PDY | cut -c5-)$(echo $PDY | cut -c3-4) @@ -112,14 +109,10 @@ fi fi ############################################################ -# GOOD RUN -set +x -echo "********** JGFS_ATMOS_GEMPAK_NCDC_UPAPGIF COMPLETED" -set -x -############################################################ + if [ -e "$pgmout" ] ; then cat $pgmout fi -msg="HAS COMPLETED NORMALLY!" + exit diff --git a/scripts/exgfs_atmos_gempak_meta.sh b/scripts/exgfs_atmos_gempak_meta.sh index dfd5b383921..cb64138c612 100755 --- a/scripts/exgfs_atmos_gempak_meta.sh +++ b/scripts/exgfs_atmos_gempak_meta.sh @@ -1,9 +1,6 @@ -#!/bin/ksh +#! /usr/bin/env bash -set -x - -msg="JOB $job HAS BEGUN" -postmsg "$jlogfile" "$msg" +source "$HOMEgfs/ush/preamble.sh" cd $DATA @@ -14,13 +11,13 @@ fhr=$fhend export numproc=23 while [ $fhr -ge $fhbeg ] ; do - typeset -Z3 fhr - ls -l $COMIN/$GEMGRD1${fhr} - err1=$? - if [ $err1 -eq 0 -o $fhr -eq $fhbeg ] ; then - break - fi - fhr=$(expr $fhr - $fhinc) + fhr=$(printf "%03d" $fhr) + ls -l $COMIN/$GEMGRD1${fhr} + err1=$? + if [ $err1 -eq 0 -o $fhr -eq $fhbeg ] ; then + break + fi + fhr=$(expr $fhr - $fhinc) done maxtries=180 @@ -73,9 +70,7 @@ do rm $DATA/poescript # fi - if [ $fhr -lt 100 ] ; then - typeset -Z2 fhr - fi + fhr=$(printf "%02d" $fhr) if [ $do_all -eq 1 ] ; then do_all=0 @@ -110,7 +105,7 @@ do # If this is the final fcst hour, alert the # file to all centers. # - if [ $fhr -ge $fhend ] ; then + if [ 10#$fhr -ge $fhend ] ; then export DBN_ALERT_TYPE=GFS_METAFILE_LAST fi @@ -130,7 +125,7 @@ do $APRUNCFP $DATA/poescript export err=$?; err_chk - typeset -Z3 fhr + fhr=$(printf "%03d" $fhr) if [ $fhr -eq 126 ] ; then let fhr=fhr+6 else @@ -139,14 +134,7 @@ do done ##################################################################### -# GOOD RUN -set +x -echo "**************JOB GFS_META COMPLETED NORMALLY on the IBM-SP" -echo "**************JOB GFS_META COMPLETED NORMALLY on the IBM-SP" -echo "**************JOB GFS_META COMPLETED NORMALLY on the IBM-SP" -set -x -##################################################################### -echo EXITING $0 + exit # diff --git a/scripts/exgfs_atmos_goes_nawips.sh b/scripts/exgfs_atmos_goes_nawips.sh index c18f2b8b425..7aae2e143cb 100755 --- a/scripts/exgfs_atmos_goes_nawips.sh +++ b/scripts/exgfs_atmos_goes_nawips.sh @@ -1,16 +1,17 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################### -echo "----------------------------------------------------" -echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" -echo "----------------------------------------------------" -echo "History: Mar 2000 - First implementation of this new script." -echo "S Lilly: May 2008 - add logic to make sure that all of the " -echo " data produced from the restricted ECMWF" -echo " data on the CCS is properly protected." -echo "C. Magee: 10/2013 - swap X and Y for rtgssthr Atl and Pac." +# echo "----------------------------------------------------" +# echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" +# echo "----------------------------------------------------" +# echo "History: Mar 2000 - First implementation of this new script." +# echo "S Lilly: May 2008 - add logic to make sure that all of the " +# echo " data produced from the restricted ECMWF" +# echo " data on the CCS is properly protected." +# echo "C. Magee: 10/2013 - swap X and Y for rtgssthr Atl and Pac." ##################################################################### -set -xa +source "$HOMEgfs/ush/preamble.sh" cd $DATA @@ -19,9 +20,6 @@ cp $FIXgempak/g2vcrdwmo2.tbl g2vcrdwmo2.tbl cp $FIXgempak/g2varsncep1.tbl g2varsncep1.tbl cp $FIXgempak/g2vcrdncep1.tbl g2vcrdncep1.tbl -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" - # # NAGRIB_TABLE=$FIXgempak/nagrib.tbl NAGRIB=$GEMEXE/nagrib2 @@ -53,16 +51,10 @@ pdsext=no maxtries=180 fhcnt=$fstart while [ $fhcnt -le $fend ] ; do -# if [ $fhcnt -ge 100 ] ; then - typeset -Z3 fhr -# else -# typeset -Z2 fhr -# fi - fhr=$fhcnt + fhr=$(printf "%03d" $fhcnt) fhcnt3=$(expr $fhr % 3) - fhr3=$fhcnt - typeset -Z3 fhr3 + fhr3=$(printf "03d" $fhcnt) GRIBIN=$COMIN/${model}.${cycle}.${GRIB}${fhr}${EXT} GEMGRD=${RUN}_${PDY}${cyc}f${fhr3} @@ -126,17 +118,7 @@ EOF let fhcnt=fhcnt+finc done -##################################################################### -# GOOD RUN -set +x -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -set -x ##################################################################### -msg='Job completed normally.' -echo $msg -postmsg "$jlogfile" "$msg" ############################### END OF SCRIPT ####################### diff --git a/scripts/exgfs_atmos_grib2_special_npoess.sh b/scripts/exgfs_atmos_grib2_special_npoess.sh index 1e81f9815b8..ad24bf64354 100755 --- a/scripts/exgfs_atmos_grib2_special_npoess.sh +++ b/scripts/exgfs_atmos_grib2_special_npoess.sh @@ -1,18 +1,16 @@ -#!/bin/ksh +#! /usr/bin/env bash + ##################################################################### -echo "-----------------------------------------------------" -echo " exglobal_grib2_special_npoess.sh" -echo " Jan 2008 - Chuang - Produces 1x1 degree special Grib from master." -echo "-----------------------------------------------------" +# echo "-----------------------------------------------------" +# echo " exglobal_grib2_special_npoess.sh" +# echo " Jan 2008 - Chuang - Produces 1x1 degree special Grib from master." +# echo "-----------------------------------------------------" ##################################################################### -set -x +source "$HOMEgfs/ush/preamble.sh" cd $DATA -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" - ############################################################ # Define Variables: # ----------------- @@ -49,12 +47,12 @@ SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) ############################################################################## export SHOUR=000 export FHOUR=024 -export fhr=$SHOUR -typeset -Z3 fhr +export fhr=$(printf "%03d" $SHOUR) + ############################################################ # Loop Through the Post Forecast Files ############################################################ -while test $fhr -le $FHOUR +while test 10#$fhr -le $FHOUR do ############################### @@ -87,10 +85,6 @@ do ###################################################################### # Process Global NPOESS 0.50 GFS GRID PRODUCTS IN GRIB2 F000 - F024 # ###################################################################### - set -x - msg="Starting half degree grib generation for fhr=$fhr" - postmsg "$jlogfile" "$msg" - paramlist=${PARMproduct}/global_npoess_paramlist_g2 cp $COMIN/gfs.t${cyc}z.pgrb2.0p50.f${fhr} tmpfile2 cp $COMIN/gfs.t${cyc}z.pgrb2b.0p50.f${fhr} tmpfile2b @@ -112,8 +106,7 @@ do echo "$PDY$cyc$fhr" > $COMOUT/${RUN}.t${cyc}z.control.halfdeg.npoess fi rm tmpfile pgb2file - export fhr=$(expr $fhr + $FHINC) - typeset -Z3 fhr + export fhr=$(printf "%03d" $(expr $fhr + $FHINC)) done @@ -122,14 +115,13 @@ done ################################################################ export SHOUR=000 export FHOUR=180 -export fhr=$SHOUR -typeset -Z3 fhr +export fhr=$(printf "%03d" $SHOUR) ################################# # Process GFS PGRB2_SPECIAL_POST ################################# -while test $fhr -le $FHOUR +while test 10#$fhr -le $FHOUR do ############################### # Start Looping for the @@ -158,10 +150,7 @@ do err_chk fi done - set -x - - msg="Starting special grib file generation for fhr=$fhr" - postmsg "$jlogfile" "$msg" + ${TRACE_ON:-set -x} ############################### # Put restart files into /nwges @@ -208,13 +197,8 @@ do export fhour=$(expr ${fhr} % 6 ) fi - export fhr=$(expr $fhr + $FHINC) - typeset -Z3 fhr + export fhr=$(printf "%03d" $(expr $fhr + $FHINC)) done -######################################################## - -msg='ENDED NORMALLY.' -postmsg "$jlogfile" "$msg" ################## END OF SCRIPT ####################### diff --git a/scripts/exgfs_atmos_grib_awips.sh b/scripts/exgfs_atmos_grib_awips.sh index 2e5ec915265..5252d71983e 100755 --- a/scripts/exgfs_atmos_grib_awips.sh +++ b/scripts/exgfs_atmos_grib_awips.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ###################################################################### # UTILITY SCRIPT NAME : exgfs_grib_awips.sh # DATE WRITTEN : 10/04/2004 @@ -9,29 +10,27 @@ # 1st argument - Forecast Hour - format of 2I # ##################################################################### -echo "------------------------------------------------" -echo "JGFS_AWIPS_00/06/12/18 GFS postprocessing" -echo "------------------------------------------------" -echo "History: OCT 2004 - First implementation of this new script." -echo " JUN 2014 - Modified to remove process for AWIPS in GRIB2" -echo " to script exgfs_grib_awips_g2.sh and this " -echo " script only process AWIPS GRIB1 (211 and 225)" -echo " AUG 2015 - Modified for WCOSS phase2" -echo " FEB 2019 - Removed grid 225" +# echo "------------------------------------------------" +# echo "JGFS_AWIPS_00/06/12/18 GFS postprocessing" +# echo "------------------------------------------------" +# echo "History: OCT 2004 - First implementation of this new script." +# echo " JUN 2014 - Modified to remove process for AWIPS in GRIB2" +# echo " to script exgfs_grib_awips_g2.sh and this " +# echo " script only process AWIPS GRIB1 (211 and 225)" +# echo " AUG 2015 - Modified for WCOSS phase2" +# echo " FEB 2019 - Removed grid 225" ##################################################################### -set +x + +source "$HOMEgfs/ush/preamble.sh" + fcsthrs="$1" num=$# job_name=$(echo $job|sed 's/[jpt]gfs/gfs/') -typeset -Z3 fcsthrs +fcsthrs=$(printf "%03d" $fcsthrs) -export PS4='gfs_grib_awips:f$fcsthrs:$SECONDS + ' export SCALEDEC=${SCALDEC:-$USHgfs/scale_dec.sh} -#if [ $fhcsthrs -t 100 ]; then -# fcsthrs=0$fcsthrs -#fi if test "$num" -ge 1 then echo "" @@ -49,8 +48,6 @@ fi cd $DATA/awips_g1 -set -x - ############################################### # Wait for the availability of the pgrb file ############################################### @@ -86,7 +83,7 @@ echo "###############################################" echo " Process GFS GRIB1 AWIP PRODUCTS (211) " echo "###############################################" echo " " -set -x +${TRACE_ON:-set -x} cp $COMIN/gfs.t${cyc}z.pgrb2.0p25.f${fcsthrs} tmpfile2 cp $COMIN/gfs.t${cyc}z.pgrb2b.0p25.f${fcsthrs} tmpfile2b @@ -149,16 +146,7 @@ if [ -e "$pgmout" ] ; then cat $pgmout fi -############################################################################### -# GOOD RUN -set +x -echo "**************JOB EXGFS_GRIB_AWIPS.SH.ECF COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXGFS_GRIB_AWIPS.SH.ECF COMPLETED NORMALLY ON THE IBM" -echo "**************JOB EXGFS_GRIB_AWIPS.SH.ECF COMPLETED NORMALLY ON THE IBM" -set -x ############################################################################### -msg="HAS COMPLETED NORMALLY!" -postmsg "$jlogfile" "$msg" ############## END OF SCRIPT ####################### diff --git a/scripts/exgfs_atmos_nawips.sh b/scripts/exgfs_atmos_nawips.sh index 8e1ba652d6a..5b751735067 100755 --- a/scripts/exgfs_atmos_nawips.sh +++ b/scripts/exgfs_atmos_nawips.sh @@ -1,15 +1,16 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################### -echo "----------------------------------------------------" -echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" -echo "----------------------------------------------------" -echo "History: Mar 2000 - First implementation of this new script." -echo "S Lilly: May 2008 - add logic to make sure that all of the " -echo " data produced from the restricted ECMWF" -echo " data on the CCS is properly protected." +# echo "----------------------------------------------------" +# echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" +# echo "----------------------------------------------------" +# echo "History: Mar 2000 - First implementation of this new script." +# echo "S Lilly: May 2008 - add logic to make sure that all of the " +# echo " data produced from the restricted ECMWF" +# echo " data on the CCS is properly protected." ##################################################################### -set -xa +source "$HOMEgfs/ush/preamble.sh" "${2}" #### If EMC GFS PARA runs hourly file are not available, The ILPOST #### will set to 3 hour in EMC GFS PARA. @@ -21,16 +22,10 @@ RUN=$1 fend=$2 DBN_ALERT_TYPE=$3 -export 'PS4=$RUN:$SECONDS + ' - DATA_RUN=$DATA/$RUN mkdir -p $DATA_RUN cd $DATA_RUN -msg="Begin job for $job" -postmsg "$jlogfile" "$msg" - - # NAGRIB=$GEMEXE/nagrib2_nc # @@ -49,20 +44,17 @@ maxtries=360 fhcnt=$fstart while [ $fhcnt -le $fend ] ; do -if mkdir lock.$fhcnt ; then +if [[ $(mkdir lock.${fhcnt}) == 0 ]] ; then cd lock.$fhcnt cp $FIXgempak/g2varswmo2.tbl g2varswmo2.tbl cp $FIXgempak/g2vcrdwmo2.tbl g2vcrdwmo2.tbl cp $FIXgempak/g2varsncep1.tbl g2varsncep1.tbl cp $FIXgempak/g2vcrdncep1.tbl g2vcrdncep1.tbl - typeset -Z3 fhr - - fhr=$fhcnt + fhr=$(printf "%03d" $fhcnt) fhcnt3=$(expr $fhr % 3) - fhr3=$fhcnt - typeset -Z3 fhr3 + fhr3=$(printf "%03d" $fhcnt) GEMGRD=${RUN}_${PDY}${cyc}f${fhr3} @@ -189,16 +181,6 @@ done $GEMEXE/gpend ##################################################################### -# GOOD RUN -set +x -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -set -x -##################################################################### -msg='Job completed normally.' -echo $msg -postmsg "$jlogfile" "$msg" ############################### END OF SCRIPT ####################### diff --git a/scripts/exgfs_atmos_nceppost.sh b/scripts/exgfs_atmos_nceppost.sh index e653a36e39d..ae94472aeba 100755 --- a/scripts/exgfs_atmos_nceppost.sh +++ b/scripts/exgfs_atmos_nceppost.sh @@ -1,47 +1,46 @@ +#! /usr/bin/env bash + ##################################################################### -echo "-----------------------------------------------------" -echo " exgfs_nceppost.sh" -echo " Apr 99 - Michaud - Generated to post global forecast" -echo " Mar 03 - Zhu - Add post for 0.5x0.5 degree" -echo " Nov 03 - Gilbert - Modified from exglobal_post.sh.sms" -echo " to run only one master post job." -echo " Jan 07 - Cooke - Add DBNet Alert for Master files" -echo " May 07 - Chuang - Modified scripts to run unified post" -echo " Feb 10 - Carlis - Add 12-hr accum precip bucket at f192" -echo " Jun 12 - Wang - Add option for grb2" -echo " Jul 14 - Carlis - Add 0.25 deg master " -echo " Mar 17 - F Yang - Modified for running fv3gfs" -echo " Aug 17 - Meng - Add flags for turning on/off flx, gtg " -echo " and satellite look like file creation" -echo " and use 3-digit forecast hour naming" -echo " post output files" -echo " Dec 17 - Meng - Link sfc data file to flxfile " -echo " since fv3gfs does not output sfc files any more." -echo " Dec 17 - Meng - Add fv3gfs_downstream_nems.sh for pgb processing " -echo " Jan 18 - Meng - Add flag PGBF for truning on/off pgb processing. " -echo " Jan 18 - Meng - For EE2 standard, move IDRT POSTGPVARS setting" -echo " from j-job script." -echo " Feb 18 - Meng - Removed legacy setting for generating grib1 data" -echo " and reading sigio model outputs." -echo " Aug 20 - Meng - Remove .ecf extentsion per EE2 review." -echo " Sep 20 - Meng - Update clean up files per EE2 review." -echo " Dec 20 - Meng - Add alert for special data file." -echo " Mar 21 - Meng - Update POSTGRB2TBL default setting." -echo " Jun 21 - Mao - Instead of err_chk, catch err and print out" -echo " WAFS failure warnings to avoid job crashing" -echo " Oct 21 - Meng - Remove jlogfile for wcoss2 transition." -echo " Feb 22 - Lin - Exception handling if anl input not found." -echo "-----------------------------------------------------" +# echo "-----------------------------------------------------" +# echo " exgfs_nceppost.sh" +# echo " Apr 99 - Michaud - Generated to post global forecast" +# echo " Mar 03 - Zhu - Add post for 0.5x0.5 degree" +# echo " Nov 03 - Gilbert - Modified from exglobal_post.sh.sms" +# echo " to run only one master post job." +# echo " Jan 07 - Cooke - Add DBNet Alert for Master files" +# echo " May 07 - Chuang - Modified scripts to run unified post" +# echo " Feb 10 - Carlis - Add 12-hr accum precip bucket at f192" +# echo " Jun 12 - Wang - Add option for grb2" +# echo " Jul 14 - Carlis - Add 0.25 deg master " +# echo " Mar 17 - F Yang - Modified for running fv3gfs" +# echo " Aug 17 - Meng - Add flags for turning on/off flx, gtg " +# echo " and satellite look like file creation" +# echo " and use 3-digit forecast hour naming" +# echo " post output files" +# echo " Dec 17 - Meng - Link sfc data file to flxfile " +# echo " since fv3gfs does not output sfc files any more." +# echo " Dec 17 - Meng - Add fv3gfs_downstream_nems.sh for pgb processing " +# echo " Jan 18 - Meng - Add flag PGBF for truning on/off pgb processing. " +# echo " Jan 18 - Meng - For EE2 standard, move IDRT POSTGPVARS setting" +# echo " from j-job script." +# echo " Feb 18 - Meng - Removed legacy setting for generating grib1 data" +# echo " and reading sigio model outputs." +# echo " Aug 20 - Meng - Remove .ecf extentsion per EE2 review." +# echo " Sep 20 - Meng - Update clean up files per EE2 review." +# echo " Dec 20 - Meng - Add alert for special data file." +# echo " Mar 21 - Meng - Update POSTGRB2TBL default setting." +# echo " Jun 21 - Mao - Instead of err_chk, catch err and print out" +# echo " WAFS failure warnings to avoid job crashing" +# echo " Oct 21 - Meng - Remove jlogfile for wcoss2 transition." +# echo " Feb 22 - Lin - Exception handling if anl input not found." +# echo "-----------------------------------------------------" ##################################################################### -set -x +source "$HOMEgfs/ush/preamble.sh" cd $DATA # specify model output format type: 4 for nemsio, 3 for sigio -msg="HAS BEGUN on $(hostname)" -postmsg "$msg" - export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_nceppost.sh} export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh} export GFSDOWNSHF=${GFSDOWNSHF:-$USHgfs/inter_flux.sh} @@ -242,7 +241,6 @@ else ## not_anl if_stime # Start Looping for the # existence of the restart files ############################### - set -x export pgm="postcheck" ic=1 while [ $ic -le $SLEEP_LOOP_MAX ]; do @@ -263,10 +261,6 @@ else ## not_anl if_stime err_chk fi done - set -x - - msg="Starting post for fhr=$fhr" - postmsg "$msg" ############################### # Put restart files into /nwges @@ -478,7 +472,7 @@ 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" && $fhr -le 120 ]]; then + if [[ $WAFSF = "YES" && 10#$fhr -le 120 ]]; then if [[ $RUN = gfs && $GRIBVERSION = 'grib2' ]]; then export OUTTYP=${OUTTYP:-4} @@ -527,9 +521,7 @@ else ## not_anl if_stime #---------------------------------- fi ## end_if_stime -#cat $pgmout -#msg='ENDED NORMALLY.' -#postmsg "$jlogfile" "$msg" + exit 0 diff --git a/scripts/exgfs_atmos_postsnd.sh b/scripts/exgfs_atmos_postsnd.sh index 67b9ce56fa4..114ab4e2344 100755 --- a/scripts/exgfs_atmos_postsnd.sh +++ b/scripts/exgfs_atmos_postsnd.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################ # Script Name: exgfs_atmos_postsnd.sh.sms # Script Description: Generate GFS BUFR sounding files @@ -18,12 +19,11 @@ # 8) 2019-10-18 Guang Ping Lou Transition to reading in NetCDF model data # 9) 2019-12-18 Guang Ping Lou generalizing to reading in NetCDF or nemsio ################################################################ -set -xa + +source "$HOMEgfs/ush/preamble.sh" cd $DATA -######################################## -msg="HAS BEGUN" -#postmsg "$jlogfile" "$msg" + ######################################## ################################################### @@ -165,21 +165,6 @@ ${APRUN_POSTSNDCFP} cmdfile sh $USHbufrsnd/gfs_bfr2gpk.sh fi -################################################ -# Convert the bufr soundings into GEMPAK files -################################################ -##$USHbufrsnd/gfs_bfr2gpk.sh - -##################################################################### -# GOOD RUN -set +x -echo "**************JOB GFS_meteogrm COMPLETED NORMALLY ON THE IBM" -echo "**************JOB GFS_meteogrm COMPLETED NORMALLY ON THE IBM" -echo "**************JOB GFS_meteogrm COMPLETED NORMALLY ON THE IBM" -set -x -##################################################################### - -msg='HAS COMPLETED NORMALLY.' -#postmsg "$jlogfile" "$msg" + ############## END OF SCRIPT ####################### diff --git a/scripts/exgfs_pmgr.sh b/scripts/exgfs_pmgr.sh index d16db660320..a417bbed55b 100755 --- a/scripts/exgfs_pmgr.sh +++ b/scripts/exgfs_pmgr.sh @@ -1,13 +1,14 @@ -#! /bin/ksh +#! /usr/bin/env bash + # # Script name: exgfs_pmgr.sh.sms # # This script monitors the progress of the gfs_fcst job # -set -x + +source "$HOMEgfs/ush/preamble.sh" hour=00 -typeset -Z2 hour TEND=384 TCP=385 @@ -17,15 +18,12 @@ fi while [ $hour -lt $TCP ]; do + hour=$(printf "%02d" $hour) echo $hour >>posthours - if [ $hour -lt 240 ] + if [ 10#$hour -lt 240 ] then - if [ $hour -eq 99 ] - then - typeset -Z3 hour - fi # JY if [ $hour -lt 12 ] - if [ $hour -lt 120 ] + if [ 10#$hour -lt 120 ] then let "hour=hour+1" else @@ -74,6 +72,5 @@ do done -echo Exiting $0 exit diff --git a/scripts/exgfs_prdgen_manager.sh b/scripts/exgfs_prdgen_manager.sh index 6584178a7ed..7d0a95696b1 100755 --- a/scripts/exgfs_prdgen_manager.sh +++ b/scripts/exgfs_prdgen_manager.sh @@ -1,13 +1,14 @@ -#! /bin/ksh +#! /usr/bin/env bash + # # Script name: exgfs_pmgr.sh.sms # # This script monitors the progress of the gfs_fcst job # -set -x + +source "$HOMEgfs/ush/preamble.sh" hour=00 -typeset -Z2 hour TEND=384 TCP=385 @@ -17,13 +18,11 @@ fi while [ $hour -lt $TCP ]; do + hour=$(printf "%02d" $hour) echo $hour >>pgrb2_hours - if [ $hour -lt 240 ] + if [ 10#$hour -lt 240 ] then - if [ $hour -eq 99 ]; then - typeset -Z3 hour - fi - if [ $hour -lt 120 ] + if [ 10#$hour -lt 120 ] then let "hour=hour+1" else @@ -71,6 +70,5 @@ do done -echo Exiting $0 exit diff --git a/scripts/exgfs_wave_init.sh b/scripts/exgfs_wave_init.sh index 8c268a6176d..31c39fd52a7 100755 --- a/scripts/exgfs_wave_init.sh +++ b/scripts/exgfs_wave_init.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -25,20 +25,15 @@ # # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - set -x +source "$HOMEgfs/ush/preamble.sh" + +# 0.a Basic modes of operation err=0 - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x cd $DATA - echo "HAS BEGUN on $(hostname)" - echo "Starting MWW3 INIT CONFIG SCRIPT for ${CDUMP}wave" - set +x echo ' ' echo ' ********************************' @@ -49,7 +44,7 @@ echo ' ' echo "Starting at : $(date)" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # Script will run only if pre-defined NTASKS # The actual work is distributed over these tasks. @@ -63,7 +58,7 @@ echo ' ' echo " Script set to run with $NTASKS tasks " echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # --------------------------------------------------------------------------- # @@ -73,7 +68,7 @@ echo 'Preparing input files :' echo '-----------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 1.a Model definition files @@ -93,14 +88,14 @@ then set +x echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cp $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID else set +x echo " Mod def file for $grdID not found in ${COMIN}/rundata. Setting up to generate ..." echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ -f $PARMwave/ww3_grid.inp.$grdID ] then cp $PARMwave/ww3_grid.inp.$grdID ww3_grid.inp.$grdID @@ -112,7 +107,7 @@ echo ' ' echo " ww3_grid.inp.$grdID copied ($PARMwave/ww3_grid.inp.$grdID)." echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -121,7 +116,7 @@ echo '*********************************************************** ' echo " grdID = $grdID" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=2;export err;${errchk} fi @@ -146,7 +141,7 @@ echo ' ' echo " Generating $nmoddef mod def files" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # Set number of processes for mpmd wavenproc=$(wc -l cmdfile | awk '{print $1}') @@ -159,8 +154,7 @@ echo " Executing the mod_def command file at : $(date)" echo ' ------------------------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x - + ${TRACE_ON:-set -x} if [ "$NTASKS" -gt '1' ] then if [ ${CFP_MP:-"NO"} = "YES" ]; then @@ -183,7 +177,7 @@ echo '********************************************************' echo ' See Details Below ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} fi fi @@ -198,7 +192,7 @@ echo ' ' echo " mod_def.$grdID succesfully created/copied " echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -208,7 +202,7 @@ echo " grdID = $grdID" echo ' ' sed "s/^/$grdID.out : /g" $grdID.out - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=3;export err;${errchk} fi done @@ -216,14 +210,5 @@ # --------------------------------------------------------------------------- # # 2. Ending - set +x - echo ' ' - echo "Ending at : $(date)" - echo ' ' - echo ' *** End of MWW3 Init Config ***' - echo ' ' - [[ "$LOUD" = YES ]] && set -x - - exit $err # End of MWW3 init config script ------------------------------------------- # diff --git a/scripts/exgfs_wave_nawips.sh b/scripts/exgfs_wave_nawips.sh index c4fa9e764df..8d41578d7e1 100755 --- a/scripts/exgfs_wave_nawips.sh +++ b/scripts/exgfs_wave_nawips.sh @@ -1,16 +1,17 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################### -echo "----------------------------------------------------" -echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" -echo "----------------------------------------------------" -echo "History: Mar 2000 - First implementation of this new script." -echo "Sept 2011 - First implementation of this new script based on" -echo " /nwprod/scripts/exnawips.sh.sms" -echo " March 2020- Modified for GEFSv12.0" +# echo "----------------------------------------------------" +# echo "exnawips - convert NCEP GRIB files into GEMPAK Grids" +# echo "----------------------------------------------------" +# echo "History: Mar 2000 - First implementation of this new script." +# echo "Sept 2011 - First implementation of this new script based on" +# echo " /nwprod/scripts/exnawips.sh.sms" +# echo " March 2020- Modified for GEFSv12.0" # March-2020 Roberto.Padilla@noaa.gov ##################################################################### -set -xa +source "$HOMEgfs/ush/preamble.sh" #export grids=${grids:-'glo_30m at_10m ep_10m wc_10m ao_9km'} #Interpolated grids export grids=${grids:-'glo_10m gso_15m ao_9km'} #Native grids @@ -90,7 +91,7 @@ while [ $fhcnt -le $FHMAX_WAV ]; do echo '**************************** ' echo ' ' echo $msg - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "$RUNwave $grdID ${fhr} prdgen $date $cycle : GRIB file missing." >> $wavelog err=1;export err;${errchk} || exit ${err} fi @@ -111,7 +112,7 @@ while [ $fhcnt -le $FHMAX_WAV ]; do echo '************************************************************* ' echo ' ' echo $msg - #[[ "$LOUD" = YES ]] && set -x + #${TRACE_ON:-set -x} echo "$RUNwave $grdID prdgen $date $cycle : error in grbindex." >> $wavelog err=2;export err;err_chk else @@ -177,14 +178,6 @@ while [ $fhcnt -le $FHMAX_WAV ]; do let fhcnt=fhcnt+inc done ##################################################################### -# GOOD RUN -set +x -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -echo "**************JOB $RUN NAWIPS COMPLETED NORMALLY ON THE IBM" -set -x -##################################################################### -msg='Job completed normally.' -echo $msg -postmsg "$jlogfile" "$msg" + + ############################### END OF SCRIPT ####################### diff --git a/scripts/exgfs_wave_post_gridded_sbs.sh b/scripts/exgfs_wave_post_gridded_sbs.sh index 622eb57880d..b602ba3a0e4 100755 --- a/scripts/exgfs_wave_post_gridded_sbs.sh +++ b/scripts/exgfs_wave_post_gridded_sbs.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -29,12 +29,10 @@ # # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - set -x - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +source "$HOMEgfs/ush/preamble.sh" + +# 0.a Basic modes of operation # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic @@ -42,7 +40,6 @@ cd $DATA - echo "HAS BEGUN on $(hostname)" echo "Starting WAVE POSTPROCESSOR SCRIPT for $WAV_MOD_TAG" set +x @@ -54,7 +51,7 @@ echo "Starting at : $(date)" echo '-------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # Script will run only if pre-defined NTASKS # The actual work is distributed over these tasks. @@ -84,7 +81,7 @@ echo " Interpolated grids : $waveinterpGRD" echo " Post-process grids : $wavepostGRD" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 0.c.3 Define CDATE_POST @@ -103,7 +100,7 @@ echo ' ' echo 'Preparing input files :' echo '-----------------------' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 1.a Model definition files and output files (set up using poe) @@ -114,7 +111,7 @@ then set +x echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cp -f $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID fi @@ -131,14 +128,14 @@ echo " FATAL ERROR : NO MOD_DEF FILE mod_def.$grdID " echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=2; export err;${errchk} exit $err DOGRB_WAV='NO' else set +x echo "File mod_def.$grdID found. Syncing to all nodes ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} fi done @@ -158,7 +155,7 @@ then set +x echo " ${intGRD}_interp.inp.tmpl copied. Syncing to all nodes ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -166,7 +163,7 @@ echo '*** ERROR : NO TEMPLATE FOR GRINT INPUT FILE *** ' echo '*********************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "$WAV_MOD_TAG post $date $cycle : GRINT template file missing." exit_code=1 DOGRI_WAV='NO' @@ -187,7 +184,7 @@ then set +x echo " ww3_grib2.${grbGRD}.inp.tmpl copied. Syncing to all nodes ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -195,7 +192,7 @@ echo "*** ERROR : NO TEMPLATE FOR ${grbGRD} GRIB INPUT FILE *** " echo '*********************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit_code=2 DOGRB_WAV='NO' fi @@ -214,7 +211,7 @@ echo " Sufficient data for GRID interpolation : $DOGRI_WAV" echo " Sufficient data for GRIB files : $DOGRB_WAV" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # --------------------------------------------------------------------------- # # 2. Make consolidated grib2 file for side-by-side grids and interpolate @@ -224,12 +221,12 @@ set +x echo ' Making command file for sbs grib2 and GRID Interpolation ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 1.a.2 Loop over forecast time to generate post files # When executed side-by-side, serial mode (cfp when run after the fcst step) # Contingency for RERUN=YES - if [ "${RERUN}" = "YES" ]; then + if [ "${RERUN-NO}" = "YES" ]; then fhr=$((FHRUN + FHMIN_WAV)) if [ $FHMAX_HF_WAV -gt 0 ] && [ $FHOUT_HF_WAV -gt 0 ] && [ $fhr -lt $FHMAX_HF_WAV ]; then FHINCG=$FHOUT_HF_WAV @@ -275,7 +272,7 @@ echo " FATAL ERROR : NO RAW FIELD OUTPUT FILE out_grd.$grdID " echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "$WAV_MOD_TAG post $grdID $date $cycle : field output missing." err=3; export err;${errchk} exit $err @@ -370,7 +367,7 @@ echo " Executing the grib2_sbs scripts at : $(date)" echo ' ------------------------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$wavenproc" -gt '1' ] then @@ -395,7 +392,7 @@ echo '*************************************' echo ' See Details Below ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=4; export err;${errchk} exit $err fi @@ -419,7 +416,7 @@ echo '********************************************' echo ' See Details Below ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=5; export err;${errchk} exit $err fi @@ -439,23 +436,6 @@ # --------------------------------------------------------------------------- # # 7. Ending output - set +x - echo ' ' - echo "Ending at : $(date)" - echo '-----------' - echo ' ' - echo ' *** End of MWW3 postprocessor ***' - echo ' ' - [[ "$LOUD" = YES ]] && set -x - - if [ "$exit_code" -ne '0' ] - then - echo " FATAL ERROR: Problem in MWW3 POST" - err=6; export err;${errchk} - exit $err - else - echo " Side-by-Side Wave Post Completed Normally " - exit 0 - fi +echo "$exit_code" # End of MWW3 prostprocessor script ---------------------------------------- # diff --git a/scripts/exgfs_wave_post_pnt.sh b/scripts/exgfs_wave_post_pnt.sh index c3cab2999d5..cf42db0bb42 100755 --- a/scripts/exgfs_wave_post_pnt.sh +++ b/scripts/exgfs_wave_post_pnt.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -31,12 +31,10 @@ # # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - set -x - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +source "$HOMEgfs/ush/preamble.sh" + +# 0.a Basic modes of operation cd $DATA @@ -56,7 +54,7 @@ echo "Starting at : $(date)" echo '-------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # Script will run only if pre-defined NTASKS # The actual work is distributed over these tasks. @@ -93,7 +91,7 @@ echo '-------------------' echo " Output points : $waveuoutpGRD" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # --------------------------------------------------------------------------- # # 1. Get files that are used by most child scripts @@ -104,7 +102,7 @@ echo ' ' echo 'Preparing input files :' echo '-----------------------' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 1.a Model definition files and output files (set up using poe) @@ -114,16 +112,17 @@ touch cmdfile chmod 744 cmdfile - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # Copy model definition files + iloop=0 for grdID in $waveuoutpGRD do if [ -f "$COMIN/rundata/${CDUMP}wave.mod_def.${grdID}" ] then set +x echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cp -f $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID iloop=$(expr $iloop + 1) @@ -140,13 +139,13 @@ echo " FATAL ERROR : NO MOD_DEF FILE mod_def.$grdID " echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=2; export err;${errchk} exit $err else set +x echo "File mod_def.$grdID found. Syncing to all nodes ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} fi done @@ -170,7 +169,7 @@ then set +x echo " buoy.loc and buoy.ibp copied and processed ($PARMwave/wave_${NET}.buoys)." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -178,7 +177,7 @@ echo ' FATAL ERROR : NO BUOY LOCATION FILE ' echo '************************************* ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=3; export err;${errchk} exit $err DOSPC_WAV='NO' @@ -196,7 +195,7 @@ then set +x echo " ww3_outp_spec.inp.tmpl copied. Syncing to all grids ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -204,7 +203,7 @@ echo '*** ERROR : NO TEMPLATE FOR SPEC INPUT FILE *** ' echo '*********************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit_code=3 DOSPC_WAV='NO' DOBLL_WAV='NO' @@ -219,7 +218,7 @@ then set +x echo " ww3_outp_bull.inp.tmpl copied. Syncing to all nodes ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -227,7 +226,7 @@ echo '*** ERROR : NO TEMPLATE FOR BULLETIN INPUT FILE *** ' echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit_code=4 DOBLL_WAV='NO' fi @@ -257,7 +256,7 @@ echo " FATAL ERROR : NO RAW POINT OUTPUT FILE out_pnt.${waveuoutpGRD}.${YMD}.${HMS} " echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "$WAV_MOD_TAG post $waveuoutpGRD $CDATE $cycle : field output missing." err=4; export err;${errchk} fi @@ -281,7 +280,7 @@ echo ' ' cat buoy_tmp.loc echo "$WAV_MOD_TAG post $date $cycle : buoy log file failed to be created." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=5;export err;${errchk} DOSPC_WAV='NO' DOBLL_WAV='NO' @@ -304,7 +303,7 @@ then set +x echo 'Buoy log file created. Syncing to all nodes ...' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -312,7 +311,7 @@ echo '*** ERROR : NO BUOY LOG FILE CREATED *** ' echo '**************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=6;export err;${errchk} DOSPC_WAV='NO' DOBLL_WAV='NO' @@ -332,7 +331,7 @@ echo " Sufficient data for bulletins : $DOBLL_WAV ($Nb points)" echo " Boundary points : $DOBNDPNT_WAV" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # --------------------------------------------------------------------------- # # 2. Make files for processing boundary points @@ -341,7 +340,7 @@ set +x echo ' Making command file for wave post points ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} rm -f cmdfile touch cmdfile @@ -375,7 +374,7 @@ else echo " FATAL ERROR : NO RAW POINT OUTPUT FILE out_pnt.$waveuoutpGRD.${YMD}.${HMS} " echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=7; export err;${errchk} exit $err fi @@ -469,7 +468,7 @@ echo " Executing the wave point scripts at : $(date)" echo ' ------------------------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$wavenproc" -gt '1' ] then @@ -494,7 +493,7 @@ echo '*************************************' echo ' See Details Below ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=8; export err;${errchk} exit $err fi @@ -561,7 +560,7 @@ echo " Executing the boundary point cat script at : $(date)" echo ' ------------------------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$wavenproc" -gt '1' ] then @@ -586,7 +585,7 @@ echo '*************************************' echo ' See Details Below ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=9; export err;${errchk} exit $err fi @@ -605,7 +604,7 @@ echo ' ' echo ' Making command file for taring all point output files.' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 6.b Spectral data files @@ -663,7 +662,7 @@ echo " Executing the wave_tar scripts at : $(date)" echo ' ------------------------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$wavenproc" -gt '1' ] then @@ -688,7 +687,7 @@ echo '*************************************' echo ' See Details Below ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=10; export err;${errchk} exit $err fi @@ -696,23 +695,7 @@ # --------------------------------------------------------------------------- # # 4. Ending output - set +x - echo ' ' - echo "Ending at : $(date)" - echo '-----------' - echo ' ' - echo ' *** End of MWW3 pnt postprocessor ***' - echo ' ' - [[ "$LOUD" = YES ]] && set -x - if [ "$exit_code" -ne '0' ] - then - echo " FATAL ERROR: Problem in MWW3 PNT POST" - err=11; export err;${errchk} - exit $err - else - echo " Point Wave Post Completed Normally " - exit 0 - fi +exit $exit_code # End of MWW3 point prostprocessor script ---------------------------------------- # diff --git a/scripts/exgfs_wave_prdgen_bulls.sh b/scripts/exgfs_wave_prdgen_bulls.sh index dc46136a54a..10bdee523b0 100755 --- a/scripts/exgfs_wave_prdgen_bulls.sh +++ b/scripts/exgfs_wave_prdgen_bulls.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ############################################################################### # # # This script is the product generator ("graphics job") for the # @@ -16,11 +17,10 @@ ############################################################################### # --------------------------------------------------------------------------- # # 0. Preparations + +source "$HOMEgfs/ush/preamble.sh" + # 0.a Basic modes of operation - set -xa - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x # PATH for working and home directories export RUNwave=${RUNwave:-${RUN}${COMPONENT}} @@ -40,10 +40,6 @@ cd $DATA export wavelog=${DATA}/${RUNwave}_prdgbulls.log - postmsg "$jlogfile" "HAS BEGUN on $(hostname)" - - msg="Starting MWW3 BULLETINS PRODUCTS SCRIPT" - postmsg "$jlogfile" "$msg" touch $wavelog # 0.b Date and time stuff export date=$PDY @@ -58,12 +54,12 @@ echo "Starting at : $(date)" echo ' ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 1. Get necessary files set +x echo " Copying bulletins from $COMIN" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 1.a Link the input file and untar it BullIn=$COMIN/station/${RUNwave}.$cycle.cbull_tar @@ -79,7 +75,7 @@ echo '************************************ ' echo ' ' echo $msg - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} msg="FATAL ERROR ${RUNwave} prdgen $date $cycle : bulletin tar missing." echo $msg >> $wavelog export err=1; ${errchk} @@ -88,14 +84,14 @@ set +x echo " Untarring bulletins ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} tar -xf cbull.tar OK=$? if [ "$OK" = '0' ]; then set +x echo " Unpacking successfull ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} rm -f cbull.tar else msg="ABNORMAL EXIT: ERROR IN BULLETIN UNTAR" @@ -107,7 +103,7 @@ echo '****************************************** ' echo ' ' echo $msg - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "${RUNwave} prdgen $date $cycle : bulletin untar error." >> $wavelog err=2;export err;err_chk exit $err @@ -117,7 +113,7 @@ set +x echo ' Nb=$(ls -1 *.cbull | wc -l)' Nb=$(ls -1 *.cbull | wc -l) - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo ' ' echo " Number of bulletin files : $Nb" echo ' --------------------------' @@ -135,7 +131,7 @@ echo '******************************************* ' echo ' ' echo $msg - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "${RUNwave} prdgen $date $cycle : Bulletin header data file missing." >> $wavelog err=3;export err;err_chk exit $err @@ -148,7 +144,7 @@ echo ' Sourcing data file with header info ...' # 2.b Set up environment variables - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} . awipsbull.data # 2.c Generate list of bulletins to process @@ -166,9 +162,8 @@ echo " Processing $bull ($headr $oname) ..." if [ -z "$headr" ] || [ ! -s $fname ]; then - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} msg="ABNORMAL EXIT: MISSING BULLETING INFO" - postmsg "$jlogfile" "$msg" set +x echo ' ' echo '******************************************** ' @@ -176,20 +171,20 @@ echo '******************************************** ' echo ' ' echo $msg - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "${RUNwave} prdgen $date $cycle : Missing bulletin data." >> $wavelog err=4;export err;err_chk exit $err fi - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} formbul.pl -d $headr -f $fname -j $job -m ${RUNwave} \ -p $PCOM -s NO -o $oname > formbul.out 2>&1 OK=$? if [ "$OK" != '0' ] || [ ! -f $oname ]; then - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cat formbul.out msg="ABNORMAL EXIT: ERROR IN formbul" postmsg "$jlogfile" "$msg" @@ -200,7 +195,7 @@ echo '************************************** ' echo ' ' echo $msg - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "${RUNwave} prdgen $date $cycle : error in formbul." >> $wavelog err=5;export err;err_chk exit $err @@ -211,7 +206,7 @@ done # 3. Send output files to the proper destination - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$SENDCOM" = YES ]; then cp awipsbull.$cycle.${RUNwave} $PCOM/awipsbull.$cycle.${RUNwave} if [ "$SENDDBN_NTC" = YES ]; then @@ -219,7 +214,7 @@ else if [ "${envir}" = "para" ] || [ "${envir}" = "test" ] || [ "${envir}" = "dev" ]; then echo "Making NTC bulletin for parallel environment, but do not alert." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} (export SENDDBN=NO; make_ntc_bull.pl WMOBH NONE KWBC NONE \ $DATA/awipsbull.$cycle.${RUNwave} $PCOM/awipsbull.$cycle.${RUNwave}) fi @@ -229,23 +224,12 @@ # --------------------------------------------------------------------------- # # 4. Clean up - set +x; [[ "$LOUD" = YES ]] && set -v + set -v rm -f ${RUNwave}.*.cbull awipsbull.data set +v # --------------------------------------------------------------------------- # # 5. Ending output - set +x - echo ' ' - echo ' ' - echo "Ending at : $(date)" - echo ' ' - echo ' *** End of MWW3 BULLETINS product generation ***' - echo ' ' - [[ "$LOUD" = YES ]] && set -x - - msg="$job completed normally" - postmsg "$jlogfile" "$msg" # End of MWW3 product generation script -------------------------------------- # diff --git a/scripts/exgfs_wave_prdgen_gridded.sh b/scripts/exgfs_wave_prdgen_gridded.sh index ed6141afec3..b56fb15819f 100755 --- a/scripts/exgfs_wave_prdgen_gridded.sh +++ b/scripts/exgfs_wave_prdgen_gridded.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ############################################################################### # # # This script is the product generator ("graphics job") for the # @@ -17,11 +18,10 @@ ############################################################################### # --------------------------------------------------------------------------- # # 0. Preparations + +source "$HOMEgfs/ush/preamble.sh" + # 0.a Basic modes of operation - set -xa - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x export RUNwave=${RUNwave:-${RUN}${COMPONENT}} export envir=${envir:-ops} @@ -63,14 +63,14 @@ echo " AWIPS grib fields" echo " Wave Grids : $grids" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # --------------------------------------------------------------------------- # # 1. Get necessary files echo ' ' echo 'Preparing input files :' echo '-----------------------' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} #======================================================================= ASWELL=(SWELL1 SWELL2) # Indices of HS from partitions @@ -120,7 +120,7 @@ echo '**************************** ' echo ' ' echo $msg - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} echo "$RUNwave $grdID ${fhr} prdgen $date $cycle : GRIB file missing." >> $wavelog err=1;export err;${errchk} || exit ${err} fi @@ -177,12 +177,12 @@ # 2.a.1 Set up for tocgrib2 echo " Do set up for tocgrib2." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} #AWIPSGRB=awipsgrib.$grdID.f${fhr} AWIPSGRB=awipsgrib # 2.a.2 Make GRIB index echo " Make GRIB index for tocgrib2." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} $GRB2INDEX gribfile.$grdID.f${fhr} gribindex.$grdID.f${fhr} OK=$? @@ -197,7 +197,7 @@ echo '******************************************** ' echo ' ' echo $msg - #[[ "$LOUD" = YES ]] && set -x + #${TRACE_ON:-set -x} echo "$RUNwave $grdID prdgen $date $cycle : error in grbindex." >> $wavelog err=4;export err;err_chk fi @@ -205,7 +205,7 @@ # 2.a.3 Run AWIPS GRIB packing program tocgrib2 echo " Run tocgrib2" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} export pgm=tocgrib2 export pgmout=tocgrib2.out . prep_step @@ -227,7 +227,7 @@ echo '*************************************** ' echo ' ' echo $msg - #[[ "$LOUD" = YES ]] && set -x + #${TRACE_ON:-set -x} echo "$RUNwave prdgen $date $cycle : error in tocgrib2." >> $wavelog err=5;export err;err_chk else @@ -236,13 +236,13 @@ # 2.a.7 Get the AWIPS grib bulletin out ... #set +x echo " Get awips GRIB bulletins out ..." - #[[ "$LOUD" = YES ]] && set -x + #${TRACE_ON:-set -x} if [ "$SENDCOM" = 'YES' ] then #set +x echo " Saving $AWIPSGRB.$grdOut.f${fhr} as grib2.$cycle.awipsww3_${grdID}.f${fhr}" echo " in $PCOM" - #[[ "$LOUD" = YES ]] && set -x + #${TRACE_ON:-set -x} cp $AWIPSGRB.$grdID.f${fhr} $PCOM/grib2.$cycle.f${fhr}.awipsww3_${grdOut} #set +x fi @@ -268,22 +268,13 @@ # --------------------------------------------------------------------------- # # 5. Clean up - set +x; [[ "$LOUD" = YES ]] && set -v + set -v rm -f gribfile gribindex.* awipsgrb.* awipsbull.data set +v # --------------------------------------------------------------------------- # # 6. Ending output - echo ' ' - echo ' ' - echo "Ending at : $(date)" - echo ' ' - echo ' *** End of MWW3 product generation ***' - echo ' ' - [[ "$LOUD" = YES ]] && set -x - msg="$job completed normally" - postmsg "$jlogfile" "$msg" # End of GFSWAVE product generation script -------------------------------------- # diff --git a/scripts/exgfs_wave_prep.sh b/scripts/exgfs_wave_prep.sh index 2e2e18985f2..f3ecf388beb 100755 --- a/scripts/exgfs_wave_prep.sh +++ b/scripts/exgfs_wave_prep.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -39,12 +39,10 @@ ############################################################################### # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - set -x - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +source "$HOMEgfs/ush/preamble.sh" + +# 0.a Basic modes of operation # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic @@ -66,7 +64,7 @@ echo ' ' echo "Starting at : $(date)" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$INDRUN" = 'no' ] then @@ -138,7 +136,7 @@ echo " starting time : $time_beg" echo " ending time : $time_end" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # Script will run only if pre-defined NTASKS # The actual work is distributed over these tasks. @@ -155,7 +153,7 @@ echo 'Preparing input files :' echo '-----------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 1.a Model definition files @@ -175,7 +173,7 @@ then set +x echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cp $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID else @@ -187,7 +185,7 @@ echo " grdID = $grdID" echo ' ' echo "FATAL ERROR: NO MODEL DEFINITION FILE" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=2;export err;${errchk} fi done @@ -227,7 +225,7 @@ echo ' ' echo " ww3_prnc.${type}.$grdID.inp.tmpl copied ($PARMwave)." echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else set +x echo ' ' @@ -238,7 +236,7 @@ echo ' ' echo "ABNORMAL EXIT: NO FILE $file" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=4;export err;${errchk} fi done @@ -267,7 +265,7 @@ echo ' ' sed "s/^/wave_prnc_ice.out : /g" wave_prnc_ice.out echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=5;export err;${errchk} else mv -f wave_prnc_ice.out $DATA/outtmp @@ -275,7 +273,7 @@ echo ' ' echo ' Ice field unpacking successful.' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} fi else echo ' ' @@ -297,7 +295,7 @@ echo '*** FATAL ERROR : Not set-up to preprocess wind *** ' echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=6;export err;${errchk} fi @@ -315,7 +313,7 @@ echo ' ' echo ' Concatenate binary current fields ...' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # Prepare files for cfp process rm -f cmdfile @@ -386,13 +384,13 @@ else curfile=${curfile3h} fi - set $setoff + set -x echo ' ' echo '************************************** ' echo "*** FATAL ERROR: NO CUR FILE $curfile *** " echo '************************************** ' echo ' ' - set $seton + ${TRACE_ON:-set -x} echo "FATAL ERROR - NO CURRENT FILE (RTOFS)" err=11;export err;${errchk} exit $err @@ -425,7 +423,7 @@ echo " Executing the curr prnc cmdfile at : $(date)" echo ' ------------------------------------' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ $wavenproc -gt '1' ] then @@ -450,7 +448,7 @@ echo '********************************************' echo ' See Details Below ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} fi files=$(ls ${WAVECUR_DID}.* 2> /dev/null) @@ -464,7 +462,7 @@ echo '******************************************** ' echo ' ' echo "ABNORMAL EXIT: NO ${WAVECUR_FID}.* FILES FOUND" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=11;export err;${errchk} fi @@ -495,14 +493,7 @@ # --------------------------------------------------------------------------- # # 4. Ending output - set +x - echo ' ' - echo "Ending at : $(date)" - echo ' ' - echo ' *** End of MWW3 preprocessor ***' - echo ' ' - [[ "$LOUD" = YES ]] && set -x - exit $err +exit $err # End of MWW3 preprocessor script ------------------------------------------- # diff --git a/scripts/exglobal_atmos_analysis.sh b/scripts/exglobal_atmos_analysis.sh index da3621838c1..7970b9b3d8a 100755 --- a/scripts/exglobal_atmos_analysis.sh +++ b/scripts/exglobal_atmos_analysis.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -17,11 +18,8 @@ ################################################################################# # Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi + +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -1011,13 +1009,10 @@ cd $pwd if [ $SENDECF = "YES" -a "$RUN" != "enkf" ]; then ecflow_client --event release_fcst fi -echo "$CDUMP $CDATE atminc done at `date`" > $COMOUT/${APREFIX}loginc.txt +echo "$CDUMP $CDATE atminc done at $(date)" > $COMOUT/${APREFIX}loginc.txt ################################################################################ -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err ################################################################################ diff --git a/scripts/exglobal_atmos_analysis_calc.sh b/scripts/exglobal_atmos_analysis_calc.sh index 02a45de52e1..2fa44c16b43 100755 --- a/scripts/exglobal_atmos_analysis_calc.sh +++ b/scripts/exglobal_atmos_analysis_calc.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -17,11 +18,8 @@ ################################################################################ # Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi + +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -199,16 +197,13 @@ if [ $DOGAUSFCANL = "YES" ]; then export err=$?; err_chk fi -echo "$CDUMP $CDATE atmanl and sfcanl done at `date`" > $COMOUT/${APREFIX}loganl.txt +echo "$CDUMP $CDATE atmanl and sfcanl done at $(date)" > $COMOUT/${APREFIX}loganl.txt ################################################################################ # Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err diff --git a/scripts/exglobal_atmos_pmgr.sh b/scripts/exglobal_atmos_pmgr.sh index 1a00eda1a62..6e4c2ed3f49 100755 --- a/scripts/exglobal_atmos_pmgr.sh +++ b/scripts/exglobal_atmos_pmgr.sh @@ -1,13 +1,14 @@ -#! /bin/ksh +#! /usr/bin/env bash + # # Script name: exgfs_pmgr.sh.sms # # This script monitors the progress of the gfs_fcst job # -set -x + +source "$HOMEgfs/ush/preamble.sh" hour=00 -typeset -Z2 hour case $RUN in gfs) @@ -25,11 +26,9 @@ if [ -e posthours ]; then fi while [ $hour -lt $TCP ]; do + hour=$(printf "%02d" $hour) echo $hour >>posthours - if [ $hour -lt 120 ]; then - if [ $hour -eq 99 ]; then - typeset -Z3 hour - fi + if [ 10#$hour -lt 120 ]; then let "hour=hour+1" else let "hour=hour+3" @@ -69,6 +68,5 @@ while [ $icnt -lt 1000 ]; do fi done -echo Exiting $0 exit diff --git a/scripts/exglobal_atmos_sfcanl.sh b/scripts/exglobal_atmos_sfcanl.sh index a8c275c10dd..899e0ae84ae 100755 --- a/scripts/exglobal_atmos_sfcanl.sh +++ b/scripts/exglobal_atmos_sfcanl.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -17,11 +18,8 @@ ################################################################################ # Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi + +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -217,10 +215,7 @@ cd $pwd ################################################################################ -set +x -if [ $VERBOSE = "YES" ]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err ################################################################################ diff --git a/scripts/exglobal_atmos_tropcy_qc_reloc.sh b/scripts/exglobal_atmos_tropcy_qc_reloc.sh index f158b10ff9e..6f96d7cfb43 100755 --- a/scripts/exglobal_atmos_tropcy_qc_reloc.sh +++ b/scripts/exglobal_atmos_tropcy_qc_reloc.sh @@ -1,21 +1,20 @@ +#! /usr/bin/env bash + ############################################################################ -echo "---------------------------------------------------------------------" -echo "exglobal_atmos_tropcy_qc_reloc.sh - Tropical Cyclone QC/Relocation Prcocessing" -echo "---------------------------------------------------------------------" -echo "History: Jun 13 2006 - Original script." -echo " March 2013 - No changes needed for WCOSS transition" -echo " MP_LABELIO default added" -echo " Oct 2013 - Use main USH vars as part of minor pkg cleanup" +# echo "---------------------------------------------------------------------" +# echo "exglobal_atmos_tropcy_qc_reloc.sh - Tropical Cyclone QC/Relocation Prcocessing" +# echo "---------------------------------------------------------------------" +# echo "History: Jun 13 2006 - Original script." +# echo " March 2013 - No changes needed for WCOSS transition" +# echo " MP_LABELIO default added" +# echo " Oct 2013 - Use main USH vars as part of minor pkg cleanup" ############################################################################ -set -x +source "$HOMEgfs/ush/preamble.sh" # Make sure we are in the $DATA directory cd $DATA -msg="HAS BEGUN on $(hostname)" -postmsg "$jlogfile" "$msg" - cat break > $pgmout export COMSP=$COMOUT/${RUN}.${cycle}. @@ -26,9 +25,6 @@ cdate10=$( ${NDATE:?} -$tmhr $PDY$cyc) NET_uc=$(echo $RUN | tr [a-z] [A-Z]) tmmark_uc=$(echo $tmmark | tr [a-z] [A-Z]) -msg="$NET_uc ANALYSIS TIME IS $PDY$cyc" -postmsg "$jlogfile" "$msg" - iflag=0 if [ $RUN = ndas ]; then if [ $DO_RELOCATE = NO ]; then @@ -71,9 +67,7 @@ if [ "$PROCESS_TROPCY" = 'YES' ]; then cd $COMOUT pwd - set +x ls -ltr *syndata* - set -x cd $ARCHSYND pwd;ls -ltr cat syndat_dateck @@ -156,27 +150,8 @@ fi ######################################################## -# GOOD RUN -set +x -echo " " -echo " ****** PROCESSING COMPLETED NORMALLY" -echo " ****** PROCESSING COMPLETED NORMALLY" -echo " ****** PROCESSING COMPLETED NORMALLY" -echo " ****** PROCESSING COMPLETED NORMALLY" -echo " " -set -x - - # save standard output -cat break $pgmout break > allout -cat allout -# rm allout - -sleep 10 +cat break $pgmout break -if [ $iflag -eq 0 ]; then - msg='ENDED NORMALLY.' - postmsg "$jlogfile" "$msg" -fi ################## END OF SCRIPT ####################### diff --git a/scripts/exglobal_diag.sh b/scripts/exglobal_diag.sh index e2422b58779..0423a9fc703 100755 --- a/scripts/exglobal_diag.sh +++ b/scripts/exglobal_diag.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -17,11 +18,8 @@ ################################################################################ # Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi + +source "$HOMEgfs/ush/preamble.sh" # Directories. pwd=$(pwd) @@ -247,7 +245,9 @@ EOFdiag # Restrict diagnostic files containing rstprod data rlist="conv_gps conv_ps conv_pw conv_q conv_sst conv_t conv_uv saphir" for rtype in $rlist; do - ${CHGRP_CMD} *${rtype}* + set +e + ${CHGRP_CMD} *${rtype}* + ${STRICT_ON:-set -e} done # If requested, create diagnostic file tarballs @@ -285,11 +285,8 @@ if [[ "$REMOVE_DIAG_DIR" = "YES" && "$err" = "0" ]]; then fi cd $pwd -[[ $mkdata = "YES" ]] && rm -rf $DATA +[[ "${mkdata:-YES}" = "YES" ]] && rm -rf $DATA + -set +x -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with return code $err >&2 -fi exit $err diff --git a/scripts/exglobal_forecast.sh b/scripts/exglobal_forecast.sh index 4c398e5055e..3f2ad87cafd 100755 --- a/scripts/exglobal_forecast.sh +++ b/scripts/exglobal_forecast.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ################################################################################ ## UNIX Script Documentation Block ## Script name: exglobal_fcst_nemsfv3gfs.sh @@ -76,11 +77,7 @@ # Main body starts here ####################### -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" SCRIPTDIR=$(dirname $(readlink -f "$0") )/../ush echo "MAIN: environment loaded for $machine platform,Current Script locates in $SCRIPTDIR." @@ -131,7 +128,7 @@ case $RUN in 'gefs') FV3_GEFS_predet;; esac [[ $cplflx = .true. ]] && MOM6_predet -#[[ $cplwav = .true. ]] && WW3_predet #no WW3_predet at this time +[[ $cplwav = .true. ]] && WW3_predet [[ $cplice = .true. ]] && CICE_predet case $RUN in @@ -219,14 +216,5 @@ fi echo "MAIN: Output copied to COMROT" #------------------------------------------------------------------ -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXITING $0 with return code $err >&2 -fi -if [ $err != 0 ]; then - echo "MAIN: $confignamevarfornems Forecast failed" - exit $err -else - echo "MAIN: $confignamevarfornems Forecast completed at normal status" - exit 0 -fi +exit $err diff --git a/scripts/run_reg2grb2.sh b/scripts/run_reg2grb2.sh index e1b1e927bfa..2284088f47e 100755 --- a/scripts/run_reg2grb2.sh +++ b/scripts/run_reg2grb2.sh @@ -1,5 +1,6 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" #requires grib_util module @@ -69,3 +70,4 @@ $executable > reg2grb2.$CDATE.$IDATE.out grid2p05="0 6 0 0 0 0 0 0 720 361 0 0 90000000 0 48 -90000000 359500000 500000 500000 0" #### $NWPROD/util/exec/copygb2 -g "${grid2p05}" -i0 -x $outfile $outfile0p5 $COPYGB2 -g "${grid2p05}" -i0 -x $outfile $outfile0p5 + diff --git a/scripts/run_regrid.sh b/scripts/run_regrid.sh index 2e59e0aafe4..6d18eeb6930 100755 --- a/scripts/run_regrid.sh +++ b/scripts/run_regrid.sh @@ -1,7 +1,7 @@ -#!/bin/bash -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" -echo "Entered $0" MOM6REGRID=${MOM6REGRID:-$HOMEgfs} export EXEC_DIR=$MOM6REGRID/exec export USH_DIR=$MOM6REGRID/ush @@ -23,3 +23,4 @@ ls -alrt $NCL $USH_DIR/icepost.ncl $NCL $USH_DIR/ocnpost.ncl ##################################################################### + diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 8eb45859224..af00b790c68 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -210,9 +210,9 @@ if [ -d ../sorc/gsi_monitor.fd ]; then $LINK ../sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcoef.sh . $LINK ../sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcor.sh . $LINK ../sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_time.sh . + $LINK ../sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/ush/rstprod.sh . fi - #------------------------------ #--link executables #------------------------------ diff --git a/ush/cplvalidate.sh b/ush/cplvalidate.sh index 29db7b3ad92..754fa72102a 100755 --- a/ush/cplvalidate.sh +++ b/ush/cplvalidate.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /usr/bin/env bash ##### ## This script validates $confignamevarfornems diff --git a/ush/drive_makeprepbufr.sh b/ush/drive_makeprepbufr.sh index e945b367433..31154c10bb7 100755 --- a/ush/drive_makeprepbufr.sh +++ b/ush/drive_makeprepbufr.sh @@ -1,4 +1,5 @@ -#!/bin/sh -x +#! /usr/bin/env bash + ############################################################### # < next few lines under version control, D O N O T E D I T > # $Date$ @@ -17,6 +18,8 @@ ## CDUMP : cycle name (gdas / gfs) ############################################################### +source "$HOMEgfs/ush/preamble.sh" + ############################################################### # Source relevant configs configs="base prep prepbufr" @@ -135,4 +138,5 @@ $NCP $DATA/prepbufr.acft_profiles $COMOUT/${APREFIX}prepbufr.acft_profiles ############################################################### # Exit out cleanly if [ $KEEPDATA = "NO" ] ; then rm -rf $DATA ; fi + exit 0 diff --git a/ush/file_utils.sh b/ush/file_utils.sh new file mode 100644 index 00000000000..544a270b0a9 --- /dev/null +++ b/ush/file_utils.sh @@ -0,0 +1,27 @@ +#! /usr/bin/env bash + +nb_copy() { + # + # TODO - Extend this to take multiple arguments for file_in (like cp) + # + # Copy a file if it exists, print a warning otherwise but don't + # error. + # + # Syntax + # nb_copy file_in file_out + # + # Arguments + # file_in: the file to copy + # file_out: the destination of the copy + # + # Environment variables + # NCP: Command to use to copy (default: cp) + # + local file_in="${1}" + local file_out="${2}" + if [[ -f ${file_in} ]]; then + ${NCP:-cp} ${file_in} ${file_out} + else + echo "WARNING: No file ${file_in} found (pwd: $(pwd))" + fi +} diff --git a/ush/forecast_det.sh b/ush/forecast_det.sh index 206fa1884cc..f3823cde992 100755 --- a/ush/forecast_det.sh +++ b/ush/forecast_det.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /usr/bin/env bash ##### ## "forecast_det.sh" @@ -8,7 +8,6 @@ ## This script is a definition of functions. ##### - # For all non-evironment variables # Cycling and forecast hour specific parameters diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 140e41ba558..089ff7dd5b4 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /usr/bin/env bash ##### ## This script defines functions for data I/O and namelist. @@ -91,7 +91,7 @@ EOF exit 1 fi $NLN $increment_file $DATA/INPUT/fv_increment$i.nc - IAU_INC_FILES="'fv_increment$i.nc',$IAU_INC_FILES" + IAU_INC_FILES="'fv_increment$i.nc',${IAU_INC_FILES:-}" done read_increment=".false." res_latlon_dynamics="" @@ -643,7 +643,7 @@ WW3_postdet() { export WRDIR=${ROTDIR}/${CDUMPRSTwave}.${WRPDY}/${WRcyc}/wave/restart export RSTDIR_WAVE=$ROTDIR/${CDUMP}.${PDY}/${cyc}/wave/restart export datwave=$COMOUTwave/rundata - export wavprfx=${CDUMPwave}${WAV_MEMBER} + export wavprfx=${CDUMPwave}${WAV_MEMBER:-} #Copy initial condition files: for wavGRD in $waveGRD ; do @@ -651,7 +651,7 @@ WW3_postdet() { if [ $RERUN = "NO" ]; then waverstfile=${WRDIR}/${sPDY}.${scyc}0000.restart.${wavGRD} else - waverstfile=${RSTDIR_WAVE}/${PDYT}.${cyct}0000.restart.${wavGRD} + waverstfile=${RSTDIR_WAVE}/${PDYT}.${cyct}0000.restart.${wavGRD} fi else waverstfile=${RSTDIR_WAVE}/${sPDY}.${scyc}0000.restart.${wavGRD} @@ -820,7 +820,7 @@ MOM6_postdet() { if [ $fhr = 'anl' ]; then continue fi - if [ -z $last_fhr ]; then + if [ -z ${last_fhr:-} ]; then last_fhr=$fhr continue fi @@ -997,7 +997,8 @@ GOCART_rc() { cat ${AERO_CONFIG_DIR}/ExtData.${AERO_EMIS_FIRE:-none} ; \ echo "%%" ; \ } > $DATA/AERO_ExtData.rc - [[ $status -ne 0 ]] && exit $status + status=$? + if (( status != 0 )); then exit $status; fi fi fi } diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index 6965d7f30e4..947fae59cd3 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /usr/bin/env bash ##### ## "forecast_def.sh" @@ -8,7 +8,6 @@ ## This script is a definition of functions. ##### - # For all non-evironment variables # Cycling and forecast hour specific parameters common_predet(){ @@ -125,9 +124,9 @@ FV3_GFS_predet(){ cores_per_node=${cores_per_node:-${npe_node_fcst:-24}} ntiles=${ntiles:-6} if [ $MEMBER -lt 0 ]; then - NTASKS_TOT=${NTASKS_TOT:-$npe_fcst_gfs} + NTASKS_TOT=${NTASKS_TOT:-${npe_fcst_gfs:-0}} else - NTASKS_TOT=${NTASKS_TOT:-$npe_efcs} + NTASKS_TOT=${NTASKS_TOT:-${npe_efcs:-0}} fi TYPE=${TYPE:-"nh"} # choices: nh, hydro diff --git a/ush/fv3gfs_downstream_nems.sh b/ush/fv3gfs_downstream_nems.sh index 68da1ce8b8a..a1257ec4af2 100755 --- a/ush/fv3gfs_downstream_nems.sh +++ b/ush/fv3gfs_downstream_nems.sh @@ -1,5 +1,4 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash #----------------------------------------------------------------------- #-Hui-Ya Chuang, January 2014: First version. @@ -31,8 +30,7 @@ set -x # 1. Modify sea icea cover via land-sea mask. #----------------------------------------------------------------------- - -echo "!!!!!CREATING $RUN DOWNSTREAM PRODUCTS FOR FH = $FH !!!!!!" +source "$HOMEgfs/ush/preamble.sh" "$FH" export downset=${downset:-1} export DATA=${DATA:-/ptmpd2/$LOGNAME/test} @@ -130,16 +128,27 @@ while [ $nset -le $totalset ]; do # if final record of each piece is ugrd, add vgrd # copygb will only interpolate u and v together #$WGRIB2 -d $end $tmpfile |grep -i ugrd - $WGRIB2 -d $end $tmpfile |egrep -i "ugrd|ustm|uflx|u-gwd" + # grep returns 1 if no match is found, so temporarily turn off exit on non-zero rc + set +e + $WGRIB2 -d $end $tmpfile | egrep -i "ugrd|ustm|uflx|u-gwd" export rc=$? + ${ERR_EXIT_ON:-set -eu} if [[ $rc -eq 0 ]] ; then export end=$(expr ${end} + 1) + elif [[ $rc -gt 1 ]]; then + echo "FATAL: WGRIB2 failed with error code ${rc}" + exit $rc fi - # if final record is land, add next record icec - $WGRIB2 -d $end $tmpfile |egrep -i "land" + # if final record is land, add next record icec + set +e + $WGRIB2 -d $end $tmpfile | egrep -i "land" export rc=$? + ${ERR_EXIT_ON:-set -eu} if [[ $rc -eq 0 ]] ; then export end=$(expr ${end} + 1) + elif [[ $rc -gt 1 ]]; then + echo "FATAL: WGRIB2 failed with error code ${rc}" + exit $rc fi if [ $iproc -eq $nproc ]; then export end=$ncount @@ -176,6 +185,7 @@ while [ $nset -le $totalset ]; do echo "$nm $line" >> $DATA/poescript_srun nm=$((nm+1)) done + nm=$(wc -l < $DATA/poescript_srun) ${launcher:-"srun --export=ALL"} -n $nm --multi-prog $DATA/poescript_srun else $launcher @@ -283,8 +293,4 @@ while [ $nset -le $totalset ]; do export nset=$(expr $nset + 1 ) done -echo "!!!!!!CREATION OF SELECT $RUN DOWNSTREAM PRODUCTS COMPLETED FOR FHR = $FH !!!!!!!" -#--------------------------------------------------------------- - - exit 0 diff --git a/ush/fv3gfs_dwn_nems.sh b/ush/fv3gfs_dwn_nems.sh index b49daee45c4..eb29445b363 100755 --- a/ush/fv3gfs_dwn_nems.sh +++ b/ush/fv3gfs_dwn_nems.sh @@ -1,5 +1,4 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash # this script generates 0.25/0.5/1/2.5 deg pgb files for each small Grib file # Hui-Ya Chuang 01/2014: First Version @@ -12,6 +11,8 @@ set -x # Wen Meng 10/2019: Use bilinear interpolation for LAND, It can trancate land-sea mask as 0 or 1. # Wen Meng 11/2019: Teak sea ice cover via land-sea mask. +source "$HOMEgfs/ush/preamble.sh" + export tmpfile=$1 export fhr3=$2 export iproc=$3 @@ -42,6 +43,7 @@ export grid2p5="latlon 0:144:2.5 90:73:-2.5" export PGB1F=${PGB1F:-"NO"} export PGBS=${PGBS:-"NO"} +optncpu=${optncpu:-} if [ $nset = 1 ]; then if [ "$PGBS" = "YES" ]; then @@ -105,5 +107,3 @@ fi # $CNVGRIB -g21 pgb2file_${fhr3}_${iproc}_1p0 pgbfile_${fhr3}_${iproc}_1p0 # $CNVGRIB -g21 pgb2file_${fhr3}_${iproc}_2p5 pgbfile_${fhr3}_${iproc}_2p5 #---------------------------------------------------------------------------------------------- - -exit 0 diff --git a/ush/fv3gfs_nc2nemsio.sh b/ush/fv3gfs_nc2nemsio.sh index 4b239e18a35..99eea9ce5f3 100755 --- a/ush/fv3gfs_nc2nemsio.sh +++ b/ush/fv3gfs_nc2nemsio.sh @@ -1,5 +1,5 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash + #---------------------------------------------------------------------------- #--Fanglin Yang, October 2016: convert FV3 NetCDF files to NEMSIO format. # Note FV3 lat-lon grid is located at the center of each grid box, @@ -8,6 +8,8 @@ set -x # X(1,1)=[0.25E,89.75S], X(nlon,nlat)=[359.75E,89.75N] #--------------------------------------------------------------------------- +source "$HOMEgfs/ush/preamble.sh" + export CDATE=${CDATE:-"2016100300"} export GG=${master_grid:-"0p25deg"} # 1deg 0p5deg 0p25deg 0p125deg export FHZER=${FHZER:-6} # accumulation bucket in hours @@ -67,5 +69,5 @@ for fhour in $(echo $fdiag | sed "s/,/ /g"); do done #--------------------------------------------------- -echo $(date) EXITING $0 with return code $err >&2 + exit $err diff --git a/ush/fv3gfs_regrid_nemsio.sh b/ush/fv3gfs_regrid_nemsio.sh index 19a050520f1..7b92c27cde6 100755 --- a/ush/fv3gfs_regrid_nemsio.sh +++ b/ush/fv3gfs_regrid_nemsio.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /usr/bin/env bash ################################################################################ # UNIX Script Documentation Block @@ -19,12 +19,7 @@ # Language: Portable Operating System Interface (POSIX) Shell ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = YES ] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" #------------------------------------------------------- # Directories and paths @@ -120,8 +115,5 @@ for ftype in atm sfc; do done #------------------------------------------------------------------ -set +x -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err diff --git a/ush/fv3gfs_remap.sh b/ush/fv3gfs_remap.sh index d5258e0975b..b1c3546d979 100755 --- a/ush/fv3gfs_remap.sh +++ b/ush/fv3gfs_remap.sh @@ -1,11 +1,12 @@ -#!/bin/ksh -set -ax +#! /usr/bin/env bash #-------------------------------------- #-- remap FV3 6 tiles to global array #-- Fanglin Yang, October 2016 #-------------------------------------- +source "$HOMEgfs/ush/preamble.sh" + export CDATE=${CDATE:-"2016100300"} export CASE=${CASE:-"C192"} # C48 C96 C192 C384 C768 C1152 C3072 export GG=${master_grid:-"0p25deg"} # 1deg 0p5deg 0p25deg 0p125deg @@ -114,6 +115,5 @@ for type in atmos_4xdaily nggps2d nggps3d ; do done -echo $(date) EXITING $0 with return code $err >&2 exit $err diff --git a/ush/fv3gfs_remap_weights.sh b/ush/fv3gfs_remap_weights.sh index a4140a7c88e..15dfc73e3f0 100755 --- a/ush/fv3gfs_remap_weights.sh +++ b/ush/fv3gfs_remap_weights.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /usr/bin/env bash #BSUB -L /bin/sh #BSUB -P FV3GFS-T2O #BSUB -oo log.weights diff --git a/ush/gaussian_sfcanl.sh b/ush/gaussian_sfcanl.sh index 866cd6d255d..147afd5497b 100755 --- a/ush/gaussian_sfcanl.sh +++ b/ush/gaussian_sfcanl.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################################ #### UNIX Script Documentation Block # . . @@ -109,12 +110,7 @@ # ################################################################################ -# Set environment. -VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" CASE=${CASE:-C768} res=$(echo $CASE | cut -c2-) @@ -144,7 +140,7 @@ DATA=${DATA:-$(pwd)} COMOUT=${COMOUT:-$(pwd)} # Filenames. -XC=${XC} +XC=${XC:-} GAUSFCANLEXE=${GAUSFCANLEXE:-$EXECgfs/gaussian_sfcanl.exe} SIGLEVEL=${SIGLEVEL:-$FIXam/global_hyblev.l${LEVSP1}.txt} @@ -160,7 +156,7 @@ export REDERR=${REDERR:-'2>'} # Set defaults ################################################################################ # Preprocessing -$INISCRIPT +${INISCRIPT:-} pwd=$(pwd) if [[ -d $DATA ]] then @@ -236,10 +232,5 @@ $ERRSCRIPT||exit 2 # Postprocessing cd $pwd [[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err + +exit ${err} diff --git a/ush/getdump.sh b/ush/getdump.sh index e5487e34a26..462ca5e7551 100755 --- a/ush/getdump.sh +++ b/ush/getdump.sh @@ -1,5 +1,6 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" COMPONENT=${COMPONENT:-atmos} @@ -38,6 +39,3 @@ else fi exit 0 - - - diff --git a/ush/getges.sh b/ush/getges.sh index 62ce0eea3fe..2fb54fccc7d 100755 --- a/ush/getges.sh +++ b/ush/getges.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################################ # # Name: getges.sh Author: Mark Iredell @@ -74,6 +75,9 @@ # ################################################################################ #------------------------------------------------------------------------------- + +source "$HOMEgfs/ush/preamble.sh" + # Set some default parameters. fhbeg=03 # hour to begin searching backward for guess fhinc=03 # hour to increment backward in search @@ -151,7 +155,7 @@ if [[ $gfile = '?' || $# -gt 1 || $err -ne 0 || -z $valid ||\ fi exit 1 fi -[[ $quiet = NO ]]&&set -x + if [[ $envir != prod && $envir != test && $envir != para && $envir != dump && $envir != pr? && $envir != dev ]];then netwk=$envir envir=prod @@ -1345,8 +1349,9 @@ while [[ $fh -le $fhend ]];do ghp2=$fhp2;[[ $ghp2 -lt 100 ]]&&ghp2=0$ghp2 ghp3=$fhp3;[[ $ghp3 -lt 100 ]]&&ghp3=0$ghp3 id=$($NDATE -$fh $valid) - typeset -L8 day=$id - typeset -R2 cyc=$id + + day=$(echo $id | xargs | cut -c8) + cyc=$(echo $id | xargs | rev | cut -c1-2 | rev) eval list=\$getlist$fh [[ -z "$list" ]]&&list=${geslist} for ges_var in $list;do @@ -1369,8 +1374,10 @@ fi # Either copy guess to a file or write guess name to standard output. if [[ -z "$gfile" ]];then echo $ges - exit $? + err=$? else cp $ges $gfile - exit $? + err=$? fi + +exit ${err} diff --git a/ush/gfs_bfr2gpk.sh b/ush/gfs_bfr2gpk.sh index 5971817f004..c11ec62735f 100755 --- a/ush/gfs_bfr2gpk.sh +++ b/ush/gfs_bfr2gpk.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#! /usr/bin/env bash + ######################################################################### # # # Script: gfs_bfr2gpk # @@ -9,7 +10,7 @@ # Log: # # K. Brill/HPC 04/12/05 # ######################################################################### -set -x +source "$HOMEgfs/ush/preamble.sh" # Set GEMPAK paths. diff --git a/ush/gfs_bufr.sh b/ush/gfs_bufr.sh index 5788bbcc436..07bebd5ac0a 100755 --- a/ush/gfs_bufr.sh +++ b/ush/gfs_bufr.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + # # UTILITY SCRIPT NAME : gfsbufr.sh # AUTHOR : Hua-Lu Pan @@ -16,10 +17,9 @@ # 2018-05-22 Guang Ping Lou: Making it work for both GFS and FV3GFS # 2018-05-30 Guang Ping Lou: Make sure all files are available. # 2019-10-10 Guang Ping Lou: Read in NetCDF files -echo "History: February 2003 - First implementation of this utility script" +# echo "History: February 2003 - First implementation of this utility script" # - -set -ax +source "$HOMEgfs/ush/preamble.sh" if test "$F00FLAG" = "YES" then @@ -112,4 +112,6 @@ ln -sf ${STNLIST:-$PARMbufrsnd/bufr_stalist.meteo.gfs} fort.8 ln -sf $PARMbufrsnd/bufr_ij13km.txt fort.7 ${APRUN_POSTSND} $EXECbufrsnd/gfs_bufr < gfsparm > out_gfs_bufr_$FEND -export err=$?;err_chk +export err=$? + +exit ${err} diff --git a/ush/gfs_bufr_netcdf.sh b/ush/gfs_bufr_netcdf.sh index 9733e02c3d7..30d7631da32 100755 --- a/ush/gfs_bufr_netcdf.sh +++ b/ush/gfs_bufr_netcdf.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + # # UTILITY SCRIPT NAME : gfsbufr.sh # AUTHOR : Hua-Lu Pan @@ -16,10 +17,9 @@ # 2018-05-22 Guang Ping Lou: Making it work for both GFS and FV3GFS # 2018-05-30 Guang Ping Lou: Make sure all files are available. # 2019-10-10 Guang Ping Lou: Read in NetCDF files -echo "History: February 2003 - First implementation of this utility script" +# echo "History: February 2003 - First implementation of this utility script" # - -set -ax +source "$HOMEgfs/ush/preamble.sh" if test "$F00FLAG" = "YES" then @@ -112,4 +112,6 @@ ln -sf ${STNLIST:-$PARMbufrsnd/bufr_stalist.meteo.gfs} fort.8 ln -sf $PARMbufrsnd/bufr_ij13km.txt fort.7 ${APRUN_POSTSND} $EXECbufrsnd/gfs_bufr < gfsparm > out_gfs_bufr_$FEND -export err=$?;err_chk +export err=$? + +exit ${err} diff --git a/ush/gfs_nceppost.sh b/ush/gfs_nceppost.sh index 6c75572d100..a8bee62d4d7 100755 --- a/ush/gfs_nceppost.sh +++ b/ush/gfs_nceppost.sh @@ -1,3 +1,4 @@ +#! /usr/bin/env bash ################################################################################ #### UNIX Script Documentation Block @@ -187,16 +188,13 @@ #### ################################################################################ # Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +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 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}} @@ -210,15 +208,15 @@ export EXECgfs=${EXECgfs:-$NWPROD/exec} export USHgfs=${USHgfs:-$NWPROD/ush} export DATA=${DATA:-$(pwd)} # Filenames. -export MP=${MP:-$([[ $LOADL_STEP_TYPE = PARALLEL ]]&&echo "p"||echo "s")} -export XC=${XC} +export MP=${MP:-$([[ ${LOADL_STEP_TYPE:-SERIAL} = PARALLEL ]]&&echo "p"||echo "s")} +export XC=${XC:-} export POSTGPEXEC=${POSTGPEXEC:-${EXECgfs}/gfs_ncep_post} export OVERPARMEXEC=${OVERPARMEXEC:-${EXECgfs}/overparm_grib} export POSTGPLIST=${POSTGPLIST:-/dev/null} -export INISCRIPT=${INISCRIPT} +export INISCRIPT=${INISCRIPT:-} export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} +export LOGSCRIPT=${LOGSCRIPT:-} +export ENDSCRIPT=${ENDSCRIPT:-} export GFSOUT=${GFSOUT:-gfsout} export CTLFILE=${CTLFILE:-$NWPROD/parm/gfs_cntrl.parm} #export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} @@ -236,15 +234,13 @@ export GENPSICHI=${GENPSICHI:-NO} export GENPSICHIEXE=${GENPSICHIEXE:-${EXECgfs}/genpsiandchi} export ens=${ens:-NO} #export D3DINP=${D3DINP:-/dev/null} -typeset -L1 l=$PGMOUT +l=$(echo $PGMOUT | xargs | cut -c1) [[ $l = '&' ]]&&a=''||a='>' export REDOUT=${REDOUT:-'1>'$a} -typeset -L1 l=$PGMERR +l=$(echo $PGMERR | xargs | cut -c1) [[ $l = '&' ]]&&a=''||a='>' export REDERR=${REDERR:-'2>'$a} ################################################################################ -# Preprocessing -$INISCRIPT # Chuang: Run chgres if OUTTYP=1 or 0 @@ -420,9 +416,5 @@ fi # Postprocessing cd $pwd [[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err diff --git a/ush/gfs_sndp.sh b/ush/gfs_sndp.sh index 53bc6fd9d67..a0616e27b4a 100755 --- a/ush/gfs_sndp.sh +++ b/ush/gfs_sndp.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + ################################################################ # Script Name: gfs_sndp.sh # Script Description: Format GFS BUFR sounding files for AWIPS @@ -6,7 +7,7 @@ # 1) 2004-09-10 Steve Gilbert First Implementation ################################################################ -set -x +source "$HOMEgfs/ush/preamble.sh" # Create "collectives" consisting of groupings of the soundings # into files designated by geographical region. Each input @@ -16,7 +17,6 @@ export m=$1 mkdir $DATA/$m cd $DATA/$m cp $FIXbufrsnd/gfs_collective${m}.list $DATA/$m/. -set +x CCCC=KWBC file_list=gfs_collective${m}.list @@ -60,7 +60,6 @@ EOF rm $DATA/${m}/bufrout done -set -x # if test $SENDCOM = 'NO' if test $SENDCOM = 'YES' then @@ -71,8 +70,3 @@ set -x cp $DATA/${m}/gfs_collective$m.fil ${COMOUT}/bufr.${cycle}/. fi -## let "m=m+1" - -## done - -#exit diff --git a/ush/gfs_transfer.sh b/ush/gfs_transfer.sh index f8b00ea6230..9d23ec849ae 100755 --- a/ush/gfs_transfer.sh +++ b/ush/gfs_transfer.sh @@ -1,21 +1,22 @@ -#!/bin/ksh +#! /usr/bin/env bash ##################################################################### -echo "-----------------------------------------------------" -echo " Script: gfs_transfer.sh" -echo " " -echo " Purpose - Copy GFS Posts to /nwges and /com" -echo " Alert posted files to DBNet" -echo " " -echo " History - " -echo " Cooke - 04/21/05 - Inital version, based off of" -echo " global_transfer.sh" -echo " Meng - 01/04/18 - Remove writing data file to /nwges." -echo " Meng - 09/14/20 - Update model output format to netcdf for GFS V16" -echo "-----------------------------------------------------" +# echo "-----------------------------------------------------" +# echo " Script: gfs_transfer.sh" +# echo " " +# echo " Purpose - Copy GFS Posts to /nwges and /com" +# echo " Alert posted files to DBNet" +# echo " " +# echo " History - " +# echo " Cooke - 04/21/05 - Inital version, based off of" +# echo " global_transfer.sh" +# echo " Meng - 01/04/18 - Remove writing data file to /nwges." +# echo " Meng - 09/14/20 - Update model output format to netcdf for GFS V16" +# echo "-----------------------------------------------------" ##################################################################### -set -xa - + +source "$HOMEgfs/ush/preamble.sh" + # export CNVGRIB=/nwprod/util/exec/cnvgrib # export GRB2INDX=/nwprod/util/exec/grb2index # export WGRIB2=/nwprod/util/exec/wgrib2 diff --git a/ush/gfs_truncate_enkf.sh b/ush/gfs_truncate_enkf.sh index 8d9e2b959c5..c7bdfad0c46 100755 --- a/ush/gfs_truncate_enkf.sh +++ b/ush/gfs_truncate_enkf.sh @@ -1,6 +1,6 @@ -#!/bin/ksh +#! /usr/bin/env bash -set -x +source "$HOMEgfs/ush/preamble.sh" member=$1 export SIGINP=$2 @@ -45,12 +45,11 @@ export APRUNC=${APRUNC:-""} export VERBOSE=YES echo "execute $CHGRESSH for $member" -eval "$CHGRESSH" +$CHGRESSH rc=$? export ERR=$rc export err=$ERR -echo EXITING $0 with return code $err exit $err diff --git a/ush/global_extrkr.sh b/ush/global_extrkr.sh index 67624a9898e..ad0b249b28a 100755 --- a/ush/global_extrkr.sh +++ b/ush/global_extrkr.sh @@ -1,54 +1,51 @@ -#!/bin/ksh +#! /usr/bin/env bash -#module load ics -export PS4='+t+$SECONDS extrkr.sh:$LINENO -- ' +source "$HOMEgfs/ush/preamble.sh" userid=$LOGNAME -set +x ############################################################################## -cat< $(date)" -set -x +${TRACE_ON:-set -x} set +x echo " " echo "TIMING: Before call to gettrk at $(date)" echo " " -set -x +${TRACE_ON:-set -x} ##/usrx/local/bin/getrusage -a /hwrf/save/Qingfu.Liu/trak/para/exec/gettrk <${namelist} @@ -1462,11 +1456,11 @@ set +x echo " " echo "TIMING: After call to gettrk at $(date)" echo " " -set -x +${TRACE_ON:-set -x} set +x echo "+++ TIMING: AFTER gettrk ---> $(date)" -set -x +${TRACE_ON:-set -x} #--------------------------------------------------------------# # Send a message to the jlogfile for each storm that used @@ -1496,7 +1490,7 @@ echo " -----------------------------------------------" echo " NOW COPYING OUTPUT TRACK FILES TO COM " echo " -----------------------------------------------" echo " " -set -x +${TRACE_ON:-set -x} if [[ ! -e "$track_file_path" ]] ; then $postmsg "$jlogfile" "WARNING: tracker output file does not exist. This is probably an error. File: $track_file_path" @@ -1665,12 +1659,12 @@ if [ ${gettrk_rcc} -eq 0 ]; then echo " " echo "+++ Adding records to TPC ATCFUNIX directory: /tpcprd/atcf_unix/${at}${NO}${syyyy}" echo " " - set -x + ${TRACE_ON:-set -x} else set +x echo " " echo "There is no TPC ATCFUNIX directory for: /tpcprd/atcf_unix/${at}${NO}${syyyy}" - set -x + ${TRACE_ON:-set -x} fi done fi @@ -1697,7 +1691,7 @@ else echo "!!! model= ${atcfout}, forecast initial time = ${PDY}${CYL}" echo "!!! Exiting...." echo " " - set -x + ${TRACE_ON:-set -x} err_exit " FAILED ${jobid} - ERROR RUNNING GETTRK IN TRACKER SCRIPT- ABNORMAL EXIT" fi diff --git a/ush/global_nceppost.sh b/ush/global_nceppost.sh index cbc9ba6cccb..45aebe8e4f0 100755 --- a/ush/global_nceppost.sh +++ b/ush/global_nceppost.sh @@ -1,3 +1,4 @@ +#! /usr/bin/env bash ################################################################################ #### UNIX Script Documentation Block @@ -183,11 +184,8 @@ #### ################################################################################ # Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi +source "$HOMEgfs/ush/preamble.sh" + # Command line arguments. export SIGINP=${1:-${SIGINP}} export FLXINP=${2:-${FLXINP}} @@ -233,15 +231,13 @@ export GENPSICHI=${GENPSICHI:-NO} export GENPSICHIEXE=${GENPSICHIEXE:-${EXECglobal}/genpsiandchi} export ens=${ens:-NO} #export D3DINP=${D3DINP:-/dev/null} -typeset -L1 l=$PGMOUT +l=$(echo $PGMOUT | xargs | cut -c1) [[ $l = '&' ]]&&a=''||a='>' export REDOUT=${REDOUT:-'1>'$a} -typeset -L1 l=$PGMERR +l=$(echo $PGMERR | xargs | cut -c1) [[ $l = '&' ]]&&a=''||a='>' export REDERR=${REDERR:-'2>'$a} ################################################################################ -# Preprocessing -$INISCRIPT # Chuang: Run chgres if OUTTYP=1 or 0 @@ -484,9 +480,5 @@ fi # Postprocessing cd $pwd [[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with return code $err >&2 -fi + exit $err diff --git a/ush/global_savefits.sh b/ush/global_savefits.sh index 9efbf778af9..f26132dd8a6 100755 --- a/ush/global_savefits.sh +++ b/ush/global_savefits.sh @@ -1,9 +1,10 @@ -#!/bin/ksh -set -xeua +#! /usr/bin/env bash ######################################################## # save fit and horiz files for all analysis cycles ######################################################## +source "$HOMEgfs/ush/preamble.sh" + export FIT_DIR=${FIT_DIR:-$COMOUT/fits} export HORZ_DIR=${HORZ_DIR:-$COMOUT/horiz} export fh1=06 diff --git a/ush/hpssarch_gen.sh b/ush/hpssarch_gen.sh index ab90f3351a9..9785de98acf 100755 --- a/ush/hpssarch_gen.sh +++ b/ush/hpssarch_gen.sh @@ -1,11 +1,10 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash ################################################### # Fanglin Yang, 20180318 # --create bunches of files to be archived to HPSS ################################################### - +source "$HOMEgfs/ush/preamble.sh" type=${1:-gfs} ##gfs, gdas, enkfgdas or enkfggfs diff --git a/ush/inter_flux.sh b/ush/inter_flux.sh index 98a9248cafa..6b3d4340697 100755 --- a/ush/inter_flux.sh +++ b/ush/inter_flux.sh @@ -1,5 +1,6 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" "$FH" #----------------------------------------------------------------------- #-Wen Meng, 03/2019: First version. @@ -7,9 +8,6 @@ set -x # into lat-lon grids. #----------------------------------------------------------------------- - -echo "!!!!!CREATING $RUN FLUX PRODUCTS FOR FH = $FH !!!!!!" - export CNVGRIB=${CNVGRIB:-${NWPROD:-/nwprod}/util/exec/cnvgrib21} export COPYGB2=${COPYGB2:-${NWPROD:-/nwprod}/util/exec/copygb2} export WGRIB2=${WGRIB2:-${NWPROD:-/nwprod}/util/exec/wgrib2} @@ -62,8 +60,6 @@ fi cp fluxfile_${fhr3}_1p00 $COMOUT/${PREFIX}flux.1p00.f${fhr3} #--------------------------------------------------------------- -echo "!!!!!CREATION OF SELECT $RUN FLUX PRODUCTS COMPLETED FOR FHR = $FH !!!!!" -#--------------------------------------------------------------- exit 0 diff --git a/ush/link_crtm_fix.sh b/ush/link_crtm_fix.sh index 3307b5f6dd6..0d4d8dc55b0 100755 --- a/ush/link_crtm_fix.sh +++ b/ush/link_crtm_fix.sh @@ -1,4 +1,6 @@ -#! /bin/sh +#! /usr/bin/env bash + +source "$HOMEgfs/ush/preamble.sh" # Get CRTM fix directory from (in this order): # 1. First argument to script, or diff --git a/ush/load_fv3gfs_modules.sh b/ush/load_fv3gfs_modules.sh index e78ec23bf67..3979d9184d2 100755 --- a/ush/load_fv3gfs_modules.sh +++ b/ush/load_fv3gfs_modules.sh @@ -1,11 +1,14 @@ -#!/bin/sh +#! /usr/bin/env bash ############################################################### +if [[ "${DEBUG_WORKFLOW:-NO}" == "NO" ]]; then + echo "Loading modules quietly..." + set +x +fi + # Setup runtime environment by loading modules ulimit_s=$( ulimit -S -s ) -set +x - # Find module command and purge: source "$HOMEgfs/modulefiles/module-setup.sh.inc" @@ -31,8 +34,8 @@ else echo WARNING: UNKNOWN PLATFORM fi -set -x - # Restore stack soft limit: ulimit -S -s "$ulimit_s" unset ulimit_s + +${TRACE_ON:-set -x} diff --git a/ush/mod_icec.sh b/ush/mod_icec.sh index bb8c22182f3..f62131846e3 100755 --- a/ush/mod_icec.sh +++ b/ush/mod_icec.sh @@ -1,13 +1,15 @@ -#!/bin/sh -set -x +#! /usr/bin/env bash + #This script is used for modifing icee via land-sea mask #Wen Meng 11/2019: First Version +source "$HOMEgfs/ush/preamble.sh" + f=$1 export WGRIB2=${WGRIB2:-${NWPROD:-/nwprod}/util/exec/wgrib2} -$WGRIB2 $optncpu $f \ +$WGRIB2 ${optncpu:-} $f \ -if 'LAND' -rpn 'sto_1' -fi \ -if 'ICEC' -rpn 'rcl_1:0:==:*' -fi \ -set_grib_type same \ @@ -17,7 +19,3 @@ export err=$?; err_chk mv $f.new $f exit 0 - -#-if 'ICEC' -rpn 'rcl_1:-1:*:1:+:*' -fi \ - - diff --git a/ush/nems_configure.sh b/ush/nems_configure.sh index 990272a41fe..04fea90f354 100755 --- a/ush/nems_configure.sh +++ b/ush/nems_configure.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#! /usr/bin/env bash ##### ## This script writes nems.configure file diff --git a/ush/parsing_model_configure_DATM.sh b/ush/parsing_model_configure_DATM.sh index a2e7c8c9185..ecd3fa6dd6a 100755 --- a/ush/parsing_model_configure_DATM.sh +++ b/ush/parsing_model_configure_DATM.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /usr/bin/env bash ##### ## "parsing_model_configure_DATM.sh" diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index 4c35179e905..4574b6e3528 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /usr/bin/env bash ##### ## "parsing_model_configure_FV3.sh" diff --git a/ush/parsing_namelists_CICE.sh b/ush/parsing_namelists_CICE.sh index 0c7dbd0d430..f7e00fd0700 100755 --- a/ush/parsing_namelists_CICE.sh +++ b/ush/parsing_namelists_CICE.sh @@ -1,3 +1,5 @@ +#! /usr/bin/env bash + # parsing namelist of CICE CICE_namelists(){ diff --git a/ush/parsing_namelists_FV3.sh b/ush/parsing_namelists_FV3.sh index 63e46dc20ab..41fdb04f1bc 100755 --- a/ush/parsing_namelists_FV3.sh +++ b/ush/parsing_namelists_FV3.sh @@ -1,4 +1,5 @@ -#! /bin/sh +#! /usr/bin/env bash + ##### ## "parsing_namelist_FV3.sh" ## This script writes namelist for FV3 model @@ -34,7 +35,7 @@ EOF cat $DIAG_TABLE >> diag_table fi -if [ ! -z "${AERO_DIAG_TABLE}" ]; then +if [ ! -z "${AERO_DIAG_TABLE:-}" ]; then cat ${AERO_DIAG_TABLE} >> diag_table fi @@ -44,7 +45,7 @@ cat $DIAG_TABLE_APPEND >> diag_table $NCP $DATA_TABLE data_table # build field_table -if [ ! -z "${AERO_FIELD_TABLE}" ]; then +if [ ! -z "${AERO_FIELD_TABLE:-}" ]; then nrec=$( cat ${FIELD_TABLE} | wc -l ) prec=${nrec} if (( dnats > 0 )); then @@ -69,20 +70,20 @@ cat > input.nml < input.nml < input.nml < input.nml <> input.nml <> input.nml <> input.nml <> input.nml << EOF - $nam_stochy_nml + ${nam_stochy_nml:-} / EOF @@ -635,13 +636,13 @@ EOF ISEED_LNDP = ${ISEED_LNDP:-$ISEED} lndp_var_list = ${lndp_var_list} lndp_prt_list = ${lndp_prt_list} - $nam_sfcperts_nml + ${nam_sfcperts_nml:-} / EOF else cat >> input.nml << EOF &nam_sfcperts - $nam_sfcperts_nml + ${nam_sfcperts_nml:-} / EOF fi diff --git a/ush/parsing_namelists_MOM6.sh b/ush/parsing_namelists_MOM6.sh index 617c7744832..49d6ea5ff58 100755 --- a/ush/parsing_namelists_MOM6.sh +++ b/ush/parsing_namelists_MOM6.sh @@ -1,3 +1,4 @@ +#! /usr/bin/env bash MOM6_namelists(){ diff --git a/ush/parsing_namelists_WW3.sh b/ush/parsing_namelists_WW3.sh index 06d22814bb0..209fe9d11ae 100755 --- a/ush/parsing_namelists_WW3.sh +++ b/ush/parsing_namelists_WW3.sh @@ -1,3 +1,4 @@ +#! /usr/bin/env bash WW3_namelists(){ @@ -69,7 +70,7 @@ WW3_namelists(){ echo " starting time : $time_beg" echo " ending time : $time_end" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} @@ -107,7 +108,7 @@ WW3_namelists(){ then set +x echo " buoy.loc copied ($PARMwave/wave_${NET}.buoys)." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} else echo " FATAL ERROR : buoy.loc ($PARMwave/wave_${NET}.buoys) NOT FOUND" exit 12 diff --git a/ush/preamble.sh b/ush/preamble.sh new file mode 100644 index 00000000000..bfa326f1030 --- /dev/null +++ b/ush/preamble.sh @@ -0,0 +1,86 @@ +#! /usr/bin/env bash + +####### +# Preamble script to be SOURCED at the beginning of every script. Sets +# useful PS4 and optionally turns on set -x and set -eu. Also sets up +# crude script timing and provides a postamble that runs on exit. +# +# Syntax: +# preamble.sh [id] +# +# Aruguments: +# id: Optional identifier string. Use when running the same script +# multiple times in the same job (e.g. MPMD) +# +# Input environment variables: +# TRACE (YES/NO): Whether to echo every command (set -x) [default: "YES"] +# STRICT (YES/NO): Whether to exit immediately on error or undefined variable +# (set -eu) [default: "YES"] +# +####### +set +x +if [[ -v '1' ]]; then + id="(${1})" +else + id="" +fi + +# Record the start time so we can calculate the elapsed time later +start_time=$(date +%s) + +# Get the base name of the calling script +_calling_script=$(basename ${BASH_SOURCE[1]}) + +# Announce the script has begun +echo "Begin ${_calling_script} at $(date -u)" + +# Stage our variables +export STRICT=${STRICT:-"YES"} +export TRACE=${TRACE:-"YES"} +export ERR_EXIT_ON="" +export TRACE_ON="" + +if [[ $STRICT == "YES" ]]; then + # Exit on error and undefined variable + export ERR_EXIT_ON="set -eu" +fi +if [[ $TRACE == "YES" ]]; then + export TRACE_ON="set -x" + # Print the script name and line number of each command as it is executed + export PS4='+ $(basename $BASH_SOURCE)[$LINENO]'"$id: " +fi + +postamble() { + # + # Commands to execute when a script ends. + # + # Syntax: + # postamble script start_time rc + # + # Arguments: + # script: name of the script ending + # start_time: start time of script (in seconds) + # rc: the exit code of the script + # + + set +x + script=${1} + start_time=${2} + rc=${3} + + # Calculate the elapsed time + end_time=$(date +%s) + elapsed_sec=$((end_time - start_time)) + elapsed=$(date -d@${elapsed_sec} -u +%H:%M:%S) + + # Announce the script has ended, then pass the error code up + echo "End ${script} at $(date -u) with error code ${rc:-0} (time elapsed: ${elapsed})" + exit ${rc} +} + +# Place the postamble in a trap so it is always called no matter how the script exits +trap "postamble ${_calling_script} ${start_time} \$?" EXIT + +# Turn on our settings +$ERR_EXIT_ON +$TRACE_ON diff --git a/ush/scale_dec.sh b/ush/scale_dec.sh index 8fba2f703b6..59e2bab14eb 100755 --- a/ush/scale_dec.sh +++ b/ush/scale_dec.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + # # This script uses WGRIB2 to change binary scale factor # and Decimal scale factor in GRIB2 file @@ -7,7 +8,8 @@ # D = decimal scaling or the text 'same' with no quotes # B = binary scaling or the text 'same' with no quotes # -set -x + +source "$HOMEgfs/ush/preamble.sh" f=$1 @@ -22,4 +24,5 @@ $WGRIB2 $f -not_if ':(TMP|PWAT|WEASD):' -grib $f.new \ -set_scaling 0 0 -grib_out $f.new export err=$?; err_chk mv $f.new $f + exit 0 diff --git a/ush/syndat_getjtbul.sh b/ush/syndat_getjtbul.sh index dc3c0f6482b..89196d05966 100755 --- a/ush/syndat_getjtbul.sh +++ b/ush/syndat_getjtbul.sh @@ -1,3 +1,4 @@ +#! /usr/bin/env bash # Script to recover JTWC Bulletins from Tank # $TANK_TROPCY/$ymddir/wtxtbul/tropcyc @@ -25,8 +26,7 @@ # jlogfile - path to job log file (skipped over by this script if not # passed in) - -set -xua +source "$HOMEgfs/ush/preamble.sh" EXECSYND=${EXECSYND:-${HOMESYND}/exec} @@ -39,7 +39,7 @@ positional parameter 1" echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout set +u [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" @@ -94,7 +94,7 @@ echo " pdym1 is $pdym1" echo echo " ymddir is $ymddir" echo -set -x +${TRACE_ON:-set -x} find=$ymd" "$hour echo "looking for string $find in $jtwcdir/tropcyc" >> $pgmout @@ -159,7 +159,7 @@ set +x echo echo 'The foreground exit status for SYNDAT_GETJTBUL is ' $errget echo -set -x +${TRACE_ON:-set -x} if [ "$errget" -gt '0' ];then if [ "$errget" -eq '1' ];then msg="No JTWC bulletins in $jtwcdir/tropcyc, no JTWC tcvitals \ @@ -182,7 +182,7 @@ RETURN CODE $errget" echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout set +u [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" @@ -194,7 +194,7 @@ rec. passed to qctropcy" echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout set +u [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" @@ -206,7 +206,7 @@ echo "----------------------------------------------------------" echo "*********** COMPLETED PROGRAM syndat_getjtbul **********" echo "----------------------------------------------------------" echo -set -x +${TRACE_ON:-set -x} if [ "$errget" -eq '0' ];then echo "Completed JTWC tcvitals records are:" >> $pgmout diff --git a/ush/syndat_qctropcy.sh b/ush/syndat_qctropcy.sh index 1f1f64b5480..571a7543b53 100755 --- a/ush/syndat_qctropcy.sh +++ b/ush/syndat_qctropcy.sh @@ -1,5 +1,4 @@ - -set +x +#! /usr/bin/env bash # SCRIPT NAME : syndat_qctropcy.sh # AUTHOR : Steven Lord/Hua-Lu pan/Dennis Keyser/Diane Stokes @@ -12,19 +11,19 @@ set +x # prediction centers by the executable syndat_qctropcy # # -echo "History: JUN 1997 - First implementation of this utility script" -echo " JUL 1997 - Added tcvitals made manually by SDM; Added " -echo " jtwc/fnoc tcvitals " -echo " MAR 2000 Converted to IBM-SP " -echo " MAR 2013 Converted to WCOSS " -echo " Added option files_override which can set " -echo " namelist var used for logical variable " -echo " FILES in syndat_qctropcy to control final " -echo " copying of records and file manipulation. " -echo " (typically F for testing, otherwise not set)" -echo " Added dateck fallback if archive file misg." -echo " OCT 2013 Remove defaults for parm, exec, fix and ush " -echo " directories. These must now be passed in. " +# echo "History: JUN 1997 - First implementation of this utility script" +# echo " JUL 1997 - Added tcvitals made manually by SDM; Added " +# echo " jtwc/fnoc tcvitals " +# echo " MAR 2000 Converted to IBM-SP " +# echo " MAR 2013 Converted to WCOSS " +# echo " Added option files_override which can set " +# echo " namelist var used for logical variable " +# echo " FILES in syndat_qctropcy to control final " +# echo " copying of records and file manipulation. " +# echo " (typically F for testing, otherwise not set)" +# echo " Added dateck fallback if archive file misg." +# echo " OCT 2013 Remove defaults for parm, exec, fix and ush " +# echo " directories. These must now be passed in. " # # # Positional parameters passed in: @@ -72,7 +71,7 @@ echo " directories. These must now be passed in. " # (Default: not set) # TIMEIT - optional time and resource reporting (Default: not set) -set -xua +source "$HOMEgfs/ush/preamble.sh" ARCHSYND=${ARCHSYND:-$COMROOTp3/gfs/prod/syndat} HOMENHCp1=${HOMENHCp1:-/gpfs/?p1/nhc/save/guidance/storm-data/ncep} @@ -96,11 +95,8 @@ set +x echo echo $msg echo -set -x +${TRACE_ON:-set -x} echo $msg >> $pgmout -set +u -[ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" -set -u if [ "$#" -ne '1' ]; then msg="**NON-FATAL ERROR PROGRAM SYNDAT_QCTROPCY run date not in \ @@ -109,21 +105,15 @@ positional parameter 1" echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u msg="**NO TROPICAL CYCLONE tcvitals processed --> non-fatal" set +x echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u # Copy null files into "${COMSP}syndata.tcvitals.$tmmark" and # "${COMSP}jtwc-fnoc.tcvitals.$tmmark" so later ftp attempts will find and @@ -147,7 +137,7 @@ set +x echo echo "Run date is $CDATE10" echo -set -x +${TRACE_ON:-set -x} year=$(echo $CDATE10 | cut -c1-4) @@ -169,11 +159,8 @@ if [ $dateck_size -lt 10 ]; then echo 1900010100 > dateck set +x echo -e "\n${msg}\n" - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u fi @@ -201,11 +188,8 @@ if [ -n "$files_override" ]; then # for testing, typically want FILES=F fi set +x echo -e "\n${msg}\n" - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u fi echo " &INPUT RUNID = '${net}_${tmmark}_${cyc}', FILES = $files " > vitchk.inp @@ -289,28 +273,22 @@ set +x echo echo "The foreground exit status for SYNDAT_QCTROPCY is " $errqct echo -set -x +${TRACE_ON:-set -x} if [ "$errqct" -gt '0' ];then msg="**NON-FATAL ERROR PROGRAM SYNDAT_QCTROPCY RETURN CODE $errqct" set +x echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u msg="**NO TROPICAL CYCLONE tcvitals processed --> non-fatal" set +x echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u # In the event of a ERROR in PROGRAM SYNDAT_QCTROPCY, copy null files into # "${COMSP}syndata.tcvitals.$tmmark" and "${COMSP}jtwc-fnoc.tcvitals.$tmmark" @@ -333,19 +311,7 @@ echo "----------------------------------------------------------" echo "********** COMPLETED PROGRAM syndat_qctropcy **********" echo "----------------------------------------------------------" echo -set -x - -if [ -s current ]; then - msg="program SYNDAT_QCTROPCY completed normally - tcvitals records \ -processed" -else -msg="no records available for program SYNDAT_QCTROPCY - null tcvitals file \ -produced" -fi -set +u -[ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" -set -u - +${TRACE_ON:-set -x} if [ "$copy_back" = 'YES' ]; then cat lthistry>>$ARCHSYND/syndat_lthistry.$year @@ -390,11 +356,8 @@ $HOMENHC/tcvitals successfully updated by syndat_qctropcy" echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u fi else @@ -405,11 +368,8 @@ not changed by syndat_qctropcy" echo echo $msg echo - set -x + ${TRACE_ON:-set -x} echo $msg >> $pgmout - set +u - [ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" - set -u fi @@ -428,16 +388,4 @@ fi # Write JTWC/FNOC Tcvitals to /com path since not saved anywhere else [ $SENDCOM = YES ] && cp fnoc ${COMSP}jtwc-fnoc.tcvitals.$tmmark -msg="TROPICAL CYCLONE TCVITALS QC PROCESSING HAS COMPLETED FOR $CDATE10" -set +x -echo -echo $msg -echo -set -x -echo $msg >> $pgmout -echo " " >> $pgmout -set +u -[ -n "$jlogfile" ] && postmsg "$jlogfile" "$msg" -set -u - exit diff --git a/ush/trim_rh.sh b/ush/trim_rh.sh index 9140e97124d..2de2e17c7bb 100755 --- a/ush/trim_rh.sh +++ b/ush/trim_rh.sh @@ -1,14 +1,15 @@ -#!/bin/ksh -set -x +#! /usr/bin/env bash #This is scripts is used to trim RH vaule larger than 100. # Wen Meng 12/2017: First Version +source "$HOMEgfs/ush/preamble.sh" + f=$1 export WGRIB2=${WGRIB2:-${NWPROD:-/nwprod}/util/exec/wgrib2} -$WGRIB2 $optncpu $f -not_if ':RH:' -grib $f.new \ +$WGRIB2 ${optncpu:-} $f -not_if ':RH:' -grib $f.new \ -if ':RH:' -rpn "10:*:0.5:+:floor:1000:min:10:/" -set_grib_type same \ -set_scaling -1 0 -grib_out $f.new export err=$?; err_chk diff --git a/ush/tropcy_relocate.sh b/ush/tropcy_relocate.sh index 44205b18466..e3a82efaf7c 100755 --- a/ush/tropcy_relocate.sh +++ b/ush/tropcy_relocate.sh @@ -1,4 +1,5 @@ -#!/bin/ksh +#! /usr/bin/env bash + #### UNIX Script Documentation Block # # Script name: tropcy_relocate.sh @@ -210,7 +211,7 @@ # #### -set -aux +source "$HOMEgfs/ush/preamble.sh" MACHINE=${MACHINE:-$(hostname -s | cut -c 1-3)} @@ -255,7 +256,7 @@ then echo "problem with obtaining date record;" echo "ABNORMAL EXIT!!!!!!!!!!!" echo - set -x + ${TRACE_ON:-set -x} if [ -s $DATA/err_exit ]; then $DATA/err_exit else @@ -273,7 +274,7 @@ set +x echo echo "CENTER DATE/TIME FOR RELOCATION PROCESSING IS $CDATE10" echo -set -x +${TRACE_ON:-set -x} #---------------------------------------------------------------------------- @@ -343,7 +344,7 @@ if [ $modhr -ne 0 ]; then not a multiple of 3-hrs;" echo "ABNORMAL EXIT!!!!!!!!!!!" echo - set -x + ${TRACE_ON:-set -x} if [ -s $DATA/err_exit ]; then $DATA/err_exit else @@ -366,14 +367,14 @@ echo " Get TCVITALS file valid for -$fhr hrs relative to center" echo " relocation processing date/time" echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" echo - set -x + ${TRACE_ON:-set -x} $USHGETGES/getges.sh -e $envir_getges -n $network_getges \ -v $CDATE10 -f $fhr -t tcvges tcvitals.m${fhr} set +x echo echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" echo - set -x + ${TRACE_ON:-set -x} fi done @@ -416,7 +417,7 @@ echo " Get global sigma GUESS valid for $fhr hrs relative to center" echo " relocation processing date/time" echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" echo - set -x + ${TRACE_ON:-set -x} $USHGETGES/getges.sh -e $envir_getges -n $network_getges \ -v $CDATE10 -t $stype $sges errges=$? @@ -428,7 +429,7 @@ echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" to center relocation date/time;" echo "ABNORMAL EXIT!!!!!!!!!!!" echo - set -x + ${TRACE_ON:-set -x} if [ -s $DATA/err_exit ]; then $DATA/err_exit else @@ -460,7 +461,7 @@ to center relocation date/time;" echo echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" echo - set -x + ${TRACE_ON:-set -x} fi if [ ! -s $pges ]; then set +x @@ -470,7 +471,7 @@ echo " Get global pressure grib GUESS valid for $fhr hrs relative to center" echo " relocation processing date/time" echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" echo - set -x + ${TRACE_ON:-set -x} $USHGETGES/getges.sh -e $envir_getges -n $network_getges \ -v $CDATE10 -t $ptype $pges errges=$? @@ -482,7 +483,7 @@ echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" relative to center relocation date/time;" echo "ABNORMAL EXIT!!!!!!!!!!!" echo - set -x + ${TRACE_ON:-set -x} if [ -s $DATA/err_exit ]; then $DATA/err_exit else @@ -495,7 +496,7 @@ relative to center relocation date/time;" echo echo "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" echo - set -x + ${TRACE_ON:-set -x} fi done @@ -567,7 +568,7 @@ else echo "$USHRELO/tropcy_relocate_extrkr.sh failed" echo "ABNORMAL EXIT!!!!!!!!!!!" echo - set -x + ${TRACE_ON:-set -x} if [ -s $DATA/err_exit ]; then $DATA/err_exit "Script $USHRELO/tropcy_relocate_extrkr.sh failed" else @@ -650,7 +651,7 @@ else # check for success # ----------------- - echo; set -x + echo; ${TRACE_ON:-set -x} if [ "$errSTATUS" -gt '0' ]; then if [ -s $DATA/err_exit ]; then $DATA/err_exit "Script RELOCATE_GES failed" @@ -737,5 +738,6 @@ $CDATE10" fi + exit 0 diff --git a/ush/tropcy_relocate_extrkr.sh b/ush/tropcy_relocate_extrkr.sh index a245dca98e2..79295cead0a 100755 --- a/ush/tropcy_relocate_extrkr.sh +++ b/ush/tropcy_relocate_extrkr.sh @@ -1,8 +1,9 @@ -#!/bin/ksh +#! /usr/bin/env bash + # This script is executed by the script tropcy_relocate.sh # -------------------------------------------------------- -set -aeux +source "$HOMEgfs/ush/preamble.sh" export machine=${machine:-ZEUS} export machine=$(echo $machine|tr '[a-z]' '[A-Z]') @@ -238,7 +239,7 @@ cmodel=$(echo ${cmodel} | tr "[A-Z]" "[a-z]") case ${cmodel} in - gdas) set +x; echo " "; echo " ++ operational GDAS chosen"; set -x; + gdas) set +x; echo " "; echo " ++ operational GDAS chosen"; ${TRACE_ON:-set -x}; fcstlen=9 ; fcsthrs="" for fhr in $( seq 0 $BKGFREQ 9); do @@ -271,48 +272,48 @@ case ${cmodel} in # jpdtn=0 for deterministic data. g2_jpdtn=0 model=8;; - gfs) set +x; echo " "; echo " ++ operational GFS chosen"; set -x; + gfs) set +x; echo " "; echo " ++ operational GFS chosen"; ${TRACE_ON:-set -x}; fcsthrsgfs=' 00 06 12 18 24 30 36 42 48 54 60 66 72 78'; gfsdir=$COMIN; gfsgfile=gfs.t${dishh}z.pgrbf; model=1;; - mrf) set +x; echo " "; echo " ++ operational MRF chosen"; set -x; + mrf) set +x; echo " "; echo " ++ operational MRF chosen"; ${TRACE_ON:-set -x}; fcsthrsmrf=' 00 12 24 36 48 60 72'; mrfdir=$COMIN; mrfgfile=drfmr.t${dishh}z.pgrbf; model=2;; - ukmet) set +x; echo " "; echo " ++ operational UKMET chosen"; set -x; + ukmet) set +x; echo " "; echo " ++ operational UKMET chosen"; ${TRACE_ON:-set -x}; fcsthrsukmet=' 00 12 24 36 48 60 72'; ukmetdir=$COMIN; ukmetgfile=ukmet.t${dishh}z.ukmet; model=3;; - ecmwf) set +x; echo " "; echo " ++ operational ECMWF chosen"; set -x; + ecmwf) set +x; echo " "; echo " ++ operational ECMWF chosen"; ${TRACE_ON:-set -x}; fcsthrsecmwf=' 00 24 48 72'; ecmwfdir=$COMIN; ecmwfgfile=ecmgrb25.t12z; model=4;; - ngm) set +x; echo " "; echo " ++ operational NGM chosen"; set -x; + ngm) set +x; echo " "; echo " ++ operational NGM chosen"; ${TRACE_ON:-set -x}; fcsthrsngm=' 00 06 12 18 24 30 36 42 48'; ngmdir=$COMIN; ngmgfile=ngm.t${dishh}z.pgrb.f; model=5;; - nam) set +x; echo " "; echo " ++ operational Early NAM chosen"; set -x; + nam) set +x; echo " "; echo " ++ operational Early NAM chosen"; ${TRACE_ON:-set -x}; fcsthrsnam=' 00 06 12 18 24 30 36 42 48'; namdir=$COMIN; namgfile=nam.t${dishh}z.awip32; model=6;; - ngps) set +x; echo " "; echo " ++ operational NAVGEM chosen"; set -x; + ngps) set +x; echo " "; echo " ++ operational NAVGEM chosen"; ${TRACE_ON:-set -x}; fcsthrsngps=' 00 12 24 36 48 60 72'; #ngpsdir=/com/hourly/prod/hourly.${CENT}${symd}; ngpsdir=$OMIN; ngpsgfile=fnoc.t${dishh}z; model=7;; other) set +x; echo " "; echo " Model selected by user is ${cmodel}, which is a "; - echo "user-defined model, NOT operational...."; echo " "; set -x; + echo "user-defined model, NOT operational...."; echo " "; ${TRACE_ON:-set -x}; model=9;; *) set +x; echo " "; echo " !!! Model selected is not recognized."; echo " Model= ---> ${cmodel} <--- ..... Please submit the script again...."; - echo " "; set -x; exit 8;; + echo " "; ${TRACE_ON:-set -x}; exit 8;; esac @@ -376,7 +377,7 @@ if [ ${cmodel} = 'other' ]; then echo " replace the forecast hour characters 00 with XX. Please check the" echo " name in the kickoff script and qsub it again. Exiting....." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -399,7 +400,7 @@ if [ ${cmodel} = 'other' ]; then echo " " echo " !!! Exiting loop, only processing 14 forecast files ...." echo " " - set -x + ${TRACE_ON:-set -x} break fi @@ -414,7 +415,7 @@ if [ ${cmodel} = 'other' ]; then echo " " echo " +++ Found file ${fnamebeg}${fhour}${fnameend}" echo " " - set -x + ${TRACE_ON:-set -x} let fhrct=fhrct+1 else fflag='n' @@ -434,7 +435,7 @@ if [ ${cmodel} = 'other' ]; then echo " !!! Please check the directory to make sure the file" echo " !!! is there and then submit this job again." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -443,7 +444,7 @@ if [ ${cmodel} = 'other' ]; then echo " Max forecast hour is $maxhour" echo " List of forecast hours: $fcsthrsother" echo " " - set -x + ${TRACE_ON:-set -x} # -------------------------------------------------- # In order for the fortran program to know how many @@ -525,7 +526,7 @@ if [ ${numvitrecs} -eq 0 ]; then echo "!!! It could just be that there are no storms for the current" echo "!!! time. Please check the dates and submit this job again...." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -573,19 +574,17 @@ pgm=$(basename $SUPVX) if [ -s $DATA/prep_step ]; then set +e . $DATA/prep_step - set -e + ${ERR_EXIT_ON:-set -eu} else [ -f errfile ] && rm errfile export XLFUNITS=0 unset $(env | grep XLFUNIT | awk -F= '{print $1}') - set +u - if [ -z "$XLFRTEOPTS" ]; then + if [ -z "${XLFRTEOPTS:-}" ]; then export XLFRTEOPTS="unit_vars=yes" else export XLFRTEOPTS="${XLFRTEOPTS}:unit_vars=yes" fi - set -u fi @@ -614,14 +613,14 @@ set +x echo echo 'The foreground exit status for SUPVIT is ' $err echo -set -x +${TRACE_ON:-set -x} if [ $err -eq 0 ]; then set +x echo " " echo " Normal end for program supvitql (which updates TC vitals file)." echo " " - set -x + ${TRACE_ON:-set -x} else set +x echo " " @@ -631,7 +630,7 @@ else echo "!!! model= ${cmodel}, forecast initial time = ${symd}${dishh}" echo "!!! Exiting...." echo " " - set -x + ${TRACE_ON:-set -x} fi if [ -s $DATA/err_chk ]; then $DATA/err_chk @@ -661,7 +660,7 @@ if [ ${numvitrecs} -eq 0 ]; then echo "!!! File ${vdir}/vitals.upd.${cmodel}.${symd}${dishh} is empty." echo "!!! Please check the dates and submit this job again...." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -677,7 +676,7 @@ echo " Below is a list of the storms to be processed: " | tee -a storm_list echo " " | tee -a storm_list cat ${vdir}/vitals.upd.${cmodel}.${symd}${dishh} | tee -a storm_list echo " " | tee -a storm_list -set -x +${TRACE_ON:-set -x} set +u [ -n "../$pgmout" ] && cat storm_list >> ../$pgmout @@ -730,7 +729,7 @@ echo " NOW CUTTING APART INPUT GRIB FILES TO " echo " CREATE 1 BIG GRIB INPUT FILE " echo " -----------------------------------------" echo " " -set -x +${TRACE_ON:-set -x} #grid='255 0 151 71 70000 190000 128 0000 340000 1000 1000 64' #grid='255 0 360 181 90000 0000 128 -90000 -1000 1000 1000 64' @@ -757,7 +756,7 @@ if [ ${model} -eq 5 ]; then echo " !!! in the analysis data." echo " *******************************************************************" echo " " - set -x + ${TRACE_ON:-set -x} fi if [ -s ${vdir}/ngmlatlon.pgrb.${symd}${dishh} ]; then @@ -773,7 +772,7 @@ if [ ${model} -eq 5 ]; then echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " !!! NGM File missing: ${ngmdir}/${ngmgfile}${fhour}" echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - set -x + ${TRACE_ON:-set -x} continue fi if [ -s $TMPDIR/tmpixfile ]; then rm $TMPDIR/tmpixfile; fi @@ -784,7 +783,7 @@ if [ ${model} -eq 5 ]; then echo " " echo " Extracting NGM GRIB data for forecast hour = $fhour" echo " " - set -x + ${TRACE_ON:-set -x} g1=${ngmdir}/${ngmgfile}${fhour} @@ -808,7 +807,7 @@ if [ ${model} -eq 5 ]; then echo "!!! sure you've allocated enough memory for this job (error 134 using $COPYGB is " echo "!!! typically due to using more memory than you've allocated). Exiting....." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -847,7 +846,7 @@ if [ ${model} -eq 6 ]; then echo " !!! in the analysis data." echo " *******************************************************************" echo " " - set -x + ${TRACE_ON:-set -x} fi if [ -s ${vdir}/namlatlon.pgrb.${symd}${dishh} ]; then @@ -863,7 +862,7 @@ if [ ${model} -eq 6 ]; then echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " !!! Early NAM File missing: ${namdir}/${namgfile}${fhour}.tm00" echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - set -x + ${TRACE_ON:-set -x} continue fi if [ -s $TMPDIR/tmpixfile ]; then rm $TMPDIR/tmpixfile; fi @@ -874,7 +873,7 @@ if [ ${model} -eq 6 ]; then echo " " echo " Extracting Early NAM GRIB data for forecast hour = $fhour" echo " " - set -x + ${TRACE_ON:-set -x} g1=${namdir}/${namgfile}${fhour}.tm00 @@ -899,7 +898,7 @@ if [ ${model} -eq 6 ]; then echo "!!! sure you've allocated enough memory for this job (error 134 using $COPYGB is " echo "!!! typically due to using more memory than you've allocated). Exiting....." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -947,7 +946,7 @@ if [ ${model} -eq 4 ]; then echo " " echo " !!! Due to missing ECMWF file, execution is ending...." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -990,7 +989,7 @@ if [ ${model} -eq 1 ]; then echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " !!! GFS File missing: ${gfsdir}/${gfsgfile}${fhour}" echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - set -x + ${TRACE_ON:-set -x} continue fi @@ -1061,7 +1060,7 @@ if [ ${model} -eq 8 ]; then echo " !!! gdas File missing: $gfile" echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " " - set -x + ${TRACE_ON:-set -x} continue fi @@ -1110,7 +1109,7 @@ if [ ${model} -eq 8 ]; then echo " !!! gdas File missing: $gfile" echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " " - set -x + ${TRACE_ON:-set -x} continue fi @@ -1165,7 +1164,7 @@ if [ ${model} -eq 2 ]; then echo " !!! MRF File missing: ${mrfdir}/${mrfgfile}${fhour}" echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " " - set -x + ${TRACE_ON:-set -x} continue fi @@ -1220,7 +1219,7 @@ if [ ${model} -eq 3 ]; then echo " !!! UKMET File missing: ${ukmetdir}/${ukmetgfile}${fhour}" echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " " - set -x + ${TRACE_ON:-set -x} continue fi @@ -1261,7 +1260,7 @@ if [ ${model} -eq 7 ]; then echo " " echo " !!! Due to missing NAVGEM file, execution is ending...." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -1336,7 +1335,7 @@ if [ ${model} -eq 9 ]; then echo "!!! Forecast File missing: ${otherdir}/${fnamebeg}00${fnameend}" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo " " - set -x + ${TRACE_ON:-set -x} continue fi @@ -1410,7 +1409,7 @@ if [ ${model} -eq 9 ]; then echo "!!! sure you've allocated enough memory for this job (error 134 using $COPYGB is " echo "!!! typically due to using more memory than you've allocated). Exiting....." echo " " - set -x + ${TRACE_ON:-set -x} exit 8 fi @@ -1441,9 +1440,9 @@ while [ $ist -le 15 ] do if [ ${stormflag[${ist}]} -ne 1 ] then - set +x; echo "Storm number $ist NOT selected for processing"; set -x + set +x; echo "Storm number $ist NOT selected for processing"; ${TRACE_ON:-set -x} else - set +x; echo "Storm number $ist IS selected for processing...."; set -x + set +x; echo "Storm number $ist IS selected for processing...."; ${TRACE_ON:-set -x} fi let ist=ist+1 done @@ -1562,7 +1561,7 @@ set +x echo echo 'The foreground exit status for GETTRK is ' $err echo -set -x +${TRACE_ON:-set -x} if [ -s $DATA/err_chk ]; then $DATA/err_chk @@ -1581,5 +1580,6 @@ fi cp ${vdir}/trak.${cmodel}.all.${symdh} ${DATA}/model_track.all + exit 0 diff --git a/ush/wave_grib2_sbs.sh b/ush/wave_grib2_sbs.sh index 2e2584a891c..a4463156f64 100755 --- a/ush/wave_grib2_sbs.sh +++ b/ush/wave_grib2_sbs.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -24,15 +24,10 @@ ################################################################################ # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - # set execution trace prompt. ${0##*/} adds the script's basename - PS4=" \${SECONDS} ${0##*/} L\${LINENO} + " - set -x +source "$HOMEgfs/ush/preamble.sh" - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +# 0.a Basic modes of operation cd $GRIBDATA @@ -51,7 +46,7 @@ echo '*** FATAL ERROR : ERROR IN ww3_grib2 (COULD NOT CREATE TEMP DIRECTORY) *** ' echo '******************************************************************************* ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 fi @@ -86,7 +81,7 @@ echo '! Make GRIB files |' echo '+--------------------------------+' echo " Model ID : $WAV_MOD_TAG" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ -z "$CDATE" ] || [ -z "$cycle" ] || [ -z "$EXECwave" ] || \ [ -z "$COMOUT" ] || [ -z "$WAV_MOD_TAG" ] || [ -z "$SENDCOM" ] || \ @@ -99,7 +94,7 @@ echo '*** EXPORTED VARIABLES IN postprocessor NOT SET ***' echo '***************************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 fi @@ -113,7 +108,7 @@ echo " Number of times : Single SBS echo " GRIB field flags : $gribflags" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 0.e Links to working directory @@ -127,7 +122,7 @@ set +x echo " Generate input file for ww3_grib2" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} sed -e "s/TIME/$tstart/g" \ -e "s/DT/$dtgrib/g" \ @@ -145,7 +140,7 @@ set +x echo " Run ww3_grib2" echo " Executing $EXECwave/ww3_grib" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} export pgm=ww3_grib;. prep_step $EXECwave/ww3_grib > grib2_${grdnam}_${FH3}.out 2>&1 @@ -158,11 +153,11 @@ echo '*** FATAL ERROR : ERROR IN ww3_grib encoding *** ' echo '************************************************ ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi - if [ $fht -gt 0 ]; then + if [ $fhr -gt 0 ]; then $WGRIB2 gribfile -set_date $CDATE -set_ftime "$fhr hour fcst" -grib ${COMOUT}/gridded/${outfile} err=$? else @@ -178,7 +173,7 @@ echo '*** FATAL ERROR : ERROR IN ww3_grib2 *** ' echo '********************************************* ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi @@ -209,7 +204,7 @@ echo ' ' echo " Error in moving grib file ${outfile} to com" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 4 fi if [ ! -s $COMOUT/gridded/${outfile} ] @@ -222,7 +217,7 @@ echo ' ' echo " Error in moving grib file ${outfile}.idx to com" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 4 fi @@ -231,7 +226,7 @@ set +x echo " Alerting GRIB file as $COMOUT/gridded/${outfile}" echo " Alerting GRIB index file as $COMOUT/gridded/${outfile}.idx" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} $DBNROOT/bin/dbn_alert MODEL ${alertName}_WAVE_GB2 $job $COMOUT/gridded/${outfile} $DBNROOT/bin/dbn_alert MODEL ${alertName}_WAVE_GB2_WIDX $job $COMOUT/gridded/${outfile}.idx else @@ -246,7 +241,7 @@ set +x echo " Removing work directory after success." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cd ../ mv -f ${gribDIR} done.${gribDIR} @@ -256,13 +251,8 @@ echo ' ' echo " File ${COMOUT}/gridded/${outfile} found, skipping generation process" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} fi - set +x - echo ' ' - echo "End of ww3_grib2.sh at" - date - [[ "$LOUD" = YES ]] && set -x # End of ww3_grib2.sh -------------------------------------------------- # diff --git a/ush/wave_grid_interp_sbs.sh b/ush/wave_grid_interp_sbs.sh index bb68333b172..59a604d0f5c 100755 --- a/ush/wave_grid_interp_sbs.sh +++ b/ush/wave_grid_interp_sbs.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -24,15 +24,10 @@ ################################################################################ # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - # set execution trace prompt. ${0##*/} adds the script's basename - PS4=" \${SECONDS} ${0##*/} L\${LINENO} + " - set -x +source "$HOMEgfs/ush/preamble.sh" - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +# 0.a Basic modes of operation cd $GRDIDATA @@ -53,7 +48,7 @@ echo '*** FATAL ERROR : ERROR IN ww3_grid_interp (COULD NOT CREATE TEMP DIRECTORY) *** ' echo '************************************************************************************* ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 fi @@ -68,7 +63,7 @@ echo '! Make GRID files |' echo '+--------------------------------+' echo " Model ID : $WAV_MOD_TAG" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ -z "$CDATE" ] || [ -z "$cycle" ] || [ -z "$EXECwave" ] || \ [ -z "$COMOUT" ] || [ -z "$WAV_MOD_TAG" ] || [ -z "$SENDCOM" ] || \ @@ -81,7 +76,7 @@ echo '***************************************************' echo ' ' echo "$CDATE $cycle $EXECwave $COMOUT $WAV_MOD_TAG $SENDCOM $SENDDBN $waveGRD" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 fi @@ -123,7 +118,7 @@ set +x echo ' ' echo " Copying $FIXwave/WHTGRIDINT.bin.${grdID} " - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cp $FIXwave/WHTGRIDINT.bin.${grdID} ${DATA} wht_OK='yes' else @@ -143,7 +138,7 @@ set +x echo " Run ww3_gint echo " Executing $EXECwave/ww3_gint - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} export pgm=ww3_gint;. prep_step $EXECwave/ww3_gint 1> gint.${grdID}.out 2>&1 @@ -165,7 +160,7 @@ echo '*** FATAL ERROR : ERROR IN ww3_gint interpolation * ' echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi @@ -181,14 +176,14 @@ then set +x echo " Saving GRID file as $COMOUT/rundata/$WAV_MOD_TAG.out_grd.$grdID.${CDATE}" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cp ${DATA}/output_${ymdh}0000/out_grd.$grdID $COMOUT/rundata/$WAV_MOD_TAG.out_grd.$grdID.${CDATE} # if [ "$SENDDBN" = 'YES' ] # then # set +x # echo " Alerting GRID file as $COMOUT/rundata/$WAV_MOD_TAG.out_grd.$grdID.${CDATE} -# [[ "$LOUD" = YES ]] && set -x +# ${TRACE_ON:-set -x} # # PUT DBNET ALERT HERE .... @@ -200,16 +195,7 @@ # --------------------------------------------------------------------------- # # 2. Clean up the directory - set +x - echo " Removing work directory after success." - [[ "$LOUD" = YES ]] && set -x - cd ../ mv -f grint_${grdID}_${ymdh} done.grint_${grdID}_${ymdh} - set +x - echo ' ' - echo "End of ww3_interp.sh at" - date - # End of ww3_grid_interp.sh -------------------------------------------- # diff --git a/ush/wave_grid_moddef.sh b/ush/wave_grid_moddef.sh index a9a12b6efea..80c041df37c 100755 --- a/ush/wave_grid_moddef.sh +++ b/ush/wave_grid_moddef.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -19,15 +19,10 @@ # # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - # set execution trace prompt. ${0##*/} adds the script's basename - PS4=" \${SECONDS} ${0##*/} L\${LINENO} + " - set -x +source "$HOMEgfs/ush/preamble.sh" - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +# 0.a Basic modes of operation echo "Generating mod_def file" @@ -43,7 +38,7 @@ echo '+--------------------------------+' echo " Grid : $1" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 0.b Check if grid set @@ -55,7 +50,7 @@ echo '*** Grid not identifife in ww3_mod_def.sh ***' echo '**************************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 else grdID=$1 @@ -72,7 +67,7 @@ echo '*** EXPORTED VARIABLES IN ww3_mod_def.sh NOT SET ***' echo '*********************************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 2 fi @@ -84,7 +79,7 @@ echo ' Creating mod_def file ...' echo " Executing $EXECwave/ww3_grid" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} rm -f ww3_grid.inp ln -sf ../ww3_grid.inp.$grdID ww3_grid.inp @@ -100,7 +95,7 @@ echo '*** FATAL ERROR : ERROR IN ww3_grid *** ' echo '******************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi @@ -115,19 +110,14 @@ echo '*** FATAL ERROR : MOD DEF FILE NOT FOUND *** ' echo '******************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 4 fi # --------------------------------------------------------------------------- # # 3. Clean up - cd .. - rm -rf moddef_$grdID - - set +x - echo ' ' - echo 'End of ww3_mod_def.sh at' - date +cd .. +rm -rf moddef_$grdID # End of ww3_mod_def.sh ------------------------------------------------- # diff --git a/ush/wave_outp_cat.sh b/ush/wave_outp_cat.sh index 536e4203a53..7adf77dbf0c 100755 --- a/ush/wave_outp_cat.sh +++ b/ush/wave_outp_cat.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -20,16 +20,10 @@ ################################################################################ # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - - # set execution trace prompt. ${0##*/} adds the script's basename - PS4=" \${SECONDS} ${0##*/} L\${LINENO} + " - set -x - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +source "$HOMEgfs/ush/preamble.sh" +# 0.a Basic modes of operation bloc=$1 MAXHOUR=$2 specdir=$3 @@ -44,7 +38,7 @@ echo '*** LOCATION ID IN ww3_outp_spec.sh NOT SET ***' echo '***********************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 else buoy=$bloc @@ -62,7 +56,7 @@ echo '*** EXPORTED VARIABLES IN ww3_outp_cat.sh NOT SET ***' echo '******************************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi @@ -72,16 +66,20 @@ set +x echo " Generate input file for ww3_outp." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$specdir" = "bull" ] then outfile=${STA_DIR}/${specdir}/$WAV_MOD_TAG.$buoy.bull coutfile=${STA_DIR}/c${specdir}/$WAV_MOD_TAG.$buoy.cbull - rm outfile coutfile + for f in outfile coutfile; do + if [[ -f ${f} ]]; then rm ${f}; fi + done else outfile=${STA_DIR}/${specdir}/$WAV_MOD_TAG.$buoy.spec - rm outfile + if [[ -f ${outfile} ]]; then + rm ${outfile} + fi fi fhr=$FHMIN_WAV @@ -115,7 +113,7 @@ echo "*** FATAL ERROR : OUTPUT DATA FILE FOR BOUY $bouy at ${ymdh} NOT FOUND *** " echo '************************************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=2; export err;${errchk} exit $err fi @@ -139,14 +137,9 @@ echo " FATAL ERROR : OUTPUTFILE ${outfile} not created " echo '*************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} err=2; export err;${errchk} exit $err fi - set +x - echo ' ' - echo 'End of ww3_outp_cat.sh at' - date - # End of ww3_outp_cat.sh ---------------------------------------------------- # diff --git a/ush/wave_outp_spec.sh b/ush/wave_outp_spec.sh index e48d6373077..a652d36745e 100755 --- a/ush/wave_outp_spec.sh +++ b/ush/wave_outp_spec.sh @@ -1,5 +1,5 @@ -#!/bin/bash -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -21,16 +21,10 @@ ################################################################################ # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - # set execution trace prompt. ${0##*/} adds the script's basename - PS4=" \${SECONDS} ${0##*/} L\${LINENO} + " - set -x - - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set +x +source "$HOMEgfs/ush/preamble.sh" +# 0.a Basic modes of operation bloc=$1 ymdh=$2 specdir=$3 @@ -51,7 +45,7 @@ echo '*** FATAL ERROR : ERROR IN ww3_outp_spec (COULD NOT CREATE TEMP DIRECTORY) *** ' echo '****************************************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 fi @@ -63,7 +57,7 @@ echo '! Make spectral file |' echo '+--------------------------------+' echo " Model ID : $WAV_MOD_TAG" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 0.b Check if buoy location set @@ -75,7 +69,7 @@ echo '*** LOCATION ID IN ww3_outp_spec.sh NOT SET ***' echo '***********************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 else buoy=$bloc @@ -90,7 +84,7 @@ echo " Location ID/# : $buoy (${point})" echo " Spectral output start time : $ymdh " echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} break fi done < tmp_list.loc @@ -101,7 +95,7 @@ echo '*** LOCATION ID IN ww3_outp_spec.sh NOT RECOGNIZED ***' echo '******************************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 2 fi fi @@ -119,7 +113,7 @@ echo '*** EXPORTED VARIABLES IN ww3_outp_spec.sh NOT SET ***' echo '******************************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi @@ -131,7 +125,7 @@ set +x echo " Output starts at $tstart." echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 0.e sync important files @@ -150,7 +144,7 @@ set +x echo " Generate input file for ww3_outp." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} if [ "$specdir" = "bull" ] then @@ -177,7 +171,7 @@ set +x echo " Executing $EXECwave/ww3_outp" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} export pgm=ww3_outp;. prep_step $EXECwave/ww3_outp 1> outp_${specdir}_${buoy}.out 2>&1 @@ -192,7 +186,7 @@ echo '*** FATAL ERROR : ERROR IN ww3_outp *** ' echo '******************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 4 fi @@ -236,18 +230,13 @@ echo '*** FATAL ERROR : OUTPUT DATA FILE FOR BOUY $bouy NOT FOUND *** ' echo '***************************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 5 fi # 3.b Clean up the rest - cd .. - rm -rf ${specdir}_${bloc} - - set +x - echo ' ' - echo 'End of ww3_outp_spec.sh at' - date +cd .. +rm -rf ${specdir}_${bloc} # End of ww3_outp_spec.sh ---------------------------------------------------- # diff --git a/ush/wave_prnc_cur.sh b/ush/wave_prnc_cur.sh index bb98fee07b1..7b193313d32 100755 --- a/ush/wave_prnc_cur.sh +++ b/ush/wave_prnc_cur.sh @@ -1,5 +1,5 @@ -#!/bin/sh -# +#! /usr/bin/env bash + ################################################################################ # # UNIX Script Documentation Block @@ -21,7 +21,8 @@ # ################################################################################ # -set -x + +source "$HOMEgfs/ush/preamble.sh" ymdh_rtofs=$1 curfile=$2 @@ -94,4 +95,3 @@ fi mv -f current.ww3 ${DATA}/${WAVECUR_DID}.${ymdh_rtofs} cd ${DATA} - diff --git a/ush/wave_prnc_ice.sh b/ush/wave_prnc_ice.sh index f73646a07a8..16473dbd1f2 100755 --- a/ush/wave_prnc_ice.sh +++ b/ush/wave_prnc_ice.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#! /usr/bin/env bash + ############################################################################### # # # This script preprocesses ice fields for the ocean wave models. # @@ -25,13 +26,13 @@ # # --------------------------------------------------------------------------- # # 0. Preparations + +source "$HOMEgfs/ush/preamble.sh" + # 0.a Basic modes of operation cd $DATA - seton='-xa' - setoff='+xa' - set $seton - + rm -rf ice mkdir ice cd ice @@ -40,7 +41,7 @@ # 0.b Define directories and the search path. # The tested variables should be exported by the postprocessor script. - set $setoff + set +x echo ' ' echo '+--------------------------------+' echo '! Make ice fields |' @@ -50,7 +51,7 @@ echo " Ice grid ID : $WAVEICE_FID" echo " Ice file : $WAVICEFILE" echo ' ' - set $seton + ${TRACE_ON:-set -x} echo "Making ice fields." if [ -z "$YMDH" ] || [ -z "$cycle" ] || \ @@ -58,14 +59,14 @@ [ -z "$WAV_MOD_TAG" ] || [ -z "$WAVEICE_FID" ] || [ -z "$SENDCOM" ] || \ [ -z "$COMIN_WAV_ICE" ] then - set $setoff + set +x echo ' ' echo '**************************************************' echo '*** EXPORTED VARIABLES IN preprocessor NOT SET ***' echo '**************************************************' echo ' ' exit 1 - set $seton + ${TRACE_ON:-set -x} echo "NON-FATAL ERROR - EXPORTED VARIABLES IN preprocessor NOT SET" fi @@ -86,17 +87,17 @@ if [ -f ice.grib ] then - set $setoff + set +x echo " ice.grib copied ($file)." - set $seton + ${TRACE_ON:-set -x} else - set $setoff + set +x echo ' ' echo '************************************** ' echo "*** FATAL ERROR: NO ICE FILE $file *** " echo '************************************** ' echo ' ' - set $seton + ${TRACE_ON:-set -x} echo "FATAL ERROR - NO ICE FILE (GFS GRIB)" exit 2 fi @@ -105,9 +106,9 @@ # 2. Process the GRIB packed ice file # 2.a Unpack data - set $setoff + set +x echo ' Extracting data from ice.grib ...' - set $seton + ${TRACE_ON:-set -x} $WGRIB2 ice.grib -netcdf icean_5m.nc 2>&1 > wgrib.out @@ -117,13 +118,13 @@ if [ "$err" != '0' ] then cat wgrib.out - set $setoff + set +x echo ' ' echo '**************************************** ' echo '*** ERROR IN UNPACKING GRIB ICE FILE *** ' echo '**************************************** ' echo ' ' - set $seton + ${TRACE_ON:-set -x} echo "ERROR IN UNPACKING GRIB ICE FILE." exit 3 fi @@ -135,10 +136,10 @@ # 2.d Run through preprocessor wave_prep - set $setoff + set +x echo ' Run through preprocessor ...' echo ' ' - set $seton + ${TRACE_ON:-set -x} cp -f ${DATA}/ww3_prnc.ice.$WAVEICE_FID.inp.tmpl ww3_prnc.inp @@ -150,13 +151,13 @@ if [ "$err" != '0' ] then cat prnc_${WAVEICE_FID}_${cycle}.out - set $setoff + set +x echo ' ' echo '******************************************** ' echo '*** WARNING: NON-FATAL ERROR IN ww3_prnc *** ' echo '******************************************** ' echo ' ' - set $seton + ${TRACE_ON:-set -x} echo "WARNING: NON-FATAL ERROR IN ww3_prnc." exit 4 fi @@ -177,25 +178,17 @@ icefile=${CDUMP}wave.${WAVEICE_FID}.$cycle.ice fi - set $setoff + set +x echo " Saving ice.ww3 as $COMOUT/rundata/${icefile}" - set $seton + ${TRACE_ON:-set -x} cp ice.ww3 $COMOUT/rundata/${icefile} rm -f ice.ww3 # --------------------------------------------------------------------------- # # 4. Clean up the directory - set $setoff - echo " Removing work directory after success." - set $seton +cd .. - cd .. - rm -rf ice - - set $setoff - echo ' ' - echo 'End of waveice.sh at' - date +rm -rf ice # End of waveice.sh --------------------------------------------------------- # diff --git a/ush/wave_tar.sh b/ush/wave_tar.sh index f071d2d4907..452601dceb4 100755 --- a/ush/wave_tar.sh +++ b/ush/wave_tar.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#! /usr/bin/env bash + ############################################################################### # # # This script tars the sectral or bulletin files into a single file and # @@ -23,15 +24,10 @@ # # --------------------------------------------------------------------------- # # 0. Preparations -# 0.a Basic modes of operation - # set execution trace prompt. ${0##*/} adds the script's basename - PS4=" \${SECONDS} ${0##*/} L\${LINENO} + " - set -x +source "$HOMEgfs/ush/preamble.sh" - # Use LOUD variable to turn on/off trace. Defaults to YES (on). - export LOUD=${LOUD:-YES}; [[ $LOUD = yes ]] && export LOUD=YES - [[ "$LOUD" != YES ]] && set -x +# 0.a Basic modes of operation cd $DATA echo "Making TAR FILE" @@ -46,7 +42,7 @@ echo " ID : $1" echo " Type : $2" echo " Number of files : $3" - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} # 0.b Check if type set @@ -59,7 +55,7 @@ echo '*** VARIABLES IN ww3_tar.sh NOT SET ***' echo '********************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 1 else ID=$1 @@ -89,7 +85,7 @@ echo '*** EXPORTED VARIABLES IN ww3_tar.sh NOT SET ***' echo '*****************************************************' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 2 fi @@ -101,7 +97,7 @@ set +x echo ' ' echo ' Making tar file ...' - set -x + ${TRACE_ON:-set -x} count=0 countMAX=5 @@ -125,7 +121,7 @@ echo '*** FATAL ERROR : TAR CREATION FAILED *** ' echo '***************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi @@ -136,7 +132,7 @@ else set +x echo ' All files not found for tar. Sleeping 10 seconds and trying again ..' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} sleep 10 count=$(expr $count + 1) fi @@ -151,7 +147,7 @@ echo '*** FATAL ERROR : TAR CREATION FAILED *** ' echo '***************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 3 fi @@ -171,7 +167,7 @@ echo '*** FATAL ERROR : SPECTRAL TAR COMPRESSION FAILED *** ' echo '***************************************************** ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 4 fi fi @@ -185,7 +181,7 @@ set +x echo ' ' echo " Moving tar file ${file_name} to $COMOUT ..." - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} cp ${file_name} $COMOUT/station/. @@ -199,7 +195,7 @@ echo '*** FATAL ERROR : TAR COPY FAILED *** ' echo '************************************* ' echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} exit 4 fi @@ -209,21 +205,19 @@ echo ' ' echo " Alerting TAR file as $COMOUT/station/${file_name}" echo ' ' - [[ "$LOUD" = YES ]] && set -x + ${TRACE_ON:-set -x} $DBNROOT/bin/dbn_alert MODEL ${alertName}_WAVE_TAR $job $COMOUT/station/${file_name} fi # --------------------------------------------------------------------------- # # 4. Final clean up - cd $DATA +cd $DATA - set +x; [[ "$LOUD" = YES ]] && set -v +if [[ ${KEEPDATA:-NO} == "NO" ]]; then + set -v rm -rf ${STA_DIR}/${type} set +v - - echo ' ' - echo 'End of ww3_tar.sh at' - date +fi # End of ww3_tar.sh ----------------------------------------------------- #