diff --git a/.shellcheckrc b/.shellcheckrc index 1e31bd4600..6d540ba17f 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -11,3 +11,6 @@ disable=SC1090 # Disable non-existent binary disable=SC1091 + +# Disable -p -m only applies to deepest directory +disable=SC2174 diff --git a/env/ORION.env b/env/ORION.env index 0c541593c7..466a115b90 100755 --- a/env/ORION.env +++ b/env/ORION.env @@ -41,7 +41,8 @@ if [[ "${step}" = "prep" ]] || [[ "${step}" = "prepbufr" ]]; then export sys_tp="ORION" export launcher_PREP="srun" -elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostbndpntbll" ]]|| [[ "${step}" = "wavepostpnt" ]]; then +elif [[ "${step}" = "waveinit" ]] || [[ "${step}" = "waveprep" ]] || [[ "${step}" = "wavepostsbs" ]] || \ + [[ "${step}" = "wavepostbndpnt" ]] || [[ "${step}" = "wavepostpnt" ]] || [[ "${step}" == "wavepostbndpntbll" ]]; then export CFP_MP="YES" if [[ "${step}" = "waveprep" ]]; then export MP_PULSE=0 ; fi diff --git a/jobs/JGDAS_ATMOS_ANALYSIS_DIAG b/jobs/JGDAS_ATMOS_ANALYSIS_DIAG index a9e2ff14ef..6ad5c8f31b 100755 --- a/jobs/JGDAS_ATMOS_ANALYSIS_DIAG +++ b/jobs/JGDAS_ATMOS_ANALYSIS_DIAG @@ -7,8 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "anal" -c "base anal analdiag" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export CDUMP="${RUN/enkf}" export DO_CALC_ANALYSIS=${DO_CALC_ANALYSIS:-"YES"} @@ -16,47 +15,21 @@ export DO_CALC_ANALYSIS=${DO_CALC_ANALYSIS:-"YES"} # Begin JOB SPECIFIC work ############################################## -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -${assim_freq} ${PDY}${cyc}) +# shellcheck disable= +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" export OPREFIX="${CDUMP}.t${cyc}z." export GPREFIX="${GDUMP}.t${gcyc}z." -export APREFIX="${CDUMP}.t${cyc}z." -export GPREFIX_ENS="enkf${GDUMP}.t${gcyc}z." - - -if [ ${RUN_ENVIR} = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMOUT=${COMOUT:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} - export COMIN_OBS=${COMIN_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${RUN}.${PDY}/${cyc}/atmos} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${GDUMP}.${gPDY}/${gcyc}/atmos} -else - export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos" - export COMIN_OBS="${COMIN_OBS:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/obs}" - export COMIN_GES_OBS="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/obs" -fi -mkdir -m 775 -p ${COMOUT} -# COMIN_GES and COMIN_GES_ENS are used in script -export COMIN_GES="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/atmos" -export COMIN_GES_ENS="${ROTDIR}/enkfgdas.${gPDY}/${gcyc}" - - -export ATMGES="${COMIN_GES}/${GPREFIX}atmf006.nc" -if [ ! -f ${ATMGES} ]; then - echo "FATAL ERROR: FILE MISSING: ATMGES = ${ATMGES}" - exit 1 -fi - - -if [ ${DOHYBVAR} = "YES" ]; then - export ATMGES_ENSMEAN="${COMIN_GES_ENS}/${GPREFIX_ENS}atmf006.ensmean.nc" - if [ ! -f ${ATMGES_ENSMEAN} ]; then - echo "FATAL ERROR: FILE MISSING: ATMGES_ENSMEAN = ${ATMGES_ENSMEAN}" - exit 2 - fi -fi +export APREFIX="${RUN}.t${cyc}z." +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS +mkdir -m 775 -p "${COM_ATMOS_ANALYSIS}" ############################################################### # Run relevant script diff --git a/jobs/JGDAS_ATMOS_CHGRES_FORENKF b/jobs/JGDAS_ATMOS_CHGRES_FORENKF index da93058ace..1bbed53586 100755 --- a/jobs/JGDAS_ATMOS_CHGRES_FORENKF +++ b/jobs/JGDAS_ATMOS_CHGRES_FORENKF @@ -7,9 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "anal" -c "base anal echgres" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} -export COMPONENT="atmos" +export CDUMP=${RUN/enkf} export DO_CALC_ANALYSIS=${DO_CALC_ANALYSIS:-"YES"} @@ -17,19 +15,11 @@ export DO_CALC_ANALYSIS=${DO_CALC_ANALYSIS:-"YES"} # Begin JOB SPECIFIC work ############################################## -export APREFIX="${CDUMP/enkf}.t${cyc}z." -export APREFIX_ENS="${CDUMP}.t${cyc}z." +export APREFIX="${CDUMP}.t${cyc}z." +export APREFIX_ENS="${RUN}.t${cyc}z." -if [ ${RUN_ENVIR} = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMOUT=${COMOUT:-${ROTDIR}/${RUN/enkf}.${PDY}/${cyc}/atmos} - export COMOUT_ENS=${COMOUT_ENS:-${ROTDIR}/${RUN}.${PDY}/${cyc}} -else - export COMOUT="${ROTDIR}/${RUN/enkf}.${PDY}/${cyc}/atmos" - export COMOUT_ENS="${ROTDIR}/${RUN}.${PDY}/${cyc}" -fi -mkdir -m 775 -p ${COMOUT} - -export ATMFCST_ENSRES="${COMOUT_ENS}/mem001/atmos/${APREFIX_ENS}atmf006.nc" +RUN=${CDUMP} YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_HISTORY +MEMDIR="mem001" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_HISTORY_MEM:COM_ATMOS_HISTORY_TMPL ############################################################### # Run relevant script diff --git a/jobs/JGDAS_ATMOS_GEMPAK b/jobs/JGDAS_ATMOS_GEMPAK index bec9c80867..f0131ffb94 100755 --- a/jobs/JGDAS_ATMOS_GEMPAK +++ b/jobs/JGDAS_ATMOS_GEMPAK @@ -35,32 +35,37 @@ export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} # Specify NET and RUN Name and model #################################### export model=${model:-gdas} -export COMPONENT="atmos" ############################################## # Define COM directories ############################################## -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}/gempak} +for grid in 0p25 0p50 1p00; do + GRID=${grid} YMD=${PDY} HH=${cyc} generate_com -rx "COM_ATMOS_GRIB_${grid}:COM_ATMOS_GRIB_TMPL" +done -if [ ${SENDCOM} = YES ] ; then - mkdir -m 775 -p ${COMOUT} -fi +for grid in 1p00 0p25; do + prod_dir="COM_ATMOS_GEMPAK_${grid}" + GRID=${grid} YMD=${PDY} HH=${cyc} generate_com -rx "COM_ATMOS_GEMPAK_${grid}:COM_ATMOS_GEMPAK_TMPL" + + if [[ ${SENDCOM} == YES && ! -d "${!prod_dir}" ]] ; then + mkdir -m 775 -p "${!prod_dir}" + fi +done -# TODO: These actions belong in an ex-script not a j-job (#1219) -if [ -f ${DATA}/poescript ]; then - rm ${DATA}/poescript +# TODO: These actions belong in an ex-script not a j-job +if [[ -f poescript ]]; then + rm -f poescript fi ######################################################## # Execute the script. -echo "${SRCgfs}/exgdas_atmos_nawips.sh gdas 009 GDAS_GEMPAK " >> poescript +echo "${SRCgfs}/exgdas_atmos_nawips.sh gdas 009 GDAS_GEMPAK ${COM_ATMOS_GEMPAK_1p00}" >> poescript ######################################################## ######################################################## # Execute the script for quater-degree grib -echo "${SRCgfs}/exgdas_atmos_nawips.sh gdas_0p25 009 GDAS_GEMPAK " >>poescript +echo "${SRCgfs}/exgdas_atmos_nawips.sh gdas_0p25 009 GDAS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}" >> poescript ######################################################## cat poescript @@ -76,9 +81,8 @@ export OMP_NUM_THREADS=${threads} APRUN="mpiexec -l -np ${ntasks} --cpu-bind verbose,core cfp" APRUN_GEMPAKCFP=${APRUN_GEMPAKCFP:-${APRUN}} -APRUNCFP=$(eval echo ${APRUN_GEMPAKCFP}) -${APRUNCFP} ${DATA}/poescript +${APRUN_GEMPAKCFP} ${DATA}/poescript export err=$?; err_chk ############################################ diff --git a/jobs/JGDAS_ATMOS_VERFOZN b/jobs/JGDAS_ATMOS_VERFOZN index e16cb6d548..deccc0b28e 100755 --- a/jobs/JGDAS_ATMOS_VERFOZN +++ b/jobs/JGDAS_ATMOS_VERFOZN @@ -6,12 +6,6 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "vrfy" -c "base vrfy" - -############################### -# Specify NET, RUN, and COMPONENT name -############################## -export COMPONENT="atmos" - export OZNMON_SUFFIX=${OZNMON_SUFFIX:-${NET}} #--------------------------------------------- @@ -39,20 +33,20 @@ export USHoznmon=${USHoznmon:-${HOMEoznmon}/ush} # determine PDY and cyc for previous cycle ############################################# -cdate=$(${NDATE} -6 ${PDY}${cyc}) -echo 'pdate = ${pdate}' +pdate=$(${NDATE} -6 ${PDY}${cyc}) +echo "pdate = ${pdate}" -export P_PDY=$(echo ${cdate} | cut -c1-8) -export p_cyc=$(echo ${cdate} | cut -c9-10) +export P_PDY=${pdate:0:8} +export p_cyc=${pdate:8:2} #--------------------------------------------- # OZN_TANKDIR - WHERE OUTPUT DATA WILL RESIDE # export OZN_TANKDIR=${OZN_TANKDIR:-$(compath.py ${envir}/${NET}/${gfs_ver})} -export TANKverf_ozn=${TANKverf_ozn:-${OZN_TANKDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT}/oznmon} -export TANKverf_oznM1=${TANKverf_oznM1:-${OZN_TANKDIR}/${RUN}.${P_PDY}/${p_cyc}/${COMPONENT}/oznmon} -export COM_IN=${COM_IN:-$(compath.py ${envir}/${NET}/${gfs_ver})} -export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}} +export TANKverf_ozn=${TANKverf_ozn:-${OZN_TANKDIR}/${RUN}.${PDY}/${cyc}/atmos/oznmon} +export TANKverf_oznM1=${TANKverf_oznM1:-${OZN_TANKDIR}/${RUN}.${P_PDY}/${p_cyc}/atmos/oznmon} + +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS if [[ ! -d ${TANKverf_ozn} ]]; then mkdir -p -m 775 ${TANKverf_ozn} @@ -69,7 +63,7 @@ fi # Set necessary environment variables # export OZN_AREA=${OZN_AREA:-glb} -export oznstat=${oznstat:-${COMIN}/gdas.t${cyc}z.oznstat} +export oznstat=${oznstat:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.oznstat} #------------------------------------------------------- diff --git a/jobs/JGDAS_ATMOS_VERFRAD b/jobs/JGDAS_ATMOS_VERFRAD index 300e6eff1a..42e112c74f 100755 --- a/jobs/JGDAS_ATMOS_VERFRAD +++ b/jobs/JGDAS_ATMOS_VERFRAD @@ -42,31 +42,21 @@ parm_file=${parm_file:-${PARMmon}/da_mon.parm} # determine PDY and cyc for previous cycle ############################################# -cdate=$(${NDATE} -6 ${PDY}${cyc}) -echo 'pdate = ${pdate}' +pdate=$(${NDATE} -6 ${PDY}${cyc}) +echo "pdate = ${pdate}" -export P_PDY=$(echo ${cdate} | cut -c1-8) -export p_cyc=$(echo ${cdate} | cut -c9-10) +export P_PDY=${pdate:0:8} +export p_cyc=${pdate:8:2} ############################################# # COMOUT - WHERE GSI OUTPUT RESIDES # TANKverf - WHERE OUTPUT DATA WILL RESIDE ############################################# export TANKverf=${TANKverf:-$(compath.py ${envir}/${NET}/${gfs_ver})} -export TANKverf_rad=${TANKverf_rad:-${TANKverf}/${RUN}.${PDY}/${cyc}/${COMPONENT}/radmon} -export TANKverf_radM1=${TANKverf_radM1:-${TANKverf}/${RUN}.${P_PDY}/${p_cyc}/${COMPONENT}/radmon} -export COM_IN=${COM_IN:-$(compath.py ${envir}/${NET}/${gfs_ver})} -export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}} - -################################ -# backwards compatibility for -# gfs v15 which doesn't have -# a $COMPONENT in output path -################################ -if [[ ! -d ${COMIN} ]]; then - export COMIN=${COM_IN}/${RUN}.${PDY}/${cyc} -fi +export TANKverf_rad=${TANKverf_rad:-${TANKverf}/${RUN}.${PDY}/${cyc}/atmos/radmon} +export TANKverf_radM1=${TANKverf_radM1:-${TANKverf}/${RUN}.${P_PDY}/${p_cyc}/atmos/radmon} +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS mkdir -p -m 775 ${TANKverf_rad} @@ -75,8 +65,8 @@ mkdir -p -m 775 ${TANKverf_rad} ######################################## export RAD_AREA=${RAD_AREA:-glb} -export biascr=${biascr:-${COMIN}/gdas.t${cyc}z.abias} -export radstat=${radstat:-${COMIN}/gdas.t${cyc}z.radstat} +export biascr=${biascr:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.abias} +export radstat=${radstat:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.radstat} echo " " echo "JOB HAS STARTED" diff --git a/jobs/JGDAS_ATMOS_VMINMON b/jobs/JGDAS_ATMOS_VMINMON index 67f50f5c1c..3f9c0d856f 100755 --- a/jobs/JGDAS_ATMOS_VMINMON +++ b/jobs/JGDAS_ATMOS_VMINMON @@ -6,8 +6,6 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "vrfy" -c "base vrfy" -export COMPONENT="atmos" - ########################################################### # obtain unique process id (pid) and make temp directories ########################################################### @@ -32,32 +30,29 @@ export USHminmon=${USHminmon:-${HOMEminmon}/ush} # determine PDY and cyc for previous cycle ############################################# -cdate=$(${NDATE} -6 ${PDY}${cyc}) -echo 'pdate = ${pdate}' +pdate=$(${NDATE} -6 ${PDY}${cyc}) +echo "pdate = ${pdate}" -export P_PDY=$(echo ${cdate} | cut -c1-8) -export p_cyc=$(echo ${cdate} | cut -c9-10) +export P_PDY=${pdate:0:8} +export p_cyc=${pdate:8:2} ############################################# # TANKverf - WHERE OUTPUT DATA WILL RESIDE ############################################# -export COM_IN=${COM_IN:-$(compath.py ${envir}/${NET}/${gfs_ver})} - -export M_TANKverf=${M_TANKverf:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}/minmon} -export M_TANKverfM1=${M_TANKverfM1:-${COM_IN}/${RUN}.${P_PDY}/${p_cyc}/${COMPONENT}/minmon} +export M_TANKverf=${M_TANKverf:-${COM_IN}/${RUN}.${PDY}/${cyc}/atmos/minmon} +export M_TANKverfM1=${M_TANKverfM1:-${COM_IN}/${RUN}.${P_PDY}/${p_cyc}/atmos/minmon} -export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}} +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS mkdir -p -m 775 ${M_TANKverf} - ######################################## # Set necessary environment variables ######################################## export CYCLE_INTERVAL=6 -export gsistat=${gsistat:-${COMIN}/gdas.t${cyc}z.gsistat} +export gsistat=${gsistat:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.gsistat} ######################################################## diff --git a/jobs/JGDAS_ENKF_ARCHIVE b/jobs/JGDAS_ENKF_ARCHIVE index e5131c4c67..37f4e17b9b 100755 --- a/jobs/JGDAS_ENKF_ARCHIVE +++ b/jobs/JGDAS_ENKF_ARCHIVE @@ -7,8 +7,11 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "earc" -c "base earc" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export CDUMP=${RUN/enkf} + +YMD=${PDY} HH=${cyc} generate_com -rx COM_TOP +MEMDIR="ensstat" YMD=${PDY} HH=${cyc} generate_com -rx \ + COM_ATMOS_ANALYSIS_ENSSTAT:COM_ATMOS_ANALYSIS_TMPL ############################################################### # Run archive script diff --git a/jobs/JGDAS_ENKF_DIAG b/jobs/JGDAS_ENKF_DIAG index 384f253ff7..e2684fded2 100755 --- a/jobs/JGDAS_ENKF_DIAG +++ b/jobs/JGDAS_ENKF_DIAG @@ -7,9 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "eobs" -c "base anal eobs analdiag edi ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gdas"}} -export COMPONENT="atmos" +export CDUMP="${RUN/enkf}" export MAKE_NSSTBUFR=${MAKE_NSSTBUFR:-"NO"} export MAKE_ACFTBUFR=${MAKE_ACFTBUFR:-"NO"} @@ -17,77 +15,72 @@ export MAKE_ACFTBUFR=${MAKE_ACFTBUFR:-"NO"} ############################################## # Begin JOB SPECIFIC work ############################################## - -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} -GDUMP_ENS=${GDUMP_ENS:-"enkf${GDUMP}"} +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" export CASE=${CASE_ENKF} -export CDUMP_OBS=${CDUMP_OBS:-${CDUMP/enkf}} -export CDUMP_CTL=${CDUMP_CTL:-${CDUMP/enkf}} +export OPREFIX="${CDUMP}.t${cyc}z." +export APREFIX="${RUN}.t${cyc}z." +export GPREFIX="${GDUMP_ENS}.t${gcyc}z." +GPREFIX_DET="${GDUMP}.t${gcyc}z." -export OPREFIX="${CDUMP_OBS}.t${cyc}z." -export APREFIX="${CDUMP_CTL}.t${cyc}z." -export APREFIX_ENS="${CDUMP}.t${cyc}z." -export GPREFIX="${GDUMP}.t${gcyc}z." -export GPREFIX_ENS="${GDUMP_ENS}.t${gcyc}z." +RUN=${CDUMP} YMD=${PDY} HH=${cyc} generate_com -rx COM_OBS +MEMDIR="ensstat" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS -if [ ${RUN_ENVIR} = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN_OBS=${COMIN_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${CDUMP_OBS}.${PDY}/${cyc}/${COMPONENT}} -else - export COMIN_OBS="${COMIN_OBS:-${ROTDIR}/${CDUMP_OBS}.${PDY}/${cyc}/obs}" -fi +RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_OBS_PREV:COM_OBS_TMPL \ + COM_ATMOS_ANALYSIS_DET_PREV:COM_ATMOS_ANALYSIS_TMPL -# COMIN_GES, COMIN_ANL COMIN_GES_ENS, and COMOUT are used in script -COMIN_GES_CTL="${ROTDIR}/gdas.${gPDY}/${gcyc}/${COMPONENT}" -export COMIN_ANL="${ROTDIR}/${CDUMP/enkf}.${PDY}/${cyc}/${COMPONENT}" -export COMIN_GES_ENS="${ROTDIR}/enkfgdas.${gPDY}/${gcyc}" -export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" +MEMDIR="ensstat" RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_ATMOS_HISTORY_PREV:COM_ATMOS_HISTORY_TMPL -export ATMGES_ENSMEAN="${COMIN_GES_ENS}/${GPREFIX_ENS}atmf006.ensmean.nc" +export ATMGES_ENSMEAN="${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf006.ensmean.nc" if [ ! -f ${ATMGES_ENSMEAN} ]; then echo "FATAL ERROR: FILE MISSING: ATMGES_ENSMEAN = ${ATMGES_ENSMEAN}" exit 1 fi - # Link observational data -export PREPQC="${COMIN_OBS}/${OPREFIX}prepbufr" +export PREPQC="${COM_OBS}/${OPREFIX}prepbufr" if [[ ! -f ${PREPQC} ]]; then echo "WARNING: Global PREPBUFR FILE ${PREPQC} MISSING" fi -export TCVITL="${COMIN_ANL}/${OPREFIX}syndata.tcvitals.tm00" +export TCVITL="${COM_OBS}/${OPREFIX}syndata.tcvitals.tm00" if [[ ${DONST} = "YES" ]]; then - export NSSTBF="${COMIN_OBS}/${OPREFIX}nsstbufr" + export NSSTBF="${COM_OBS}/${OPREFIX}nsstbufr" fi -export PREPQCPF="${COMIN_OBS}/${OPREFIX}prepbufr.acft_profiles" +export PREPQCPF="${COM_OBS}/${OPREFIX}prepbufr.acft_profiles" # Guess Bias correction coefficients related to control -export GBIAS=${COMIN_GES_CTL}/${GPREFIX}abias -export GBIASPC=${COMIN_GES_CTL}/${GPREFIX}abias_pc -export GBIASAIR=${COMIN_GES_CTL}/${GPREFIX}abias_air -export GRADSTAT=${COMIN_GES_CTL}/${GPREFIX}radstat +export GBIAS=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}abias +export GBIASPC=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}abias_pc +export GBIASAIR=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}abias_air +export GRADSTAT=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}radstat # Bias correction coefficients related to ensemble mean -export ABIAS="${COMOUT}/${APREFIX_ENS}abias.ensmean" -export ABIASPC="${COMOUT}/${APREFIX_ENS}abias_pc.ensmean" -export ABIASAIR="${COMOUT}/${APREFIX_ENS}abias_air.ensmean" -export ABIASe="${COMOUT}/${APREFIX_ENS}abias_int.ensmean" +export ABIAS="${COM_ATMOS_ANALYSIS}/${APREFIX}abias.ensmean" +export ABIASPC="${COM_ATMOS_ANALYSIS}/${APREFIX}abias_pc.ensmean" +export ABIASAIR="${COM_ATMOS_ANALYSIS}/${APREFIX}abias_air.ensmean" +export ABIASe="${COM_ATMOS_ANALYSIS}/${APREFIX}abias_int.ensmean" # Diagnostics related to ensemble mean -export GSISTAT="${COMOUT}/${APREFIX_ENS}gsistat.ensmean" -export CNVSTAT="${COMOUT}/${APREFIX_ENS}cnvstat.ensmean" -export OZNSTAT="${COMOUT}/${APREFIX_ENS}oznstat.ensmean" -export RADSTAT="${COMOUT}/${APREFIX_ENS}radstat.ensmean" +export GSISTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}gsistat.ensmean" +export CNVSTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}cnvstat.ensmean" +export OZNSTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}oznstat.ensmean" +export RADSTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}radstat.ensmean" # Select observations based on ensemble mean export RUN_SELECT="YES" export USE_SELECT="NO" -export SELECT_OBS="${COMOUT}/${APREFIX_ENS}obsinput.ensmean" +export SELECT_OBS="${COM_ATMOS_ANALYSIS}/${APREFIX}obsinput.ensmean" export DIAG_SUFFIX="_ensmean" export DIAG_COMPRESS="NO" diff --git a/jobs/JGDAS_ENKF_ECEN b/jobs/JGDAS_ENKF_ECEN index d08f2e11b0..9c2f09a0dc 100755 --- a/jobs/JGDAS_ENKF_ECEN +++ b/jobs/JGDAS_ENKF_ECEN @@ -7,36 +7,36 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "ecen" -c "base ecen" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"enkfgdas"}} -export COMPONENT="atmos" - +export CDUMP="${RUN/enkf}" ############################################## # Begin JOB SPECIFIC work ############################################## - -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} -GDUMP_ENS=${GDUMP_ENS:-"enkf${GDUMP}"} +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" export CASE=${CASE_ENKF} -export CDUMP_OBS=${CDUMP_OBS:-${CDUMP/enkf}} - -export OPREFIX="${CDUMP_OBS}.t${cyc}z." -export APREFIX="${CDUMP/enkf}.t${cyc}z." -export APREFIX_ENS="${CDUMP}.t${cyc}z." +export OPREFIX="${CDUMP}.t${cyc}z." +export APREFIX="${CDUMP}.t${cyc}z." +export APREFIX_ENS="${RUN}.t${cyc}z." export GPREFIX="${GDUMP}.t${gcyc}z." export GPREFIX_ENS="${GDUMP_ENS}.t${gcyc}z." -# COMIN, COMIN_ENS and COMIN_GES_ENS are used in script -export COMIN="${ROTDIR}/${CDUMP/enkf}.${PDY}/${cyc}/atmos" -export COMIN_ENS="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" -export COMOUT_ENS="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" -export COMIN_GES_ENS="${ROTDIR}/${GDUMP_ENS}.${gPDY}/${gcyc}" +RUN=${CDUMP} YMD=${PDY} HH=${cyc} generate_com -rx \ + COM_ATMOS_ANALYSIS_DET:COM_ATMOS_ANALYSIS_TMPL + +MEMDIR="ensstat" YMD=${PDY} HH=${cyc} generate_com -rx \ + COM_ATMOS_ANALYSIS_STAT:COM_ATMOS_ANALYSIS_TMPL + +MEMDIR="ensstat" RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_ATMOS_HISTORY_STAT_PREV:COM_ATMOS_HISTORY_TMPL ############################################################### diff --git a/jobs/JGDAS_ENKF_FCST b/jobs/JGDAS_ENKF_FCST index 8a30b9abe3..77c8b7c059 100755 --- a/jobs/JGDAS_ENKF_FCST +++ b/jobs/JGDAS_ENKF_FCST @@ -7,9 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "efcs" -c "base fcst efcs" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"enkfgdas"}} -export COMPONENT="atmos" +export CDUMP=${RUN/enkf} export rCDUMP="enkfgdas" ############################################## @@ -18,8 +16,7 @@ export rCDUMP="enkfgdas" export CASE=${CASE_ENKF} -# COMOUT is used in script -export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" +YMD=${PDY} HH=${cyc} generate_com -rx COM_TOP # Forecast length for EnKF forecast @@ -27,7 +24,6 @@ export FHMIN=${FHMIN_ENKF} export FHOUT=${FHOUT_ENKF} export FHMAX=${FHMAX_ENKF} - # Get ENSBEG/ENSEND from ENSGRP and NMEM_EFCSGRP if [[ $CDUMP == "gfs" ]]; then export NMEM_EFCSGRP=${NMEM_EFCSGRP_GFS:-${NMEM_EFCSGRP:-1}} @@ -45,7 +41,7 @@ status=$? # Double check the status of members in ENSGRP -EFCSGRP=${COMOUT}/efcs.grp${ENSGRP} +EFCSGRP="${COM_TOP}/efcs.grp${ENSGRP}" npass=0 if [ -f ${EFCSGRP} ]; then npass=$(grep "PASS" ${EFCSGRP} | wc -l) @@ -83,5 +79,4 @@ fi cd ${DATAROOT} [[ ${KEEPDATA} = "NO" ]] && rm -rf ${DATA} - exit 0 diff --git a/jobs/JGDAS_ENKF_POST b/jobs/JGDAS_ENKF_POST index a9750d00ba..0f7039d614 100755 --- a/jobs/JGDAS_ENKF_POST +++ b/jobs/JGDAS_ENKF_POST @@ -7,9 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "epos" -c "base epos" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"enkfgdas"}} -export COMPONENT="atmos" +export CDUMP=${RUN/enkf} ############################################## @@ -17,12 +15,7 @@ export COMPONENT="atmos" ############################################## export GFS_NCIO=${GFS_NCIO:-"YES"} -export PREFIX="${CDUMP}.t${cyc}z." - -# COMIN, COMOUT are used in script -export COMIN="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" -export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" - +export PREFIX="${RUN}.t${cyc}z." export LEVS=$((LEVS-1)) diff --git a/jobs/JGDAS_ENKF_SELECT_OBS b/jobs/JGDAS_ENKF_SELECT_OBS index eba1b0c6c4..7c02512989 100755 --- a/jobs/JGDAS_ENKF_SELECT_OBS +++ b/jobs/JGDAS_ENKF_SELECT_OBS @@ -7,9 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "eobs" -c "base anal eobs" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gdas"}} -export COMPONENT="atmos" +export CDUMP=${RUN/enkf} export MAKE_NSSTBUFR=${MAKE_NSSTBUFR:-"NO"} export MAKE_ACFTBUFR=${MAKE_ACFTBUFR:-"NO"} @@ -17,87 +15,91 @@ export MAKE_ACFTBUFR=${MAKE_ACFTBUFR:-"NO"} ############################################## # Begin JOB SPECIFIC work ############################################## +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -${assim_freq} ${PDY}${cyc}) +# shellcheck disable= +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" + +export OPREFIX="${CDUMP}.t${cyc}z." +export APREFIX="${RUN}.t${cyc}z." +export GPREFIX="${GDUMP_ENS}.t${gcyc}z." +APREFIX_DET="${CDUMP}.t${cyc}z." +GPREFIX_DET="${GDUMP}.t${gcyc}z." -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} -GDUMP_ENS=${GDUMP_ENS:-"enkf${GDUMP}"} +export GSUFFIX=".ensmean.nc" -export CASE=${CASE_ENKF} -export CDUMP_OBS=${CDUMP_OBS:-${CDUMP/enkf}} +# Generate COM variables from templates +RUN=${CDUMP} YMD=${PDY} HH=${cyc} generate_com -rx COM_OBS +MEMDIR='ensstat' YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS +declare -rx COM_ATMOS_ANALYSIS_ENS="${COM_ATMOS_ANALYSIS}" -export OPREFIX="${CDUMP_OBS}.t${cyc}z." -export APREFIX="${CDUMP}.t${cyc}z." -export APREFIX_ANL="${CDUMP/enkf}.t${cyc}z." -export GPREFIX_CTL="${GDUMP}.t${gcyc}z." -export GPREFIX="${GDUMP_ENS}.t${gcyc}z." -export GSUFFIX=".ensmean.nc" +RUN=${CDUMP} YMD=${PDY} HH=${cyc} generate_com -r COM_ATMOS_ANALYSIS_DET:COM_ATMOS_ANALYSIS_TMPL -if [ ${RUN_ENVIR} = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN_OBS=${COMIN_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${CDUMP_OBS}.${PDY}/${cyc}/${COMPONENT}} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${GDUMP}.${gPDY}/${gcyc}/${COMPONENT}} -else - export COMIN_OBS="${COMIN_OBS:-${ROTDIR}/${CDUMP_OBS}.${PDY}/${cyc}/obs}" - export COMIN_GES_OBS="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/obs" -fi +MEMDIR='ensstat' RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_ATMOS_ANALYSIS_PREV:COM_ATMOS_ANALYSIS_TMPL \ + COM_ATMOS_HISTORY_PREV:COM_ATMOS_HISTORY_TMPL \ + +RUN="${GDUMP}" YMD=${gPDY} HH=${gcyc} generate_com -r COM_ATMOS_ANALYSIS_DET_PREV:COM_ATMOS_ANALYSIS_TMPL -# COMIN_GES, COMIN_ANL COMIN_GES_ENS, and COMOUT are used in script -COMIN_GES_CTL="${ROTDIR}/gdas.${gPDY}/${gcyc}/${COMPONENT}" -export COMIN_ANL="${ROTDIR}/${CDUMP/enkf}.${PDY}/${cyc}/${COMPONENT}" -export COMIN_GES_ENS="${ROTDIR}/enkfgdas.${gPDY}/${gcyc}" -export COMIN_GES=${COMIN_GES_ENS} -export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" +mkdir -m 775 -p "${COM_ATMOS_ANALYSIS}" -export ATMGES_ENSMEAN="${COMIN_GES_ENS}/${GPREFIX}atmf006${GSUFFIX}" +export ATMGES_ENSMEAN="${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf006${GSUFFIX}" if [[ ! -f ${ATMGES_ENSMEAN} ]]; then echo "FATAL ERROR: FILE MISSING: ATMGES_ENSMEAN = ${ATMGES_ENSMEAN}" exit 1 fi -export LEVS=$(${NCDUMP} -h ${ATMGES_ENSMEAN} | grep -i "pfull" | head -1 | awk -F" = " '{print $2}' | awk -F" " '{print $1}') # get LEVS +# Ignore masking of chained commands and possible misspelling warning +# shellcheck disable=SC2153,SC2312 +LEVS=$(${NCDUMP} -h "${ATMGES_ENSMEAN}" | grep -i "pfull" | head -1 | awk -F" = " '{print $2}' | awk -F" " '{print $1}') # get LEVS +# shellcheck disable= status=$? -[[ ${status} -ne 0 ]] && exit ${status} +[[ ${status} -ne 0 ]] && exit "${status}" +export LEVS # Link observational data -export PREPQC="${COMIN_OBS}/${OPREFIX}prepbufr" +export PREPQC="${COM_OBS}/${OPREFIX}prepbufr" if [[ ! -f ${PREPQC} ]]; then echo "WARNING: Global PREPBUFR FILE ${PREPQC} MISSING" fi -export TCVITL="${COMIN_ANL}/${OPREFIX}syndata.tcvitals.tm00" +export TCVITL="${COM_OBS}/${APREFIX_DET}syndata.tcvitals.tm00" if [[ ${DONST} = "YES" ]]; then - export NSSTBF="${COMIN_OBS}/${OPREFIX}nsstbufr" + export NSSTBF="${COM_OBS}/${OPREFIX}nsstbufr" fi -export PREPQCPF="${COMIN_OBS}/${OPREFIX}prepbufr.acft_profiles" +export PREPQCPF="${COM_OBS}/${OPREFIX}prepbufr.acft_profiles" # Deterministic analysis and increment files -export SFCANL="${COMIN_ANL}/${APREFIX_ANL}sfcanl.nc" -export DTFANL="${COMIN_ANL}/${APREFIX_ANL}dtfanl.nc" -export ATMANL="${COMIN_ANL}/${APREFIX_ANL}atmanl.nc" -export ATMINC="${COMIN_ANL}/${APREFIX_ANL}atminc.nc" +export SFCANL="${COM_ATMOS_ANALYSIS_DET}/${APREFIX_DET}sfcanl.nc" +export DTFANL="${COM_ATMOS_ANALYSIS_DET}/${APREFIX_DET}dtfanl.nc" +export ATMANL="${COM_ATMOS_ANALYSIS_DET}/${APREFIX_DET}atmanl.nc" +export ATMINC="${COM_ATMOS_ANALYSIS_DET}/${APREFIX_DET}atminc.nc" # Guess Bias correction coefficients related to control -export GBIAS=${COMIN_GES_CTL}/${GPREFIX_CTL}abias -export GBIASPC=${COMIN_GES_CTL}/${GPREFIX_CTL}abias_pc -export GBIASAIR=${COMIN_GES_CTL}/${GPREFIX_CTL}abias_air -export GRADSTAT=${COMIN_GES_CTL}/${GPREFIX_CTL}radstat +export GBIAS=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}abias +export GBIASPC=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}abias_pc +export GBIASAIR=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}abias_air +export GRADSTAT=${COM_ATMOS_ANALYSIS_DET_PREV}/${GPREFIX_DET}radstat # Bias correction coefficients related to ensemble mean -export ABIAS="${COMOUT}/${APREFIX}abias.ensmean" -export ABIASPC="${COMOUT}/${APREFIX}abias_pc.ensmean" -export ABIASAIR="${COMOUT}/${APREFIX}abias_air.ensmean" -export ABIASe="${COMOUT}/${APREFIX}abias_int.ensmean" +export ABIAS="${COM_ATMOS_ANALYSIS}/${APREFIX}abias.ensmean" +export ABIASPC="${COM_ATMOS_ANALYSIS}/${APREFIX}abias_pc.ensmean" +export ABIASAIR="${COM_ATMOS_ANALYSIS}/${APREFIX}abias_air.ensmean" +export ABIASe="${COM_ATMOS_ANALYSIS}/${APREFIX}abias_int.ensmean" # Diagnostics related to ensemble mean -export GSISTAT="${COMOUT}/${APREFIX}gsistat.ensmean" -export CNVSTAT="${COMOUT}/${APREFIX}cnvstat.ensmean" -export OZNSTAT="${COMOUT}/${APREFIX}oznstat.ensmean" -export RADSTAT="${COMOUT}/${APREFIX}radstat.ensmean" +export GSISTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}gsistat.ensmean" +export CNVSTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}cnvstat.ensmean" +export OZNSTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}oznstat.ensmean" +export RADSTAT="${COM_ATMOS_ANALYSIS}/${APREFIX}radstat.ensmean" # Select observations based on ensemble mean export RUN_SELECT="YES" export USE_SELECT="NO" -export SELECT_OBS="${COMOUT}/${APREFIX}obsinput.ensmean" +export SELECT_OBS="${COM_ATMOS_ANALYSIS}/${APREFIX}obsinput.ensmean" export DIAG_SUFFIX="_ensmean" diff --git a/jobs/JGDAS_ENKF_SFC b/jobs/JGDAS_ENKF_SFC index 075c285ba5..9e6196fbd7 100755 --- a/jobs/JGDAS_ENKF_SFC +++ b/jobs/JGDAS_ENKF_SFC @@ -7,38 +7,38 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "esfc" -c "base esfc" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gdas"}} -export COMPONENT="atmos" - +export CDUMP="${RUN/enkf}" ############################################## # Begin JOB SPECIFIC work ############################################## - -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} -GDUMP_ENS=${GDUMP_ENS:-"enkf${GDUMP}"} +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" + +export OPREFIX="${CDUMP}.t${cyc}z." +export GPREFIX="${GDUMP}.t${gcyc}z." +export APREFIX="${CDUMP}.t${cyc}z." export CASE=${CASE_ENKF} -export CDUMP_OBS=${CDUMP_OBS:-${CDUMP/enkf}} - -export OPREFIX="${CDUMP_OBS}.t${cyc}z." -export APREFIX="${CDUMP/enkf}.t${cyc}z." -export APREFIX_ENS="${CDUMP}.t${cyc}z." +export OPREFIX="${CDUMP}.t${cyc}z." +export APREFIX="${CDUMP}.t${cyc}z." +export APREFIX_ENS="${RUN}.t${cyc}z." export GPREFIX="${GDUMP}.t${gcyc}z." export GPREFIX_ENS="${GDUMP_ENS}.t${gcyc}z." -# COMIN, COMIN_ENS and COMIN_GES_ENS are used in script -export COMIN="${ROTDIR}/${RUN/enkf}.${PDY}/${cyc}/atmos" -export COMIN_GES="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/atmos" -export COMIN_ENS="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" -export COMOUT_ENS="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" -export COMIN_GES_ENS="${ROTDIR}/${GDUMP_ENS}.${gPDY}/${gcyc}" +RUN=${CDUMP} YMD=${PDY} HH=${cyc} generate_com -rx COM_OBS \ + COM_ATMOS_ANALYSIS_DET:COM_ATMOS_ANALYSIS_TMPL +RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_OBS_PREV:COM_OBS_TMPL \ + COM_ATMOS_ANALYSIS_DET_PREV:COM_ATMOS_ANALYSIS_TMPL ############################################################### # Run relevant script diff --git a/jobs/JGDAS_ENKF_UPDATE b/jobs/JGDAS_ENKF_UPDATE index f8f959acc8..1050529165 100755 --- a/jobs/JGDAS_ENKF_UPDATE +++ b/jobs/JGDAS_ENKF_UPDATE @@ -7,25 +7,29 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "eupd" -c "base anal eupd" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"enkfgdas"}} -export COMPONENT="atmos" +export CDUMP="${RUN/enkf}" ############################################## # Begin JOB SPECIFIC work ############################################## +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) +export APREFIX="${RUN}.t${cyc}z." +export GPREFIX="${GDUMP_ENS}.t${gcyc}z." -export APREFIX="${CDUMP}.t${cyc}z." -export GPREFIX="enkfgdas.t${gcyc}z." +MEMDIR="ensstat" YMD=${PDY} HH=${cyc} generate_com -rx \ + COM_ATMOS_ANALYSIS_STAT:COM_ATMOS_ANALYSIS_TMPL -# COMIN_GES_ENS and COMOUT_ANL_ENS are used in script -export COMIN_GES_ENS="${ROTDIR}/enkfgdas.${gPDY}/${gcyc}" -export COMOUT_ANL_ENS="${ROTDIR}/${CDUMP}.${PDY}/${cyc}" +MEMDIR="ensstat" RUN="enkfgdas" YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_ATMOS_HISTORY_STAT_PREV:COM_ATMOS_HISTORY_TMPL ############################################################### @@ -40,7 +44,7 @@ status=$? # Send Alerts ############################################## if [ ${SENDDBN} = YES ] ; then - ${DBNROOT}/bin/dbn_alert MODEL ENKF1_MSC_enkfstat ${job} ${COMOUT_ANL_ENS}/${APREFIX}enkfstat + "${DBNROOT}/bin/dbn_alert" "MODEL" "ENKF1_MSC_enkfstat" "${job}" "${COM_ATMOS_ANALYSIS_STAT}/${APREFIX}enkfstat" fi diff --git a/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG b/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG index ef4d4f8199..0119bc7f2d 100755 --- a/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG +++ b/jobs/JGFS_ATMOS_AWIPS_20KM_1P0DEG @@ -3,10 +3,8 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "awips" -c "base awips" - export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} - ################################ # Set up the HOME directory ################################ @@ -27,16 +25,15 @@ export COMPONENT="atmos" ############################################## # Define COM directories ############################################## -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}} -export COMOUTwmo=${COMOUTwmo:-${COMOUT}/wmo} - export SENDDBN=${SENDDBN:-NO} export SENDAWIP=${SENDAWIP:-NO} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} -if [ ${SENDCOM} = YES ] ; then - mkdir -m 775 -p ${COMOUT} ${COMOUTwmo} +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_WMO +GRID="0p25" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GRIB_0p25:COM_ATMOS_GRIB_TMPL + +if [[ ${SENDCOM} == "YES" && ! -d "${COM_ATMOS_WMO}" ]] ; then + mkdir -m 775 -p "${COM_ATMOS_WMO}" fi export pgmout=OUTPUT.$$ diff --git a/jobs/JGFS_ATMOS_AWIPS_G2 b/jobs/JGFS_ATMOS_AWIPS_G2 index ee823c9ada..94151fbd72 100755 --- a/jobs/JGFS_ATMOS_AWIPS_G2 +++ b/jobs/JGFS_ATMOS_AWIPS_G2 @@ -29,16 +29,15 @@ export COMPONENT="atmos" ############################################## # Define COM directories ############################################## -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}} -export COMOUTwmo=${COMOUTwmo:-${COMOUT}/wmo} - export SENDDBN=${SENDDBN:-NO} export SENDAWIP=${SENDAWIP:-NO} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} -if [ ${SENDCOM} = YES ] ; then - mkdir -m 775 -p ${COMOUT} ${COMOUTwmo} +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_WMO +GRID="0p25" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GRIB_0p25:COM_ATMOS_GRIB_TMPL + +if [[ ${SENDCOM} == "YES" && ! -d "${COM_ATMOS_WMO}" ]] ; then + mkdir -m 775 -p "${COM_ATMOS_WMO}" fi export pgmout=OUTPUT.$$ diff --git a/jobs/JGFS_ATMOS_CYCLONE_GENESIS b/jobs/JGFS_ATMOS_CYCLONE_GENESIS index bf674fccde..85e4bf7651 100755 --- a/jobs/JGFS_ATMOS_CYCLONE_GENESIS +++ b/jobs/JGFS_ATMOS_CYCLONE_GENESIS @@ -7,14 +7,10 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "vrfy" -c "base vrfy" # TODO (#1220) Determine if this is still needed export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export COMPONENT="atmos" - ############################################## # Set variables used in the exglobal script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} -export cmodel=${CDUMP} +export cmodel=${RUN} #################################### # SENDCOM - Copy Files From TMPDIR to $COMOUT @@ -36,18 +32,24 @@ export SCRIPTens_tracker=${SCRIPTens_tracker:-${HOMEens_tracker}/scripts} ############################################## # Define COM directories ############################################## -export COMIN=${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT} -export gfsdir=${COMIN} -export COMINgfs=${COMIN} -export COMOUT=${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT} +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GENESIS +YMD=${PDY} HH=${cyc} GRID="0p25" generate_com -rx COM_ATMOS_GRIB_0p25:COM_ATMOS_GRIB_TMPL + +# The following variables are used by the tracker scripts which are outside +# of global-workflow and therefore can't be standardized at this time +export COMIN=${COM_ATMOS_GRIB_0p25} +export gfsdir=${COM_ATMOS_GRIB_0p25} +export COMINgfs=${COM_ATMOS_GRIB_0p25} + +export COMINgenvit=${COM_ATMOS_GENESIS} +export COMOUTgenvit=${COM_ATMOS_GENESIS} +export COMOUT=${COM_ATMOS_GENESIS} -export JYYYY=$(echo ${PDY} | cut -c1-4) -export COMINgenvit=${COMINgenvit:-${COMOUT}/genesis_vital_${JYYYY}} -export COMOUTgenvit=${COMOUTgenvit:-${COMOUT}/genesis_vital_${JYYYY}} +export COMINsyn=${COMINsyn:-$(compath.py "${envir}/com/gfs/${gfs_ver}")/syndat} -export COMINsyn=${COMINsyn:-$(compath.py ${envir}/com/gfs/${gfs_ver})/syndat} +mkdir -m 775 -p "${COMOUTgenvit}" -mkdir -m 775 -p ${COMOUTgenvit} +export JYYYY=${PDY:0:4} ############################################## # Run relevant script diff --git a/jobs/JGFS_ATMOS_CYCLONE_TRACKER b/jobs/JGFS_ATMOS_CYCLONE_TRACKER index 7734e4ea66..3aa3c6f5f4 100755 --- a/jobs/JGFS_ATMOS_CYCLONE_TRACKER +++ b/jobs/JGFS_ATMOS_CYCLONE_TRACKER @@ -14,7 +14,7 @@ export COMPONENT="atmos" # Set variables used in the exglobal script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export CDUMP=${RUN/enkf} #################################### @@ -37,14 +37,22 @@ export USHens_tracker=${USHens_tracker:-${HOMEens_tracker}/ush} ############################################## # Define COM and Data directories ############################################## -export COMIN=${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT} -export COMINgfs=${COMIN} -export gfsdir=${COMINgfs} -export COMINgdas=${COMIN} -export gdasdir=${COMINgdas} -export COMOUT=${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT} +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_TRACK COM_ATMOS_GENESIS +YMD=${PDY} HH=${cyc} GRID="0p25" generate_com -rx COM_ATMOS_GRIB_0p25:COM_ATMOS_GRIB_TMPL + +if [[ ! -d "${COM_ATMOS_TRACK}" ]]; then mkdir -p "${COM_ATMOS_TRACK}"; fi + +# The following variables are used by the tracker scripts which are outside +# of global-workflow and therefore can't be standardized at this time +export COMINgfs=${COM_ATMOS_GRIB_0p25} +export gfsdir=${COM_ATMOS_GRIB_0p25} +export COMINgdas=${COM_ATMOS_GRIB_0p25} +export gdasdir=${COM_ATMOS_GRIB_0p25} +export COMOUT=${COM_ATMOS_TRACK} export COMINsyn=${COMINsyn:-$(compath.py ${envir}/com/gfs/${gfs_ver})/syndat} +export COMINgenvit=${COM_ATMOS_GENESIS} + if [ ${RUN_ENVIR} = "nco" ]; then export COMOUThur=${COMROOTp1}/hur/${envir}/global export COMOUTatcf=${COMROOTp1}/nhc/${envir}/atcf diff --git a/jobs/JGFS_ATMOS_GEMPAK b/jobs/JGFS_ATMOS_GEMPAK index 2d822e53ce..161f0e0883 100755 --- a/jobs/JGFS_ATMOS_GEMPAK +++ b/jobs/JGFS_ATMOS_GEMPAK @@ -31,78 +31,87 @@ export DBN_ALERT_TYPE=${DBN_ALERT_TYPE:-GFS_GEMPAK} # Specify NET and RUN Name and model #################################### export model=${model:-gfs} -export COMPONENT="atmos" ############################################## # Define COM directories ############################################## -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}/gempak} - export SENDDBN=${SENDDBN:-NO} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} -if [ ${SENDCOM} = YES ] ; then - mkdir -m 775 -p ${COMOUT} -fi +for grid in 0p25 0p50 1p00; do + GRID=${grid} YMD=${PDY} HH=${cyc} generate_com -rx "COM_ATMOS_GRIB_${grid}:COM_ATMOS_GRIB_TMPL" +done + +for grid in 1p00 0p50 0p25 40km 35km_atl 35km_pac; do + prod_dir="COM_ATMOS_GEMPAK_${grid}" + GRID=${grid} YMD=${PDY} HH=${cyc} generate_com -rx "COM_ATMOS_GEMPAK_${grid}:COM_ATMOS_GEMPAK_TMPL" + if [[ ${SENDCOM} == YES && ! -d "${!prod_dir}" ]] ; then + mkdir -m 775 -p "${!prod_dir}" + fi +done # TODO: These actions belong in an ex-script not a j-job -if [ -f poescript ]; then +if [[ -f poescript ]]; then rm -f poescript fi +ocean_domain_max=180 +if (( ocean_domain_max > FHMAX_GFS )); then + ocean_domain_max=${FHMAX_GFS} +fi + ################################################################# # Execute the script for the 384 hour 1 degree grib ################################################################## -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs 384 GFS_GEMPAK &> ${DATA}/gfs_1p0.$$.1 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs 384 GFS_GEMPAK &> ${DATA}/gfs_1p0.$$.2 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs 384 GFS_GEMPAK &> ${DATA}/gfs_1p0.$$.3 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs 384 GFS_GEMPAK &> ${DATA}/gfs_1p0.$$.4 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs 384 GFS_GEMPAK &> ${DATA}/gfs_1p0.$$.5 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs 384 GFS_GEMPAK &> ${DATA}/gfs_1p0.$$.6 " >>poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_1p00} &> ${DATA}/gfs_1p0.$$.1 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_1p00} &> ${DATA}/gfs_1p0.$$.2 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_1p00} &> ${DATA}/gfs_1p0.$$.3 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_1p00} &> ${DATA}/gfs_1p0.$$.4 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_1p00} &> ${DATA}/gfs_1p0.$$.5 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_1p00} &> ${DATA}/gfs_1p0.$$.6 " >> poescript ################################################################# # Execute the script for the half-degree grib ################################################################## -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 384 GFS_GEMPAK &> ${DATA}/gfs_0p5.$$.1 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 384 GFS_GEMPAK &> ${DATA}/gfs_0p5.$$.2 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 384 GFS_GEMPAK &> ${DATA}/gfs_0p5.$$.3 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 384 GFS_GEMPAK &> ${DATA}/gfs_0p5.$$.4 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 384 GFS_GEMPAK &> ${DATA}/gfs_0p5.$$.5 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 384 GFS_GEMPAK &> ${DATA}/gfs_0p5.$$.6 " >>poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p50} &> ${DATA}/gfs_0p5.$$.1 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p50} &> ${DATA}/gfs_0p5.$$.2 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p50} &> ${DATA}/gfs_0p5.$$.3 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p50} &> ${DATA}/gfs_0p5.$$.4 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p50} &> ${DATA}/gfs_0p5.$$.5 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p50 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p50} &> ${DATA}/gfs_0p5.$$.6 " >> poescript ################################################################# # Execute the script for the quater-degree grib #################################################################### -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.1 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.2 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.3 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.4 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.5 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.6 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.7 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.8 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.9 " >> poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 384 GFS_GEMPAK &> ${DATA}/gfs_0p25.$$.10 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.1 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.2 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.3 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.4 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.5 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.6 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.7 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.8 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.9 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs_0p25 ${FHMAX_GFS} GFS_GEMPAK ${COM_ATMOS_GEMPAK_0p25}&> ${DATA}/gfs_0p25.$$.10 " >> poescript #################################################################### # Execute the script to create the 35km Pacific grids for OPC ##################################################################### -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_pac 180 GFS_GEMPAK_WWB &> ${DATA}/gfs35_pac.$$.1 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_pac 180 GFS_GEMPAK_WWB &> ${DATA}/gfs35_pac.$$.2 " >>poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_pac ${ocean_domain_max} GFS_GEMPAK_WWB ${COM_ATMOS_GEMPAK_35km_pac} &> ${DATA}/gfs35_pac.$$.1 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_pac ${ocean_domain_max} GFS_GEMPAK_WWB ${COM_ATMOS_GEMPAK_35km_pac} &> ${DATA}/gfs35_pac.$$.2 " >> poescript #################################################################### # Execute the script to create the 35km Atlantic grids for OPC ##################################################################### -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_atl 180 GFS_GEMPAK_WWB &> ${DATA}/gfs35_atl.$$.1 " >>poescript -echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_atl 180 GFS_GEMPAK_WWB &> ${DATA}/gfs35_atl.$$.2 " >>poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_atl ${ocean_domain_max} GFS_GEMPAK_WWB ${COM_ATMOS_GEMPAK_35km_atl} &> ${DATA}/gfs35_atl.$$.1 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs35_atl ${ocean_domain_max} GFS_GEMPAK_WWB ${COM_ATMOS_GEMPAK_35km_atl} &> ${DATA}/gfs35_atl.$$.2 " >> poescript ##################################################################### # Execute the script to create the 40km grids for HPC ###################################################################### -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 +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs40 ${ocean_domain_max} GFS_GEMPAK_WWB ${COM_ATMOS_GEMPAK_40km} &> ${DATA}/gfs40.$$.1 " >> poescript +echo "time ${SRCgfs}/exgfs_atmos_nawips.sh gfs40 ${ocean_domain_max} GFS_GEMPAK_WWB ${COM_ATMOS_GEMPAK_40km} &> ${DATA}/gfs40.$$.2 " >> poescript if [[ ${CFP_MP:-"NO"} == "YES" ]]; then # Add task number to the MPMD script @@ -123,7 +132,7 @@ export OMP_NUM_THREADS=${threads} APRUN=${APRUN:-"mpiexec -l -np ${ntasks} --cpu-bind verbose,core cfp"} APRUN_GEMPAKCFP=${APRUN_GEMPAKCFP:-${APRUN}} -APRUNCFP=$(eval echo ${APRUN_GEMPAKCFP}) +APRUNCFP=${APRUN_GEMPAKCFP} ${APRUNCFP} ${DATA}/poescript export err=$?; err_chk diff --git a/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS b/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS index 8bb39c0532..48b13c3d9e 100755 --- a/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS +++ b/jobs/JGFS_ATMOS_PGRB2_SPEC_NPOESS @@ -26,22 +26,19 @@ export FIXgfs=${FIXgfs:-${HOMEgfs}/fix} # Specify NET and RUN Name and model #################################### export model=${model:-gfs} -export COMPONENT="atmos" ############################################## # Define COM directories ############################################## -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}} -export COMOUTwmo=${COMOUTwmo:-${COMOUT}/wmo} - export SENDDBN=${SENDDBN:-NO} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} -if [ ${SENDCOM} = YES ] ; then - mkdir -m 775 -p ${COMOUT} ${COMOUTwmo} -fi +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GOES +GRID="0p50" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GRIB_0p50:COM_ATMOS_GRIB_TMPL +if [[ ${SENDCOM} == "YES" ]]; then + mkdir -m 775 -p "${COM_ATMOS_GOES}" +fi # TODO - This should be in the ex-script (#1226) @@ -52,11 +49,6 @@ export SHOUR=000 export FHOUR=180 export FHINC=003 -####################################### -# Specify Restart File Name to Key Off -####################################### -restart_file=${COMIN}/${RUN}.t${cyc}z.special.grb2if - #################################### # Specify Timeout Behavior of Post # @@ -71,46 +63,41 @@ export SLEEP_INT=5 #################################### # Check if this is a restart #################################### -if test -f ${COMIN}/${RUN}.t${cyc}z.control.goessimpgrb2 -then - modelrecvy=$(cat < ${COMIN}/${RUN}.t${cyc}z.control.goessimpgrb) - recvy_pdy=$(echo ${modelrecvy} | cut -c1-8) - recvy_cyc=$(echo ${modelrecvy} | cut -c9-10) - recvy_shour=$(echo ${modelrecvy} | cut -c11-13) - - if test ${RERUN} = "NO" - then - NEW_SHOUR=$(expr ${recvy_shour} + ${FHINC}) - if test ${NEW_SHOUR} -ge ${SHOUR} - then +if [[ -f "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.goessimpgrb2" ]]; then + modelrecvy=$(cat < "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.goessimpgrb") + recvy_cyc="${modelrecvy:8:2}" + recvy_shour="${modelrecvy:10:13}" + + if [[ ${RERUN} == "NO" ]]; then + NEW_SHOUR=$(( recvy_shour + FHINC )) + if (( NEW_SHOUR >= SHOUR )); then export SHOUR=${NEW_SHOUR} fi - if test ${recvy_shour} -ge ${FHOUR} - then - echo="Forecast Pgrb Generation Already Completed to ${FHOUR}" + if (( recvy_shour >= FHOUR )); then + echo "Forecast Pgrb Generation Already Completed to ${FHOUR}" else - echo="Starting: PDY=${PDY} cycle=t${recvy_cyc}z SHOUR=${SHOUR} ." + echo "Starting: PDY=${PDY} cycle=t${recvy_cyc}z SHOUR=${SHOUR}" fi fi fi ############################################################# # Execute the script -${HOMEgfs}/scripts/exgfs_atmos_grib2_special_npoess.sh +"${HOMEgfs}/scripts/exgfs_atmos_grib2_special_npoess.sh" export err=$?;err_chk ############################################################# ############################################ # print exec I/O output ############################################ -if [ -e "${pgmout}" ] ; then - cat ${pgmout} +if [[ -e "${pgmout}" ]] ; then + cat "${pgmout}" fi ################################### # Remove temp directories ################################### -if [ "${KEEPDATA}" != "YES" ] ; then - rm -rf ${DATA} +if [[ "${KEEPDATA}" != "YES" ]] ; then + rm -rf "${DATA}" fi diff --git a/jobs/JGFS_ATMOS_POSTSND b/jobs/JGFS_ATMOS_POSTSND index d5aa921e69..2318d70e31 100755 --- a/jobs/JGFS_ATMOS_POSTSND +++ b/jobs/JGFS_ATMOS_POSTSND @@ -7,8 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "postsnd" -c "base postsnd" ############################################## # Set variables used in the exglobal script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export CDUMP=${RUN/enkf} ######################################## @@ -34,14 +33,14 @@ export SCRbufrsnd=${SCRbufrsnd:-${HOMEbufrsnd}/scripts} ############################## # Define COM Directories ############################## -export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos} -export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos} -export pcom=${pcom:-${COMOUT}/wmo} -export COMAWP=${COMAWP:-${COMOUT}/gempak} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} -[[ ! -d ${COMOUT} ]] && mkdir -p ${COMOUT} -[[ ! -d ${pcom} ]] && mkdir -p ${pcom} -[[ ! -d ${COMAWP} ]] && mkdir -p ${COMAWP} + +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_HISTORY COM_ATMOS_BUFR \ + COM_ATMOS_WMO COM_ATMOS_GEMPAK + +[[ ! -d ${COM_ATMOS_BUFR} ]] && mkdir -p "${COM_ATMOS_BUFR}" +[[ ! -d ${COM_ATMOS_GEMPAK} ]] && mkdir -p "${COM_ATMOS_GEMPAK}" +[[ ! -d ${COM_ATMOS_WMO} ]] && mkdir -p "${COM_ATMOS_WMO}" ######################################################## diff --git a/jobs/JGFS_ATMOS_VMINMON b/jobs/JGFS_ATMOS_VMINMON index 01f2d3516c..a7300b4dd3 100755 --- a/jobs/JGFS_ATMOS_VMINMON +++ b/jobs/JGFS_ATMOS_VMINMON @@ -6,13 +6,6 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "vrfy" -c "base vrfy" - -############################### -# Specify NET and RUN name -############################## -export COMPONENT="atmos" - - ########################################################### # obtain unique process id (pid) and make temp directories ########################################################### @@ -35,31 +28,29 @@ export USHminmon=${USHminmon:-${HOMEminmon}/ush} # determine PDY and cyc for previous cycle ############################################# -cdate=$(${NDATE} -6 ${PDY}${cyc}) +pdate=$(${NDATE} -6 ${PDY}${cyc}) echo 'pdate = ${pdate}' -export P_PDY=$(echo ${cdate} | cut -c1-8) -export p_cyc=$(echo ${cdate} | cut -c9-10) +export P_PDY=${pdate:0:8} +export p_cyc=${pdate:8:2} ############################################# # TANKverf - WHERE OUTPUT DATA WILL RESIDE ############################################# -export COM_IN=${COM_IN:-$(compath.py ${envir}/${NET}/${gfs_ver})} +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS +YMD=${P_PDY} HH=${p_cyc} generate_com -rx COM_ATMOS_ANALYSIS_PREV:COM_ATMOS_ANALYSIS_TMPL -M_TANKverf=${M_TANKverf:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}/minmon} -export M_TANKverfM1=${M_TANKverfM1:-${COM_IN}/${RUN}.${P_PDY}/${p_cyc}/${COMPONENT}/minmon} - -export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}} +M_TANKverf=${M_TANKverf:-${COM_ATMOS_ANALYSIS}/minmon} +export M_TANKverfM1=${M_TANKverfM1:-${COM_ATMOS_ANALYSIS_PREV}/minmon} mkdir -p -m 775 ${M_TANKverf} - ######################################## # Set necessary environment variables ######################################## export CYCLE_INTERVAL=6 -export gsistat=${gsistat:-${COMIN}/gfs.t${cyc}z.gsistat} +export gsistat=${gsistat:-${COM_ATMOS_ANALYSIS}/gfs.t${cyc}z.gsistat} ######################################################## diff --git a/jobs/JGLOBAL_ARCHIVE b/jobs/JGLOBAL_ARCHIVE index 801998e2c2..2d2f8c8814 100755 --- a/jobs/JGLOBAL_ARCHIVE +++ b/jobs/JGLOBAL_ARCHIVE @@ -7,9 +7,21 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "arch" -c "base arch" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} - +export CDUMP=${RUN/enkf} + +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS COM_ATMOS_BUFR COM_ATMOS_GEMPAK \ + COM_ATMOS_GENESIS COM_ATMOS_HISTORY COM_ATMOS_INPUT COM_ATMOS_MASTER COM_ATMOS_RESTART \ + COM_ATMOS_TRACK COM_ATMOS_WAFS COM_ATMOS_WMO \ + COM_CHEM_HISTORY \ + COM_ICE_HISTORY COM_ICE_INPUT \ + COM_OBS COM_TOP \ + COM_OCEAN_DAILY COM_OCEAN_HISTORY COM_OCEAN_INPUT COM_OCEAN_XSECT \ + COM_WAVE_GRID COM_WAVE_HISTORY COM_WAVE_STATION + +for grid in "0p25" "0p50" "1p00"; do + YMD=${PDY} HH=${cyc} GRID=${grid} generate_com -rx "COM_ATMOS_GRIB_${grid}:COM_ATMOS_GRIB_TMPL" + YMD=${PDY} HH=${cyc} GRID=${grid} generate_com -rx "COM_OCEAN_GRIB_${grid}:COM_OCEAN_GRIB_TMPL" +done ############################################################### # Run archive script diff --git a/jobs/JGLOBAL_ATMOS_ANALYSIS b/jobs/JGLOBAL_ATMOS_ANALYSIS index 48c7a44cb0..9e5850bfc3 100755 --- a/jobs/JGLOBAL_ATMOS_ANALYSIS +++ b/jobs/JGLOBAL_ATMOS_ANALYSIS @@ -8,7 +8,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "anal" -c "base anal" # Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export CDUMP=${RUN/enkf} export COMPONENT="atmos" export DO_CALC_ANALYSIS=${DO_CALC_ANALYSIS:-"YES"} export MAKE_NSSTBUFR=${MAKE_NSSTBUFR:-"NO"} @@ -19,38 +19,35 @@ export MAKE_ACFTBUFR=${MAKE_ACFTBUFR:-"NO"} # Begin JOB SPECIFIC work ############################################## -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} +GDATE=$(${NDATE} -${assim_freq} ${PDY}${cyc}) +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" export OPREFIX="${CDUMP}.t${cyc}z." export GPREFIX="${GDUMP}.t${gcyc}z." export APREFIX="${CDUMP}.t${cyc}z." -export GPREFIX_ENS="enkf${GDUMP}.t${gcyc}z." - -export COMIN=${COMIN:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} -export COMOUT=${COMOUT:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} -export COMIN_OBS=${COMIN_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${RUN}.${PDY}/${cyc}/atmos} -if [ ${RUN_ENVIR} = "nco" ]; then - export COMIN_GES_OBS=${COMIN_GES_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${GDUMP}.${gPDY}/${gcyc}/atmos} -else - export COMIN_GES_OBS="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/obs" -fi +export GPREFIX_ENS="${GDUMP_ENS}.t${gcyc}z." + +# Generate COM variables from templates +YMD=${PDY} HH=${cyc} generate_com -rx COM_OBS COM_ATMOS_ANALYSIS -mkdir -m 775 -p ${COMOUT} -# COMIN_GES and COMIN_GES_ENS are used in script -export COMIN_GES="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/atmos" -export COMIN_GES_ENS="${ROTDIR}/enkfgdas.${gPDY}/${gcyc}" +RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_ATMOS_ANALYSIS_PREV:COM_ATMOS_ANALYSIS_TMPL \ + COM_ATMOS_HISTORY_PREV:COM_ATMOS_HISTORY_TMPL +MEMDIR='ensstat' RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_ATMOS_HISTORY_ENS_PREV:COM_ATMOS_HISTORY_TMPL -export ATMGES="${COMIN_GES}/${GPREFIX}atmf006.nc" +mkdir -m 775 -p "${COM_ATMOS_ANALYSIS}" + +export ATMGES="${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf006.nc" if [ ! -f ${ATMGES} ]; then echo "FATAL ERROR: FILE MISSING: ATMGES = ${ATMGES}" exit 1 fi - # Get LEVS export LEVS=$(${NCLEN} ${ATMGES} pfull) status=$? @@ -58,7 +55,7 @@ status=$? if [ ${DOHYBVAR} = "YES" ]; then - export ATMGES_ENSMEAN="${COMIN_GES_ENS}/enkf${GPREFIX}atmf006.ensmean.nc" + export ATMGES_ENSMEAN="${COM_ATMOS_HISTORY_ENS_PREV}/${GPREFIX_ENS}atmf006.ensmean.nc" if [ ! -f ${ATMGES_ENSMEAN} ]; then echo "FATAL ERROR: FILE MISSING: ATMGES_ENSMEAN = ${ATMGES_ENSMEAN}" exit 2 @@ -67,17 +64,17 @@ fi # Link observational data -export PREPQC="${COMIN_OBS}/${OPREFIX}prepbufr" +export PREPQC="${COM_OBS}/${OPREFIX}prepbufr" if [[ ! -f ${PREPQC} ]]; then echo "WARNING: Global PREPBUFR FILE ${PREPQC} MISSING" fi -export TCVITL="${COMOUT}/${OPREFIX}syndata.tcvitals.tm00" +export TCVITL="${COM_OBS}/${OPREFIX}syndata.tcvitals.tm00" if [[ ${DONST} = "YES" ]]; then if [[ ${MAKE_NSSTBUFR} == "YES" ]]; then - export NSSTBF="${COMIN_OBS}/${OPREFIX}nsstbufr" + export NSSTBF="${COM_OBS}/${OPREFIX}nsstbufr" fi fi -export PREPQCPF="${COMIN_OBS}/${OPREFIX}prepbufr.acft_profiles" +export PREPQCPF="${COM_OBS}/${OPREFIX}prepbufr.acft_profiles" # Copy fix file for obsproc # TODO: Why is this necessary? if [[ ${RUN} = "gfs" ]]; then @@ -98,9 +95,9 @@ status=$? # Send Alerts ############################################## if [ ${SENDDBN} = YES -a ${RUN} = gdas ] ; then - ${DBNROOT}/bin/dbn_alert MODEL GDAS_MSC_abias ${job} ${COMOUT}/${APREFIX}abias - ${DBNROOT}/bin/dbn_alert MODEL GDAS_MSC_abias_pc ${job} ${COMOUT}/${APREFIX}abias_pc - ${DBNROOT}/bin/dbn_alert MODEL GDAS_MSC_abias_air ${job} ${COMOUT}/${APREFIX}abias_air + ${DBNROOT}/bin/dbn_alert MODEL GDAS_MSC_abias ${job} ${COM_ATMOS_ANALYSIS}/${APREFIX}abias + ${DBNROOT}/bin/dbn_alert MODEL GDAS_MSC_abias_pc ${job} ${COM_ATMOS_ANALYSIS}/${APREFIX}abias_pc + ${DBNROOT}/bin/dbn_alert MODEL GDAS_MSC_abias_air ${job} ${COM_ATMOS_ANALYSIS}/${APREFIX}abias_air fi diff --git a/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC b/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC index 81f792b032..65a571a974 100755 --- a/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC +++ b/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC @@ -7,64 +7,48 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "analcalc" -c "base anal analcalc" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} -export COMPONENT="atmos" +export CDUMP="${RUN/enkf}" export DO_CALC_ANALYSIS=${DO_CALC_ANALYSIS:-"YES"} ############################################## # Begin JOB SPECIFIC work ############################################## - -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +export gPDY=${GDATE:0:8} +export gcyc=${GDATE:8:2} +export GDUMP="gdas" +export GDUMP_ENS="enkf${GDUMP}" export OPREFIX="${CDUMP}.t${cyc}z." export GPREFIX="${GDUMP}.t${gcyc}z." -export APREFIX="${CDUMP}.t${cyc}z." -export GPREFIX_ENS="enkf${GDUMP}.t${gcyc}z." - -if [ ${RUN_ENVIR} = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN=${COMIN:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} - export COMOUT=${COMOUT:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} - export COMIN_OBS=${COMIN_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${RUN}.${PDY}/${cyc}/atmos} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$(compath.py ${envir}/obsproc/${obsproc_ver})/${GDUMP}.${gPDY}/${gcyc}/atmos} -else - export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos" - export COMIN_OBS="${COMIN_OBS:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/obs}" - export COMIN_GES_OBS="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/obs" -fi -mkdir -m 775 -p ${COMOUT} -# COMIN_GES and COMIN_GES_ENS are used in script -export COMIN_GES="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/atmos" -export COMIN_GES_ENS="${ROTDIR}/enkfgdas.${gPDY}/${gcyc}" +export APREFIX="${RUN}.t${cyc}z." +export GPREFIX_ENS="${GDUMP_ENS}.t${gcyc}z." + +RUN=${CDUMP} YMD=${PDY} HH=${cyc} generate_com -rx COM_OBS + +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS COM_ATMOS_RESTART + +RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_OBS_PREV:COM_OBS_TMPL \ + COM_ATMOS_HISTORY_PREV:COM_ATMOS_HISTORY_TMPL -export ATMGES="${COMIN_GES}/${GPREFIX}atmf006.nc" +export ATMGES="${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf006.nc" if [ ! -f ${ATMGES} ]; then echo "FATAL ERROR: FILE MISSING: ATMGES = ${ATMGES}" exit 1 fi - # Get LEVS export LEVS=$(${NCLEN} ${ATMGES} pfull) status=$? [[ ${status} -ne 0 ]] && exit ${status} -if [ ${DOHYBVAR} = "YES" ]; then - export ATMGES_ENSMEAN="${COMIN_GES_ENS}/${GPREFIX_ENS}atmf006.ensmean.nc" - if [ ! -f ${ATMGES_ENSMEAN} ]; then - echo "FATAL ERROR: FILE MISSING: ATMGES_ENSMEAN = ${ATMGES_ENSMEAN}" - exit 2 - fi -fi - - # Generate Gaussian surface analysis # TODO: Should this be removed now that sfcanl is its own job? export DOGAUSFCANL=${DOGAUSFCANL:-"YES"} diff --git a/jobs/JGLOBAL_ATMOS_POST b/jobs/JGLOBAL_ATMOS_POST index 1c6af31f91..ac7a36f6db 100755 --- a/jobs/JGLOBAL_ATMOS_POST +++ b/jobs/JGLOBAL_ATMOS_POST @@ -15,15 +15,13 @@ export g2tmpl_ver=${g2tmpl_ver:-v1.5.0} ############################################## # Set variables used in the exglobal script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} -export COMPONENT="atmos" +export CDUMP=${RUN/enkf} ############################################## # TODO: Remove this egregious HACK ############################################## -if [[ "${SDATE:-}" = "${CDATE}" ]]; then +if [[ "${SDATE:-}" = "${PDY}${cyc}" ]]; then if [[ ${post_times} = "anl" ]]; then echo "No offline post-processing in the first half cycle for analysis" exit 0 @@ -41,12 +39,25 @@ export FIXCRTM=${CRTM_FIX:-${HOMECRTM}/fix} export PARMpost=${PARMpost:-${HOMEgfs}/parm/post} export INLINE_POST=${WRITE_DOPOST:-".false."} -export COMIN=${COMIN:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} -export COMOUT=${COMOUT:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} +# Construct COM variables from templates +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_RESTART COM_ATMOS_ANALYSIS COM_ATMOS_HISTORY COM_ATMOS_MASTER +if [[ ! -d ${COM_ATMOS_MASTER} ]]; then mkdir -m 775 -p "${COM_ATMOS_MASTER}"; fi -# shellcheck disable=SC2174 -[[ ! -d "${COMOUT}" ]] && mkdir -m 775 -p "${COMOUT}" -# shellcheck disable= +if [[ ${GOESF} == "YES" ]]; then + YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_GOES + if [[ ! -d ${COM_ATMOS_GOES} ]]; then mkdir -m 775 -p "${COM_ATMOS_GOES}"; fi +fi + +if [[ ${WAFSF} == "YES" ]]; then + YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_WAFS + if [[ ! -d ${COM_ATMOS_WAFS} ]]; then mkdir -m 775 -p "${COM_ATMOS_WAFS}"; fi +fi + +for grid in '0p25' '0p50' '1p00'; do + prod_dir="COM_ATMOS_GRIB_${grid}" + GRID=${grid} YMD=${PDY} HH=${cyc} generate_com -rx "${prod_dir}:COM_ATMOS_GRIB_TMPL" + if [[ ! -d "${prod_dir}" ]]; then mkdir -m 775 -p "${!prod_dir}"; fi +done if [ "${RUN}" = gfs ];then export FHOUT_PGB=${FHOUT_GFS:-3} #Output frequency of gfs pgb file at 1.0 and 0.5 deg. @@ -68,7 +79,8 @@ fi ####################################### # Specify Restart File Name to Key Off ####################################### -export restart_file=${COMIN}/${RUN}.t${cyc}z.logf +# TODO Improve the name of this variable +export restart_file=${COM_ATMOS_HISTORY}/${RUN}.t${cyc}z.logf #################################### # Specify Timeout Behavior of Post @@ -85,7 +97,7 @@ export SLEEP_INT=5 ############################################################### # Run relevant exglobal script -"${SCRgfs}/ex${RUN}_atmos_post.sh" +"${HOMEgfs}/scripts/ex${RUN}_atmos_post.sh" status=$? (( status != 0 )) && exit "${status}" diff --git a/jobs/JGLOBAL_ATMOS_SFCANL b/jobs/JGLOBAL_ATMOS_SFCANL index 8012b64a88..07a6570c74 100755 --- a/jobs/JGLOBAL_ATMOS_SFCANL +++ b/jobs/JGLOBAL_ATMOS_SFCANL @@ -7,9 +7,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "sfcanl" -c "base sfcanl" ############################################## # Set variables used in the script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} -export COMPONENT="atmos" +export CDUMP="${RUN/enkf}" if [[ ${RUN_ENVIR} = "nco" ]]; then export ROTDIR=${COMROOT:?}/${NET}/${envir} fi @@ -18,38 +16,23 @@ fi ############################################## # Begin JOB SPECIFIC work ############################################## - -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -gPDY=$(echo ${GDATE} | cut -c1-8) -gcyc=$(echo ${GDATE} | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +gPDY=${GDATE:0:8} +gcyc=${GDATE:8:2} +export GDUMP="gdas" export OPREFIX="${CDUMP}.t${cyc}z." export GPREFIX="${GDUMP}.t${gcyc}z." export APREFIX="${CDUMP}.t${cyc}z." -if [ ${RUN_ENVIR} = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN=${COMIN:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} - export COMOUT=${COMOUT:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} - export COMIN_OBS=${COMIN_OBS:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} - export COMIN_GES_OBS=${COMIN_GES_OBS:-${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/atmos} -else - export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos" - export COMIN_OBS="${COMIN_OBS:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/obs}" - export COMIN_GES_OBS="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/obs" -fi -mkdir -m 775 -p ${COMOUT} -# COMIN_GES and COMIN_GES_ENS are used in script -export COMIN_GES="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/atmos" -export COMIN_GES_ENS="${ROTDIR}/enkfgdas.${gPDY}/${gcyc}" - - -export ATMGES="${COMIN_GES}/${GPREFIX}atmf006.nc" -if [ ! -f ${ATMGES} ]; then - echo "FATAL ERROR: FILE MISSING: ATMGES = ${ATMGES}" - exit 1 -fi +YMD=${PDY} HH=${cyc} generate_com -rx COM_OBS COM_ATMOS_ANALYSIS COM_ATMOS_RESTART +RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_OBS_PREV:COM_OBS_TMPL \ + COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL ############################################################### # Run relevant script diff --git a/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC b/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC index 9a70cb968e..d5e4834851 100755 --- a/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC +++ b/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC @@ -11,8 +11,7 @@ export RUN_ENVIR=${RUN_ENVIR:-"nco"} # Set variables used in the exglobal script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} -export COMPONENT="atmos" +export CDUMP=${RUN/enkf} ############################################## @@ -33,11 +32,8 @@ export TANK_TROPCY=${TANK_TROPCY:-${DCOMROOT}} # path to tropical cyclone reco ############################################## # Define COM directories ############################################## -export COMIN=${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT} -export COMOUT=${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT} -if [ ! -d ${COMOUT} ]; then mkdir -p ${COMOUT}; fi -#export COMINgdas=${ROTDIR}/gdas.${PDY}/${cyc} -#export COMINgfs=${ROTDIR}/gfs.${PDY}/${cyc} +generate_com COM_OBS +if [[ ! -d "${COM_OBS}" ]]; then mkdir -p "${COM_OBS}"; fi export CRES=$(echo ${CASE} | cut -c2-) export LATB=$((CRES*2)) diff --git a/jobs/JGLOBAL_FORECAST b/jobs/JGLOBAL_FORECAST index 9027512761..5be44a8c97 100755 --- a/jobs/JGLOBAL_FORECAST +++ b/jobs/JGLOBAL_FORECAST @@ -6,13 +6,7 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "fcst" -c "base fcst" ############################################## # Set variables used in the script ############################################## -# Set wave variables -if [ ${DO_WAVE:-"NO"} = "YES" ]; then - # WAVE component directory - export CDUMPwave=${CDUMPwave:-${CDUMP}wave} - export COMINwave=${COMINwave:-$(compath.py ${envir}/${NET}/${gfs_ver})/${CDUMP}.${PDY}/${cyc}/wave} - export COMOUTwave=${COMOUTwave:-$(compath.py -o ${NET}/${gfs_ver})/${CDUMP}.${PDY}/${cyc}/wave} -fi +export CDUMP=${RUN/enkf} ############################################## # Begin JOB SPECIFIC work @@ -34,6 +28,45 @@ else fi +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +declare -x gPDY="${GDATE:0:8}" +declare -x gcyc="${GDATE:8:2}" + +# Construct COM variables from templates (see config.com) +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_RESTART COM_ATMOS_INPUT COM_ATMOS_ANALYSIS \ + COM_ATMOS_HISTORY COM_ATMOS_MASTER COM_TOP + +RUN=${rCDUMP} YMD="${gPDY}" HH="${gcyc}" generate_com -rx \ + COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL + +if [[ ${DO_WAVE} == "YES" ]]; then + YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_RESTART COM_WAVE_PREP COM_WAVE_HISTORY + RUN=${rCDUMP} YMD="${gPDY}" HH="${gcyc}" generate_com -rx \ + COM_WAVE_RESTART_PREV:COM_WAVE_RESTART_TMPL + declare -rx RUNwave="${RUN}wave" +fi + +if [[ ${DO_OCN} == "YES" ]]; then + YMD=${PDY} HH=${cyc} generate_com -rx COM_MED_RESTART COM_OCEAN_RESTART COM_OCEAN_INPUT \ + COM_OCEAN_HISTORY COM_OCEAN_ANALYSIS + RUN=${CDUMP} YMD="${gPDY}" HH="${gcyc}" generate_com -rx \ + COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL +fi + +if [[ ${DO_ICE} == "YES" ]]; then + YMD=${PDY} HH=${cyc} generate_com -rx COM_ICE_HISTORY COM_ICE_INPUT COM_ICE_RESTART + RUN=${CDUMP} YMD="${gPDY}" HH="${gcyc}" generate_com -rx \ + COM_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL +fi + +if [[ ${DO_AERO} == "YES" ]]; then + YMD=${PDY} HH=${cyc} generate_com -rx COM_CHEM_HISTORY +fi + + ############################################################### # Run relevant exglobal script diff --git a/jobs/JGLOBAL_WAVE_GEMPAK b/jobs/JGLOBAL_WAVE_GEMPAK index f57324607e..b7c97ce571 100755 --- a/jobs/JGLOBAL_WAVE_GEMPAK +++ b/jobs/JGLOBAL_WAVE_GEMPAK @@ -1,27 +1,22 @@ #! /usr/bin/env bash source "${HOMEgfs}/ush/preamble.sh" -source "${HOMEgfs}/ush/jjob_header.sh" -e "wavegempak" -c "base wavegempak" - -export COMPONENT="wave" +source "${HOMEgfs}/ush/jjob_header.sh" -e "wavegempak" -c "base wave wavegempak" # Add default errchk = err_chk export errchk=${errchk:-err_chk} ################################### # Set COM Paths -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}/gempak} - +################################### export DBN_ALERT_TYPE=GFS_WAVE_GEMPAK export SENDCOM=${SENDCOM:-YES} export SENDDBN=${SENDDBN:-YES} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} -if [ ${SENDCOM} = YES ] ; then - mkdir -m 775 -p ${COMOUT} -fi +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_GRID COM_WAVE_GEMPAK +if [[ ! -d ${COM_WAVE_GEMPAK} ]]; then mkdir -p "${COM_WAVE_GEMPAK}"; fi ######################################################## # Execute the script. diff --git a/jobs/JGLOBAL_WAVE_INIT b/jobs/JGLOBAL_WAVE_INIT index d1b0037bf0..49fccad66f 100755 --- a/jobs/JGLOBAL_WAVE_INIT +++ b/jobs/JGLOBAL_WAVE_INIT @@ -3,7 +3,6 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "waveinit" -c "base wave waveinit" -export COMPONENT="wave" # Add default errchk = err_chk export errchk=${errchk:-err_chk} @@ -16,13 +15,11 @@ export PARMwave=${PARMwave:-${HOMEgfs}/parm/wave} export USHwave=${USHwave:-${HOMEgfs}/ush} export EXECwave=${EXECwave:-${HOMEgfs}/exec} -# Set COM Paths and GETGES environment -export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -[[ ! -d ${COMOUT} ]] && mkdir -m 775 -p ${COMOUT} +# Set COM Paths +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_PREP if [ ${SENDCOM} = YES ]; then - mkdir -p ${COMOUT}/rundata + mkdir -m 775 -p ${COM_WAVE_PREP} fi # Set mpi serial command diff --git a/jobs/JGLOBAL_WAVE_POST_BNDPNT b/jobs/JGLOBAL_WAVE_POST_BNDPNT index ff473c08f5..9016d624d7 100755 --- a/jobs/JGLOBAL_WAVE_POST_BNDPNT +++ b/jobs/JGLOBAL_WAVE_POST_BNDPNT @@ -3,13 +3,9 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "wavepostbndpnt" -c "base wave wavepostsbs wavepostbndpnt" -export COMPONENT="wave" - # Add default errchk = err_chk export errchk=${errchk:-err_chk} -export CDATE=${PDY}${cyc} - export MP_PULSE=0 # Path to HOME Directory @@ -19,25 +15,23 @@ export USHwave=${USHwave:-${HOMEgfs}/ush} export EXECwave=${EXECwave:-${HOMEgfs}/exec} # Set COM Paths and GETGES environment -export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} - -mkdir -p ${COMOUT}/station +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_PREP COM_WAVE_HISTORY COM_WAVE_STATION +if [[ ! -d ${COM_WAVE_STATION} ]]; then mkdir -p "${COM_WAVE_STATION}"; fi # 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 -export WAV_MOD_TAG=${CDUMP}wave${waveMEMB} +export WAV_MOD_TAG=${RUN}wave${waveMEMB} export CFP_VERBOSE=1 export FHMAX_WAV_PNT=${FHMAX_WAV_IBP} export DOSPC_WAV='YES' # Spectral post export DOBLL_WAV='NO' # Bulletin post -export DOBNDPNT_WAV='YES' #not boundary points +export DOBNDPNT_WAV='YES' # Do boundary points # Execute the Script ${HOMEgfs}/scripts/exgfs_wave_post_pnt.sh diff --git a/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL b/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL index 769c738082..c193a28cf7 100755 --- a/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL +++ b/jobs/JGLOBAL_WAVE_POST_BNDPNTBLL @@ -19,21 +19,16 @@ export USHwave=${USHwave:-${HOMEgfs}/ush} export EXECwave=${EXECwave:-${HOMEgfs}/exec} # Set COM Paths and GETGES environment -export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_PREP COM_WAVE_HISTORY COM_WAVE_STATION +if [[ ! -d ${COM_WAVE_STATION} ]]; then mkdir -p "${COM_WAVE_STATION}"; fi -mkdir -p ${COMOUT}/station - - -# 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 -export WAV_MOD_TAG=${CDUMP}wave${waveMEMB} +export WAV_MOD_TAG=${RUN}wave${waveMEMB} export CFP_VERBOSE=1 diff --git a/jobs/JGLOBAL_WAVE_POST_PNT b/jobs/JGLOBAL_WAVE_POST_PNT index 41d4b95ac2..3ee1d56eef 100755 --- a/jobs/JGLOBAL_WAVE_POST_PNT +++ b/jobs/JGLOBAL_WAVE_POST_PNT @@ -3,13 +3,9 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "wavepostpnt" -c "base wave wavepostsbs wavepostpnt" -export COMPONENT="wave" - # Add default errchk = err_chk export errchk=${errchk:-err_chk} -export CDATE=${PDY}${cyc} - export MP_PULSE=0 # Path to HOME Directory @@ -19,20 +15,16 @@ export USHwave=${USHwave:-${HOMEgfs}/ush} export EXECwave=${EXECwave:-${HOMEgfs}/exec} # Set COM Paths and GETGES environment -export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} - -mkdir -p ${COMOUT}/station +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_PREP COM_WAVE_HISTORY COM_WAVE_STATION +if [[ ! -d ${COM_WAVE_STATION} ]]; then mkdir -p "${COM_WAVE_STATION}"; fi -# 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 -export WAV_MOD_TAG=${CDUMP}wave${waveMEMB} +export WAV_MOD_TAG=${RUN}wave${waveMEMB} export CFP_VERBOSE=1 diff --git a/jobs/JGLOBAL_WAVE_POST_SBS b/jobs/JGLOBAL_WAVE_POST_SBS index d656a1b9c7..47e7063db4 100755 --- a/jobs/JGLOBAL_WAVE_POST_SBS +++ b/jobs/JGLOBAL_WAVE_POST_SBS @@ -3,13 +3,9 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "wavepostsbs" -c "base wave wavepostsbs" -export COMPONENT="wave" - # Add default errchk = err_chk export errchk=${errchk:-err_chk} -export CDATE=${PDY}${cyc} - export MP_PULSE=0 # Path to HOME Directory @@ -19,14 +15,9 @@ export USHwave=${USHwave:-${HOMEgfs}/ush} export EXECwave=${EXECwave:-${HOMEgfs}/exec} # Set COM Paths and GETGES environment -export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} - -export COMINice=${COMINice:-${COMROOTp2:-${COMROOT}}/omb/prod} -export COMINwnd=${COMINwnd:-${COMROOT}/gfs/prod} -export COMIN_WAV_CUR=${COMIN_WAV_CUR:-$(compath.py ${envir}/rtofs/${rtofs_ver})} +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_PREP COM_WAVE_HISTORY COM_WAVE_GRID -mkdir -p ${COMOUT}/gridded +mkdir -p "${COM_WAVE_GRID}" # Set wave model ID tag to include member number @@ -36,7 +27,7 @@ mkdir -p ${COMOUT}/gridded membTAG='p' if [ "${waveMEMB}" == "00" ]; then membTAG='c'; fi export membTAG -export WAV_MOD_TAG=${CDUMP}wave${waveMEMB} +export WAV_MOD_TAG=${RUN}wave${waveMEMB} export CFP_VERBOSE=1 diff --git a/jobs/JGLOBAL_WAVE_PRDGEN_BULLS b/jobs/JGLOBAL_WAVE_PRDGEN_BULLS index d1bbc81e4f..794258e756 100755 --- a/jobs/JGLOBAL_WAVE_PRDGEN_BULLS +++ b/jobs/JGLOBAL_WAVE_PRDGEN_BULLS @@ -1,29 +1,22 @@ #! /usr/bin/env bash source "${HOMEgfs}/ush/preamble.sh" -source "${HOMEgfs}/ush/jjob_header.sh" -e "waveawipsbulls" -c "base waveawipsbulls" - -export COMPONENT="wave" +source "${HOMEgfs}/ush/jjob_header.sh" -e "waveawipsbulls" -c "base wave waveawipsbulls" # Add default errchk = err_chk export errchk=${errchk:-err_chk} ################################### # Set COM Paths -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}} -export PCOM=${PCOM:-${COMOUT}/wmo} - +################################### export SENDCOM=${SENDCOM:-YES} export SENDDBN_NTC=${SENDDBN_NTC:-YES} export SENDDBN=${SENDDBN:-NO} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_STATION COM_WAVE_WMO -if [ ${SENDCOM} = YES ]; then - mkdir -p ${COMOUT} ${PCOM} -fi - +if [[ ! -d ${COM_WAVE_WMO} ]]; then mkdir -p "${COM_WAVE_WMO}"; fi ################################### # Execute the Script diff --git a/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED b/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED index b3c5ce550d..a2134461da 100755 --- a/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED +++ b/jobs/JGLOBAL_WAVE_PRDGEN_GRIDDED @@ -1,9 +1,7 @@ #! /usr/bin/env bash source "${HOMEgfs}/ush/preamble.sh" -source "${HOMEgfs}/ush/jjob_header.sh" -e "waveawipsgridded" -c "base waveawipsgridded" - -export COMPONENT="wave" +source "${HOMEgfs}/ush/jjob_header.sh" -e "waveawipsgridded" -c "base wave waveawipsgridded" # Add default errchk = err_chk export errchk=${errchk:-err_chk} @@ -11,17 +9,17 @@ export errchk=${errchk:-err_chk} ################################### # Set COM Paths ################################### -export COMIN=${COMIN:-$(compath.py ${envir}/${NET}/${gfs_ver})/${RUN}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${gfs_ver}/${RUN}.${PDY})/${cyc}/${COMPONENT}} -export PCOM=${PCOM:-${COMOUT}/wmo} - export SENDCOM=${SENDCOM:-YES} export SENDDBN_NTC=${SENDDBN_NTC:-YES} export SENDDBN=${SENDDBN:-NO} export DBNROOT=${DBNROOT:-${UTILROOT}/fakedbn} +YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_GRID COM_WAVE_WMO + +if [[ ! -d ${COM_WAVE_WMO} ]]; then mkdir -p "${COM_WAVE_WMO}"; fi + if [ ${SENDCOM} = YES ]; then - mkdir -p ${COMOUT} ${PCOM} + mkdir -p "${COM_WAVE_WMO}" fi ################################### diff --git a/jobs/JGLOBAL_WAVE_PREP b/jobs/JGLOBAL_WAVE_PREP index 1b059f38f4..5ff48d886c 100755 --- a/jobs/JGLOBAL_WAVE_PREP +++ b/jobs/JGLOBAL_WAVE_PREP @@ -3,11 +3,11 @@ source "${HOMEgfs}/ush/preamble.sh" source "${HOMEgfs}/ush/jjob_header.sh" -e "waveprep" -c "base wave waveprep" -export COMPONENT="wave" - # Add default errchk = err_chk export errchk=${errchk:-err_chk} +export CDUMP=${RUN/enkf} + # Set rtofs PDY export RPDY=${PDY} @@ -23,32 +23,9 @@ export USHwave=${USHwave:-${HOMEgfs}/ush} export EXECwave=${EXECwave:-${HOMEgfs}/exec} # Set COM Paths and GETGES environment -export COMIN=${COMIN:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -export COMOUT=${COMOUT:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}} -[[ ! -d ${COMOUT} ]] && mkdir -m 775 -p ${COMOUT} - -if [ ${RUN_ENVIR} = "nco" ]; then - export COMIN_WAV_ICE=${COMIN_WAV_ICE:-$(compath.py ${envir}/obsproc/${obsproc_ver})}/${CDUMP}.${PDY}/${cyc}/atmos - export COMIN_WAV_RTOFS=${COMIN_WAV_RTOFS:-$(compath.py ${envir}/${WAVECUR_DID}/${rtofs_ver})} -else - if [ ${WW3CURINP} = "YES" ]; then - if [ ! -d ${DMPDIR}/${WAVECUR_DID}.${RPDY} ]; then export RPDY=$(${NDATE} -24 ${PDY}00 | cut -c1-8); fi - if [ ! -L ${ROTDIR}/${WAVECUR_DID}.${RPDY} ]; then # Check if symlink already exists in ROTDIR - ${NLN} ${DMPDIR}/${WAVECUR_DID}.${RPDY} ${ROTDIR}/${WAVECUR_DID}.${RPDY} - fi - BRPDY=$(${NDATE} -24 ${RPDY}00 | cut -c1-8) - if [ ! -L ${ROTDIR}/${WAVECUR_DID}.${BRPDY} ]; then # Check if symlink already exists in ROTDIR - ${NLN} ${DMPDIR}/${WAVECUR_DID}.${BRPDY} ${ROTDIR}/${WAVECUR_DID}.${BRPDY} - fi - export COMIN_WAV_RTOFS=${COMIN_WAV_RTOFS:-${ROTDIR}} - fi - if [ ${WW3ICEINP} = "YES" ]; then - if [ ! -L ${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos/${WAVICEFILE} ]; then # Check if symlink already exists in ROTDIR - ${NLN} ${DMPDIR}/${CDUMP}.${PDY}/${cyc}/atmos/${WAVICEFILE} ${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos/${WAVICEFILE} - fi - export COMIN_WAV_ICE=${COMIN_WAV_ICE:-${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos} - fi -fi +YMD=${PDY} HH=${cyc} generate_com -rx COM_OBS COM_WAVE_PREP +generate_com -rx COM_RTOFS +[[ ! -d ${COM_WAVE_PREP} ]] && mkdir -m 775 -p "${COM_WAVE_PREP}" # Execute the Script ${HOMEgfs}/scripts/exgfs_wave_prep.sh diff --git a/jobs/rocoto/awips.sh b/jobs/rocoto/awips.sh index 7ba31e0dd1..f9289255f9 100755 --- a/jobs/rocoto/awips.sh +++ b/jobs/rocoto/awips.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" ############################################################### ## Abstract: @@ -27,114 +27,49 @@ export jobid="${job}.$$" # Also, this forces us to call the config files here instead of the j-job source "${HOMEgfs}/ush/jjob_header.sh" -e "awips" -c "base awips" - -fhrlst=$(echo $FHRLST | sed -e 's/_/ /g; s/f/ /g; s/,/ /g') +fhrlst=$(echo ${FHRLST} | sed -e 's/_/ /g; s/f/ /g; s/,/ /g') ############################################################### -export COMPONENT=${COMPONENT:-atmos} -export CDATEm1=$($NDATE -24 $CDATE) -export PDYm1=$(echo $CDATEm1 | cut -c1-8) - -export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" -export DATAROOT="$RUNDIR/$CDATE/$CDUMP/awips$FHRGRP" -[[ -d $DATAROOT ]] && rm -rf $DATAROOT -mkdir -p $DATAROOT - ################################################################################ echo echo "=============== BEGIN AWIPS ===============" -export SENDCOM="YES" -export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" -export PCOM="$COMOUT/wmo" - -SLEEP_TIME=1800 -SLEEP_INT=5 -SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) -for fhr in $fhrlst; do - - if [ $fhr -gt $FHMAX_GFS ]; then - echo "Nothing to process for FHR = $fhr, cycle" +for fhr in ${fhrlst}; do + if (( fhr > FHMAX_GFS )); then + echo "Nothing to process for FHR = ${fhr}, cycle" continue fi fhmin=0 fhmax=84 - if [ $fhr -ge $fhmin -a $fhr -le $fhmax ] ; then - if [[ $(expr $fhr % 3) -eq 0 ]]; then - fhr3=$(printf %03d $((10#$fhr))) - -# Check for input file existence. If not present, sleep -# Loop SLEEP_LOOP_MAX times. Abort if not found. - ic=1 - while [[ $ic -le $SLEEP_LOOP_MAX ]]; do - if [ -s $COMOUT/$CDUMP.t${cyc}z.pgrb2b.0p25.f${fhr3}.idx ]; then - break - else - ic=$(expr $ic + 1) - sleep $SLEEP_INT - fi - if [ $ic -eq $SLEEP_LOOP_MAX ]; then - echo "***FATAL ERROR*** $COMOUT/$CDUMP.t${cyc}z.pgrb2b.0p25.f${fhr3}.idx NOT available" - export err=9 - err_chk - fi - done - - export fcsthrs=$fhr3 - # export job="jgfs_awips_f${fcsthrs}_20km_${cyc}" - # export DATA="${DATAROOT}/$job" - $AWIPS20SH - fi - - if [[ $(expr $fhr % 6) -eq 0 ]]; then - # export job="jgfs_awips_f${fcsthrs}_${cyc}" - # export DATA="${DATAROOT}/$job" - $AWIPSG2SH - fi + if (( fhr >= fhmin && fhr <= fhmax )); then + if ((fhr % 3 == 0)); then + fhr3=$(printf %03d $((10#${fhr}))) + export fcsthrs=${fhr3} + ${AWIPS20SH} + fi + + if ((fhr % 6 == 0)); then + ${AWIPSG2SH} + fi fi fhmin=90 fhmax=240 - if [ $fhr -ge $fhmin -a $fhr -le $fhmax ]; then - - if [[ $(expr $fhr % 6) -eq 0 ]]; then - fhr3=$(printf %03i $fhr) - -# Check for input file existence. If not present, sleep -# Loop SLEEP_LOOP_MAX times. Abort if not found. - ic=1 - while [[ $ic -le $SLEEP_LOOP_MAX ]]; do - if [ -s $COMOUT/$CDUMP.t${cyc}z.pgrb2b.0p25.f${fhr3}.idx ]; then - break - else - ic=$(expr $ic + 1) - sleep $SLEEP_INT - fi - if [ $ic -eq $SLEEP_LOOP_MAX ]; then - echo "***FATAL ERROR*** $COMOUT/$CDUMP.t${cyc}z.pgrb2b.0p25.f${fhr3}.idx NOT available" - export err=9 - err_chk - fi - done - - export fcsthrs=$fhr3 - # export job="jgfs_awips_f${fcsthrs}_20km_${cyc}" - # export DATA="${DATAROOT}/$job" - $AWIPS20SH - - # export job="jgfs_awips_f${fcsthrs}_${cyc}" - # export DATA="${DATAROOT}/$job" - $AWIPSG2SH - fi + if (( fhr >= fhmin && fhr <= fhmax )); then + if ((fhr % 6 == 0)); then + fhr3=$(printf %03i $((10#${fhr}))) + export fcsthrs=${fhr3} + ${AWIPS20SH} + ${AWIPSG2SH} + fi fi done ############################################################### # Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf $DATAROOT ; fi - +if [[ ${KEEPDATA:-"NO"} == "NO" ]] ; then rm -rf "${DATA}" ; fi exit 0 diff --git a/jobs/rocoto/coupled_ic.sh b/jobs/rocoto/coupled_ic.sh index 13562e8eab..bedb7e5272 100755 --- a/jobs/rocoto/coupled_ic.sh +++ b/jobs/rocoto/coupled_ic.sh @@ -44,11 +44,14 @@ error_message(){ echo "FATAL ERROR: Unable to copy ${1} to ${2} (Error code ${3})" } +YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_INPUT COM_ICE_RESTART COM_WAVE_RESTART +YMD=${gPDY} HH=${gcyc} generate_com -rx COM_OCEAN_RESTART + ############################################################### # Start staging # Stage the FV3 initial conditions to ROTDIR (cold start) -ATMdir="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos/INPUT" +ATMdir="${COM_ATMOS_INPUT}" [[ ! -d "${ATMdir}" ]] && mkdir -p "${ATMdir}" source="${BASE_CPLIC}/${CPL_ATMIC}/${PDY}${cyc}/${CDUMP}/${CASE}/INPUT/gfs_ctrl.nc" target="${ATMdir}/gfs_ctrl.nc" @@ -68,7 +71,7 @@ for ftype in gfs_data sfc_data; do done # Stage ocean initial conditions to ROTDIR (warm start) -OCNdir="${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/ocean/RESTART" +OCNdir="${COM_OCEAN_RESTART}" [[ ! -d "${OCNdir}" ]] && mkdir -p "${OCNdir}" source="${BASE_CPLIC}/${CPL_OCNIC}/${PDY}${cyc}/ocn/${OCNRES}/MOM.res.nc" target="${OCNdir}/${PDY}.${cyc}0000.MOM.res.nc" @@ -97,7 +100,7 @@ case $OCNRES in esac # Stage ice initial conditions to ROTDIR (cold start as these are SIS2 generated) -ICEdir="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ice/RESTART" +ICEdir="${COM_ICE_RESTART}" [[ ! -d "${ICEdir}" ]] && mkdir -p "${ICEdir}" ICERESdec=$(echo "${ICERES}" | awk '{printf "%0.2f", $1/100}') source="${BASE_CPLIC}/${CPL_ICEIC}/${PDY}${cyc}/ice/${ICERES}/cice5_model_${ICERESdec}.res_${PDY}${cyc}.nc" @@ -109,7 +112,7 @@ err=$((err + rc)) # Stage the WW3 initial conditions to ROTDIR (warm start; TODO: these should be placed in $RUN.$gPDY/$gcyc) if [[ "${DO_WAVE}" = "YES" ]]; then - WAVdir="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/wave/restart" + WAVdir="${COM_WAVE_RESTART}" [[ ! -d "${WAVdir}" ]] && mkdir -p "${WAVdir}" for grdID in ${waveGRD}; do # TODO: check if this is a bash array; if so adjust source="${BASE_CPLIC}/${CPL_WAVIC}/${PDY}${cyc}/wav/${grdID}/${PDY}.${cyc}0000.restart.${grdID}" diff --git a/jobs/rocoto/ocnpost.sh b/jobs/rocoto/ocnpost.sh index 54e3652b44..ee8da061f2 100755 --- a/jobs/rocoto/ocnpost.sh +++ b/jobs/rocoto/ocnpost.sh @@ -9,139 +9,112 @@ source "${HOMEgfs}/ush/preamble.sh" ############################################################### # Source FV3GFS workflow modules -. ${HOMEgfs}/ush/load_fv3gfs_modules.sh +source "${HOMEgfs}/ush/load_fv3gfs_modules.sh" status=$? -[[ ${status} -ne 0 ]] && exit ${status} +(( status != 0 )) && exit "${status}" export job="ocnpost" -export jobid=${job}.$$ - -############################################## -# make temp directory -############################################## -export DATA="${DATAROOT}/${jobid}" -[[ -d ${DATA} ]] && rm -rf ${DATA} -mkdir -p ${DATA} && cd ${DATA} - -############################################## -# Run setpdy and initialize PDY variables -############################################## -export cycle="t${cyc}z" -setpdy.sh -. ./PDY - -############################################## -# Determine Job Output Name on System -############################################## -export pid=${pid:-$$} -export pgmout="OUTPUT.${pid}" -export pgmerr=errfile - - -############################# -# Source relevant config files -############################# -config_path=${EXPDIR:-${PACKAGEROOT}/gfs.${gfs_ver}/parm/config} -configs="base ocnpost" -for config in ${configs}; do - . ${config_path}/config.${config} - status=$? - [[ ${status} -ne 0 ]] && exit ${status} -done - - -########################################## -# Source machine runtime environment -########################################## -. ${HOMEgfs}/env/${machine}.env ocnpost -status=$? -[[ ${status} -ne 0 ]] && exit ${status} - +export jobid="${job}.$$" +source "${HOMEgfs}/ush/jjob_header.sh" -e "ocnpost" -c "base ocnpost" ############################################## # Set variables used in the exglobal script ############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gfs"}} -if [ ${RUN_ENVIR} = "nco" ]; then +export CDUMP=${RUN/enkf} +if [[ ${RUN_ENVIR} = "nco" ]]; then export ROTDIR=${COMROOT:?}/${NET}/${envir} fi ############################################## # Begin JOB SPECIFIC work ############################################## -[[ ! -d ${COMOUTocean} ]] && mkdir -p ${COMOUTocean} -[[ ! -d ${COMOUTice} ]] && mkdir -p ${COMOUTice} +YMD=${PDY} HH=${cyc} generate_com -rx COM_OCEAN_HISTORY COM_OCEAN_2D COM_OCEAN_3D \ + COM_OCEAN_XSECT COM_ICE_HISTORY + +for grid in "0p50" "0p25"; do + YMD=${PDY} HH=${cyc} GRID=${grid} generate_com -rx "COM_OCEAN_GRIB_${grid}:COM_OCEAN_GRIB_TMPL" +done + +for outdir in COM_OCEAN_2D COM_OCEAN_3D COM_OCEAN_XSECT COM_OCEAN_GRIB_0p25 COM_OCEAN_GRIB_0p50; do + if [[ ! -d "${!outdir}" ]]; then + mkdir -p "${!outdir}" + fi +done fhrlst=$(echo ${FHRLST} | sed -e 's/_/ /g; s/f/ /g; s/,/ /g') export OMP_NUM_THREADS=1 export ENSMEM=${ENSMEM:-01} -export IDATE=${CDATE} +export IDATE=${PDY}${cyc} for fhr in ${fhrlst}; do - export fhr=${fhr} - VDATE=$(${NDATE} ${fhr} ${IDATE}) - # Regrid the MOM6 and CICE5 output from tripolar to regular grid via NCL - # This can take .25 degree input and convert to .5 degree - other opts avail - # The regrid scripts use CDATE for the current day, restore it to IDATE afterwards - export CDATE=${VDATE} - cd ${DATA} - if [ ${fhr} -gt 0 ]; then - export MOM6REGRID=${MOM6REGRID:-${HOMEgfs}} - ${MOM6REGRID}/scripts/run_regrid.sh - status=$? - [[ ${status} -ne 0 ]] && exit ${status} - - # Convert the netcdf files to grib2 - export executable=${MOM6REGRID}/exec/reg2grb2.x - ${MOM6REGRID}/scripts/run_reg2grb2.sh - status=$? - [[ ${status} -ne 0 ]] && exit ${status} + export fhr=${fhr} + # Ignore possible spelling error (nothing is misspelled) + # shellcheck disable=SC2153 + VDATE=$(${NDATE} "${fhr}" "${IDATE}") + # shellcheck disable= + declare -x VDATE + cd "${DATA}" || exit 2 + if (( fhr > 0 )); then + # TODO: This portion calls NCL scripts that are deprecated (see Issue #923) + if [[ "${MAKE_OCN_GRIB:-YES}" == "YES" ]]; then + export MOM6REGRID=${MOM6REGRID:-${HOMEgfs}} + "${MOM6REGRID}/scripts/run_regrid.sh" + status=$? + [[ ${status} -ne 0 ]] && exit "${status}" + # Convert the netcdf files to grib2 + export executable=${MOM6REGRID}/exec/reg2grb2.x + "${MOM6REGRID}/scripts/run_reg2grb2.sh" + status=$? + [[ ${status} -ne 0 ]] && exit "${status}" + ${NMV} "ocn_ice${VDATE}.${ENSMEM}.${IDATE}_0p25x0p25.grb2" "${COM_OCEAN_GRIB_0p25}/" + ${NMV} "ocn_ice${VDATE}.${ENSMEM}.${IDATE}_0p5x0p5.grb2" "${COM_OCEAN_GRIB_0p50}/" + fi #break up ocn netcdf into multiple files: - if [ -f ${COMOUTocean}/ocn_2D_${VDATE}.${ENSMEM}.${IDATE}.nc ]; then - echo "File ${COMOUTocean}/ocn_2D_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" + if [[ -f "${COM_OCEAN_2D}/ocn_2D_${VDATE}.${ENSMEM}.${IDATE}.nc" ]]; then + echo "File ${COM_OCEAN_2D}/ocn_2D_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" else - ncks -x -v vo,uo,so,temp ${COMOUTocean}/ocn${VDATE}.${ENSMEM}.${IDATE}.nc ${COMOUTocean}/ocn_2D_${VDATE}.${ENSMEM}.${IDATE}.nc + ncks -x -v vo,uo,so,temp \ + "${COM_OCEAN_HISTORY}/ocn${VDATE}.${ENSMEM}.${IDATE}.nc" \ + "${COM_OCEAN_2D}/ocn_2D_${VDATE}.${ENSMEM}.${IDATE}.nc" status=$? - [[ ${status} -ne 0 ]] && exit ${status} + [[ ${status} -ne 0 ]] && exit "${status}" fi - if [ -f ${COMOUTocean}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc ]; then - echo "File ${COMOUTocean}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" + if [[ -f "${COM_OCEAN_3D}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc" ]]; then + echo "File ${COM_OCEAN_3D}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" else - ncks -x -v Heat_PmE,LW,LwLatSens,MLD_003,MLD_0125,SSH,SSS,SST,SSU,SSV,SW,cos_rot,ePBL,evap,fprec,frazil,latent,lprec,lrunoff,sensible,sin_rot,speed,taux,tauy,wet_c,wet_u,wet_v ${COMOUTocean}/ocn${VDATE}.${ENSMEM}.${IDATE}.nc ${COMOUTocean}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc + ncks -x -v Heat_PmE,LW,LwLatSens,MLD_003,MLD_0125,SSH,SSS,SST,SSU,SSV,SW,cos_rot,ePBL,evap,fprec,frazil,latent,lprec,lrunoff,sensible,sin_rot,speed,taux,tauy,wet_c,wet_u,wet_v \ + "${COM_OCEAN_HISTORY}/ocn${VDATE}.${ENSMEM}.${IDATE}.nc" \ + "${COM_OCEAN_3D}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc" status=$? - [[ ${status} -ne 0 ]] && exit ${status} + [[ ${status} -ne 0 ]] && exit "${status}" fi - if [ -f ${COMOUTocean}/ocn-temp-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc ]; then - echo "File ${COMOUTocean}/ocn-temp-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" + if [[ -f "${COM_OCEAN_XSECT}/ocn-temp-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc" ]]; then + echo "File ${COM_OCEAN_XSECT}/ocn-temp-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" else - ncks -v temp -d yh,503 -d xh,-299.92,60.03 ${COMOUTocean}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc ${COMOUTocean}/ocn-temp-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc + ncks -v temp -d yh,503 -d xh,-299.92,60.03 \ + "${COM_OCEAN_3D}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc" \ + "${COM_OCEAN_XSECT}/ocn-temp-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc" status=$? - [[ ${status} -ne 0 ]] && exit ${status} + [[ ${status} -ne 0 ]] && exit "${status}" fi - if [ -f ${COMOUTocean}/ocn-uo-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc ]; then - echo "File ${COMOUTocean}/ocn-uo-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" + if [[ -f "${COM_OCEAN_XSECT}/ocn-uo-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc" ]]; then + echo "File ${COM_OCEAN_XSECT}/ocn-uo-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc already exists" else - ncks -v uo -d yh,503 -d xh,-299.92,60.03 ${COMOUTocean}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc ${COMOUTocean}/ocn-uo-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc + ncks -v uo -d yh,503 -d xh,-299.92,60.03 \ + "${COM_OCEAN_3D}/ocn_3D_${VDATE}.${ENSMEM}.${IDATE}.nc" \ + "${COM_OCEAN_XSECT}/ocn-uo-EQ_${VDATE}.${ENSMEM}.${IDATE}.nc" status=$? - [[ ${status} -ne 0 ]] && exit ${status} + [[ ${status} -ne 0 ]] && exit "${status}" fi fi - done -# Restore CDATE to what is expected -export CDATE=${IDATE} -${NMV} ocn_ice*.grb2 ${COMOUTocean}/ -status=$? -[[ ${status} -ne 0 ]] && exit ${status} - # clean up working folder -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf ${DATA} ; fi +if [[ ${KEEPDATA:-"NO"} = "NO" ]] ; then rm -rf "${DATA}" ; fi ############################################################### # Exit out cleanly diff --git a/jobs/rocoto/post.sh b/jobs/rocoto/post.sh index 1de899b7ba..e84b2b7b71 100755 --- a/jobs/rocoto/post.sh +++ b/jobs/rocoto/post.sh @@ -16,17 +16,12 @@ status=$? export job="post" export jobid="${job}.$$" -export COMPONENT="atmos" - if [ ${FHRGRP} = 'anl' ]; then fhrlst="anl" - restart_file=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}/${CDUMP}.t${cyc}z.atm else fhrlst=$(echo ${FHRLST} | sed -e 's/_/ /g; s/f/ /g; s/,/ /g') - restart_file=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}/${CDUMP}.t${cyc}z.logf fi - #--------------------------------------------------------------- for fhr in ${fhrlst}; do export post_times=${fhr} diff --git a/jobs/rocoto/prep.sh b/jobs/rocoto/prep.sh index e35721e4e6..826dec5ae7 100755 --- a/jobs/rocoto/prep.sh +++ b/jobs/rocoto/prep.sh @@ -9,49 +9,49 @@ status=$? [[ ${status} -ne 0 ]] && exit ${status} ############################################################### -# Source relevant configs -configs="base prep" -for config in ${configs}; do - . ${EXPDIR}/config.${config} - status=$? - [[ ${status} -ne 0 ]] && exit ${status} -done +export job="prep" +export jobid="${job}.$$" +source "${HOMEgfs}/ush/jjob_header.sh" -e "prep" -c "base prep" -############################################################### -# Source machine runtime environment -. ${BASE_ENV}/${machine}.env prep -status=$? -[[ ${status} -ne 0 ]] && exit ${status} +export CDUMP="${RUN/enkf}" ############################################################### # Set script and dependency variables +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +# shellcheck disable= +gPDY=${GDATE:0:8} +gcyc=${GDATE:8:2} +GDUMP="gdas" + export OPREFIX="${CDUMP}.t${cyc}z." -export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos" + +YMD=${PDY} HH=${cyc} DUMP=${CDUMP} generate_com -rx COM_OBS COM_OBSDMP + +RUN=${GDUMP} DUMP=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + COM_OBS_PREV:COM_OBS_TMPL \ + COM_OBSDMP_PREV:COM_OBSDMP_TMPL + export MAKE_PREPBUFR=${MAKE_PREPBUFR:-"YES"} -[[ ! -d ${COMOUT} ]] && mkdir -p ${COMOUT} -[[ ! -d ${COMIN_OBS} ]] && mkdir -p ${COMIN_OBS} +if [[ ! -d "${COM_OBS}" ]]; then mkdir -p "${COM_OBS}"; fi ############################################################### # If ROTDIR_DUMP=YES, copy dump files to rotdir if [[ ${ROTDIR_DUMP} = "YES" ]]; then - ${HOMEgfs}/ush/getdump.sh "${CDATE}" "${CDUMP}" "${DMPDIR}/${CDUMP}${DUMP_SUFFIX}.${PDY}/${cyc}/atmos" "${COMIN_OBS}" + "${HOMEgfs}/ush/getdump.sh" "${PDY}${cyc}" "${CDUMP}" "${COM_OBSDMP}" "${COM_OBS}" status=$? [[ ${status} -ne 0 ]] && exit ${status} -# Ensure previous cycle gdas dumps are available (used by cycle & downstream) - GDATE=$(${NDATE} -${assim_freq} ${CDATE}) - gPDY=$(echo ${GDATE} | cut -c1-8) - gcyc=$(echo ${GDATE} | cut -c9-10) - GDUMP=gdas - gCOMOBS="${ROTDIR}/${GDUMP}.${gPDY}/${gcyc}/obs" - if [[ ! -s ${gCOMOBS}/${GDUMP}.t${gcyc}z.updated.status.tm00.bufr_d ]]; then - ${HOMEgfs}/ush/getdump.sh "${GDATE}" "${GDUMP}" "${DMPDIR}/${GDUMP}${DUMP_SUFFIX}.${gPDY}/${gcyc}/atmos" "${gCOMOBS}" + # Ensure previous cycle gdas dumps are available (used by cycle & downstream) + if [[ ! -s "${COM_OBS_PREV}/${GDUMP}.t${gcyc}z.updated.status.tm00.bufr_d" ]]; then + "${HOMEgfs}/ush/getdump.sh" "${GDATE}" "${GDUMP}" "${COM_OBSDMP_PREV}" "${COM_OBS_PREV}" status=$? [[ ${status} -ne 0 ]] && exit ${status} fi # exception handling to ensure no dead link - [[ $(find ${COMIN_OBS} -xtype l | wc -l) -ge 1 ]] && exit 9 - [[ $(find ${gCOMOBS} -xtype l | wc -l) -ge 1 ]] && exit 9 + [[ $(find ${COM_OBS} -xtype l | wc -l) -ge 1 ]] && exit 9 + [[ $(find ${COM_OBS_PREV} -xtype l | wc -l) -ge 1 ]] && exit 9 fi @@ -75,40 +75,36 @@ if [[ ${PROCESS_TROPCY} = "YES" ]]; then fi fi - [[ ${ROTDIR_DUMP} = "YES" ]] && rm ${COMOUT}${CDUMP}.t${cyc}z.syndata.tcvitals.tm00 + if [[ ${ROTDIR_DUMP} = "YES" ]]; then rm "${COM_OBS}/${CDUMP}.t${cyc}z.syndata.tcvitals.tm00"; fi - ${HOMEgfs}/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC + "${HOMEgfs}/jobs/JGLOBAL_ATMOS_TROPCY_QC_RELOC" status=$? [[ ${status} -ne 0 ]] && exit ${status} else - [[ ${ROTDIR_DUMP} = "NO" ]] && cp ${DMPDIR}/${CDUMP}${DUMP_SUFFIX}.${PDY}/${cyc}/atmos/${CDUMP}.t${cyc}z.syndata.tcvitals.tm00 ${COMOUT}/ + if [[ ${ROTDIR_DUMP} = "NO" ]]; then cp "${COM_OBSDMP}/${CDUMP}.t${cyc}z.syndata.tcvitals.tm00" "${COM_OBS}/"; fi fi -# Will modify the new location later in the next PR to address issue 1198 -if [[ ${ROTDIR_DUMP} = "YES" ]]; then - mv ${COMIN_OBS}/*syndata.tcvitals.tm00 ${COMOUT} - mv ${COMIN_OBS}/*snogrb_t1534.3072.1536 ${COMOUT} - mv ${COMIN_OBS}/*seaice.5min.blend.grb ${COMOUT} -fi ############################################################### # Generate prepbufr files from dumps or copy from OPS if [[ ${MAKE_PREPBUFR} = "YES" ]]; then if [[ ${ROTDIR_DUMP} = "YES" ]]; then - rm -f ${COMIN_OBS}/${OPREFIX}prepbufr - rm -f ${COMIN_OBS}/${OPREFIX}prepbufr.acft_profiles - rm -f ${COMIN_OBS}/${OPREFIX}nsstbufr + rm -f "${COM_OBS}/${OPREFIX}prepbufr" + rm -f "${COM_OBS}/${OPREFIX}prepbufr.acft_profiles" + rm -f "${COM_OBS}/${OPREFIX}nsstbufr" fi export job="j${CDUMP}_prep_${cyc}" export DATAROOT="${RUNDIR}/${CDATE}/${CDUMP}/prepbufr" - export COMIN=${COMIN_OBS} - export COMINgdas=${COMINgdas:-${ROTDIR}/gdas.${PDY}/${cyc}/atmos} - export COMINgfs=${COMINgfs:-${ROTDIR}/gfs.${PDY}/${cyc}/atmos} - export COMOUT=${COMIN_OBS} + export COMIN=${COM_OBS} + export COMOUT=${COM_OBS} + RUN="gdas" YMD=${PDY} HH=${cyc} generate_com -rx COMINgdas:COM_ATMOS_HISTORY_TMPL + RUN="gfs" YMD=${PDY} HH=${cyc} generate_com -rx COMINgfs:COM_ATMOS_HISTORY_TMPL if [[ ${ROTDIR_DUMP} = "NO" ]]; then - COMIN_OBS=${COMIN_OBS:-${DMPDIR}/${CDUMP}${DUMP_SUFFIX}.${PDY}/${cyc}/atmos} + export COMSP=${COMSP:-"${COM_OBSDMP}/${CDUMP}.t${cyc}z."} + else + export COMSP=${COMSP:-"${COM_OBS}/${CDUMP}.t${cyc}z."} fi export COMSP=${COMSP:-${COMIN_OBS}/${CDUMP}.t${cyc}z.} @@ -117,20 +113,20 @@ if [[ ${MAKE_PREPBUFR} = "YES" ]]; then export MAKE_NSSTBUFR="NO" fi - ${HOMEobsproc}/jobs/JOBSPROC_GLOBAL_PREP + "${HOMEobsproc}/jobs/JOBSPROC_GLOBAL_PREP" status=$? [[ ${status} -ne 0 ]] && exit ${status} # If creating NSSTBUFR was disabled, copy from DMPDIR if appropriate. if [[ ${MAKE_NSSTBUFR:-"NO"} = "NO" ]]; then - [[ ${DONST} = "YES" ]] && ${NCP} ${DMPDIR}/${CDUMP}${DUMP_SUFFIX}.${PDY}/${cyc}/atmos/${OPREFIX}nsstbufr ${COMIN_OBS}/${OPREFIX}nsstbufr + if [[ ${DONST} = "YES" ]]; then ${NCP} "${COM_OBSDMP}/${OPREFIX}nsstbufr" "${COM_OBS}/${OPREFIX}nsstbufr"; fi fi else if [[ ${ROTDIR_DUMP} = "NO" ]]; then - ${NCP} ${DMPDIR}/${CDUMP}${DUMP_SUFFIX}.${PDY}/${cyc}/atmos/${OPREFIX}prepbufr ${COMIN_OBS}/${OPREFIX}prepbufr - ${NCP} ${DMPDIR}/${CDUMP}${DUMP_SUFFIX}.${PDY}/${cyc}/atmos/${OPREFIX}prepbufr.acft_profiles ${COMIN_OBS}/${OPREFIX}prepbufr.acft_profiles - [[ ${DONST} = "YES" ]] && ${NCP} ${DMPDIR}/${CDUMP}${DUMP_SUFFIX}.${PDY}/${cyc}/atmos/${OPREFIX}nsstbufr ${COMIN_OBS}/${OPREFIX}nsstbufr + ${NCP} "${COM_OBSDMP}/${OPREFIX}prepbufr" "${COM_OBS}/${OPREFIX}prepbufr" + ${NCP} "${COM_OBSDMP}/${OPREFIX}prepbufr.acft_profiles" "${COM_OBS}/${OPREFIX}prepbufr.acft_profiles" + if [[ ${DONST} = "YES" ]]; then ${NCP} "${COM_OBSDMP}/${OPREFIX}nsstbufr" "${COM_OBS}/${OPREFIX}nsstbufr"; fi fi fi diff --git a/jobs/rocoto/vrfy.sh b/jobs/rocoto/vrfy.sh index 9cbbb746b0..93d9f11c44 100755 --- a/jobs/rocoto/vrfy.sh +++ b/jobs/rocoto/vrfy.sh @@ -16,37 +16,34 @@ export jobid="${job}.$$" source "${HOMEgfs}/ush/jjob_header.sh" -e "vrfy" -c "base vrfy" ############################################################### -export COMPONENT="atmos" -CDATEm1=$(${NDATE} -24 "${CDATE}") -export CDATEm1 -PDYm1=$(echo "${CDATEm1}" | cut -c1-8) -export PDYm1 +export CDUMP="${RUN/enkf}" -CDATEm1c=$(${NDATE} -06 "${CDATE}") -PDYm1c=$(echo "${CDATEm1c}" | cut -c1-8) -pcyc=$(echo "${CDATEm1c}" | cut -c9-10) +CDATEm1=$(${NDATE} -24 "${PDY}${cyc}") +export CDATEm1 +export PDYm1=${CDATEm1:0:8} -export COMIN="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}" +CDATEm1c=$(${NDATE} -06 "${PDY}${cyc}") +PDYm1c=${CDATEm1c:0:8} +pcyc=${CDATEm1c:8:2} ############################################################### +# TODO: We can likely drop support for these dev-only grib1 precip files echo echo "=============== START TO GENERATE QUARTER DEGREE GRIB1 FILES ===============" -if [[ ${MKPGB4PRCP} = "YES" && ${CDUMP} = "gfs" ]]; then - if [[ ! -d "${ARCDIR}" ]]; then mkdir -p "${ARCDIR}" ; fi +if [[ ${MKPGB4PRCP} = "YES" && ${CDUMP} == "gfs" ]]; then + YMD=${PDY} HH=${cyc} generate_com -x COM_ATMOS_MASTER + if [ ! -d ${ARCDIR} ]; then mkdir -p ${ARCDIR} ; fi nthreads_env=${OMP_NUM_THREADS:-1} # get threads set in env export OMP_NUM_THREADS=1 - set -e - cd "${COMIN}" + cd "${COM_ATMOS_MASTER}" || exit 9 fhmax=${vhr_rain:-${FHMAX_GFS}} - fhr=0 - while [[ ${fhr} -le ${fhmax} ]]; do + for (( fhr=0; fhr <= fhmax; fhr+=6 )); do fhr2=$(printf %02i "${fhr}") fhr3=$(printf %03i "${fhr}") - fname=${CDUMP}.t${cyc}z.sfluxgrbf${fhr3}.grib2 - fileout=${ARCDIR}/pgbq${fhr2}.${CDUMP}.${CDATE}.grib2 + fname=${RUN}.t${cyc}z.sfluxgrbf${fhr3}.grib2 + fileout=${ARCDIR}/pgbq${fhr2}.${RUN}.${PDY}${cyc}.grib2 ${WGRIB2} "${fname}" -match "(:PRATE:surface:)|(:TMP:2 m above ground:)" -grib "${fileout}" - (( fhr = fhr + 6 )) done export OMP_NUM_THREADS=${nthreads_env} # revert to threads set in env fi @@ -55,20 +52,20 @@ fi ############################################################### echo echo "=============== START TO RUN MOS ===============" -if [ ${RUNMOS} = "YES" -a ${CDUMP} = "gfs" ]; then - ${RUNGFSMOSSH} ${PDY}${cyc} +if [[ "${RUNMOS}" == "YES" && "${CDUMP}" == "gfs" ]]; then + ${RUNGFSMOSSH} "${PDY}${cyc}" fi ############################################################### echo echo "=============== START TO RUN RADMON DATA EXTRACTION ===============" -if [[ ${VRFYRAD} = "YES" && ${CDUMP} = "${CDFNL}" && ${CDATE} != "${SDATE}" ]]; then + +if [[ "${VRFYRAD}" == "YES" && "${CDUMP}" == "${CDFNL}" && "${PDY}${cyc}" != "${SDATE}" ]]; then export EXP=${PSLOT} - export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}" - export TANKverf_rad="${TANKverf}/stats/${PSLOT}/${CDUMP}.${PDY}/${cyc}" - export TANKverf_radM1="${TANKverf}/stats/${PSLOT}/${CDUMP}.${PDYm1c}/${pcyc}" + export TANKverf_rad="${TANKverf}/stats/${PSLOT}/${RUN}.${PDY}/${cyc}" + export TANKverf_radM1="${TANKverf}/stats/${PSLOT}/${RUN}.${PDYm1c}/${pcyc}" export MY_MACHINE=${machine} ${VRFYRADSH} @@ -79,12 +76,11 @@ fi ############################################################### echo echo "=============== START TO RUN OZMON DATA EXTRACTION ===============" -if [[ ${VRFYOZN} = "YES" && ${CDUMP} = "${CDFNL}" && ${CDATE} != "${SDATE}" ]]; then +if [[ "${VRFYOZN}" == "YES" && "${CDUMP}" == "${CDFNL}" && "${PDY}${cyc}" != "${SDATE}" ]]; then export EXP=${PSLOT} - export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}" - export TANKverf_ozn="${TANKverf_ozn}/stats/${PSLOT}/${CDUMP}.${PDY}/${cyc}" - export TANKverf_oznM1="${TANKverf_ozn}/stats/${PSLOT}/${CDUMP}.${PDYm1c}/${pcyc}" + export TANKverf_ozn="${TANKverf_ozn}/stats/${PSLOT}/${RUN}.${PDY}/${cyc}" + export TANKverf_oznM1="${TANKverf_ozn}/stats/${PSLOT}/${RUN}.${PDYm1c}/${pcyc}" export MY_MACHINE=${machine} ${VRFYOZNSH} @@ -95,11 +91,10 @@ fi ############################################################### echo echo "=============== START TO RUN MINMON ===============" -if [[ ${VRFYMINMON} = "YES" && ${CDATE} != "${SDATE}" ]]; then +if [[ "${VRFYMINMON}" == "YES" && "${PDY}${cyc}" != "${SDATE}" ]]; then - export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}" - export M_TANKverfM0="${M_TANKverf}/stats/${PSLOT}/${CDUMP}.${PDY}/${cyc}" - export M_TANKverfM1="${M_TANKverf}/stats/${PSLOT}/${CDUMP}.${PDYm1c}/${pcyc}" + export M_TANKverfM0="${M_TANKverf}/stats/${PSLOT}/${RUN}.${PDY}/${cyc}" + export M_TANKverfM1="${M_TANKverf}/stats/${PSLOT}/${RUN}.${PDYm1c}/${pcyc}" export MY_MACHINE=${machine} ${VRFYMINSH} diff --git a/jobs/rocoto/wavegempak.sh b/jobs/rocoto/wavegempak.sh index 325762a19b..58fbcdcc5b 100755 --- a/jobs/rocoto/wavegempak.sh +++ b/jobs/rocoto/wavegempak.sh @@ -7,6 +7,9 @@ source $HOMEgfs/ush/load_fv3gfs_modules.sh status=$? [[ $status -ne 0 ]] && exit $status +export job="post" +export jobid="${job}.$$" + ############################################################### # Execute the JJOB $HOMEgfs/jobs/JGLOBAL_WAVE_GEMPAK diff --git a/modulefiles/module_base.hera.lua b/modulefiles/module_base.hera.lua index 4bb16ed442..13f08d3cd9 100644 --- a/modulefiles/module_base.hera.lua +++ b/modulefiles/module_base.hera.lua @@ -28,7 +28,7 @@ load(pathJoin("crtm", "2.4.0")) load(pathJoin("wgrib2", "2.0.8")) setenv("WGRIB2","wgrib2") -prepend_path("MODULEPATH", pathJoin("/scratch1/NCEPDEV/global/glopara/git/prepobs/v1.0.1/modulefiles")) +prepend_path("MODULEPATH", pathJoin("/scratch1/NCEPDEV/global/glopara/git/prepobs/feature-GFSv17_com_reorg/modulefiles")) load(pathJoin("prepobs", "1.0.1")) prepend_path("MODULEPATH", pathJoin("/scratch1/NCEPDEV/global/glopara/git/Fit2Obs/v1.0.0/modulefiles")) diff --git a/modulefiles/module_base.jet.lua b/modulefiles/module_base.jet.lua index 5a543a3329..d22cdbf0ca 100644 --- a/modulefiles/module_base.jet.lua +++ b/modulefiles/module_base.jet.lua @@ -35,6 +35,8 @@ load(pathJoin("prepobs", "1.0.1")) prepend_path("MODULEPATH", "/contrib/anaconda/modulefiles") load(pathJoin("anaconda", "5.3.1")) +prepend_path("MODULEPATH", pathJoin("/lfs4/HFIP/hfv3gfs/glopara/git/prepobs/feature-GFSv17_com_reorg/modulefiles")) +load(pathJoin("prepobs", "1.0.1")) prepend_path("MODULEPATH", pathJoin("/lfs4/HFIP/hfv3gfs/glopara/git/Fit2Obs/v1.0.0/modulefiles")) load(pathJoin("fit2obs", "1.0.0")) diff --git a/modulefiles/module_base.orion.lua b/modulefiles/module_base.orion.lua index 77a7486da4..d5cdb5b00c 100644 --- a/modulefiles/module_base.orion.lua +++ b/modulefiles/module_base.orion.lua @@ -27,7 +27,7 @@ load(pathJoin("crtm", "2.4.0")) load(pathJoin("wgrib2", "2.0.8")) setenv("WGRIB2","wgrib2") -prepend_path("MODULEPATH", pathJoin("/work/noaa/global/glopara/git/prepobs/v1.0.1/modulefiles")) +prepend_path("MODULEPATH", pathJoin("/work/noaa/global/glopara/git/prepobs/feature-GFSv17_com_reorg/modulefiles")) load(pathJoin("prepobs", "1.0.1")) prepend_path("MODULEPATH", pathJoin("/work/noaa/global/glopara/git/Fit2Obs/v1.0.0/modulefiles")) diff --git a/modulefiles/module_base.s4.lua b/modulefiles/module_base.s4.lua index 35c00d83c6..5bd0f1d6fb 100644 --- a/modulefiles/module_base.s4.lua +++ b/modulefiles/module_base.s4.lua @@ -28,7 +28,7 @@ load(pathJoin("crtm", "2.4.0")) load(pathJoin("wgrib2", "2.0.8")) setenv("WGRIB2","wgrib2") -prepend_path("MODULEPATH", pathJoin("/data/prod/glopara/git/prepobs/v1.0.1/modulefiles")) +prepend_path("MODULEPATH", pathJoin("/data/prod/glopara/git/prepobs/feature-GFSv17_com_reorg/modulefiles")) load(pathJoin("prepobs", "1.0.1")) prepend_path("MODULEPATH", pathJoin("/data/prod/glopara/git/Fit2Obs/v1.0.0/modulefiles")) diff --git a/modulefiles/module_base.wcoss2.lua b/modulefiles/module_base.wcoss2.lua index c015bb8af2..a6f3f4679c 100644 --- a/modulefiles/module_base.wcoss2.lua +++ b/modulefiles/module_base.wcoss2.lua @@ -31,7 +31,7 @@ load(pathJoin("ncdiag", "1.0.0")) load(pathJoin("crtm", "2.4.0")) load(pathJoin("wgrib2", "2.0.7")) -prepend_path("MODULEPATH", pathJoin("/lfs/h2/emc/global/save/emc.global/git/prepobs/v1.0.1/modulefiles")) +prepend_path("MODULEPATH", pathJoin("/lfs/h2/emc/global/save/emc.global/git/prepobs/feature-GFSv17_com_reorg/modulefiles")) load(pathJoin("prepobs", "1.0.1")) prepend_path("MODULEPATH", pathJoin("/lfs/h2/emc/global/save/emc.global/git/Fit2Obs/v1.0.0/modulefiles")) diff --git a/parm/config/config.anal b/parm/config/config.anal index 4cbe22ea11..018bab9597 100644 --- a/parm/config/config.anal +++ b/parm/config/config.anal @@ -53,25 +53,6 @@ export OBERROR=${FIXgsi}/prepobs_errtable.global # Use experimental dumps in EMC GFS v16 parallels if [[ ${RUN_ENVIR} == "emc" ]]; then - export ABIBF="/dev/null" - if [[ "${CDATE}" -ge "2019022800" ]] ; then - export ABIBF="${COMIN_OBS}/${CDUMP}.t${cyc}z.gsrcsr.tm00.bufr_d" - fi - - export AHIBF="/dev/null" - if [[ "${CDATE}" -ge "2019042300" ]]; then - export AHIBF="${COMIN_OBS}/${CDUMP}.t${cyc}z.ahicsr.tm00.bufr_d" - fi - - export HDOB="${COMIN_OBS}/${CDUMP}.t${cyc}z.hdob.tm00.bufr_d" - - # Use dumps from NCO GFS v16 parallel - if [[ "${CDATE}" -ge "2020103012" ]]; then - export ABIBF="" - export AHIBF="" - export HDOB="" - fi - # Set info files and prepobs.errtable.global for GFS v16 retrospective parallels if [[ "${CDATE}" -ge "2019021900" && "${CDATE}" -lt "2019110706" ]]; then export CONVINFO=${FIXgsi}/gfsv16_historical/global_convinfo.txt.2019021900 diff --git a/parm/config/config.base.emc.dyn b/parm/config/config.base.emc.dyn index 51f60bab13..0af91daaed 100644 --- a/parm/config/config.base.emc.dyn +++ b/parm/config/config.base.emc.dyn @@ -119,19 +119,9 @@ export RUN=${RUN:-${CDUMP:-"gfs"}} # RUN is defined in the job-card (ecf); CDUM # TODO: determine where is RUN actually used in the workflow other than here # TODO: is it possible to replace all instances of ${CDUMP} to ${RUN} to be # consistent w/ EE2? -export COMIN_OBS=${COMIN_OBS:-${ROTDIR}/${CDUMP/enkf}.${PDY}/${cyc}/obs} -export COMIN_GES_OBS=${COMIN_GES_OBS:-${ROTDIR}/${CDUMP/enkf}.${PDY}/${cyc}/obs} - -export COMINatmos=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos -export COMOUTatmos=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos -export COMINwave=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/wave -export COMOUTwave=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/wave -export COMINocean=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ocean -export COMOUTocean=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ocean -export COMINice=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ice -export COMOUTice=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ice -export COMINaero=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/chem -export COMOUTaero=${ROTDIR}/${CDUMP}.${PDY}/${cyc}/chem + +# Get all the COM path templates +source "${EXPDIR}/config.com" export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} export LOGSCRIPT=${LOGSCRIPT:-""} @@ -141,7 +131,7 @@ export REDOUT="1>" export REDERR="2>" export SENDECF=${SENDECF:-"NO"} -export SENDCOM=${SENDCOM:-"NO"} +export SENDCOM=${SENDCOM:-"YES"} export SENDSDM=${SENDSDM:-"NO"} export SENDDBN_NTC=${SENDDBN_NTC:-"NO"} export SENDDBN=${SENDDBN:-"NO"} @@ -381,7 +371,7 @@ export binary_diag=".false." # Verification options export DO_METP="YES" # Run METPLUS jobs - set METPLUS settings in config.metp -export DO_FIT2OBS="YES" # Run fit to observations package +export DO_FIT2OBS="NO" # Run fit to observations package # Archiving options export HPSSARCH="@HPSSARCH@" # save data to HPSS archive diff --git a/parm/config/config.com b/parm/config/config.com new file mode 100644 index 0000000000..52652c53c0 --- /dev/null +++ b/parm/config/config.com @@ -0,0 +1,91 @@ +# shellcheck shell=bash +# Ignore shellcheck warnings about variables not being expanded; this is what we want +# shellcheck disable=SC2016 +echo "BEGIN: config.com" + +# These are just templates. All templates must use single quotations so variable +# expansion does not occur when this file is sourced. Substitution happens later +# during runtime. It is recommended to use the helper function `generate_com()`, +# to do this substitution, which is defined in `ush/preamble.sh`. +# +# Syntax for generate_com(): +# generate_com [-rx] $var1[:$tmpl1] [$var2[:$tmpl2]] [...]] +# +# options: +# -r: Make variable read-only (same as `decalre -r`) +# -x: Mark variable for declare -rx (same as `declare -x`) +# var1, var2, etc: Variable names whose values will be generated from a template +# and declared +# tmpl1, tmpl2, etc: Specify the template to use (default is "${var}_TMPL") +# +# Examples: +# # Current cycle and RUN +# YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS +# +# # Previous cycle and gdas +# RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ +# COM_ATMOS_HISTORY_PREV:COM_ATMOS_HISTORY_TMPL +# +# # Current cycle and COM for first member +# MEMDIR='mem001' YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_HISTORY +# + +# +# If any restart, input, or analysis template is updated, `setup_expt.py.fill_COMROT_cycled()` +# must correspondingly be updated to match. +# +if [[ "${RUN_ENVIR:-emc}" == "nco" ]]; then + COM_OBS_TMPL=$(compath.py "${envir}/obsproc/${obsproc_ver}")'/${RUN}.${YMD}/${HH}/atmos' + COM_RTOFS_TMPL=$(compath.py "${envir}/${WAVECUR_DID}/${rtofs_ver}") +else + COM_OBS_TMPL='${ROTDIR}/${RUN}.${YMD}/${HH}/obs' + COM_RTOFS_TMPL='${DMPDIR}' +fi +declare -rx COM_OBS_TMPL COM_RTOFS_TMPL +declare -rx COM_OBSDMP_TMPL='${DMPDIR}/${DUMP}${DUMP_SUFFIX}.${YMD}/${HH}/atmos' + +COM_BASE='${ROTDIR}/${RUN}.${YMD}/${HH}/${MEMDIR}' + +declare -rx COM_TOP_TMPL='${ROTDIR}/${RUN}.${YMD}/${HH}' + +declare -rx COM_ATMOS_INPUT_TMPL=${COM_BASE}'/model_data/atmos/input' +declare -rx COM_ATMOS_RESTART_TMPL=${COM_BASE}'/model_data/atmos/restart' +declare -rx COM_ATMOS_ANALYSIS_TMPL=${COM_BASE}'/analysis/atmos' +declare -rx COM_ATMOS_HISTORY_TMPL=${COM_BASE}'/model_data/atmos/history' +declare -rx COM_ATMOS_MASTER_TMPL=${COM_BASE}'/model_data/atmos/master' +declare -rx COM_ATMOS_GRIB_TMPL=${COM_BASE}'/products/atmos/grib2/${GRID}' +declare -rx COM_ATMOS_BUFR_TMPL=${COM_BASE}'/products/atmos/bufr' +declare -rx COM_ATMOS_GEMPAK_TMPL=${COM_BASE}'/products/atmos/gempak/${GRID}' +declare -rx COM_ATMOS_GENESIS_TMPL=${COM_BASE}'/products/atmos/cyclone/genesis_vital' +declare -rx COM_ATMOS_TRACK_TMPL=${COM_BASE}'/products/atmos/cyclone/tracks' +declare -rx COM_ATMOS_GOES_TMPL=${COM_BASE}'/products/atmos/goes_sim' +declare -rx COM_ATMOS_IMAGERY_TMPL=${COM_BASE}'/products/atmos/imagery' +declare -rx COM_ATMOS_MINMON_TMPL=${COM_BASE}'/products/atmos/minmon' +declare -rx COM_ATMOS_WAFS_TMPL=${COM_BASE}'/products/atmos/wafs' +declare -rx COM_ATMOS_WMO_TMPL=${COM_BASE}'/products/atmos/wmo' + +declare -rx COM_WAVE_RESTART_TMPL=${COM_BASE}'/model_data/wave/restart' +declare -rx COM_WAVE_PREP_TMPL=${COM_BASE}'/model_data/wave/prep' +declare -rx COM_WAVE_HISTORY_TMPL=${COM_BASE}'/model_data/wave/history' +declare -rx COM_WAVE_GRID_TMPL=${COM_BASE}'/products/wave/gridded' +declare -rx COM_WAVE_STATION_TMPL=${COM_BASE}'/products/wave/station' +declare -rx COM_WAVE_GEMPAK_TMPL=${COM_BASE}'/products/wave/gempak' +declare -rx COM_WAVE_WMO_TMPL=${COM_BASE}'/products/wave/wmo' + +declare -rx COM_OCEAN_HISTORY_TMPL=${COM_BASE}'/model_data/ocean/history' +declare -rx COM_OCEAN_RESTART_TMPL=${COM_BASE}'/model_data/ocean/restart' +declare -rx COM_OCEAN_INPUT_TMPL=${COM_BASE}'/model_data/ocean/input' +declare -rx COM_OCEAN_ANALYSIS_TMPL=${COM_BASE}'/analysis/ocean' +declare -rx COM_OCEAN_2D_TMPL=${COM_BASE}'/products/ocean/2D' +declare -rx COM_OCEAN_3D_TMPL=${COM_BASE}'/products/ocean/3D' +declare -rx COM_OCEAN_DAILY_TMPL=${COM_BASE}'/products/ocean/daily' +declare -rx COM_OCEAN_XSECT_TMPL=${COM_BASE}'/products/ocean/xsect' +declare -rx COM_OCEAN_GRIB_TMPL=${COM_BASE}'/products/ocean/grib2/${GRID}' + +declare -rx COM_ICE_INPUT_TMPL=${COM_BASE}'/model_data/ice/input' +declare -rx COM_ICE_HISTORY_TMPL=${COM_BASE}'/model_data/ice/history' +declare -rx COM_ICE_RESTART_TMPL=${COM_BASE}'/model_data/ice/restart' + +declare -rx COM_CHEM_HISTORY_TMPL=${COM_BASE}'/model_data/chem/history' + +declare -rx COM_MED_RESTART_TMPL=${COM_BASE}'/model_data/med/restart' diff --git a/parm/config/config.vrfy b/parm/config/config.vrfy index e2cf18d01e..c277e8e963 100644 --- a/parm/config/config.vrfy +++ b/parm/config/config.vrfy @@ -66,7 +66,7 @@ fi # Cyclone genesis and cyclone track verification #------------------------------------------------- -export ens_tracker_ver=v1.1.15.6 +export ens_tracker_ver=feature-GFSv17_com_reorg # TODO - temporary ahead of new tag/version export HOMEens_tracker=$BASE_GIT/TC_tracker/${ens_tracker_ver} if [[ "${VRFYTRAK}" = "YES" ]]; then diff --git a/parm/config/config.wave b/parm/config/config.wave index 5cc55e5542..658c4b40ae 100644 --- a/parm/config/config.wave +++ b/parm/config/config.wave @@ -19,7 +19,7 @@ export USHwave="$HOMEgfs/ush" # Some others are also used across the workflow in wave component scripts # General runtime labels -export CDUMPwave="${CDUMP}wave" +export CDUMPwave="${RUN}wave" # In GFS/GDAS, restart files are generated/read from gdas runs export CDUMPRSTwave="gdas" diff --git a/parm/config/config.waveawipsbulls b/parm/config/config.waveawipsbulls index e3748e9cd1..fd21869355 100644 --- a/parm/config/config.waveawipsbulls +++ b/parm/config/config.waveawipsbulls @@ -10,8 +10,5 @@ echo "BEGIN: config.waveawipsbulls" export DBNROOT=/dev/null export SENDCOM="YES" -export COMPONENT=${COMPONENT:-wave} -export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" -export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" echo "END: config.waveawipsbulls" diff --git a/parm/config/config.waveawipsgridded b/parm/config/config.waveawipsgridded index e84352558e..6896ec8bd2 100644 --- a/parm/config/config.waveawipsgridded +++ b/parm/config/config.waveawipsgridded @@ -10,8 +10,5 @@ echo "BEGIN: config.waveawipsgridded" export DBNROOT=/dev/null export SENDCOM="YES" -export COMPONENT=${COMPONENT:-wave} -export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" -export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" echo "END: config.waveawipsgridded" diff --git a/parm/config/config.wavegempak b/parm/config/config.wavegempak index 66af59f2a4..da76c364ce 100644 --- a/parm/config/config.wavegempak +++ b/parm/config/config.wavegempak @@ -9,8 +9,5 @@ echo "BEGIN: config.wavegempak" . $EXPDIR/config.resources wavegempak export SENDCOM="YES" -export COMPONENT=${COMPONENT:-wave} -export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" -export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT/gempak" echo "END: config.wavegempak" diff --git a/scripts/exgdas_atmos_chgres_forenkf.sh b/scripts/exgdas_atmos_chgres_forenkf.sh index f99979bc77..25d034ef47 100755 --- a/scripts/exgdas_atmos_chgres_forenkf.sh +++ b/scripts/exgdas_atmos_chgres_forenkf.sh @@ -65,22 +65,22 @@ SIGLEVEL=${SIGLEVEL:-${FIXgsm}/global_hyblev.l${LEVS}.txt} APREFIX=${APREFIX:-""} APREFIX_ENS=${APREFIX_ENS:-""} # at full resolution -ATMF03=${ATMF03:-${COMOUT}/${APREFIX}atmf003.nc} -ATMF04=${ATMF04:-${COMOUT}/${APREFIX}atmf004.nc} -ATMF05=${ATMF05:-${COMOUT}/${APREFIX}atmf005.nc} -ATMF06=${ATMF06:-${COMOUT}/${APREFIX}atmf006.nc} -ATMF07=${ATMF07:-${COMOUT}/${APREFIX}atmf007.nc} -ATMF08=${ATMF08:-${COMOUT}/${APREFIX}atmf008.nc} -ATMF09=${ATMF09:-${COMOUT}/${APREFIX}atmf009.nc} +ATMF03=${ATMF03:-${COM_ATMOS_HISTORY}/${APREFIX}atmf003.nc} +ATMF04=${ATMF04:-${COM_ATMOS_HISTORY}/${APREFIX}atmf004.nc} +ATMF05=${ATMF05:-${COM_ATMOS_HISTORY}/${APREFIX}atmf005.nc} +ATMF06=${ATMF06:-${COM_ATMOS_HISTORY}/${APREFIX}atmf006.nc} +ATMF07=${ATMF07:-${COM_ATMOS_HISTORY}/${APREFIX}atmf007.nc} +ATMF08=${ATMF08:-${COM_ATMOS_HISTORY}/${APREFIX}atmf008.nc} +ATMF09=${ATMF09:-${COM_ATMOS_HISTORY}/${APREFIX}atmf009.nc} # at ensemble resolution -ATMF03ENS=${ATMF03ENS:-${COMOUT}/${APREFIX}atmf003.ensres.nc} -ATMF04ENS=${ATMF04ENS:-${COMOUT}/${APREFIX}atmf004.ensres.nc} -ATMF05ENS=${ATMF05ENS:-${COMOUT}/${APREFIX}atmf005.ensres.nc} -ATMF06ENS=${ATMF06ENS:-${COMOUT}/${APREFIX}atmf006.ensres.nc} -ATMF07ENS=${ATMF07ENS:-${COMOUT}/${APREFIX}atmf007.ensres.nc} -ATMF08ENS=${ATMF08ENS:-${COMOUT}/${APREFIX}atmf008.ensres.nc} -ATMF09ENS=${ATMF09ENS:-${COMOUT}/${APREFIX}atmf009.ensres.nc} -ATMFCST_ENSRES=${ATMFCST_ENSRES:-${COMOUT_ENS}/mem001/atmos/${APREFIX_ENS}atmf006.nc} +ATMF03ENS=${ATMF03ENS:-${COM_ATMOS_HISTORY}/${APREFIX}atmf003.ensres.nc} +ATMF04ENS=${ATMF04ENS:-${COM_ATMOS_HISTORY}/${APREFIX}atmf004.ensres.nc} +ATMF05ENS=${ATMF05ENS:-${COM_ATMOS_HISTORY}/${APREFIX}atmf005.ensres.nc} +ATMF06ENS=${ATMF06ENS:-${COM_ATMOS_HISTORY}/${APREFIX}atmf006.ensres.nc} +ATMF07ENS=${ATMF07ENS:-${COM_ATMOS_HISTORY}/${APREFIX}atmf007.ensres.nc} +ATMF08ENS=${ATMF08ENS:-${COM_ATMOS_HISTORY}/${APREFIX}atmf008.ensres.nc} +ATMF09ENS=${ATMF09ENS:-${COM_ATMOS_HISTORY}/${APREFIX}atmf009.ensres.nc} +ATMFCST_ENSRES=${ATMFCST_ENSRES:-${COM_ATMOS_HISTORY_MEM}/${APREFIX_ENS}atmf006.nc} # Set script / GSI control parameters DOHYBVAR=${DOHYBVAR:-"NO"} @@ -102,16 +102,7 @@ fi ################################################################################ ################################################################################ -# Preprocessing -mkdata=NO -if [ ! -d $DATA ]; then - mkdata=YES - mkdir -p $DATA -fi - -cd $DATA || exit 99 -############################################################## # get resolution information LONB_ENKF=${LONB_ENKF:-$($NCLEN $ATMFCST_ENSRES grid_xt)} # get LONB_ENKF LATB_ENKF=${LATB_ENKF:-$($NCLEN $ATMFCST_ENSRES grid_yt)} # get LATB_ENFK @@ -196,7 +187,5 @@ fi ################################################################################ # Postprocessing cd $pwd -[[ $mkdata = "YES" ]] && rm -rf $DATA - exit $err diff --git a/scripts/exgdas_atmos_nawips.sh b/scripts/exgdas_atmos_nawips.sh index 9251852892..725cb0223f 100755 --- a/scripts/exgdas_atmos_nawips.sh +++ b/scripts/exgdas_atmos_nawips.sh @@ -16,6 +16,7 @@ cd $DATA RUN2=$1 fend=$2 DBN_ALERT_TYPE=$3 +destination=$4 DATA_RUN=$DATA/$RUN2 mkdir -p $DATA_RUN @@ -77,18 +78,18 @@ while [ $fhcnt -le $fend ] ; do GEMGRD=${RUN2}_${PDY}${cyc}f${fhr3} - if [ $RUN2 = "gdas_0p25" ]; then - export GRIBIN=$COMIN/${model}.${cycle}.pgrb2.0p25.f${fhr} - if [ ! -f $GRIBIN ] ; then - echo "WARNING: $GRIBIN FILE is missing" + if [[ ${RUN2} = "gdas_0p25" ]]; then + export GRIBIN=${COM_ATMOS_GRIB_0p25}/${model}.${cycle}.pgrb2.0p25.f${fhr} + if [[ ! -f ${GRIBIN} ]] ; then + echo "WARNING: ${GRIBIN} FILE is missing" fi - GRIBIN_chk=$COMIN/${model}.${cycle}.pgrb2.0p25.f${fhr}.idx + GRIBIN_chk=${COM_ATMOS_GRIB_0p25}${model}.${cycle}.pgrb2.0p25.f${fhr}.idx else - export GRIBIN=$COMIN/${model}.${cycle}.pgrb2.1p00.f${fhr} - if [ ! -f $GRIBIN ] ; then - echo "WARNING: $GRIBIN FILE is missing" + export GRIBIN=${COM_ATMOS_GRIB_1p00}/${model}.${cycle}.pgrb2.1p00.f${fhr} + if [[ ! -f ${GRIBIN} ]] ; then + echo "WARNING: ${GRIBIN} FILE is missing" fi - GRIBIN_chk=$COMIN/${model}.${cycle}.pgrb2.1p00.f${fhr}.idx + GRIBIN_chk=${COM_ATMOS_GRIB_1p00}/${model}.${cycle}.pgrb2.1p00.f${fhr}.idx fi icnt=1 @@ -135,17 +136,17 @@ EOF export err=$?;err_chk if [ $SENDCOM = "YES" ] ; then - cp $GEMGRD $COMOUT/.$GEMGRD + cp "${GEMGRD}" "${destination}/.${GEMGRD}" export err=$? - if [[ $err -ne 0 ]] ; then - echo " File $GEMGRD does not exist." - exit $err + if [[ ${err} -ne 0 ]] ; then + echo " File ${GEMGRD} does not exist." + exit "${err}" fi - mv $COMOUT/.$GEMGRD $COMOUT/$GEMGRD - if [ $SENDDBN = "YES" ] ; then - $DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job \ - $COMOUT/$GEMGRD + mv "${destination}/.${GEMGRD}" "${destination}/${GEMGRD}" + if [[ ${SENDDBN} = "YES" ]] ; then + "${DBNROOT}/bin/dbn_alert" MODEL "${DBN_ALERT_TYPE}" "${job}" \ + "${destination}/${GEMGRD}" else echo "##### DBN_ALERT_TYPE is: ${DBN_ALERT_TYPE} #####" fi diff --git a/scripts/exgdas_atmos_post.sh b/scripts/exgdas_atmos_post.sh index 895765c970..dd72c5a33e 100755 --- a/scripts/exgdas_atmos_post.sh +++ b/scripts/exgdas_atmos_post.sh @@ -49,8 +49,7 @@ export JO=${LATB:-721} # specify default model output format: 3 for sigio and 4 # for nemsio export OUTTYP=${OUTTYP:-4} -export TCYC=${TCYC:-".t${cyc}z."} -export PREFIX=${PREFIX:-${RUN}${TCYC}} +export PREFIX=${PREFIX:-${RUN}.t${cyc}z.} export machine=${machine:-WCOSS2} ########################### @@ -69,7 +68,7 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Chuang: modify to process analysis when post_times is 00 stime="$(echo "${post_times}" | cut -c1-3)" export stime -export loganl="${COMIN}/${PREFIX}atmanl.nc" +export loganl="${COM_ATMOS_ANALYSIS}/${PREFIX}atmanl.nc" if [[ "${stime}" = "anl" ]]; then if [[ -f "${loganl}" ]]; then @@ -100,9 +99,9 @@ if [[ "${stime}" = "anl" ]]; then [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile - ln -fs "${COMIN}/${PREFIX}atmanl.nc" nemsfile + ln -fs "${COM_ATMOS_ANALYSIS}/${PREFIX}atmanl.nc" nemsfile export NEMSINP=nemsfile - ln -fs "${COMIN}/${PREFIX}sfcanl.nc" flxfile + ln -fs "${COM_ATMOS_ANALYSIS}/${PREFIX}sfcanl.nc" flxfile export FLXINP=flxfile export PGBOUT=pgbfile export PGIOUT=pgifile @@ -117,7 +116,6 @@ if [[ "${stime}" = "anl" ]]; then ${POSTGPSH} export err=$?; err_chk - if [[ "${GRIBVERSION}" = 'grib2' ]]; then mv "${PGBOUT}" "${PGBOUT2}" @@ -126,28 +124,25 @@ if [[ "${stime}" = "anl" ]]; then export downset=${downset:-1} ${GFSDOWNSH} export err=$?; err_chk - - export fhr3=anl fi if [[ "${SENDCOM}" = 'YES' ]]; then - export fhr3=anl if [[ "${GRIBVERSION}" = 'grib2' ]]; then - MASTERANL=${PREFIX}master.grb2${fhr3} + MASTERANL=${PREFIX}master.grb2anl ##########XXW Accord to Boi, fortran index should use *if${fhr}, wgrib index use .idx #MASTERANLIDX=${RUN}.${cycle}.master.grb2${fhr3}.idx - MASTERANLIDX=${PREFIX}master.grb2i${fhr3} - cp "${PGBOUT2}" "${COMOUT}/${MASTERANL}" - ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" + MASTERANLIDX=${PREFIX}master.grb2ianl + cp "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERANL}" + ${GRB2INDEX} "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERANLIDX}" fi if [[ "${SENDDBN}" = 'YES' ]]; then run="$(echo "${RUN}" | tr '[:lower:]' '[:upper:]')" if [[ "${GRIBVERSION}" = 'grib2' ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_MSC_sfcanl" "${job}" "${COMOUT}/${PREFIX}sfc${fhr3}.nc" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SA" "${job}" "${COMIN}/${PREFIX}atm${fhr3}.nc" - "${DBNROOT}/bin/dbn_alert" MODEL "GDAS_PGA_GB2" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}" - "${DBNROOT}/bin/dbn_alert" MODEL "GDAS_PGA_GB2_WIDX" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.${fhr3}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_MSC_sfcanl" "${job}" "${COM_ATMOS_ANALYSIS}/${PREFIX}sfcanl.nc" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SA" "${job}" "${COM_ATMOS_ANALYSIS}/${PREFIX}atmanl.nc" + "${DBNROOT}/bin/dbn_alert" MODEL "GDAS_PGA_GB2" "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.anl" + "${DBNROOT}/bin/dbn_alert" MODEL "GDAS_PGA_GB2_WIDX" "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.anl.idx" fi fi fi @@ -199,9 +194,9 @@ else ## not_anl if_stimes ############################### [[ -f flxfile ]] && rm flxfile [[ -f nemsfile ]] && rm nemsfile - ln -sf "${COMIN}/${PREFIX}atmf${fhr}.nc" nemsfile + ln -sf "${COM_ATMOS_HISTORY}/${PREFIX}atmf${fhr}.nc" nemsfile export NEMSINP=nemsfile - ln -sf "${COMIN}/${PREFIX}sfcf${fhr}.nc" flxfile + ln -sf "${COM_ATMOS_HISTORY}/${PREFIX}sfcf${fhr}.nc" flxfile export FLXINP=flxfile if (( d_fhr > 0 )); then @@ -265,7 +260,7 @@ else ## not_anl if_stimes if [[ "${INLINE_POST}" = ".false." ]]; then ${POSTGPSH} else - cp "${COMOUT}/${MASTERFHR}" "${PGBOUT}" + cp "${COM_ATMOS_MASTER}/${MASTERFHR}" "${PGBOUT}" fi export err=$?; err_chk @@ -281,27 +276,27 @@ else ## not_anl if_stimes if [[ "${SENDDBN}" = "YES" ]]; then run="$(echo "${RUN}" | tr '[:lower:]' '[:upper:]')" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25" "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25_WIDX ""${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}.idx" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2_WIDX" "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25" "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB2_0P25_WIDX ""${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2" "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_PGB_GB2_WIDX" "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.f${fhr}.idx" fi if [[ "${SENDCOM}" = 'YES' ]]; then if [[ "${GRIBVERSION}" = 'grib2' ]]; then if [[ "${INLINE_POST}" = ".false." ]]; then - cp "${PGBOUT2}" "${COMOUT}/${MASTERFHR}" + cp "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERFHR}" fi - ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERFHRIDX}" + ${GRB2INDEX} "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERFHRIDX}" fi # Model generated flux files will be in nemsio after FY17 upgrade # use post to generate Grib2 flux files if (( OUTTYP == 4 )) ; then - export NEMSINP=${COMIN}/${PREFIX}atmf${fhr}.nc - export FLXINP=${COMIN}/${PREFIX}sfcf${fhr}.nc + export NEMSINP=${COM_ATMOS_HISTORY}/${PREFIX}atmf${fhr}.nc + export FLXINP=${COM_ATMOS_HISTORY}/${PREFIX}sfcf${fhr}.nc if (( d_fhr == 0 )); then export PostFlatFile=${PARMpost}/postxconfig-NT-GFS-FLUX-F00.txt export CTLFILE=${PARMpost}/postcntrl_gfs_flux_f00.xml @@ -317,16 +312,16 @@ else ## not_anl if_stimes if [[ "${INLINE_POST}" = ".false." ]]; then ${POSTGPSH} export err=$?; err_chk - mv fluxfile "${COMOUT}/${FLUXFL}" + mv fluxfile "${COM_ATMOS_MASTER}/${FLUXFL}" fi - ${WGRIB2} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}" + ${WGRIB2} -s "${COM_ATMOS_MASTER}/${FLUXFL}" > "${COM_ATMOS_MASTER}/${FLUXFLIDX}" fi if [[ "${SENDDBN}" = 'YES' ]] && [[ "${RUN}" = 'gdas' ]] && (( d_fhr % 3 == 0 )); then - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SF" "${job}" "${COMOUT}/${PREFIX}atmf${fhr}.nc" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_BF" "${job}" "${COMOUT}/${PREFIX}sfcf${fhr}.nc" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SGB_GB2" "${job}" "${COMOUT}/${PREFIX}sfluxgrbf${fhr}.grib2" - "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SGB_GB2_WIDX ""${job}" "${COMOUT}/${PREFIX}sfluxgrbf${fhr}.grib2.idx" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SF" "${job}" "${COM_ATMOS_HISTORY}/${PREFIX}atmf${fhr}.nc" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_BF" "${job}" "${COM_ATMOS_HISTORY}/${PREFIX}sfcf${fhr}.nc" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SGB_GB2" "${job}" "${COM_ATMOS_MASTER}/${PREFIX}sfluxgrbf${fhr}.grib2" + "${DBNROOT}/bin/dbn_alert" MODEL "${run}_SGB_GB2_WIDX ""${job}" "${COM_ATMOS_MASTER}/${PREFIX}sfluxgrbf${fhr}.grib2.idx" fi fi diff --git a/scripts/exgdas_atmos_verfozn.sh b/scripts/exgdas_atmos_verfozn.sh index e9a1900085..aa686284be 100755 --- a/scripts/exgdas_atmos_verfozn.sh +++ b/scripts/exgdas_atmos_verfozn.sh @@ -18,12 +18,6 @@ export RUN_ENVIR=${RUN_ENVIR:-nco} export NET=${NET:-gfs} export RUN=${RUN:-gdas} export envir=${envir:-prod} -export COMPONENT=${COMPONENT:-atmos} - -# Command line arguments -export PDY=${1:-${PDY:?}} -export cyc=${2:-${cyc:?}} - # Other variables export SATYPE_FILE=${SATYPE_FILE:-$FIXgdas_ozn/gdas_oznmon_satype.txt} diff --git a/scripts/exgdas_atmos_verfrad.sh b/scripts/exgdas_atmos_verfrad.sh index b9cfa701cd..5306fbbdba 100755 --- a/scripts/exgdas_atmos_verfrad.sh +++ b/scripts/exgdas_atmos_verfrad.sh @@ -25,21 +25,11 @@ export RUN_ENVIR=${RUN_ENVIR:-nco} export NET=${NET:-gfs} export RUN=${RUN:-gdas} export envir=${envir:-prod} -export COMPONENT=${COMPONENT:-atmos} - -# Command line arguments -export PDY=${1:-${PDY:?}} -export cyc=${2:-${cyc:?}} - -# Directories -export COM_IN=${COM_IN:-$(compath.py ${envir}/${NET}/${gfs_ver})} -export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}/$COMPONENT} - # Filenames -export biascr=${biascr:-$COMIN/gdas.t${cyc}z.abias} -export radstat=${radstat:-$COMIN/gdas.t${cyc}z.radstat} -export satype_file=${satype_file:-${FIXgdas}/gdas_radmon_satype.txt} +biascr=${biascr:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.abias} +radstat=${radstat:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.radstat} +satype_file=${satype_file:-${FIXgdas}/gdas_radmon_satype.txt} # Other variables export RAD_AREA=${RAD_AREA:-glb} diff --git a/scripts/exgdas_atmos_vminmon.sh b/scripts/exgdas_atmos_vminmon.sh index 5d54174bf7..2a22fcb0b6 100755 --- a/scripts/exgdas_atmos_vminmon.sh +++ b/scripts/exgdas_atmos_vminmon.sh @@ -28,12 +28,6 @@ export NET=${NET:-gfs} export RUN=${RUN:-gdas} export envir=${envir:-prod} -######################################## -# Command line arguments -######################################## -export PDY=${1:-${PDY:?}} -export cyc=${2:-${cyc:?}} - ######################################## # Directories ######################################## @@ -43,7 +37,7 @@ export DATA=${DATA:-$(pwd)} ######################################## # Filenames ######################################## -gsistat=${gsistat:-$COMIN/gdas.t${cyc}z.gsistat} +gsistat=${gsistat:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.gsistat} export mm_gnormfile=${gnormfile:-${M_FIXgdas}/gdas_minmon_gnorm.txt} export mm_costfile=${costfile:-${M_FIXgdas}/gdas_minmon_cost.txt} diff --git a/scripts/exgdas_enkf_earc.sh b/scripts/exgdas_enkf_earc.sh index 1408165bfd..79e43d1a17 100755 --- a/scripts/exgdas_enkf_earc.sh +++ b/scripts/exgdas_enkf_earc.sh @@ -6,8 +6,9 @@ source "${HOMEgfs}/ush/preamble.sh" # Begin JOB SPECIFIC work ############################################## export n=$((10#${ENSGRP})) -export CDUMP_ENKF=$(echo "${EUPD_CYC:-"gdas"}" | tr a-z A-Z) -export ARCH_LIST="${ROTDIR}/${RUN}.${PDY}/${cyc}/earc${ENSGRP}" +export CDUMP_ENKF="${EUPD_CYC:-"gdas"}" + +export ARCH_LIST="${COM_TOP}/earc${ENSGRP}" # ICS are restarts and always lag INC by $assim_freq hours. EARCINC_CYC=${ARCH_CYC} @@ -18,16 +19,16 @@ fi [[ -d ${ARCH_LIST} ]] && rm -rf "${ARCH_LIST}" mkdir -p "${ARCH_LIST}" -cd "${ARCH_LIST}" +cd "${ARCH_LIST}" || exit 2 -"${HOMEgfs}"/ush/hpssarch_gen.sh "${RUN}" +"${HOMEgfs}/ush/hpssarch_gen.sh" "${RUN}" status=$? if [ "${status}" -ne 0 ]; then echo "${HOMEgfs}/ush/hpssarch_gen.sh ${RUN} failed, ABORT!" exit "${status}" fi -cd "${ROTDIR}" +cd "${ROTDIR}" || exit 2 source "${HOMEgfs}/ush/file_utils.sh" @@ -40,18 +41,18 @@ if (( 10#${ENSGRP} > 0 )) && [[ ${HPSSARCH} = "YES" || ${LOCALARCH} = "YES" ]]; TARCMD="htar" if [[ ${LOCALARCH} = "YES" ]]; then TARCMD="tar" - [ ! -d "${ATARDIR}"/"${CDATE}" ] && mkdir -p "${ATARDIR}"/"${CDATE}" + if [[ ! -d "${ATARDIR}/${PDY}${cyc}" ]]; then mkdir -p "${ATARDIR}/${PDY}${cyc}"; fi fi #--determine when to save ICs for warm start SAVEWARMICA="NO" SAVEWARMICB="NO" - mm=$(echo "${CDATE}"|cut -c 5-6) - dd=$(echo "${CDATE}"|cut -c 7-8) + mm="${PDY:4:2}" + dd="${PDY:6:2}" nday=$(( (10#${mm}-1)*30+10#${dd} )) mod=$((nday % ARCH_WARMICFREQ)) - if [ "${CDATE}" -eq "${firstday}" ] && [ "${cyc}" -eq "${EARCINC_CYC}" ]; then SAVEWARMICA="YES" ; fi - if [ "${CDATE}" -eq "${firstday}" ] && [ "${cyc}" -eq "${EARCICS_CYC}" ]; then SAVEWARMICB="YES" ; fi + if [ "${PDY}${cyc}" -eq "${firstday}" ] && [ "${cyc}" -eq "${EARCINC_CYC}" ]; then SAVEWARMICA="YES" ; fi + if [ "${PDY}${cyc}" -eq "${firstday}" ] && [ "${cyc}" -eq "${EARCICS_CYC}" ]; then SAVEWARMICB="YES" ; fi if [ "${mod}" -eq 0 ] && [ "${cyc}" ] && [ "${EARCINC_CYC}" ]; then SAVEWARMICA="YES" ; fi if [ "${mod}" -eq 0 ] && [ "${cyc}" ] && [ "${EARCICS_CYC}" ]; then SAVEWARMICB="YES" ; fi @@ -60,32 +61,32 @@ if (( 10#${ENSGRP} > 0 )) && [[ ${HPSSARCH} = "YES" || ${LOCALARCH} = "YES" ]]; mod1=$((nday1 % ARCH_WARMICFREQ)) if [ "${mod1}" -eq 0 ] && [ "${cyc}" -eq "${EARCICS_CYC}" ] ; then SAVEWARMICB="YES" ; fi if [ "${mod1}" -ne 0 ] && [ "${cyc}" -eq "${EARCICS_CYC}" ] ; then SAVEWARMICB="NO" ; fi - if [ "${CDATE}" -eq "${SDATE}" ] && [ "${cyc}" -eq "${EARCICS_CYC}" ] ; then SAVEWARMICB="YES" ; fi + if [ "${PDY}${cyc}" -eq "${SDATE}" ] && [ "${cyc}" -eq "${EARCICS_CYC}" ] ; then SAVEWARMICB="YES" ; fi fi - if [ "${CDATE}" -gt "${SDATE}" ]; then # Don't run for first half cycle + if [ "${PDY}${cyc}" -gt "${SDATE}" ]; then # Don't run for first half cycle - ${TARCMD} -P -cvf "${ATARDIR}/${CDATE}/${RUN}_grp${ENSGRP}.tar" $(cat "${ARCH_LIST}/${RUN}_grp${n}.txt") + ${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${RUN}_grp${ENSGRP}.tar" $(cat "${ARCH_LIST}/${RUN}_grp${n}.txt") status=$? - if [ "${status}" -ne 0 ] && [ "${CDATE}" -ge "${firstday}" ]; then - echo "$(echo "${TARCMD}" | tr 'a-z' 'A-Z') ${CDATE} ${RUN}_grp${ENSGRP}.tar failed" + if [ "${status}" -ne 0 ] && [ "${PDY}${cyc}" -ge "${firstday}" ]; then + echo "FATAL ERROR: ${TARCMD} ${PDY}${cyc} ${RUN}_grp${ENSGRP}.tar failed" exit "${status}" fi if [ "${SAVEWARMICA}" = "YES" ] && [ "${cyc}" -eq "${EARCINC_CYC}" ]; then - ${TARCMD} -P -cvf "${ATARDIR}/${CDATE}/${RUN}_restarta_grp${ENSGRP}.tar" $(cat "${ARCH_LIST}/${RUN}_restarta_grp${n}.txt") + ${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${RUN}_restarta_grp${ENSGRP}.tar" $(cat "${ARCH_LIST}/${RUN}_restarta_grp${n}.txt") status=$? if [ "${status}" -ne 0 ]; then - echo "$(echo "${TARCMD}" | tr 'a-z' 'A-Z') ${CDATE} ${RUN}_restarta_grp${ENSGRP}.tar failed" + echo "FATAL ERROR: ${TARCMD} ${PDY}${cyc} ${RUN}_restarta_grp${ENSGRP}.tar failed" exit "${status}" fi fi if [ "${SAVEWARMICB}" = "YES" ] && [ "${cyc}" -eq "${EARCICS_CYC}" ]; then - ${TARCMD} -P -cvf "${ATARDIR}/${CDATE}/${RUN}_restartb_grp${ENSGRP}.tar" $(cat "${ARCH_LIST}/${RUN}_restartb_grp${n}.txt") + ${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${RUN}_restartb_grp${ENSGRP}.tar" $(cat "${ARCH_LIST}/${RUN}_restartb_grp${n}.txt") status=$? if [ "${status}" -ne 0 ]; then - echo "$(echo "${TARCMD}" | tr 'a-z' 'A-Z') ${CDATE} ${RUN}_restartb_grp${ENSGRP}.tar failed" + echo "FATAL ERROR: ${TARCMD} ${PDY}${cyc} ${RUN}_restartb_grp${ENSGRP}.tar failed" exit "${status}" fi fi @@ -101,22 +102,22 @@ if [ "${ENSGRP}" -eq 0 ]; then if [[ ${HPSSARCH} = "YES" || ${LOCALARCH} = "YES" ]]; then -#--set the archiving command and create local directories, if necessary + #--set the archiving command and create local directories, if necessary TARCMD="htar" HSICMD="hsi" if [[ ${LOCALARCH} = "YES" ]]; then TARCMD="tar" HSICMD="" - [ ! -d "${ATARDIR}"/"${CDATE}" ] && mkdir -p "${ATARDIR}"/"${CDATE}" + if [[ ! -d "${ATARDIR}/${PDY}${cyc}" ]]; then mkdir -p "${ATARDIR}/${PDY}${cyc}"; fi fi set +e - ${TARCMD} -P -cvf "${ATARDIR}/${CDATE}/${RUN}.tar" $(cat "${ARCH_LIST}/${RUN}.txt") + ${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${RUN}.tar" $(cat "${ARCH_LIST}/${RUN}.txt") status=$? - ${HSICMD} chgrp rstprod "${ATARDIR}/${CDATE}/${RUN}.tar" - ${HSICMD} chmod 640 "${ATARDIR}/${CDATE}/${RUN}.tar" - if [ "${status}" -ne 0 ] && [ "${CDATE}" -ge "${firstday}" ]; then - echo "$(echo "${TARCMD}" | tr 'a-z' 'A-Z') ${CDATE} ${RUN}.tar failed" + ${HSICMD} chgrp rstprod "${ATARDIR}/${PDY}${cyc}/${RUN}.tar" + ${HSICMD} chmod 640 "${ATARDIR}/${PDY}${cyc}/${RUN}.tar" + if (( status != 0 && ${PDY}${cyc} >= firstday )); then + echo "FATAL ERROR: ${TARCMD} ${PDY}${cyc} ${RUN}.tar failed" exit "${status}" fi set_strict @@ -124,16 +125,12 @@ if [ "${ENSGRP}" -eq 0 ]; then #-- Archive online for verification and diagnostics [[ ! -d ${ARCDIR} ]] && mkdir -p "${ARCDIR}" - cd "${ARCDIR}" - - nb_copy "${ROTDIR}/${RUN}.${PDY}/${cyc}/${RUN}.t${cyc}z.enkfstat" "enkfstat.${RUN}.${CDATE}" - nb_copy "${ROTDIR}/${RUN}.${PDY}/${cyc}/${RUN}.t${cyc}z.gsistat.ensmean" "gsistat.${RUN}.${CDATE}.ensmean" - - if [ "${CDUMP_ENKF}" != "GDAS" ]; then - nb_copy "${ROTDIR}/enkfgfs.${PDY}/${cyc}/${RUN}.t${cyc}z.enkfstat" "enkfstat.gfs.${CDATE}" - nb_copy "${ROTDIR}/enkfgfs.${PDY}/${cyc}/${RUN}.t${cyc}z.gsistat.ensmean" "gsistat.gfs.${CDATE}.ensmean" - fi + cd "${ARCDIR}" || exit 2 + nb_copy "${COM_ATMOS_ANALYSIS_ENSSTAT}/${RUN}.t${cyc}z.enkfstat" \ + "enkfstat.${RUN}.${PDY}${cyc}" + nb_copy "${COM_ATMOS_ANALYSIS_ENSSTAT}/${RUN}.t${cyc}z.gsistat.ensmean" \ + "gsistat.${RUN}.${PDY}${cyc}.ensmean" fi @@ -143,53 +140,154 @@ fi ############################################################### # ENSGRP 0 also does clean-up -if [ "${ENSGRP}" -eq 0 ]; then +############################################################### +if [[ "${ENSGRP}" -eq 0 ]]; then + function remove_files() { + # TODO: move this to a new location + local directory=$1 + shift + if [[ ! -d ${directory} ]]; then + echo "No directory ${directory} to remove files from, skiping" + return + fi + local exclude_list="" + if (($# > 0)); then + exclude_list=$* + fi + local file_list + declare -a file_list + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + readarray -t file_list < <(find -L "${directory}" -type f) + if (( ${#file_list[@]} == 0 )); then return; fi + for exclude in ${exclude_list}; do + echo "Excluding ${exclude}" + declare -a file_list_old=("${file_list[@]}") + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + readarray file_list < <(printf -- '%s\n' "${file_list_old[@]}" | grep -v "${exclude}") + if (( ${#file_list[@]} == 0 )); then return; fi + done + + for file in "${file_list[@]}"; do + rm -f "${file}" + done + # Remove directory if empty + rmdir "${directory}" || true + } # Start start and end dates to remove - GDATEEND=$(${NDATE} -"${RMOLDEND_ENKF:-24}" "${CDATE}") - GDATE=$(${NDATE} -"${RMOLDSTD_ENKF:-120}" "${CDATE}") + GDATEEND=$(${NDATE} -"${RMOLDEND_ENKF:-24}" "${PDY}${cyc}") + GDATE=$(${NDATE} -"${RMOLDSTD_ENKF:-120}" "${PDY}${cyc}") + while [ "${GDATE}" -le "${GDATEEND}" ]; do - gPDY=$(echo "${GDATE}" | cut -c1-8) - gcyc=$(echo "${GDATE}" | cut -c9-10) - - # Loop over GDAS and GFS EnKF directories separately. - clist="gdas gfs" - for ctype in ${clist}; do - COMIN_ENS="${ROTDIR}/enkf${ctype}.${gPDY}/${gcyc}" - if [ -d "${COMIN_ENS}" ]; then - rocotolog="${EXPDIR}/logs/${GDATE}.log" - if [ -f "${rocotolog}" ]; then - set +e - testend=$(tail -n 1 "${rocotolog}" | grep "This cycle is complete: Success") - rc=$? - set_strict - if [ "${rc}" -eq 0 ]; then - # Retain f006.ens files. Remove everything else - for file in $(ls "${COMIN_ENS}" | grep -v f006.ens); do - rm -rf "${COMIN_ENS}"/"${file}" + gPDY="${GDATE:0:8}" + gcyc="${GDATE:8:2}" + + if [[ -d ${COM_TOP} ]]; then + rocotolog="${EXPDIR}/logs/${GDATE}.log" + if [[ -f "${rocotolog}" ]]; then + set +e + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + testend=$(tail -n 1 "${rocotolog}" | grep "This cycle is complete: Success") + rc=$? + set_strict + if [ "${rc}" -eq 0 ]; then + case ${CDUMP} in + gdas) nmem=${NMEM_ENKF};; + gfs) nmem=${NMEM_EFCS};; + *) + echo "FATAL ERROR: Unknown CDUMP ${CDUMP} during cleanup" + exit 10 + ;; + esac + + readarray memlist< <(seq --format="mem%03g" 1 "${nmem}") + memlist+=("ensstat") + + for mem in "${memlist[@]}"; do + # Atmos + exclude_list="f006.ens" + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + templates=$(compgen -A variable | grep 'COM_ATMOS_.*_TMPL') + for template in ${templates}; do + MEMDIR="${mem}" YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Wave + exclude_list="" + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + templates=$(compgen -A variable | grep 'COM_WAVE_.*_TMPL') + for template in ${templates}; do + MEMDIR="${mem}" YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" done - fi + + # Ocean + exclude_list="" + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + templates=$(compgen -A variable | grep 'COM_OCEAN_.*_TMPL') + for template in ${templates}; do + YMEMDIR="${mem}" MD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Ice + exclude_list="" + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + templates=$(compgen -A variable | grep 'COM_ICE_.*_TMPL') + for template in ${templates}; do + MEMDIR="${mem}" YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Aerosols (GOCART) + exclude_list="" + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + templates=$(compgen -A variable | grep 'COM_CHEM_.*_TMPL') + for template in ${templates}; do + MEMDIR="${mem}" YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Mediator + exclude_list="" + # Suppress warnings about chained commands suppressing exit codes + # shellcheck disable=SC2312 + templates=$(compgen -A variable | grep 'COM_MED_.*_TMPL') + for template in ${templates}; do + MEMDIR="${mem}" YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + done fi fi + fi - # Remove empty directories - if [ -d "${COMIN_ENS}" ] ; then - [[ ! "$(ls -A "${COMIN_ENS}")" ]] && rm -rf "${COMIN_ENS}" - fi - done + # Remove any empty directories + YMD=${gPDY} HH=${gcyc} generate_com target_dir:COM_TOP_TMPL + target_dir="${ROTDIR:?}/${RUN}.${gPDY}/${gcyc}/" + if [[ -d ${target_dir} ]]; then + find "${target_dir}" -empty -type d -delete + fi # Advance to next cycle GDATE=$(${NDATE} +"${assim_freq}" "${GDATE}") - done - fi # Remove enkf*.$rPDY for the older of GDATE or RDATE -GDATE=$(${NDATE} -"${RMOLDSTD_ENKF:-120}" "${CDATE}") +GDATE=$(${NDATE} -"${RMOLDSTD_ENKF:-120}" "${PDY}${cyc}") fhmax=${FHMAX_GFS} -RDATE=$(${NDATE} -"${fhmax}" "${CDATE}") +RDATE=$(${NDATE} -"${fhmax}" "${PDY}${cyc}") if [ "${GDATE}" -lt "${RDATE}" ]; then RDATE=${GDATE} fi diff --git a/scripts/exgdas_enkf_ecen.sh b/scripts/exgdas_enkf_ecen.sh index 08abd1ae20..3d54cf001f 100755 --- a/scripts/exgdas_enkf_ecen.sh +++ b/scripts/exgdas_enkf_ecen.sh @@ -110,32 +110,39 @@ for FHR in $(seq $FHMIN $FHOUT $FHMAX); do for imem in $(seq 1 $NMEM_ENKF); do memchar="mem"$(printf %03i $imem) - $NLN $COMIN_GES_ENS/$memchar/atmos/${GPREFIX_ENS}atmf00${FHR}${ENKF_SUFFIX}.nc ./atmges_$memchar + + MEMDIR=${memchar} YMD=${PDY} HH=${cyc} generate_com -x \ + COM_ATMOS_ANALYSIS_MEM:COM_ATMOS_ANALYSIS_TMPL + + MEMDIR=${memchar} RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} generate_com -x \ + COM_ATMOS_HISTORY_MEM_PREV:COM_ATMOS_HISTORY_TMPL + + ${NLN} "${COM_ATMOS_HISTORY_MEM_PREV}/${GPREFIX_ENS}atmf00${FHR}${ENKF_SUFFIX}.nc" "./atmges_${memchar}" if [ $DO_CALC_INCREMENT = "YES" ]; then if [ $FHR -eq 6 ]; then - $NLN $COMIN_ENS/$memchar/atmos/${APREFIX_ENS}atmanl.nc ./atmanl_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}atmanl.nc" "./atmanl_${memchar}" else - $NLN $COMIN_ENS/$memchar/atmos/${APREFIX_ENS}atma00${FHR}.nc ./atmanl_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}atma00${FHR}.nc" "./atmanl_${memchar}" fi fi - mkdir -p $COMOUT_ENS/$memchar + mkdir -p "${COM_ATMOS_ANALYSIS_MEM}" if [ $FHR -eq 6 ]; then - $NLN $COMOUT_ENS/$memchar/atmos/${APREFIX_ENS}atminc.nc ./atminc_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}atminc.nc" "./atminc_${memchar}" else - $NLN $COMOUT_ENS/$memchar/atmos/${APREFIX_ENS}atmi00${FHR}.nc ./atminc_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}atmi00${FHR}.nc" "./atminc_${memchar}" fi if [[ $RECENTER_ENKF = "YES" ]]; then if [ $DO_CALC_INCREMENT = "YES" ]; then if [ $FHR -eq 6 ]; then - $NLN $COMOUT_ENS/$memchar/atmos/${APREFIX_ENS}ratmanl.nc ./ratmanl_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}ratmanl.nc" "./ratmanl_${memchar}" else - $NLN $COMOUT_ENS/$memchar/atmos/${APREFIX_ENS}ratma00${FHR}.nc ./ratmanl_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}ratma00${FHR}.nc" "./ratmanl_${memchar}" fi else if [ $FHR -eq 6 ]; then - $NLN $COMOUT_ENS/$memchar/atmos/${APREFIX_ENS}ratminc.nc ./ratminc_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}ratminc.nc" "./ratminc_${memchar}" else - $NLN $COMOUT_ENS/$memchar/atmos/${APREFIX_ENS}ratmi00${FHR}.nc ./ratminc_$memchar + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX_ENS}ratmi00${FHR}.nc" "./ratminc_${memchar}" fi fi fi @@ -144,9 +151,9 @@ done if [ $DO_CALC_INCREMENT = "YES" ]; then # Link ensemble mean analysis if [ $FHR -eq 6 ]; then - $NLN $COMIN_ENS/${APREFIX_ENS}atmanl.ensmean.nc ./atmanl_ensmean + ${NLN} "${COM_ATMOS_ANALYSIS_STAT}/${APREFIX_ENS}atmanl.ensmean.nc" "./atmanl_ensmean" else - $NLN $COMIN_ENS/${APREFIX_ENS}atma00${FHR}.ensmean.nc ./atmanl_ensmean + ${NLN} "${COM_ATMOS_ANALYSIS_STAT}/${APREFIX_ENS}atma00${FHR}.ensmean.nc" "./atmanl_ensmean" fi # Compute ensemble mean analysis @@ -164,9 +171,9 @@ if [ $DO_CALC_INCREMENT = "YES" ]; then else # Link ensemble mean increment if [ $FHR -eq 6 ]; then - $NLN $COMIN_ENS/${APREFIX_ENS}atminc.ensmean.nc ./atminc_ensmean + ${NLN} "${COM_ATMOS_ANALYSIS_STAT}/${APREFIX_ENS}atminc.ensmean.nc" "./atminc_ensmean" else - $NLN $COMIN_ENS/${APREFIX_ENS}atmi00${FHR}.ensmean.nc ./atminc_ensmean + ${NLN} "${COM_ATMOS_ANALYSIS_STAT}/${APREFIX_ENS}atmi00${FHR}.ensmean.nc" "./atminc_ensmean" fi # Compute ensemble mean increment @@ -183,8 +190,8 @@ else export err=$?; err_chk # If available, link to ensemble mean guess. Otherwise, compute ensemble mean guess - if [ -s $COMIN_GES_ENS/${GPREFIX_ENS}atmf00${FHR}.ensmean.nc ]; then - $NLN $COMIN_GES_ENS/${GPREFIX_ENS}atmf00${FHR}.ensmean.nc ./atmges_ensmean + if [[ -s "${COM_ATMOS_HISTORY_STAT_PREV}/${GPREFIX_ENS}atmf00${FHR}.ensmean.nc" ]]; then + ${NLN} "${COM_ATMOS_HISTORY_STAT_PREV}/${GPREFIX_ENS}atmf00${FHR}.ensmean.nc" "./atmges_ensmean" else DATAPATH="./" ATMGESNAME="atmges" @@ -219,11 +226,11 @@ if [ $RECENTER_ENKF = "YES" ]; then # GSI EnVar analysis if [ $FHR -eq 6 ]; then - ATMANL_GSI=$COMIN/${APREFIX}atmanl.nc - ATMANL_GSI_ENSRES=$COMIN/${APREFIX}atmanl.ensres.nc + ATMANL_GSI="${COM_ATMOS_ANALYSIS_DET}/${APREFIX}atmanl.nc" + ATMANL_GSI_ENSRES="${COM_ATMOS_ANALYSIS_DET}/${APREFIX}atmanl.ensres.nc" else - ATMANL_GSI=$COMIN/${APREFIX}atma00${FHR}.nc - ATMANL_GSI_ENSRES=$COMIN/${APREFIX}atma00${FHR}.ensres.nc + ATMANL_GSI="${COM_ATMOS_ANALYSIS_DET}/${APREFIX}atma00${FHR}.nc" + ATMANL_GSI_ENSRES="${COM_ATMOS_ANALYSIS_DET}/${APREFIX}atma00${FHR}.ensres.nc" fi # if we already have a ensemble resolution GSI analysis then just link to it diff --git a/scripts/exgdas_enkf_fcst.sh b/scripts/exgdas_enkf_fcst.sh index 3f02ae6417..206fa03932 100755 --- a/scripts/exgdas_enkf_fcst.sh +++ b/scripts/exgdas_enkf_fcst.sh @@ -21,7 +21,6 @@ source "$HOMEgfs/ush/preamble.sh" # Directories. -pwd=$(pwd) export FIX_DIR=${FIX_DIR:-$HOMEgfs/fix} export FIX_AM=${FIX_AM:-$FIX_DIR/am} @@ -46,10 +45,6 @@ export FCSTEXEC=${FCSTEXEC:-fv3gfs.x} export PARM_FV3DIAG=${PARM_FV3DIAG:-$HOMEgfs/parm/parm_fv3diag} export DIAG_TABLE=${DIAG_TABLE_ENKF:-${DIAG_TABLE:-$PARM_FV3DIAG/diag_table_da}} -# Cycling and forecast hour specific parameters -export CDATE=${CDATE:-"2001010100"} -export CDUMP=${CDUMP:-"enkfgdas"} - # Re-run failed members, or entire group RERUN_EFCSGRP=${RERUN_EFCSGRP:-"YES"} @@ -63,19 +58,12 @@ SENDDBN=${SENDDBN:-"NO"} ################################################################################ # Preprocessing -mkdata=NO -if [ ! -d $DATA ]; then - mkdata=YES - mkdir -p $DATA -fi cd $DATA || exit 99 DATATOP=$DATA ################################################################################ # Set output data -cymd=$(echo $CDATE | cut -c1-8) -chh=$(echo $CDATE | cut -c9-10) -EFCSGRP=$COMOUT/efcs.grp${ENSGRP} +EFCSGRP="${COM_TOP}/efcs.grp${ENSGRP}" if [ -f $EFCSGRP ]; then if [ $RERUN_EFCSGRP = "YES" ]; then rm -f $EFCSGRP @@ -107,13 +95,13 @@ export LEVS=${LEVS_ENKF:-${LEVS:-64}} # nggps_diag_nml export FHOUT=${FHOUT_ENKF:-3} -if [[ ${CDUMP} == "enkfgfs" ]]; then +if [[ ${RUN} == "enkfgfs" ]]; then export FHOUT=${FHOUT_ENKF_GFS:-${FHOUT_ENKF:${FHOUT:-3}}} fi # model_configure export DELTIM=${DELTIM_ENKF:-${DELTIM:-225}} export FHMAX=${FHMAX_ENKF:-9} -if [[ $CDUMP == "enkfgfs" ]]; then +if [[ ${RUN} == "enkfgfs" ]]; then export FHMAX=${FHMAX_ENKF_GFS:-${FHMAX_ENKF:-${FHMAX}}} fi @@ -137,6 +125,12 @@ if [ $RECENTER_ENKF = "YES" ]; then export PREFIX_ATMINC="r" fi +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +declare -x gPDY="${GDATE:0:8}" +declare -x gcyc="${GDATE:8:2}" + ################################################################################ # Run forecast for ensemble member rc=0 @@ -145,7 +139,7 @@ for imem in $(seq $ENSBEG $ENSEND); do cd $DATATOP cmem=$(printf %03i $imem) - memchar="mem$cmem" + memchar="mem${cmem}" echo "Processing MEMBER: $cmem" @@ -157,12 +151,40 @@ for imem in $(seq $ENSBEG $ENSEND); do [[ $memstat -eq 1 ]] && skip_mem="YES" fi + # Construct COM variables from templates (see config.com) + # Can't make these read-only because we are looping over members + MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -x COM_ATMOS_RESTART COM_ATMOS_INPUT COM_ATMOS_ANALYSIS \ + COM_ATMOS_HISTORY COM_ATMOS_MASTER + + RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -x COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL + + if [[ ${DO_WAVE} == "YES" ]]; then + MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -x COM_WAVE_RESTART COM_WAVE_PREP COM_WAVE_HISTORY + RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -x COM_WAVE_RESTART_PREV:COM_WAVE_RESTART_TMPL + fi + + if [[ ${DO_OCN} == "YES" ]]; then + MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -x COM_MED_RESTART COM_OCEAN_RESTART \ + COM_OCEAN_INPUT COM_OCEAN_HISTORY COM_OCEAN_ANALYSIS + RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -x COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL + fi + + if [[ ${DO_ICE} == "YES" ]]; then + MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -x COM_ICE_HISTORY + RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -x COM_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL + fi + + if [[ ${DO_AERO} == "YES" ]]; then + MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -x COM_CHEM_HISTORY + fi + + if [ $skip_mem = "NO" ]; then ra=0 export MEMBER=$imem - export DATA=$DATATOP/$memchar + export DATA="${DATATOP}/${memchar}" if [ -d $DATA ]; then rm -rf $DATA; fi mkdir -p $DATA $FORECASTSH @@ -182,7 +204,7 @@ for imem in $(seq $ENSBEG $ENSEND); do while [ $fhr -le $FHMAX ]; do FH3=$(printf %03i $fhr) if [ $(expr $fhr % 3) -eq 0 ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT/$memchar/atmos/${CDUMP}.t${cyc}z.sfcf${FH3}.nc + "${DBNROOT}/bin/dbn_alert" MODEL GFS_ENKF "${job}" "${COM_ATMOS_HISTORY}/${RUN}.t${cyc}z.sfcf${FH3}.nc" fi fhr=$((fhr+FHOUT)) done @@ -222,8 +244,5 @@ export err=$rc; err_chk ################################################################################ # Postprocessing -cd $pwd -[[ $mkdata = "YES" ]] && rm -rf $DATATOP - exit $err diff --git a/scripts/exgdas_enkf_post.sh b/scripts/exgdas_enkf_post.sh index 1338b0ceef..0bdea980ec 100755 --- a/scripts/exgdas_enkf_post.sh +++ b/scripts/exgdas_enkf_post.sh @@ -55,13 +55,6 @@ ENKF_SPREAD=${ENKF_SPREAD:-"NO"} ################################################################################ # Preprocessing -mkdata=NO -if [ ! -d $DATA ]; then - mkdata=YES - mkdir -p $DATA -fi -cd $DATA || exit 99 - ENKF_SUFFIX="s" [[ $SMOOTH_ENKF = "NO" ]] && ENKF_SUFFIX="" @@ -75,26 +68,32 @@ export OMP_NUM_THREADS=$NTHREADS_EPOS ################################################################################ # Forecast ensemble member files for imem in $(seq 1 $NMEM_ENKF); do - memchar="mem"$(printf %03i $imem) + memchar="mem"$(printf %03i "${imem}") + MEMDIR=${memchar} YMD=${PDY} HH=${cyc} generate_com -x COM_ATMOS_HISTORY:COM_ATMOS_HISTORY_TMPL + for fhr in $(seq $FHMIN $FHOUT $FHMAX); do fhrchar=$(printf %03i $fhr) - $NLN $COMIN/$memchar/atmos/${PREFIX}sfcf${fhrchar}.nc sfcf${fhrchar}_$memchar - $NLN $COMIN/$memchar/atmos/${PREFIX}atmf${fhrchar}.nc atmf${fhrchar}_$memchar + ${NLN} "${COM_ATMOS_HISTORY}/${PREFIX}sfcf${fhrchar}.nc" "sfcf${fhrchar}_${memchar}" + ${NLN} "${COM_ATMOS_HISTORY}/${PREFIX}atmf${fhrchar}.nc" "atmf${fhrchar}_${memchar}" done done # Forecast ensemble mean and smoothed files +MEMDIR="ensstat" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_HISTORY_STAT:COM_ATMOS_HISTORY_TMPL +if [[ ! -d "${COM_ATMOS_HISTORY_STAT}" ]]; then mkdir -p "${COM_ATMOS_HISTORY_STAT}"; fi + for fhr in $(seq $FHMIN $FHOUT $FHMAX); do fhrchar=$(printf %03i $fhr) - $NLN $COMOUT/${PREFIX}sfcf${fhrchar}.ensmean.nc sfcf${fhrchar}.ensmean - $NLN $COMOUT/${PREFIX}atmf${fhrchar}.ensmean.nc atmf${fhrchar}.ensmean + ${NLN} "${COM_ATMOS_HISTORY_STAT}/${PREFIX}sfcf${fhrchar}.ensmean.nc" "sfcf${fhrchar}.ensmean" + ${NLN} "${COM_ATMOS_HISTORY_STAT}/${PREFIX}atmf${fhrchar}.ensmean.nc" "atmf${fhrchar}.ensmean" if [ $SMOOTH_ENKF = "YES" ]; then for imem in $(seq 1 $NMEM_ENKF); do - memchar="mem"$(printf %03i $imem) - $NLN $COMOUT/$memchar/atmos/${PREFIX}atmf${fhrchar}${ENKF_SUFFIX}.nc atmf${fhrchar}${ENKF_SUFFIX}_$memchar + memchar="mem"$(printf %03i "${imem}") + MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -x COM_ATMOS_HISTORY + ${NLN} "${COM_ATMOS_HISTORY}/${PREFIX}atmf${fhrchar}${ENKF_SUFFIX}.nc" "atmf${fhrchar}${ENKF_SUFFIX}_${memchar}" done fi - [[ $ENKF_SPREAD = "YES" ]] && $NLN $COMOUT/${PREFIX}atmf${fhrchar}.ensspread.nc atmf${fhrchar}.ensspread + [[ $ENKF_SPREAD = "YES" ]] && ${NLN} "${COM_ATMOS_HISTORY_STAT}/${PREFIX}atmf${fhrchar}.ensspread.nc" "atmf${fhrchar}.ensspread" done ################################################################################ @@ -135,7 +134,7 @@ if [ $SMOOTH_ENKF = "YES" ]; then echo WARNING! no smoothed ensemble member for fhour = $fhrchar >&2 for imem in $(seq 1 $NMEM_ENKF); do memchar="mem"$(printf %03i $imem) - $NCP atmf${fhrchar}_$memchar atmf${fhrchar}${ENKF_SUFFIX}_$memchar + ${NCP} "atmf${fhrchar}_${memchar}" "atmf${fhrchar}${ENKF_SUFFIX}_${memchar}" done fi done @@ -149,7 +148,7 @@ if [ $SENDDBN = "YES" ]; then fhrchar=$(printf %03i $fhr) if [ $(expr $fhr % 3) -eq 0 ]; then if [ -s ./sfcf${fhrchar}.ensmean ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT/${PREFIX}sfcf${fhrchar}.ensmean.nc + ${DBNROOT}/bin/dbn_alert "MODEL" "GFS_ENKF" "${job}" "${COM_ATMOS_HISTORY_STAT}/${PREFIX}sfcf${fhrchar}.ensmean.nc" fi fi done @@ -159,7 +158,5 @@ fi ################################################################################ # Postprocessing cd $pwd -[[ $mkdata = "YES" ]] && rm -rf $DATA - exit $err diff --git a/scripts/exgdas_enkf_select_obs.sh b/scripts/exgdas_enkf_select_obs.sh index 7a6eec5535..2ad624bcdb 100755 --- a/scripts/exgdas_enkf_select_obs.sh +++ b/scripts/exgdas_enkf_select_obs.sh @@ -28,13 +28,9 @@ export NLN=${NLN:-"/bin/ln -sf"} # Scripts. ANALYSISSH=${ANALYSISSH:-$HOMEgfs/scripts/exglobal_atmos_analysis.sh} -# Prefix and Suffix Variables. -export APREFIX=${APREFIX:-""} - # Select obs export RUN_SELECT=${RUN_SELECT:-"YES"} export USE_SELECT=${USE_SELECT:-"NO"} -export SELECT_OBS=${SELECT_OBS:-$COMOUT/${APREFIX}obsinput} # Observation Operator GSI namelist initialization SETUP_INVOBS=${SETUP_INVOBS:-""} @@ -61,8 +57,6 @@ if [ ! -d $DATA ]; then fi cd $DATA || exit 8 -[[ ! -d $COMOUT ]] && mkdir -p $COMOUT - ################################################################################ # ObsInput file from ensemble mean rm -f obs*input* diff --git a/scripts/exgdas_enkf_sfc.sh b/scripts/exgdas_enkf_sfc.sh index 8ba8d6e012..d74306a8b3 100755 --- a/scripts/exgdas_enkf_sfc.sh +++ b/scripts/exgdas_enkf_sfc.sh @@ -23,7 +23,6 @@ source "$HOMEgfs/ush/preamble.sh" pwd=$(pwd) # Base variables -CDATE=${CDATE:-"2010010100"} DONST=${DONST:-"NO"} DOSFCANL_ENKF=${DOSFCANL_ENKF:-"YES"} export CASE=${CASE:-384} @@ -78,34 +77,30 @@ cd $DATA || exit 99 ################################################################################ # Update surface fields in the FV3 restart's using global_cycle. -PDY=$(echo $CDATE | cut -c1-8) -cyc=$(echo $CDATE | cut -c9-10) - -GDATE=$($NDATE -$assim_freq $CDATE) -gPDY=$(echo $GDATE | cut -c1-8) -gcyc=$(echo $GDATE | cut -c9-10) -GDUMP=${GDUMP:-"gdas"} - -BDATE=$($NDATE -3 $CDATE) -bPDY=$(echo $BDATE | cut -c1-8) -bcyc=$(echo $BDATE | cut -c9-10) +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +BDATE=$(${NDATE} -3 "${PDY}${cyc}") +bPDY=${BDATE:0:8} +bcyc=${BDATE:8:2} # Get dimension information based on CASE -res=$(echo $CASE | cut -c2-) +res=${CASE:2:} JCAP_CASE=$((res*2-2)) LATB_CASE=$((res*2)) LONB_CASE=$((res*4)) # Global cycle requires these files export FNTSFA=${FNTSFA:-' '} -export FNACNA=${FNACNA:-$COMIN/${OPREFIX}seaice.5min.blend.grb} -export FNSNOA=${FNSNOA:-$COMIN/${OPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} -[[ ! -f $FNSNOA ]] && export FNSNOA="$COMIN/${OPREFIX}snogrb_t1534.3072.1536" -FNSNOG=${FNSNOG:-$COMIN_GES/${GPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} -[[ ! -f $FNSNOG ]] && FNSNOG="$COMIN_GES/${GPREFIX}snogrb_t1534.3072.1536" +export FNACNA=${FNACNA:-${COM_OBS}/${OPREFIX}seaice.5min.blend.grb} +export FNSNOA=${FNSNOA:-${COM_OBS}/${OPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} +[[ ! -f $FNSNOA ]] && export FNSNOA="${COM_OBS}/${OPREFIX}snogrb_t1534.3072.1536" +FNSNOG=${FNSNOG:-${COM_OBS_PREV}/${GPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} +[[ ! -f $FNSNOG ]] && FNSNOG="${COM_OBS_PREV}/${GPREFIX}snogrb_t1534.3072.1536" # Set CYCLVARS by checking grib date of current snogrb vs that of prev cycle if [ ${RUN_GETGES:-"NO"} = "YES" ]; then + # Ignore possible spelling error (nothing is misspelled) + # shellcheck disable=SC2153 snoprv=$($GETGESSH -q -t snogrb_$JCAP_CASE -e $gesenvir -n $GDUMP -v $GDATE) else snoprv=${snoprv:-$FNSNOG} @@ -121,7 +116,7 @@ else fi if [ $DONST = "YES" ]; then - export NST_FILE=${NST_FILE:-$COMIN/${APREFIX}dtfanl.nc} + export NST_FILE=${NST_FILE:-${COM_ATMOS_ANALYSIS_DET}/${APREFIX}dtfanl.nc} else export NST_FILE="NULL" fi @@ -143,17 +138,26 @@ if [ $DOIAU = "YES" ]; then cmem=$(printf %03i $imem) memchar="mem$cmem" - [[ $TILE_NUM -eq 1 ]] && mkdir -p $COMOUT_ENS/$memchar/atmos/RESTART + MEMDIR=${memchar} YMD=${PDY} HH=${cyc} generate_com \ + COM_ATMOS_RESTART_MEM:COM_ATMOS_RESTART_TMPL + + MEMDIR=${memchar} RUN="enkfgdas" YMD=${gPDY} HH=${gcyc} generate_com \ + COM_ATMOS_RESTART_MEM_PREV:COM_ATMOS_RESTART_TMPL + + [[ ${TILE_NUM} -eq 1 ]] && mkdir -p "${COM_ATMOS_RESTART_MEM}" - $NCP $COMIN_GES_ENS/$memchar/atmos/RESTART/$bPDY.${bcyc}0000.sfc_data.tile${n}.nc $COMOUT_ENS/$memchar/atmos/RESTART/$bPDY.${bcyc}0000.sfcanl_data.tile${n}.nc - $NLN $COMIN_GES_ENS/$memchar/atmos/RESTART/$bPDY.${bcyc}0000.sfc_data.tile${n}.nc $DATA/fnbgsi.$cmem - $NLN $COMOUT_ENS/$memchar/atmos/RESTART/$bPDY.${bcyc}0000.sfcanl_data.tile${n}.nc $DATA/fnbgso.$cmem - $NLN $FIXfv3/$CASE/${CASE}_grid.tile${n}.nc $DATA/fngrid.$cmem - $NLN $FIXfv3/$CASE/${CASE}_oro_data.tile${n}.nc $DATA/fnorog.$cmem + ${NCP} "${COM_ATMOS_RESTART_MEM_PREV}/${bPDY}.${bcyc}0000.sfc_data.tile${n}.nc" \ + "${COM_ATMOS_RESTART_MEM}/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc" + ${NLN} "${COM_ATMOS_RESTART_MEM_PREV}/${bPDY}.${bcyc}0000.sfc_data.tile${n}.nc" \ + "${DATA}/fnbgsi.${cmem}" + ${NLN} "${COM_ATMOS_RESTART_MEM}/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc" \ + "${DATA}/fnbgso.${cmem}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_grid.tile${n}.nc" "${DATA}/fngrid.${cmem}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_oro_data.tile${n}.nc" "${DATA}/fnorog.${cmem}" done - $CYCLESH + CDATE="${PDY}${cyc}" ${CYCLESH} export err=$?; err_chk done @@ -161,29 +165,38 @@ if [ $DOIAU = "YES" ]; then fi if [ $DOSFCANL_ENKF = "YES" ]; then - for n in $(seq 1 $ntiles); do + for n in $(seq 1 $ntiles); do - export TILE_NUM=$n + export TILE_NUM=$n - for imem in $(seq 1 $NMEM_ENKF); do + for imem in $(seq 1 $NMEM_ENKF); do - cmem=$(printf %03i $imem) - memchar="mem$cmem" + cmem=$(printf %03i $imem) + memchar="mem$cmem" - [[ $TILE_NUM -eq 1 ]] && mkdir -p $COMOUT_ENS/$memchar/atmos/RESTART + MEMDIR=${memchar} YMD=${PDY} HH=${cyc} generate_com \ + COM_ATMOS_RESTART_MEM:COM_ATMOS_RESTART_TMPL - $NCP $COMIN_GES_ENS/$memchar/atmos/RESTART/$PDY.${cyc}0000.sfc_data.tile${n}.nc $COMOUT_ENS/$memchar/atmos/RESTART/$PDY.${cyc}0000.sfcanl_data.tile${n}.nc - $NLN $COMIN_GES_ENS/$memchar/atmos/RESTART/$PDY.${cyc}0000.sfc_data.tile${n}.nc $DATA/fnbgsi.$cmem - $NLN $COMOUT_ENS/$memchar/atmos/RESTART/$PDY.${cyc}0000.sfcanl_data.tile${n}.nc $DATA/fnbgso.$cmem - $NLN $FIXfv3/$CASE/${CASE}_grid.tile${n}.nc $DATA/fngrid.$cmem - $NLN $FIXfv3/$CASE/${CASE}_oro_data.tile${n}.nc $DATA/fnorog.$cmem + RUN="${GDUMP_ENS}" MEMDIR=${memchar} YMD=${gPDY} HH=${gcyc} generate_com \ + COM_ATMOS_RESTART_MEM_PREV:COM_ATMOS_RESTART_TMPL - done + [[ ${TILE_NUM} -eq 1 ]] && mkdir -p "${COM_ATMOS_RESTART_MEM}" - $CYCLESH - export err=$?; err_chk + ${NCP} "${COM_ATMOS_RESTART_MEM_PREV}/${PDY}.${cyc}0000.sfc_data.tile${n}.nc" \ + "${COM_ATMOS_RESTART_MEM}/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc" + ${NLN} "${COM_ATMOS_RESTART_MEM_PREV}/${PDY}.${cyc}0000.sfc_data.tile${n}.nc" \ + "${DATA}/fnbgsi.${cmem}" + ${NLN} "${COM_ATMOS_RESTART_MEM}/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc" \ + "${DATA}/fnbgso.${cmem}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_grid.tile${n}.nc" "${DATA}/fngrid.${cmem}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_oro_data.tile${n}.nc" "${DATA}/fnorog.${cmem}" + + done - done + CDATE="${PDY}${cyc}" ${CYCLESH} + export err=$?; err_chk + + done fi ################################################################################ diff --git a/scripts/exgdas_enkf_update.sh b/scripts/exgdas_enkf_update.sh index 906ef5f070..dfe00effd9 100755 --- a/scripts/exgdas_enkf_update.sh +++ b/scripts/exgdas_enkf_update.sh @@ -90,7 +90,8 @@ fi INCREMENTS_TO_ZERO=${INCREMENTS_TO_ZERO:-"'NONE'"} ################################################################################ -ATMGES_ENSMEAN=$COMIN_GES_ENS/${GPREFIX}atmf006.ensmean.nc + +ATMGES_ENSMEAN="${COM_ATMOS_HISTORY_STAT_PREV}/${GPREFIX}atmf006.ensmean.nc" LONB_ENKF=${LONB_ENKF:-$($NCLEN $ATMGES_ENSMEAN grid_xt)} # get LONB_ENKF LATB_ENKF=${LATB_ENKF:-$($NCLEN $ATMGES_ENSMEAN grid_yt)} # get LATB_ENFK LEVS_ENKF=${LEVS_ENKF:-$($NCLEN $ATMGES_ENSMEAN pfull)} # get LEVS_ENFK @@ -137,7 +138,7 @@ $NLN $ANAVINFO anavinfo $NLN $VLOCALEIG vlocal_eig.dat # Bias correction coefficients based on the ensemble mean -$NLN $COMOUT_ANL_ENS/$GBIASe satbias_in +${NLN} "${COM_ATMOS_ANALYSIS_STAT}/${GBIASe}" "satbias_in" ################################################################################ @@ -147,12 +148,13 @@ if [ $USE_CFP = "YES" ]; then cat > $DATA/untar.sh << EOFuntar #!/bin/sh memchar=\$1 +COM_ATMOS_ANALYSIS=\$2 flist="$CNVSTAT $OZNSTAT $RADSTAT" for ftype in \$flist; do if [ \$memchar = "ensmean" ]; then - fname=$COMOUT_ANL_ENS/\${ftype}.ensmean + fname=\${COM_ATMOS_ANALYSIS}/\${ftype}.ensmean else - fname=$COMOUT_ANL_ENS/\$memchar/atmos/\$ftype + fname=\${COM_ATMOS_ANALYSIS}/\${ftype} fi tar -xvf \$fname done @@ -165,49 +167,62 @@ fi flist="$CNVSTAT $OZNSTAT $RADSTAT" if [ $USE_CFP = "YES" ]; then - echo "$nm $DATA/untar.sh ensmean" | tee -a $DATA/mp_untar.sh + echo "${nm} ${DATA}/untar.sh ensmean ${COM_ATMOS_ANALYSIS_STAT}" | tee -a "${DATA}/mp_untar.sh" if [ ${CFP_MP:-"NO"} = "YES" ]; then nm=$((nm+1)) fi else for ftype in $flist; do - fname=$COMOUT_ANL_ENS/${ftype}.ensmean + fname="${COM_ATMOS_ANALYSIS_STAT}/${ftype}.ensmean" tar -xvf $fname done fi nfhrs=$(echo $IAUFHRS_ENKF | sed 's/,/ /g') for imem in $(seq 1 $NMEM_ENKF); do memchar="mem"$(printf %03i $imem) + + MEMDIR=${memchar} RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} generate_com -x \ + COM_ATMOS_HISTORY_MEM_PREV:COM_ATMOS_HISTORY_TMPL + + MEMDIR=${memchar} YMD=${PDY} HH=${cyc} generate_com -x \ + COM_ATMOS_ANALYSIS_MEM:COM_ATMOS_ANALYSIS_TMPL + if [ $lobsdiag_forenkf = ".false." ]; then if [ $USE_CFP = "YES" ]; then - echo "$nm $DATA/untar.sh $memchar" | tee -a $DATA/mp_untar.sh + echo "${nm} ${DATA}/untar.sh ${memchar} ${COM_ATMOS_ANALYSIS_MEM}" | tee -a "${DATA}/mp_untar.sh" if [ ${CFP_MP:-"NO"} = "YES" ]; then nm=$((nm+1)) fi else for ftype in $flist; do - fname=$COMOUT_ANL_ENS/$memchar/atmos/$ftype + fname="${COM_ATMOS_ANALYSIS_MEM}/${ftype}" tar -xvf $fname done fi fi - mkdir -p $COMOUT_ANL_ENS/$memchar/atmos + mkdir -p "${COM_ATMOS_ANALYSIS_MEM}" for FHR in $nfhrs; do - $NLN $COMIN_GES_ENS/$memchar/atmos/${GPREFIX}atmf00${FHR}${ENKF_SUFFIX}.nc sfg_${CDATE}_fhr0${FHR}_${memchar} + ${NLN} "${COM_ATMOS_HISTORY_MEM_PREV}/${GPREFIX}atmf00${FHR}${ENKF_SUFFIX}.nc" \ + "sfg_${PDY}${cyc}_fhr0${FHR}_${memchar}" if [ $cnvw_option = ".true." ]; then - $NLN $COMIN_GES_ENS/$memchar/atmos/${GPREFIX}sfcf00${FHR}.nc sfgsfc_${CDATE}_fhr0${FHR}_${memchar} + ${NLN} "${COM_ATMOS_HISTORY_MEM_PREV}/${GPREFIX}sfcf00${FHR}.nc" \ + "sfgsfc_${PDY}${cyc}_fhr0${FHR}_${memchar}" fi if [ $FHR -eq 6 ]; then if [ $DO_CALC_INCREMENT = "YES" ]; then - $NLN $COMOUT_ANL_ENS/$memchar/atmos/${APREFIX}atmanl.nc sanl_${CDATE}_fhr0${FHR}_${memchar} + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX}atmanl.nc" \ + "sanl_${PDY}${cyc}_fhr0${FHR}_${memchar}" else - $NLN $COMOUT_ANL_ENS/$memchar/atmos/${APREFIX}atminc.nc incr_${CDATE}_fhr0${FHR}_${memchar} + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX}atminc.nc" \ + "incr_${PDY}${cyc}_fhr0${FHR}_${memchar}" fi else if [ $DO_CALC_INCREMENT = "YES" ]; then - $NLN $COMOUT_ANL_ENS/$memchar/atmos/${APREFIX}atma00${FHR}.nc sanl_${CDATE}_fhr0${FHR}_${memchar} + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX}atma00${FHR}.nc" \ + "sanl_${PDY}${cyc}_fhr0${FHR}_${memchar}" else - $NLN $COMOUT_ANL_ENS/$memchar/atmos/${APREFIX}atmi00${FHR}.nc incr_${CDATE}_fhr0${FHR}_${memchar} + ${NLN} "${COM_ATMOS_ANALYSIS_MEM}/${APREFIX}atmi00${FHR}.nc" \ + "incr_${PDY}${cyc}_fhr0${FHR}_${memchar}" fi fi done @@ -215,9 +230,12 @@ done # Ensemble mean guess for FHR in $nfhrs; do - $NLN $COMIN_GES_ENS/${GPREFIX}atmf00${FHR}.ensmean.nc sfg_${CDATE}_fhr0${FHR}_ensmean + + ${NLN} "${COM_ATMOS_HISTORY_STAT_PREV}/${GPREFIX}atmf00${FHR}.ensmean.nc" \ + "sfg_${PDY}${cyc}_fhr0${FHR}_ensmean" if [ $cnvw_option = ".true." ]; then - $NLN $COMIN_GES_ENS/${GPREFIX}sfcf00${FHR}.ensmean.nc sfgsfc_${CDATE}_fhr0${FHR}_ensmean + ${NLN} "${COM_ATMOS_HISTORY_STAT_PREV}/${GPREFIX}sfcf00${FHR}.ensmean.nc" \ + "sfgsfc_${PDY}${cyc}_fhr0${FHR}_ensmean" fi done @@ -236,7 +254,7 @@ fi # Create global_enkf namelist cat > enkf.nml << EOFnml &nam_enkf - datestring="$CDATE",datapath="$DATA/", + datestring="${PDY}${cyc}",datapath="$DATA/", analpertwtnh=${analpertwt},analpertwtsh=${analpertwt},analpertwttr=${analpertwt}, covinflatemax=1.e2,covinflatemin=1,pseudo_rh=.true.,iassim_order=0, corrlengthnh=${corrlength},corrlengthsh=${corrlength},corrlengthtr=${corrlength}, @@ -377,7 +395,7 @@ $APRUN_ENKF ${DATA}/$(basename $ENKFEXEC) 1>stdout 2>stderr export err=$?; err_chk # Cat runtime output files. -cat stdout stderr > $COMOUT_ANL_ENS/$ENKFSTAT +cat stdout stderr > "${COM_ATMOS_ANALYSIS_STAT}/${ENKFSTAT}" ################################################################################ # Postprocessing diff --git a/scripts/exgfs_atmos_awips_20km_1p0deg.sh b/scripts/exgfs_atmos_awips_20km_1p0deg.sh index 91053a8762..0f9868a506 100755 --- a/scripts/exgfs_atmos_awips_20km_1p0deg.sh +++ b/scripts/exgfs_atmos_awips_20km_1p0deg.sh @@ -19,47 +19,39 @@ # echo " " ############################################################################### -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" fcsthrs="$1" num=$# -job_name=$(echo $job|sed 's/[jpt]gfs/gfs/') +job_name=${job/[jpt]gfs/gfs} -if test "$num" -ge 1 -then +if (( num != 1 )); then echo "" - echo " Appropriate number of arguments were passed" + echo " FATAL ERROR: Incorrect number of arguments " echo "" -else echo "" - echo " Number of arguments were not passed " - echo "" - echo "" - echo "Usage: $0 \$fcsthrs (3 digits) " + echo "Usage: $0 \${fcsthrs} (3 digits) " echo "" exit 16 fi -cd $DATA +cd "${DATA}" || exit 2 ############################################### # Wait for the availability of the pgrb file ############################################### icnt=1 -while [ $icnt -lt 1000 ] -do - if [ -s $COMIN/${RUN}.${cycle}.pgrb2b.0p25.f$fcsthrs.idx ] - then - break - fi - - sleep 10 - icnt=$((icnt + 1)) - if [ $icnt -ge 180 ] - then - msg="ABORTING after 30 min of waiting for the GFS pgrb2 file!" - err_exit $msg - fi +while (( icnt < 1000 )); do + if [[ -s "${COM_ATMOS_GRIB_0p25}/${RUN}.${cycle}.pgrb2b.0p25.f${fcsthrs}.idx" ]]; then + break + fi + + sleep 10 + icnt=$((icnt + 1)) + if (( icnt >= 180 )); then + msg="FATAL ERROR: No GFS pgrb2 file after 30 min of waiting" + err_exit "${msg}" + fi done ######################################## @@ -94,157 +86,184 @@ export SCALEDEC=${SCALDEC:-$USHgfs/scale_dec.sh} # Process GFS GRIB AWIP PRODUCTS IN GRIB2 # ############################################################### -cp $COMIN/gfs.t${cyc}z.pgrb2.0p25.f${fcsthrs} tmpfile2${fcsthrs} -cp $COMIN/gfs.t${cyc}z.pgrb2b.0p25.f${fcsthrs} tmpfile2b${fcsthrs} -cat tmpfile2${fcsthrs} tmpfile2b${fcsthrs} > tmpfile${fcsthrs} -$WGRIB2 tmpfile${fcsthrs} | grep -F -f $PARMproduct/gfs_awips_parmlist_g2 | $WGRIB2 -i -grib masterfile tmpfile${fcsthrs} +cp "${COM_ATMOS_GRIB_0p25}/gfs.t${cyc}z.pgrb2.0p25.f${fcsthrs}" "tmpfile2${fcsthrs}" +cp "${COM_ATMOS_GRIB_0p25}/gfs.t${cyc}z.pgrb2b.0p25.f${fcsthrs}" "tmpfile2b${fcsthrs}" +cat "tmpfile2${fcsthrs}" "tmpfile2b${fcsthrs}" > "tmpfile${fcsthrs}" +${WGRIB2} "tmpfile${fcsthrs}" | grep -F -f "${PARMproduct}/gfs_awips_parmlist_g2" | \ + ${WGRIB2} -i -grib masterfile "tmpfile${fcsthrs}" export err=$? -if [[ $err -ne 0 ]] ; then +if [[ $err -ne 0 ]]; then echo " FATAL ERROR: masterfile does not exist." exit $err fi -$WGRIB2 masterfile -match ":PWAT:entire atmosphere" -grib gfs_pwat.grb -$WGRIB2 masterfile | grep -v ":PWAT:entire atmosphere" | $WGRIB2 -i -grib temp_gfs masterfile +${WGRIB2} masterfile -match ":PWAT:entire atmosphere" -grib gfs_pwat.grb +${WGRIB2} masterfile | grep -v ":PWAT:entire atmosphere" | ${WGRIB2} -i -grib temp_gfs masterfile ################################################################## # Process to change PWAT from level 200 to 10 (Entire Atmosphere) # in production defintion template (PDT) 4.0 ################################################################## -$WGRIB2 gfs_pwat.grb -set_byte 4 23 10 -grib gfs_pwat_levels_10.grb +${WGRIB2} gfs_pwat.grb -set_byte 4 23 10 -grib gfs_pwat_levels_10.grb export err=$?; err_chk cat temp_gfs gfs_pwat_levels_10.grb > tmp_masterfile -for GRID in conus ak prico pac 003 -do - case $GRID in - conus) - # Grid 20km_conus - CONUS - 20 km Quadruple Resolution (Lambert Conformal) - # export grid_20km_conus="30 6 0 0 0 0 0 0 369 257 12190000 226541000 8 25000000 265000000 20318000 20318000 0 64 25000000 25000000 0 0" - # $COPYGB2 -g "$grid_20km_conus" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} - - export gridconus="lambert:265.0:25.0:25.0 226.541:369:20318.0 12.19:257:20318.0" - $WGRIB2 tmp_masterfile $opt1uv $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid $gridconus awps_file_f${fcsthrs}_${GRID} - ;; - ak) - # Grid 20km_ak - Alaska - Double Resolution (Polar Stereographic) - # Redefined grid 217 for Alaska region - # export grid_20km_ak="20 6 0 0 0 0 0 0 277 213 30000000 187000000 8 60000000 225000000 22500000 22500000 0 64" - # $COPYGB2 -g "$grid_20km_ak" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} - - export gridak="nps:210.0:60.0 170.0:277:22500 35.0:225:22500" - $WGRIB2 tmp_masterfile $opt1uv $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid $gridak awps_file_f${fcsthrs}_${GRID} - ;; - prico) - # Grid 20km_prico - 0.25 degree Lat/Lon grid for Puerto Rico (20km) - # export grid_20km_prico="0 6 0 0 0 0 0 0 275 205 0 0 50750000 271750000 48 -250000 340250000 250000 250000 0" - # $COPYGB2 -g "$grid_20km_prico" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} - - export gridprico="latlon 271.75:275:0.25 50.75:205:-0.25" - $WGRIB2 tmp_masterfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid $gridprico awps_file_f${fcsthrs}_${GRID} - ;; - pac) - # Grid 20km_pac - 20 km Mercator grid for Pacific Region - # export grid_20km_pac="10 6 0 0 0 0 0 0 837 692 -45000000 110000000 48 20000000 65720000 270000000 64 0 20000000 20000000" - # NEW export grid_20km_pac="10 6 0 0 0 0 0 0 837 725 -45000000 110000000 48 20000000 65734500 270000000 64 0 20000000 20000000" - # $COPYGB2 -g "$grid_20km_pac" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} - - export gridpac="mercator:20.0 110.0:837:20000:270.0 -45.0:725:20000:65.7345" - $WGRIB2 tmp_masterfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid $gridpac awps_file_f${fcsthrs}_${GRID} - ;; - 003) - ###################################################################### - # Process GFS GRIB AWIP 1.0 DEGREE (GRID 003) PRODUCTS IN GRIB2 # - ###################################################################### - export grid003="latlon 0:360:1.0 90:181:-1.0" - $WGRIB2 tmp_masterfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid $grid003 awps_file_f${fcsthrs}_${GRID} - ;; +for GRID in conus ak prico pac 003; do + # shellcheck disable=SC2086 + case ${GRID} in + conus) + # Grid 20km_conus - CONUS - 20 km Quadruple Resolution (Lambert Conformal) + # export grid_20km_conus="30 6 0 0 0 0 0 0 369 257 12190000 226541000 8 25000000 265000000 20318000 20318000 0 64 25000000 25000000 0 0" + # $COPYGB2 -g "$grid_20km_conus" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} + + export gridconus="lambert:265.0:25.0:25.0 226.541:369:20318.0 12.19:257:20318.0" + ${WGRIB2} tmp_masterfile ${opt1uv} ${opt21} ${opt22} ${opt23} ${opt24} ${opt25} ${opt26} \ + ${opt27} ${opt28} -new_grid ${gridconus} "awps_file_f${fcsthrs}_${GRID}" + ;; + ak) + # Grid 20km_ak - Alaska - Double Resolution (Polar Stereographic) + # Redefined grid 217 for Alaska region + # export grid_20km_ak="20 6 0 0 0 0 0 0 277 213 30000000 187000000 8 60000000 225000000 22500000 22500000 0 64" + # $COPYGB2 -g "$grid_20km_ak" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} + + export gridak="nps:210.0:60.0 170.0:277:22500 35.0:225:22500" + ${WGRIB2} tmp_masterfile ${opt1uv} ${opt21} ${opt22} ${opt23} ${opt24} ${opt25} ${opt26} \ + ${opt27} ${opt28} -new_grid ${gridak} "awps_file_f${fcsthrs}_${GRID}" + ;; + prico) + # Grid 20km_prico - 0.25 degree Lat/Lon grid for Puerto Rico (20km) + # export grid_20km_prico="0 6 0 0 0 0 0 0 275 205 0 0 50750000 271750000 48 -250000 340250000 250000 250000 0" + # $COPYGB2 -g "$grid_20km_prico" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} + + export gridprico="latlon 271.75:275:0.25 50.75:205:-0.25" + ${WGRIB2} tmp_masterfile ${opt1} ${opt21} ${opt22} ${opt23} ${opt24} ${opt25} ${opt26} \ + ${opt27} ${opt28} -new_grid ${gridprico} "awps_file_f${fcsthrs}_${GRID}" + ;; + pac) + # Grid 20km_pac - 20 km Mercator grid for Pacific Region + # export grid_20km_pac="10 6 0 0 0 0 0 0 837 692 -45000000 110000000 48 20000000 65720000 270000000 64 0 20000000 20000000" + # NEW export grid_20km_pac="10 6 0 0 0 0 0 0 837 725 -45000000 110000000 48 20000000 65734500 270000000 64 0 20000000 20000000" + # $COPYGB2 -g "$grid_20km_pac" -i0 -x tmp_masterfile awps_file_f${fcsthrs}_${GRID} + + export gridpac="mercator:20.0 110.0:837:20000:270.0 -45.0:725:20000:65.7345" + ${WGRIB2} tmp_masterfile ${opt1} ${opt21} ${opt22} ${opt23} ${opt24} ${opt25} ${opt26} \ + ${opt27} ${opt28} -new_grid ${gridpac} "awps_file_f${fcsthrs}_${GRID}" + ;; + 003) + ###################################################################### + # Process GFS GRIB AWIP 1.0 DEGREE (GRID 003) PRODUCTS IN GRIB2 # + ###################################################################### + export grid003="latlon 0:360:1.0 90:181:-1.0" + ${WGRIB2} tmp_masterfile ${opt1} ${opt21} ${opt22} ${opt23} ${opt24} ${opt25} ${opt26} \ + ${opt27} ${opt28} -new_grid ${grid003} "awps_file_f${fcsthrs}_${GRID}" + ;; + *) + echo "FATAL ERROR: Unknown output grid ${GRID}" + exit 2 + ;; esac - $TRIMRH awps_file_f${fcsthrs}_${GRID} - $SCALEDEC awps_file_f${fcsthrs}_${GRID} - $GRB2INDEX awps_file_f${fcsthrs}_${GRID} awps_file_fi${fcsthrs}_${GRID} - -########################################################################### -# Checking fields in awps_file_f${fcsthrs}_${GRID} file -# before TOCGRIB2 adding WMO headers for AWIPS products. -# -# NOTE: numparm is the total of fields in grib2_awpgfs_20km_conusf000 file -########################################################################### -numparm=247 -numrec=$( $WGRIB2 awps_file_f${fcsthrs}_${GRID} | wc -l ) - -if [ $numrec -lt $numparm ] -then - msg="ABORTING : awps_file_f${fcsthrs}_${GRID} file is missing fields for AWIPS !" - err_exit $msg -fi + # shellcheck disable= + ${TRIMRH} "awps_file_f${fcsthrs}_${GRID}" + ${SCALEDEC} "awps_file_f${fcsthrs}_${GRID}" + ${GRB2INDEX} "awps_file_f${fcsthrs}_${GRID}" "awps_file_fi${fcsthrs}_${GRID}" + + ########################################################################### + # Checking fields in awps_file_f${fcsthrs}_${GRID} file + # before TOCGRIB2 adding WMO headers for AWIPS products. + # + # NOTE: numparm is the total of fields in grib2_awpgfs_20km_conusf000 file + ########################################################################### + numparm=247 + numrec=$( ${WGRIB2} "awps_file_f${fcsthrs}_${GRID}" | wc -l ) + + if (( numrec < numparm )); then + msg="FATAL ERROR: awps_file_f${fcsthrs}_${GRID} file is missing fields for AWIPS !" + err_exit "${msg}" || exit 10 + fi -# Processing AWIPS GRIB2 grids with WMO headers + # Processing AWIPS GRIB2 grids with WMO headers pgm=tocgrib2 export pgm; prep_step startmsg - if [ $GRID = "003" -a $(expr ${fcsthrs} % 6) -eq 0 ] ; then - export FORT11=awps_file_f${fcsthrs}_${GRID} - export FORT31=awps_file_fi${fcsthrs}_${GRID} - export FORT51=grib2.awpgfs${fcsthrs}.${GRID} + if [[ ${GRID} = "003" && $(( fcsthrs % 6 )) == 0 ]]; then + export FORT11="awps_file_f${fcsthrs}_${GRID}" + export FORT31="awps_file_fi${fcsthrs}_${GRID}" + export FORT51="grib2.awpgfs${fcsthrs}.${GRID}" + + cp "${PARMwmo}/grib2_awpgfs${fcsthrs}.${GRID}" "parm_list" + if [[ ${DO_WAVE} != "YES" ]]; then + # Remove wave field it not running wave model + grep -vw "5WAVH" "parm_list" > "parm_list_temp" + mv "parm_list_temp" "parm_list" + fi - $TOCGRIB2 < $PARMwmo/grib2_awpgfs${fcsthrs}.${GRID} >> $pgmout 2> errfile + ${TOCGRIB2} < "parm_list" >> "${pgmout}" 2> errfile export err=$?; err_chk echo " error from tocgrib2=",$err - if [ $SENDCOM = "YES" ] ; then + if [[ ${SENDCOM} == "YES" ]]; then ############################## - # Post Files to ${COMOUTwmo} + # Post Files to ${COM_ATMOS_WMO} ############################## - mv grib2.awpgfs${fcsthrs}.${GRID} ${COMOUTwmo}/grib2.awpgfs${fcsthrs}.${GRID}.gfs_awips_f${fcsthrs}_1p0deg_${cyc} + mv "grib2.awpgfs${fcsthrs}.${GRID}" \ + "${COM_ATMOS_WMO}/grib2.awpgfs${fcsthrs}.${GRID}.gfs_awips_f${fcsthrs}_1p0deg_${cyc}" ############################## # Distribute Data ############################## - if [ "$SENDDBN" = 'YES' -o "$SENDAWIP" = 'YES' ] ; then - $DBNROOT/bin/dbn_alert NTC_LOW $NET $job ${COMOUTwmo}/grib2.awpgfs${fcsthrs}.${GRID}.gfs_awips_f${fcsthrs}_1p0deg_${cyc} + if [[ "${SENDDBN}" == 'YES' || "${SENDAWIP}" == 'YES' ]]; then + "${DBNROOT}/bin/dbn_alert" NTC_LOW "${NET}" "${job}" \ + "${COM_ATMOS_WMO}/grib2.awpgfs${fcsthrs}.${GRID}.gfs_awips_f${fcsthrs}_1p0deg_${cyc}" else - echo "File ${COMOUTwmo}/grib2.awpgfs${fcsthrs}.${GRID}.gfs_awips_f${fcsthrs}_1p0deg_${cyc} not posted to db_net." + echo "File ${COM_ATMOS_WMO}/grib2.awpgfs${fcsthrs}.${GRID}.gfs_awips_f${fcsthrs}_1p0deg_${cyc} not posted to db_net." fi fi - elif [ $GRID != "003" ] ; then - export FORT11=awps_file_f${fcsthrs}_${GRID} - export FORT31=awps_file_fi${fcsthrs}_${GRID} - export FORT51=grib2.awpgfs_20km_${GRID}_f${fcsthrs} + elif [[ ${GRID} != "003" ]]; then + export FORT11="awps_file_f${fcsthrs}_${GRID}" + export FORT31="awps_file_fi${fcsthrs}_${GRID}" + export FORT51="grib2.awpgfs_20km_${GRID}_f${fcsthrs}" + + cp "${PARMwmo}/grib2_awpgfs_20km_${GRID}f${fcsthrs}" "parm_list" + if [[ ${DO_WAVE} != "YES" ]]; then + # Remove wave field it not running wave model + grep -vw "5WAVH" "parm_list" > "parm_list_temp" + mv "parm_list_temp" "parm_list" + fi - $TOCGRIB2 < $PARMwmo/grib2_awpgfs_20km_${GRID}f${fcsthrs} >> $pgmout 2> errfile - export err=$? ;err_chk - echo " error from tocgrib2=",$err + ${TOCGRIB2} < "parm_list" >> "${pgmout}" 2> errfile + export err=$?; err_chk || exit "${err}" - if [ $SENDCOM = "YES" ] ; then + if [[ ${SENDCOM} = "YES" ]]; then - ############################## - # Post Files to ${COMOUTwmo} - ############################## + ############################## + # Post Files to ${COM_ATMOS_WMO} + ############################## - mv grib2.awpgfs_20km_${GRID}_f${fcsthrs} ${COMOUTwmo}/grib2.awpgfs_20km_${GRID}_f${fcsthrs}.$job_name + mv "grib2.awpgfs_20km_${GRID}_f${fcsthrs}" \ + "${COM_ATMOS_WMO}/grib2.awpgfs_20km_${GRID}_f${fcsthrs}.${job_name}" - ############################## - # Distribute Data - ############################## + ############################## + # Distribute Data + ############################## - if [ "$SENDDBN" = 'YES' -o "$SENDAWIP" = 'YES' ] ; then - $DBNROOT/bin/dbn_alert NTC_LOW $NET $job ${COMOUTwmo}/grib2.awpgfs_20km_${GRID}_f${fcsthrs}.$job_name - else - echo "File ${COMOUTwmo}/grib2.awpgfs_20km_${GRID}_f${fcsthrs}.$job_name not posted to db_net." + if [[ "${SENDDBN}" = 'YES' || "${SENDAWIP}" = 'YES' ]]; then + "${DBNROOT}/bin/dbn_alert" NTC_LOW "${NET}" "${job}" \ + "${COM_ATMOS_WMO}/grib2.awpgfs_20km_${GRID}_f${fcsthrs}.${job_name}" + else + echo "File ${COM_ATMOS_WMO}/grib2.awpgfs_20km_${GRID}_f${fcsthrs}.${job_name} not posted to db_net." + fi fi - fi fi echo "Awip Processing ${fcsthrs} hour completed normally" done -if [ -e "$pgmout" ] ; then - cat $pgmout +if [[ -e "${pgmout}" ]]; then + cat "${pgmout}" fi diff --git a/scripts/exgfs_atmos_grib2_special_npoess.sh b/scripts/exgfs_atmos_grib2_special_npoess.sh index ccffbeb7aa..4009a8e66a 100755 --- a/scripts/exgfs_atmos_grib2_special_npoess.sh +++ b/scripts/exgfs_atmos_grib2_special_npoess.sh @@ -47,66 +47,62 @@ SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) ############################################################################## export SHOUR=000 export FHOUR=024 -export fhr=$(printf "%03d" $SHOUR) ############################################################ # Loop Through the Post Forecast Files ############################################################ -while test 10#$fhr -le $FHOUR -do - - ############################### - # Start Looping for the - # existence of the restart files - ############################### - export pgm="postcheck" - ic=1 - while [ $ic -le $SLEEP_LOOP_MAX ] - do - if test -f $COMIN/gfs.t${cyc}z.pgrb2b.0p50.f${fhr}.idx - then - break - else - ic=$(expr $ic + 1) - sleep $SLEEP_INT - fi - ############################### - # If we reach this point assume - # fcst job never reached restart - # period and error exit - ############################### - if [ $ic -eq $SLEEP_LOOP_MAX ] - then - export err=9 - err_chk - fi - done - -###################################################################### -# Process Global NPOESS 0.50 GFS GRID PRODUCTS IN GRIB2 F000 - F024 # -###################################################################### - 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 - cat tmpfile2 tmpfile2b > tmpfile - $WGRIB2 tmpfile | grep -F -f $paramlist | $WGRIB2 -i -grib pgb2file tmpfile - export err=$?; err_chk - - if test $SENDCOM = "YES" - then - cp pgb2file $COMOUT/${RUN}.${cycle}.pgrb2f${fhr}.npoess - - if test $SENDDBN = "YES" - then - $DBNROOT/bin/dbn_alert MODEL GFS_PGBNPOESS $job $COMOUT/${RUN}.${cycle}.pgrb2f${fhr}.npoess - else - msg="File ${RUN}.${cycle}.pgrb2f${fhr}.npoess not posted to db_net." - postmsg "$msg" - fi - echo "$PDY$cyc$fhr" > $COMOUT/${RUN}.t${cyc}z.control.halfdeg.npoess - fi - rm tmpfile pgb2file - export fhr=$(printf "%03d" $(expr $fhr + $FHINC)) +for (( fhr=$((10#${SHOUR})); fhr <= $((10#${FHOUR})); fhr = fhr + FHINC )); do + + fhr3=$(printf "%03d" "${fhr}") + + ############################### + # Start Looping for the + # existence of the restart files + ############################### + export pgm="postcheck" + ic=1 + while (( ic <= SLEEP_LOOP_MAX )); do + if [[ -f "${COM_ATMOS_GRIB_0p50}/gfs.t${cyc}z.pgrb2b.0p50.f${fhr3}.idx" ]]; then + break + else + ic=$((ic + 1)) + sleep "${SLEEP_INT}" + fi + ############################### + # If we reach this point assume + # fcst job never reached restart + # period and error exit + ############################### + if (( ic == SLEEP_LOOP_MAX )); then + echo "FATAL ERROR: 0p50 grib file not available after max sleep time" + export err=9 + err_chk || exit "${err}" + fi + done + + ###################################################################### + # Process Global NPOESS 0.50 GFS GRID PRODUCTS IN GRIB2 F000 - F024 # + ###################################################################### + paramlist=${PARMproduct}/global_npoess_paramlist_g2 + cp "${COM_ATMOS_GRIB_0p50}/gfs.t${cyc}z.pgrb2.0p50.f${fhr3}" tmpfile2 + cp "${COM_ATMOS_GRIB_0p50}/gfs.t${cyc}z.pgrb2b.0p50.f${fhr3}" tmpfile2b + cat tmpfile2 tmpfile2b > tmpfile + ${WGRIB2} tmpfile | grep -F -f ${paramlist} | ${WGRIB2} -i -grib pgb2file tmpfile + export err=$?; err_chk + + if [[ ${SENDCOM} == "YES" ]]; then + cp pgb2file "${COM_ATMOS_GOES}/${RUN}.${cycle}.pgrb2f${fhr3}.npoess" + + if [[ ${SENDDBN} == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGBNPOESS "${job}" \ + "${COM_ATMOS_GOES}/${RUN}.${cycle}.pgrb2f${fhr3}.npoess" + else + msg="File ${RUN}.${cycle}.pgrb2f${fhr3}.npoess not posted to db_net." + postmsg "${msg}" || echo "${msg}" + fi + echo "${PDY}${cyc}${fhr3}" > "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.halfdeg.npoess" + fi + rm tmpfile pgb2file done @@ -115,89 +111,80 @@ done ################################################################ export SHOUR=000 export FHOUR=180 -export fhr=$(printf "%03d" $SHOUR) ################################# # Process GFS PGRB2_SPECIAL_POST ################################# -while test 10#$fhr -le $FHOUR -do - ############################### - # Start Looping for the - # existence of the restart files - ############################### - set +x - export pgm="postcheck" - ic=1 - while [ $ic -le $SLEEP_LOOP_MAX ] - do - if test -f $restart_file$fhr - then - break - else - ic=$(expr $ic + 1) - sleep $SLEEP_INT - fi - ############################### - # If we reach this point assume - # fcst job never reached restart - # period and error exit - ############################### - if [ $ic -eq $SLEEP_LOOP_MAX ] - then - export err=9 - err_chk - fi - done - set_trace - - ############################### - # Put restart files into /nwges - # for backup to start Model Fcst - ############################### - - cp $COMIN/${RUN}.t${cyc}z.special.grb2f$fhr masterfile - -# $COPYGB2 -g "0 6 0 0 0 0 0 0 360 181 0 0 90000000 0 48 -90000000 359000000 1000000 1000000 0" -i1,1 -x masterfile pgb2file - -# export grid1p0="latlon 0:360:1.0 90:181:-1.0" - export grid0p25="latlon 0:1440:0.25 90:721:-0.25" - $WGRIB2 masterfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid $grid0p25 pgb2file - -# creating higher resolution goes files for US centers -# $COPYGB2 -g "30 6 0 0 0 0 0 0 349 277 1000000 214500000 8 50000000 253000000 32463000 32463000 0 64 50000000 50000000 0 0" -i1,1 -x masterfile pgb2file2 - - export gridconus="lambert:253.0:50.0:50.0 214.5:349:32463.0 1.0:277:32463.0" - $WGRIB2 masterfile $opt1uv $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid $gridconus pgb2file2 - - $WGRIB2 pgb2file -s > pgb2ifile - - if test $SENDCOM = "YES" - then - - cp pgb2file $COMOUT/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr} - cp pgb2ifile $COMOUT/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr}.idx - - cp pgb2file2 $COMOUT/${RUN}.${cycle}.goessimpgrb2f${fhr}.grd221 - - if test $SENDDBN = "YES" - then - $DBNROOT/bin/dbn_alert MODEL GFS_GOESSIMPGB2_0P25 $job $COMOUT/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr} - $DBNROOT/bin/dbn_alert MODEL GFS_GOESSIMPGB2_0P25_WIDX $job $COMOUT/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr}.idx - $DBNROOT/bin/dbn_alert MODEL GFS_GOESSIMGRD221_PGB2 $job $COMOUT/${RUN}.${cycle}.goessimpgrb2f${fhr}.grd221 - fi - - echo "$PDY$cyc$fhr" > $COMOUT/${RUN}.t${cyc}z.control.goessimpgrb - fi - rm pgb2file2 pgb2ifile - - if test "$SENDECF" = 'YES' - then - export fhour=$(expr ${fhr} % 6 ) - fi - - export fhr=$(printf "%03d" $(expr $fhr + $FHINC)) +for (( fhr=$((10#${SHOUR})); fhr <= $((10#${FHOUR})); fhr = fhr + FHINC )); do + + fhr3=$(printf "%03d" "${fhr}") + + ############################### + # Start Looping for the + # existence of the restart files + ############################### + set +x + export pgm="postcheck" + ic=1 + while (( ic <= SLEEP_LOOP_MAX )); do + if [[ -f "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.special.grb2if${fhr3}.idx" ]]; then + break + else + ic=$((ic + 1)) + sleep "${SLEEP_INT}" + fi + ############################### + # If we reach this point assume + # fcst job never reached restart + # period and error exit + ############################### + if (( ic == SLEEP_LOOP_MAX )); then + echo "FATAL ERROR: Special goes grib file not available after max sleep time" + export err=9 + err_chk || exit "${err}" + fi + done + set_trace + ############################### + # Put restart files into /nwges + # for backup to start Model Fcst + ############################### + cp "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.special.grb2if${fhr3}" masterfile + export grid0p25="latlon 0:1440:0.25 90:721:-0.25" + ${WGRIB2} masterfile ${opt1} ${opt21} ${opt22} ${opt23} ${opt24} ${opt25} ${opt26} \ + ${opt27} ${opt28} -new_grid ${grid0p25} pgb2file + + export gridconus="lambert:253.0:50.0:50.0 214.5:349:32463.0 1.0:277:32463.0" + ${WGRIB2} masterfile ${opt1} ${opt21} ${opt22} ${opt23} ${opt24} ${opt25} ${opt26} \ + ${opt27} ${opt28} -new_grid ${gridconus} pgb2file2 + + ${WGRIB2} pgb2file -s > pgb2ifile + + if [[ ${SENDCOM} == "YES" ]]; then + + cp pgb2file "${COM_ATMOS_GOES}/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr3}" + cp pgb2ifile "${COM_ATMOS_GOES}/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr3}.idx" + cp pgb2file2 "${COM_ATMOS_GOES}/${RUN}.${cycle}.goessimpgrb2f${fhr3}.grd221" + + if [[ ${SENDDBN} == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_GOESSIMPGB2_0P25 "${job}" \ + "${COM_ATMOS_GOES}/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_GOESSIMPGB2_0P25_WIDX "${job}" \ + "${COM_ATMOS_GOES}/${RUN}.${cycle}.goessimpgrb2.0p25.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_GOESSIMGRD221_PGB2 "${job}" \ + "${COM_ATMOS_GOES}/${RUN}.${cycle}.goessimpgrb2f${fhr}.grd221" + fi + + echo "${PDY}${cyc}${fhr}" > "${COM_ATMOS_GOES}/${RUN}.t${cyc}z.control.goessimpgrb" + fi + rm pgb2file2 pgb2ifile + + if [[ ${SENDECF} == "YES" ]]; then + # TODO Does this even do anything? + export fhour=$(( fhr % 6 )) + fi + done diff --git a/scripts/exgfs_atmos_grib_awips.sh b/scripts/exgfs_atmos_grib_awips.sh index 857846c448..f10508626f 100755 --- a/scripts/exgfs_atmos_grib_awips.sh +++ b/scripts/exgfs_atmos_grib_awips.sh @@ -21,51 +21,45 @@ # echo " FEB 2019 - Removed grid 225" ##################################################################### -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" fcsthrs="$1" num=$# -job_name=$(echo $job|sed 's/[jpt]gfs/gfs/') +job_name=${job/[jpt]gfs/gfs} -fcsthrs=$(printf "%03d" $fcsthrs) - -export SCALEDEC=${SCALDEC:-$USHgfs/scale_dec.sh} - -if test "$num" -ge 1 -then - echo "" - echo " Appropriate number of arguments were passed" - echo "" -else +if (( num != 1 )); then echo "" - echo " FATAL ERROR: Number of arguments were not passed." + echo " FATAL ERROR: Incorrect number of arguments " echo "" echo "" - echo "Usage: $0 \$fcsthrs (3-digit) " + echo "Usage: $0 \${fcsthrs} (3 digits) " echo "" exit 16 fi -cd $DATA/awips_g1 +cd "${DATA}" || exit 2 + +fcsthrs=$(printf "%03d" "${fcsthrs}") + +export SCALEDEC=${SCALDEC:-${USHgfs}/scale_dec.sh} + +cd ${DATA}/awips_g1 || exit 2 ############################################### # Wait for the availability of the pgrb file ############################################### icnt=1 -while [ $icnt -lt 1000 ] -do - if [ -s $COMIN/${RUN}.${cycle}.pgrb2b.0p25.f${fcsthrs}.idx ] - then - break - fi - - sleep 10 - icnt=$((icnt + 1)) - if [ $icnt -ge 180 ] - then - msg="ABORTING after 30 min of waiting for the pgrb file!" - err_exit $msg - fi +while (( icnt < 1000 )); do + if [[ -s "${COM_ATMOS_GRIB_0p25}/${RUN}.${cycle}.pgrb2b.0p25.f${fcsthrs}.idx" ]]; then + break + fi + + sleep 10 + icnt=$((icnt + 1)) + if (( icnt >= 180 )); then + msg="FATAL ERROR: No GFS pgrb2 file after 30 min of waiting" + err_exit "${msg}" + fi done echo " ------------------------------------------" @@ -80,64 +74,63 @@ echo "###############################################" echo " " set_trace - cp $COMIN/gfs.t${cyc}z.pgrb2.0p25.f${fcsthrs} tmpfile2 - cp $COMIN/gfs.t${cyc}z.pgrb2b.0p25.f${fcsthrs} tmpfile2b - cat tmpfile2 tmpfile2b > tmpfile - $WGRIB2 tmpfile | grep -F -f $PARMproduct/gfs_awips_parmlist_g2 | $WGRIB2 -i -grib masterfile tmpfile - $SCALEDEC masterfile - $CNVGRIB -g21 masterfile masterfile.grib1 +cp "${COM_ATMOS_GRIB_0p25}/gfs.t${cyc}z.pgrb2.0p25.f${fcsthrs}" "tmpfile2" +cp "${COM_ATMOS_GRIB_0p25}/gfs.t${cyc}z.pgrb2b.0p25.f${fcsthrs}" "tmpfile2b" +cat tmpfile2 tmpfile2b > tmpfile +${WGRIB2} tmpfile | grep -F -f "${PARMproduct}/gfs_awips_parmlist_g2" | \ + ${WGRIB2} -i -grib masterfile tmpfile +${SCALEDEC} masterfile +${CNVGRIB} -g21 masterfile masterfile.grib1 - ln -s masterfile.grib1 fort.11 +ln -s masterfile.grib1 fort.11 -# $OVERGRIDID << EOF - ${UTILgfs}/exec/overgridid << EOF +"${HOMEgfs}/exec/overgridid.x" << EOF 255 EOF - mv fort.51 master.grbf${fcsthrs} - rm fort.11 +mv fort.51 "master.grbf${fcsthrs}" +rm fort.11 - $GRBINDEX master.grbf${fcsthrs} master.grbif${fcsthrs} +${GRBINDEX} "master.grbf${fcsthrs}" "master.grbif${fcsthrs}" ############################################################### # Process GFS GRIB1 AWIP GRIDS 211 PRODUCTS ############################################################### - executable=mkgfsawps - DBNALERT_TYPE=GRIB_LOW +DBNALERT_TYPE=GRIB_LOW - startmsg +startmsg # GRID=211 out to 240 hours: - export GRID=211 - export FORT11=master.grbf${fcsthrs} - export FORT31=master.grbif${fcsthrs} - export FORT51=xtrn.awpgfs${fcsthrs}.${GRID} +export GRID=211 +export FORT11="master.grbf${fcsthrs}" +export FORT31="master.grbif${fcsthrs}" +export FORT51="xtrn.awpgfs${fcsthrs}.${GRID}" # $MKGFSAWPS < $PARMwmo/grib_awpgfs${fcsthrs}.${GRID} parm=KWBC >> $pgmout 2>errfile - ${UTILgfs}/exec/mkgfsawps < $PARMwmo/grib_awpgfs${fcsthrs}.${GRID} parm=KWBC >> $pgmout 2>errfile - export err=$?; err_chk - ############################## - # Post Files to ${COMOUTwmo} - ############################## +"${HOMEgfs}/exec/mkgfsawps.x" < "${PARMwmo}/grib_awpgfs${fcsthrs}.${GRID}" parm=KWBC >> "${pgmout}" 2>errfile +export err=$?; err_chk +############################## +# Post Files to ${COM_ATMOS_WMO} +############################## - if test "$SENDCOM" = 'YES' - then - cp xtrn.awpgfs${fcsthrs}.${GRID} ${COMOUTwmo}/xtrn.awpgfs${fcsthrs}.${GRID}.$job_name +if [[ "${SENDCOM}" = 'YES' ]]; then + cp "xtrn.awpgfs${fcsthrs}.${GRID}" "${COM_ATMOS_WMO}/xtrn.awpgfs${fcsthrs}.${GRID}.${job_name}" - ############################## - # Distribute Data - ############################## + ############################## + # Distribute Data + ############################## - if [ "$SENDDBN" = 'YES' -o "$SENDAWIP" = 'YES' ] ; then - $DBNROOT/bin/dbn_alert $DBNALERT_TYPE $NET $job ${COMOUTwmo}/xtrn.awpgfs${fcsthrs}.${GRID}.$job_name - else - echo "File $output_grb.$job_name not posted to db_net." - fi + if [[ "${SENDDBN}" == 'YES' || "${SENDAWIP}" == 'YES' ]] ; then + "${DBNROOT}/bin/dbn_alert" "${DBNALERT_TYPE}" "${NET}" "${job}" \ + "${COM_ATMOS_WMO}/xtrn.awpgfs${fcsthrs}.${GRID}.${job_name}" + else + echo "File ${output_grb}.${job_name} not posted to db_net." fi +fi -if [ -e "$pgmout" ] ; then - cat $pgmout +if [[ -e "${pgmout}" ]] ; then + cat ${pgmout} fi ############################################################################### diff --git a/scripts/exgfs_atmos_nawips.sh b/scripts/exgfs_atmos_nawips.sh index 764dde4fe1..07b0ca8b3f 100755 --- a/scripts/exgfs_atmos_nawips.sh +++ b/scripts/exgfs_atmos_nawips.sh @@ -21,13 +21,14 @@ cd $DATA RUN2=$1 fend=$2 DBN_ALERT_TYPE=$3 +destination=${4} DATA_RUN=$DATA/$RUN2 mkdir -p $DATA_RUN cd $DATA_RUN # -NAGRIB=$GEMEXE/nagrib2_nc +NAGRIB=$GEMEXE/nagrib2 # cpyfil=gds @@ -44,137 +45,131 @@ maxtries=360 fhcnt=$fstart while [ $fhcnt -le $fend ] ; do -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 - - fhr=$(printf "%03d" $fhcnt) - fhcnt3=$(expr $fhr % 3) - - fhr3=$(printf "%03d" $fhcnt) - - GEMGRD=${RUN2}_${PDY}${cyc}f${fhr3} - -# Set type of Interpolation for WGRIB2 - export opt1=' -set_grib_type same -new_grid_winds earth ' - export opt1uv=' -set_grib_type same -new_grid_winds grid ' - export opt21=' -new_grid_interpolation bilinear -if ' - export opt22=":(CSNOW|CRAIN|CFRZR|CICEP|ICSEV):" - export opt23=' -new_grid_interpolation neighbor -fi ' - export opt24=' -set_bitmap 1 -set_grib_max_bits 16 -if ' - export opt25=":(APCP|ACPCP|PRATE|CPRAT):" - export opt26=' -set_grib_max_bits 25 -fi -if ' - export opt27=":(APCP|ACPCP|PRATE|CPRAT|DZDT):" - export opt28=' -new_grid_interpolation budget -fi ' - export TRIMRH=$HOMEgfs/ush/trim_rh.sh - - if [ $RUN2 = "gfs_0p50" ]; then - export GRIBIN=$COMIN/${model}.${cycle}.pgrb2.0p50.f${fhr} - GRIBIN_chk=$COMIN/${model}.${cycle}.pgrb2.0p50.f${fhr}.idx - elif [ $RUN2 = "gfs_0p25" -o $RUN2 = "gdas_0p25" -o $RUN2 = "gfs35_atl" -o $RUN2 = "gfs35_pac" -o $RUN2 = "gfs40" ]; then - export GRIBIN=$COMIN/${model}.${cycle}.pgrb2.0p25.f${fhr} - GRIBIN_chk=$COMIN/${model}.${cycle}.pgrb2.0p25.f${fhr}.idx - else - export GRIBIN=$COMIN/${model}.${cycle}.pgrb2.1p00.f${fhr} - GRIBIN_chk=$COMIN/${model}.${cycle}.pgrb2.1p00.f${fhr}.idx - fi - - icnt=1 - while [ $icnt -lt 1000 ] - do - if [ -r $GRIBIN_chk ] ; then - sleep 5 - break - else - echo "The process is waiting ... ${GRIBIN_chk} file to proceed." - sleep 10 - let "icnt=icnt+1" - fi - if [ $icnt -ge $maxtries ] - then - echo "ABORTING: after 1 hour of waiting for ${GRIBIN_chk} file at F$fhr to end." - export err=7 ; err_chk - exit $err - fi - done - -case $RUN2 in - gfs35_pac) -# $COPYGB2 -g "0 6 0 0 0 0 0 0 416 186 0 0 75125000 130000000 48 17000000 260000000 312000 312000 0" -x $GRIBIN grib$fhr -# NEW define gfs35_pac="0 6 0 0 0 0 0 0 416 186 0 -1 75125000 130000000 48 17405000 259480000 312000 312000 0" -# $COPYGB2 -g "0 6 0 0 0 0 0 0 416 186 0 -1 75125000 130000000 48 17405000 259480000 312000 312000 0" -x $GRIBIN grib$fhr - - export gfs35_pac='latlon 130.0:416:0.312 75.125:186:-0.312' - $WGRIB2 $GRIBIN $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid ${gfs35_pac} grib$fhr - $TRIMRH grib$fhr - ;; - gfs35_atl) -# $COPYGB2 -g "0 6 0 0 0 0 0 0 480 242 0 0 75125000 230000000 48 -500000 20000000 312000 312000 0" -x $GRIBIN grib$fhr -# NEW define gfs35_atl="0 6 0 0 0 0 0 0 480 242 0 -1 75125000 230000000 48 -67000 19448000 312000 312000 0" -# $COPYGB2 -g "0 6 0 0 0 0 0 0 480 242 0 -1 75125000 230000000 48 -67000 19448000 312000 312000 0" -x $GRIBIN grib$fhr - - export gfs35_atl='latlon 230.0:480:0.312 75.125:242:-0.312' - $WGRIB2 $GRIBIN $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid ${gfs35_atl} grib$fhr - $TRIMRH grib$fhr - ;; - gfs40) -# $COPYGB2 -g "30 6 0 0 0 0 0 0 185 129 12190000 226541000 8 25000000 265000000 40635000 40635000 0 64 25000000 25000000 0 0" -x $GRIBIN grib$fhr - - export gfs40='lambert:265.0:25.0:25.0 226.541:185:40635.0 12.19:129:40635.0' - $WGRIB2 $GRIBIN $opt1uv $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid ${gfs40} grib$fhr - $TRIMRH grib$fhr - ;; - *) - cp $GRIBIN grib$fhr -esac - - export pgm="nagrib2 F$fhr" - startmsg - - $NAGRIB << EOF - GBFILE = grib$fhr - INDXFL = - GDOUTF = $GEMGRD - PROJ = $proj - GRDAREA = $grdarea - KXKY = $kxky - MAXGRD = $maxgrd - CPYFIL = $cpyfil - GAREA = $garea - OUTPUT = $output - GBTBLS = $gbtbls - GBDIAG = - PDSEXT = $pdsext - l - r + if mkdir "lock.${fhcnt}" ; 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 + + fhr=$(printf "%03d" "${fhcnt}") + + GEMGRD=${RUN2}_${PDY}${cyc}f${fhr} + + # Set type of Interpolation for WGRIB2 + export opt1=' -set_grib_type same -new_grid_winds earth ' + export opt1uv=' -set_grib_type same -new_grid_winds grid ' + export opt21=' -new_grid_interpolation bilinear -if ' + export opt22=":(CSNOW|CRAIN|CFRZR|CICEP|ICSEV):" + export opt23=' -new_grid_interpolation neighbor -fi ' + export opt24=' -set_bitmap 1 -set_grib_max_bits 16 -if ' + export opt25=":(APCP|ACPCP|PRATE|CPRAT):" + export opt26=' -set_grib_max_bits 25 -fi -if ' + export opt27=":(APCP|ACPCP|PRATE|CPRAT|DZDT):" + export opt28=' -new_grid_interpolation budget -fi ' + export TRIMRH=$HOMEgfs/ush/trim_rh.sh + + case ${RUN2} in + # TODO: Why aren't we interpolating from the 0p25 grids for 35-km and 40-km? + 'gfs_0p50' | 'gfs_0p25') res=${RUN2: -4};; + *) res="1p00";; + esac + + source_var="COM_ATMOS_GRIB_${res}" + export GRIBIN="${!source_var}/${model}.${cycle}.pgrb2.${res}.f${fhr}" + GRIBIN_chk="${!source_var}/${model}.${cycle}.pgrb2.${res}.f${fhr}.idx" + + icnt=1 + while [ $icnt -lt 1000 ]; do + if [ -r $GRIBIN_chk ] ; then + sleep 5 + break + else + echo "The process is waiting ... ${GRIBIN_chk} file to proceed." + sleep 10 + let "icnt=icnt+1" + fi + if [ $icnt -ge $maxtries ]; then + echo "ABORTING: after 1 hour of waiting for ${GRIBIN_chk} file at F$fhr to end." + export err=7 ; err_chk + exit $err + fi + done + + case $RUN2 in + gfs35_pac) + # $COPYGB2 -g "0 6 0 0 0 0 0 0 416 186 0 0 75125000 130000000 48 17000000 260000000 312000 312000 0" -x $GRIBIN grib$fhr + # NEW define gfs35_pac="0 6 0 0 0 0 0 0 416 186 0 -1 75125000 130000000 48 17405000 259480000 312000 312000 0" + # $COPYGB2 -g "0 6 0 0 0 0 0 0 416 186 0 -1 75125000 130000000 48 17405000 259480000 312000 312000 0" -x $GRIBIN grib$fhr + + export gfs35_pac='latlon 130.0:416:0.312 75.125:186:-0.312' + $WGRIB2 $GRIBIN $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid ${gfs35_pac} grib$fhr + $TRIMRH grib$fhr + ;; + gfs35_atl) + # $COPYGB2 -g "0 6 0 0 0 0 0 0 480 242 0 0 75125000 230000000 48 -500000 20000000 312000 312000 0" -x $GRIBIN grib$fhr + # NEW define gfs35_atl="0 6 0 0 0 0 0 0 480 242 0 -1 75125000 230000000 48 -67000 19448000 312000 312000 0" + # $COPYGB2 -g "0 6 0 0 0 0 0 0 480 242 0 -1 75125000 230000000 48 -67000 19448000 312000 312000 0" -x $GRIBIN grib$fhr + + export gfs35_atl='latlon 230.0:480:0.312 75.125:242:-0.312' + $WGRIB2 $GRIBIN $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid ${gfs35_atl} grib$fhr + $TRIMRH grib$fhr + ;; + gfs40) + # $COPYGB2 -g "30 6 0 0 0 0 0 0 185 129 12190000 226541000 8 25000000 265000000 40635000 40635000 0 64 25000000 25000000 0 0" -x $GRIBIN grib$fhr + + export gfs40='lambert:265.0:25.0:25.0 226.541:185:40635.0 12.19:129:40635.0' + $WGRIB2 $GRIBIN $opt1uv $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 -new_grid ${gfs40} grib$fhr + $TRIMRH grib$fhr + ;; + *) + cp $GRIBIN grib$fhr + esac + + export pgm="nagrib2 F$fhr" + startmsg + + $NAGRIB << EOF + GBFILE = grib$fhr + INDXFL = + GDOUTF = $GEMGRD + PROJ = $proj + GRDAREA = $grdarea + KXKY = $kxky + MAXGRD = $maxgrd + CPYFIL = $cpyfil + GAREA = $garea + OUTPUT = $output + GBTBLS = $gbtbls + GBDIAG = + PDSEXT = $pdsext + l + r EOF - export err=$?;err_chk - - if [ $SENDCOM = "YES" ] ; then - cpfs $GEMGRD $COMOUT/$GEMGRD - if [ $SENDDBN = "YES" ] ; then - $DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job \ - $COMOUT/$GEMGRD - fi - fi - cd $DATA_RUN -else + export err=$?;err_chk + + if [[ ${SENDCOM} == "YES" ]] ; then + cpfs "${GEMGRD}" "${destination}/${GEMGRD}" + if [[ ${SENDDBN} == "YES" ]] ; then + "${DBNROOT}/bin/dbn_alert" MODEL "${DBN_ALERT_TYPE}" "${job}" \ + "${destination}/${GEMGRD}" + fi + fi + cd $DATA_RUN + else if [ $fhcnt -ge 240 ] ; then - if [ $fhcnt -lt 276 -a $RUN2 = "gfs_0p50" ] ; then - let fhcnt=fhcnt+6 - else - let fhcnt=fhcnt+12 - fi + if [ $fhcnt -lt 276 -a $RUN2 = "gfs_0p50" ] ; then + let fhcnt=fhcnt+6 + else + let fhcnt=fhcnt+12 + fi elif [ $fhcnt -lt 120 -a $RUN2 = "gfs_0p25" ] ; then -#### let fhcnt=fhcnt+1 - let fhcnt=fhcnt+$ILPOST + #### let fhcnt=fhcnt+1 + let fhcnt=fhcnt+$ILPOST else - let fhcnt=fhcnt+finc + fhcnt=$((ILPOST > finc ? fhcnt+ILPOST : fhcnt+finc )) fi -fi + fi done $GEMEXE/gpend diff --git a/scripts/exgfs_atmos_post.sh b/scripts/exgfs_atmos_post.sh index aa266c1721..40bde0f731 100755 --- a/scripts/exgfs_atmos_post.sh +++ b/scripts/exgfs_atmos_post.sh @@ -84,7 +84,7 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Process analysis when post_times is 00 stime="$(echo "${post_times}" | cut -c1-3)" export stime -export loganl="${COMIN}/${PREFIX}atmanl.nc" +export loganl="${COM_ATMOS_ANALYSIS}/${PREFIX}atmanl.nc" if [[ "${stime}" = "anl" ]]; then if [[ -f "${loganl}" ]]; then @@ -106,9 +106,9 @@ if [[ "${stime}" = "anl" ]]; then fi [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile - ln -fs "${COMIN}/${PREFIX}atmanl.nc" nemsfile + ln -fs "${COM_ATMOS_ANALYSIS}/${PREFIX}atmanl.nc" nemsfile export NEMSINP=nemsfile - ln -fs "${COMIN}/${PREFIX}sfcanl.nc" flxfile + ln -fs "${COM_ATMOS_ANALYSIS}/${PREFIX}sfcanl.nc" flxfile export FLXINP=flxfile export PGBOUT=pgbfile @@ -138,28 +138,28 @@ if [[ "${stime}" = "anl" ]]; then if [[ "${GRIBVERSION}" = 'grib2' ]]; then MASTERANL=${PREFIX}master.grb2${fhr3} MASTERANLIDX=${PREFIX}master.grb2i${fhr3} - cp "${PGBOUT2}" "${COMOUT}/${MASTERANL}" - ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERANLIDX}" + cp "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERANL}" + ${GRB2INDEX} "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERANLIDX}" fi if [[ "${SENDDBN}" = 'YES' ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL GFS_MSC_sfcanl "${job}" "${COMOUT}/${PREFIX}sfcanl.nc" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_SA "${job}" "${COMOUT}/${PREFIX}atmanl.nc" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_MSC_sfcanl "${job}" "${COM_ATMOS_ANALYSIS}/${PREFIX}sfcanl.nc" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SA "${job}" "${COM_ATMOS_ANALYSIS}/${PREFIX}atmanl.nc" if [[ "${PGBF}" = 'YES' ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.anl.idx" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.anl" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.anl.idx" - - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.anl" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.anl.idx" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.anl" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.anl.idx" - - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.anl" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.anl.idx" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.anl" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.anl.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.anl.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25_WIDX "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.anl.idx" + + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5 "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5_WIDX "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.anl.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5 "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5_WIDX "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.anl.idx" + + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0 "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0_WIDX "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.anl.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0 "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.anl" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0_WIDX "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.anl.idx" fi fi fi @@ -192,8 +192,8 @@ if [[ "${stime}" = "anl" ]]; then -new_grid ${wafsgrid} "${PGBOUT}.tmp" if [[ "${SENDCOM}" = "YES" ]]; then - cp "${PGBOUT}.tmp" "${COMOUT}/${PREFIX}wafs.0p25.anl" - ${WGRIB2} -s "${PGBOUT}.tmp" > "${COMOUT}/${PREFIX}wafs.0p25.anl.idx" + cp "${PGBOUT}.tmp" "${COM_ATMOS_WAFS}/${PREFIX}wafs.0p25.anl" + ${WGRIB2} -s "${PGBOUT}.tmp" > "${COM_ATMOS_WAFS}/${PREFIX}wafs.0p25.anl.idx" # if [ $SENDDBN = YES ]; then # $DBNROOT/bin/dbn_alert MODEL GFS_WAFS_GB2 $job $COMOUT/${PREFIX}wafs.0p25.anl @@ -250,9 +250,9 @@ else ## not_anl if_stime # for backup to start Model Fcst ############################### [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile - ln -fs "${COMIN}/${PREFIX}atmf${fhr}.nc" nemsfile + ln -fs "${COM_ATMOS_HISTORY}/${PREFIX}atmf${fhr}.nc" nemsfile export NEMSINP=nemsfile - ln -fs "${COMIN}/${PREFIX}sfcf${fhr}.nc" flxfile + ln -fs "${COM_ATMOS_HISTORY}/${PREFIX}sfcf${fhr}.nc" flxfile export FLXINP=flxfile if (( fhr > 0 )); then @@ -311,7 +311,7 @@ else ## not_anl if_stime if [[ "${INLINE_POST}" = ".false." ]]; then ${POSTGPSH} else - cp -p "${COMOUT}/${MASTERFL}" "${PGBOUT}" + cp -p "${COM_ATMOS_MASTER}/${MASTERFL}" "${PGBOUT}" fi export err=$?; err_chk @@ -330,31 +330,31 @@ else ## not_anl if_stime if [[ "${SENDCOM}" = "YES" ]]; then if [[ "${GRIBVERSION}" = 'grib2' ]]; then if [[ "${INLINE_POST}" = ".false." ]]; then - cp "${PGBOUT2}" "${COMOUT}/${MASTERFL}" + cp "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERFL}" fi - ${GRB2INDEX} "${PGBOUT2}" "${COMOUT}/${MASTERFLIDX}" + ${GRB2INDEX} "${PGBOUT2}" "${COM_ATMOS_MASTER}/${MASTERFLIDX}" fi if [[ "${SENDDBN}" = 'YES' ]]; then if [[ "${GRIBVERSION}" = 'grib2' ]]; then if [[ "${PGBF}" = 'YES' ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p25.f${fhr}.idx" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p25.f${fhr}.idx" - - if [[ -s "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}" ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.0p50.f${fhr}.idx" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5 "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.0p50.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25 "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P25_WIDX "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25 "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P25_WIDX "${job}" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.f${fhr}.idx" + + if [[ -s "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.f${fhr}" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5 "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_0P5_WIDX "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5 "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_0P5_WIDX "${job}" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.f${fhr}.idx" fi - if [[ -s "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2.1p00.f${fhr}.idx" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0 "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.f${fhr}" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0_WIDX "${job}" "${COMOUT}/${PREFIX}pgrb2b.1p00.f${fhr}.idx" + if [[ -s "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.f${fhr}" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0 "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2_1P0_WIDX "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.f${fhr}.idx" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0 "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PGB2B_1P0_WIDX "${job}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.f${fhr}.idx" fi fi fi @@ -384,9 +384,9 @@ else ## not_anl if_stime if [[ "${INLINE_POST}" = ".false." ]]; then ${POSTGPSH} export err=$?; err_chk - mv fluxfile "${COMOUT}/${FLUXFL}" + mv fluxfile "${COM_ATMOS_MASTER}/${FLUXFL}" fi - ${WGRIB2} -s "${COMOUT}/${FLUXFL}" > "${COMOUT}/${FLUXFLIDX}" + ${WGRIB2} -s "${COM_ATMOS_MASTER}/${FLUXFL}" > "${COM_ATMOS_MASTER}/${FLUXFLIDX}" #Add extra flux.1p00 file for coupled if [[ "${FLXGF}" = 'YES' ]]; then @@ -396,8 +396,8 @@ else ## not_anl if_stime fi if [[ "${SENDDBN}" = 'YES' ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2 "${job}" "${COMOUT}/${FLUXFL}" - "${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2_WIDX "${job}" "${COMOUT}/${FLUXFLIDX}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2 "${job}" "${COM_ATMOS_MASTER}/${FLUXFL}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SGB_GB2_WIDX "${job}" "${COM_ATMOS_MASTER}/${FLUXFLIDX}" fi fi @@ -410,7 +410,7 @@ else ## not_anl if_stime # if model already runs gfs io, make sure GFSOUT is linked to the gfsio file # new imported variable for global_post.sh - export GFSOUT=${PREFIX}gfsio${fhr} + export GFSOUT=${PREFIX}gfsio${fhr} # link satellite coefficients files, use hwrf version as ops crtm 2.0.5 # does not new coefficient files used by post @@ -444,11 +444,11 @@ else ## not_anl if_stime if [[ "${SENDCOM}" = "YES" ]]; then # echo "$PDY$cyc$pad$fhr" > $COMOUT/${RUN}.t${cyc}z.master.control - mv goesfile "${COMOUT}/${SPECIALFL}f${fhr}" - mv goesifile "${COMOUT}/${SPECIALFLIDX}f${fhr}" + mv goesfile "${COM_ATMOS_GOES}/${SPECIALFL}f${fhr}" + mv goesifile "${COM_ATMOS_GOES}/${SPECIALFLIDX}f${fhr}" if [[ "${SENDDBN}" = "YES" ]]; then - "${DBNROOT}/bin/dbn_alert" MODEL GFS_SPECIAL_GB2 "${job}" "${COMOUT}/${SPECIALFL}f${fhr}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_SPECIAL_GB2 "${job}" "${COM_ATMOS_GOES}/${SPECIALFL}f${fhr}" fi fi fi @@ -492,8 +492,8 @@ else ## not_anl if_stime else if [[ -e "${PGBOUT}" ]]; then if [[ "${SENDCOM}" = "YES" ]]; then - cp "${PGBOUT}" "${COMOUT}/${PREFIX}wafs.grb2f${fhr}" - cp "${PGIOUT}" "${COMOUT}/${PREFIX}wafs.grb2if${fhr}" + cp "${PGBOUT}" "${COM_ATMOS_WAFS}/${PREFIX}wafs.grb2f${fhr}" + cp "${PGIOUT}" "${COM_ATMOS_WAFS}/${PREFIX}wafs.grb2if${fhr}" fi fi fi diff --git a/scripts/exgfs_atmos_postsnd.sh b/scripts/exgfs_atmos_postsnd.sh index c6d07bf9b9..668234c357 100755 --- a/scripts/exgfs_atmos_postsnd.sh +++ b/scripts/exgfs_atmos_postsnd.sh @@ -42,14 +42,11 @@ export NINT1=${FHOUT_HF_GFS:-1} export NEND1=${FHMAX_HF_GFS:-120} export NINT3=${FHOUT_GFS:-3} -rm -f -r ${COMOUT}/bufr.${cycle} -mkdir -p ${COMOUT}/bufr.${cycle} -if [ -f $HOMEgfs/ush/getncdimlen ]; then - GETDIM=$HOMEgfs/ush/getncdimlen -else - GETDIM=$EXECbufrsnd/getncdimlen -fi -export LEVS=$($GETDIM $COMIN/${RUN}.${cycle}.atmf000.${atmfm} pfull) +rm -f -r "${COM_ATMOS_BUFR}" +mkdir -p "${COM_ATMOS_BUFR}" +GETDIM="${HOMEgfs}/ush/getncdimlen" +LEVS=$(${GETDIM} "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atmf000.${atmfm}" pfull) +declare -x LEVS ### Loop for the hour and wait for the sigma and surface flux file: export FSTART=$STARTHOUR @@ -73,10 +70,8 @@ export FINT=$NINT1 fi ic=0 - while [ $ic -lt 1000 ] - do - if [ ! -f $COMIN/${RUN}.${cycle}.logf$FEND.${logfm} ] - then + while [ $ic -lt 1000 ]; do + if [[ ! -f "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.logf${FEND}.${logfm}" ]]; then sleep 10 ic=$(expr $ic + 1) else @@ -102,17 +97,16 @@ done ############################################################## # Tar and gzip the individual bufr files and send them to /com ############################################################## -cd ${COMOUT}/bufr.${cycle} -tar -cf - . | /usr/bin/gzip > ../${RUN}.${cycle}.bufrsnd.tar.gz -cd $DATA +cd "${COM_ATMOS_BUFR}" || exit 2 +tar -cf - . | /usr/bin/gzip > "${RUN}.${cycle}.bufrsnd.tar.gz" +cd "${DATA}" || exit 2 ######################################## # Send the single tar file to OSO ######################################## -if test "$SENDDBN" = 'YES' -then - $DBNROOT/bin/dbn_alert MODEL GFS_BUFRSND_TAR $job \ - $COMOUT/${RUN}.${cycle}.bufrsnd.tar.gz +if [[ "${SENDDBN}" == 'YES' ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_BUFRSND_TAR "${job}" \ + "${COM_ATMOS_BUFR}/${RUN}.${cycle}.bufrsnd.tar.gz" fi ######################################## diff --git a/scripts/exgfs_atmos_vminmon.sh b/scripts/exgfs_atmos_vminmon.sh index 4311878a03..a1346d5f9e 100755 --- a/scripts/exgfs_atmos_vminmon.sh +++ b/scripts/exgfs_atmos_vminmon.sh @@ -43,7 +43,7 @@ export DATA=${DATA:-$(pwd)} ######################################## # Filenames ######################################## -gsistat=${gsistat:-$COMIN/gfs.t${cyc}z.gsistat} +gsistat=${gsistat:-${COM_ATMOS_ANALYSIS}/gfs.t${cyc}z.gsistat} export mm_gnormfile=${gnormfile:-${M_FIXgfs}/gfs_minmon_gnorm.txt} export mm_costfile=${costfile:-${M_FIXgfs}/gfs_minmon_cost.txt} diff --git a/scripts/exgfs_wave_init.sh b/scripts/exgfs_wave_init.sh index da9aa5e181..2be224d1da 100755 --- a/scripts/exgfs_wave_init.sh +++ b/scripts/exgfs_wave_init.sh @@ -26,7 +26,7 @@ # --------------------------------------------------------------------------- # # 0. Preparations -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" # 0.a Basic modes of operation @@ -40,7 +40,7 @@ source "$HOMEgfs/ush/preamble.sh" echo ' *** MWW3 INIT CONFIG SCRIPT ***' echo ' ********************************' echo ' Initial configuration script' - echo " Model identifier : ${CDUMP}wave" + echo " Model identifier : ${RUN}wave" echo ' ' echo "Starting at : $(date)" echo ' ' @@ -82,18 +82,16 @@ source "$HOMEgfs/ush/preamble.sh" array=($WAVECUR_FID $WAVEICE_FID $WAVEWND_FID $waveuoutpGRD $waveGRD $waveesmfGRD $wavepostGRD $waveinterpGRD) grdALL=$(printf "%s\n" "${array[@]}" | sort -u | tr '\n' ' ') - for grdID in ${grdALL} - do - if [ -f "$COMIN/rundata/${CDUMP}wave.mod_def.${grdID}" ] - then + for grdID in ${grdALL}; do + if [[ -f "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" ]]; then set +x - echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." + echo " Mod def file for ${grdID} found in ${COM_WAVE_PREP}. copying ...." set_trace - cp $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID + cp "${COM_WAVE_PREP}/${RUN}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 " Mod def file for ${grdID} not found in ${COM_WAVE_PREP}. Setting up to generate ..." echo ' ' set_trace if [ -f $FIXwave/ww3_grid.inp.$grdID ] @@ -120,7 +118,7 @@ source "$HOMEgfs/ush/preamble.sh" err=2;export err;${errchk} fi - [[ ! -d $COMOUT/rundata ]] && mkdir -m 775 -p $COMOUT/rundata + [[ ! -d "${COM_WAVE_PREP}" ]] && mkdir -m 775 -p "${COM_WAVE_PREP}" if [ ${CFP_MP:-"NO"} = "YES" ]; then echo "$nmoddef $USHwave/wave_grid_moddef.sh $grdID > $grdID.out 2>&1" >> cmdfile else @@ -184,10 +182,8 @@ source "$HOMEgfs/ush/preamble.sh" # 1.a.3 File check - for grdID in ${grdALL} - do - if [ -f ${COMOUT}/rundata/${CDUMP}wave.mod_def.$grdID ] - then + for grdID in ${grdALL}; do + if [[ -f "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" ]]; then set +x echo ' ' echo " mod_def.$grdID succesfully created/copied " diff --git a/scripts/exgfs_wave_nawips.sh b/scripts/exgfs_wave_nawips.sh index a7ac02d085..09d23ec685 100755 --- a/scripts/exgfs_wave_nawips.sh +++ b/scripts/exgfs_wave_nawips.sh @@ -14,8 +14,8 @@ 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 -export RUNwave=${RUNwave:-${RUN}${COMPONENT}} +export grids=${grids:-'glo_30m'} #Native grids +export RUNwave=${RUNwave:-${RUN}wave} export fstart=${fstart:-0} export FHMAX_WAV=${FHMAX_WAV:-180} #180 Total of hours to process export FHMAX_HF_WAV=${FHMAX_HF_WAV:-72} @@ -71,7 +71,7 @@ while [ $fhcnt -le $FHMAX_WAV ]; do *) gridIDin= grdIDout= ;; esac - GRIBIN=$COMIN/gridded/$RUNwave.$cycle.$grdIDin.f${fhr}.grib2 + GRIBIN="${COM_WAVE_GRID}/${RUNwave}.${cycle}.${grdIDin}.f${fhr}.grib2" GRIBIN_chk=$GRIBIN.idx icnt=1 @@ -83,7 +83,7 @@ while [ $fhcnt -le $FHMAX_WAV ]; do sleep 20 fi if [ $icnt -ge $maxtries ]; then - echo "ABORTING after 5 minutes of waiting for $GRIBIN." + msg="ABORTING after 5 minutes of waiting for $GRIBIN." echo ' ' echo '**************************** ' echo '*** ERROR : NO GRIB FILE *** ' @@ -102,7 +102,7 @@ while [ $fhcnt -le $FHMAX_WAV ]; do $GRIBIN 1> out 2>&1 OK=$? if [ "$OK" != '0' ]; then - echo "ABNORMAL EXIT: ERROR IN interpolation the global grid" + msg="ABNORMAL EXIT: ERROR IN interpolation the global grid" #set +x echo ' ' echo '************************************************************* ' @@ -158,12 +158,11 @@ while [ $fhcnt -le $FHMAX_WAV ]; do fi if [ $SENDCOM = "YES" ] ; then - cpfs $GEMGRD $COMOUT/$GEMGRD + cpfs "${GEMGRD}" "${COM_WAVE_GEMPAK}/${GEMGRD}" if [ $SENDDBN = "YES" ] ; then - $DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job \ - $COMOUT/$GEMGRD + "${DBNROOT}/bin/dbn_alert" MODEL "${DBN_ALERT_TYPE}" "${job}" "${COM_WAVE_GEMPAK}/${GEMGRD}" else - echo "##### DBN_ALERT is: MODEL ${DBN_ALERT_TYPE} $job $COMOUT/$GEMGRD#####" + echo "##### DBN_ALERT is: MODEL ${DBN_ALERT_TYPE} ${job} ${COM_WAVE_GEMPAK}/${GEMGRD}#####" fi fi rm grib_$grid diff --git a/scripts/exgfs_wave_post_gridded_sbs.sh b/scripts/exgfs_wave_post_gridded_sbs.sh index bd003b7f22..76e2d6d1da 100755 --- a/scripts/exgfs_wave_post_gridded_sbs.sh +++ b/scripts/exgfs_wave_post_gridded_sbs.sh @@ -36,7 +36,7 @@ source "$HOMEgfs/ush/preamble.sh" # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic - export WAV_MOD_TAG=${CDUMP}wave${waveMEMB} + export WAV_MOD_TAG=${RUN}wave${waveMEMB} cd $DATA @@ -83,9 +83,6 @@ source "$HOMEgfs/ush/preamble.sh" echo ' ' set_trace - -# 0.c.3 Define CDATE_POST - export CDATE_POST=${CDATE} export FHRUN=0 # --------------------------------------------------------------------------- # @@ -105,23 +102,19 @@ source "$HOMEgfs/ush/preamble.sh" # 1.a Model definition files and output files (set up using poe) # 1.a.1 Copy model definition files - for grdID in $waveGRD $wavepostGRD $waveinterpGRD - do - if [ -f "$COMIN/rundata/${CDUMP}wave.mod_def.${grdID}" ] - then + for grdID in ${waveGRD} ${wavepostGRD} ${waveinterpGRD}; do + if [[ -f "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" ]]; then set +x - echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." + echo " Mod def file for ${grdID} found in ${COM_WAVE_PREP}. copying ...." set_trace - cp -f $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID + cp -f "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" "mod_def.${grdID}" fi done # 1.a.2 Check that model definition files exist - for grdID in $waveGRD $wavepostGRD $waveinterpGRD - do - if [ ! -f mod_def.$grdID ] - then + for grdID in ${waveGRD} ${wavepostGRD} ${waveinterpGRD}; do + if [[ ! -f "mod_def.${grdID}" ]]; then set +x echo ' ' echo '*************************************************** ' @@ -164,7 +157,7 @@ source "$HOMEgfs/ush/preamble.sh" echo '*********************************************** ' echo ' ' set_trace - echo "$WAV_MOD_TAG post $date $cycle : GRINT template file missing." + echo "${WAV_MOD_TAG} post ${PDY} ${cycle} : GRINT template file missing." exit_code=1 DOGRI_WAV='NO' fi @@ -241,7 +234,7 @@ source "$HOMEgfs/ush/preamble.sh" iwaitmax=120 # Maximum loop cycles for waiting until wave component output file is ready (fails after max) while [ $fhr -le $FHMAX_WAV ]; do - ymdh=$($NDATE $fhr $CDATE) + ymdh=$($NDATE $fhr ${PDY}${cyc}) YMD=$(echo $ymdh | cut -c1-8) HMS="$(echo $ymdh | cut -c9-10)0000" YMDHMS=${YMD}${HMS} @@ -265,7 +258,7 @@ source "$HOMEgfs/ush/preamble.sh" then iwait=0 for wavGRD in ${waveGRD} ; do - gfile=$COMIN/rundata/${WAV_MOD_TAG}.out_grd.${wavGRD}.${YMD}.${HMS} + gfile=${COM_WAVE_HISTORY}/${WAV_MOD_TAG}.out_grd.${wavGRD}.${YMD}.${HMS} while [ ! -s ${gfile} ]; do sleep 10; let iwait=iwait+1; done if [ $iwait -eq $iwaitmax ]; then echo '*************************************************** ' @@ -273,7 +266,7 @@ source "$HOMEgfs/ush/preamble.sh" echo '*************************************************** ' echo ' ' set_trace - echo "$WAV_MOD_TAG post $grdID $date $cycle : field output missing." + echo "${WAV_MOD_TAG} post ${grdID} ${PDY} ${cycle} : field output missing." err=3; export err;${errchk} exit $err fi @@ -407,8 +400,8 @@ source "$HOMEgfs/ush/preamble.sh" # Check if grib2 file created ENSTAG="" if [ ${waveMEMB} ]; then ENSTAG=".${membTAG}${waveMEMB}" ; fi - gribchk=${CDUMP}wave.${cycle}${ENSTAG}.${GRDNAME}.${GRDRES}.f${FH3}.grib2 - if [ ! -s ${COMOUT}/gridded/${gribchk} ]; then + gribchk="${RUN}wave.${cycle}${ENSTAG}.${GRDNAME}.${GRDRES}.f${FH3}.grib2" + if [ ! -s ${COM_WAVE_GRID}/${gribchk} ]; then set +x echo ' ' echo '********************************************' diff --git a/scripts/exgfs_wave_post_pnt.sh b/scripts/exgfs_wave_post_pnt.sh index 1a36f36eee..a7aa957564 100755 --- a/scripts/exgfs_wave_post_pnt.sh +++ b/scripts/exgfs_wave_post_pnt.sh @@ -116,16 +116,14 @@ source "$HOMEgfs/ush/preamble.sh" # Copy model definition files iloop=0 - for grdID in $waveuoutpGRD - do - if [ -f "$COMIN/rundata/${CDUMP}wave.mod_def.${grdID}" ] - then + for grdID in ${waveuoutpGRD}; do + if [[ -f "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" ]]; then set +x - echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." + echo " Mod def file for ${grdID} found in ${COM_WAVE_PREP}. copying ...." set_trace - cp -f $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID - iloop=$(expr $iloop + 1) + cp -f "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" "mod_def.${grdID}" + iloop=$((iloop + 1)) fi done @@ -235,29 +233,28 @@ source "$HOMEgfs/ush/preamble.sh" if [ "$DOSPC_WAV" = 'YES' ] || [ "$DOBLL_WAV" = 'YES' ] then - ymdh=$($NDATE -${WAVHINDH} $CDATE) - tstart="$(echo $ymdh | cut -c1-8) $(echo $ymdh | cut -c9-10)0000" + ymdh=$(${NDATE} -"${WAVHINDH}" "${PDY}${cyc}") + tstart="${ymdh:0:8} ${ymdh:8:2}0000" dtspec=3600. # default time step (not used here) - sed -e "s/TIME/$tstart/g" \ - -e "s/DT/$dtspec/g" \ + sed -e "s/TIME/${tstart}/g" \ + -e "s/DT/${dtspec}/g" \ -e "s/POINT/1/g" \ -e "s/ITYPE/0/g" \ -e "s/FORMAT/F/g" \ ww3_outp_spec.inp.tmpl > ww3_outp.inp ln -s mod_def.$waveuoutpGRD mod_def.ww3 - YMD=$(echo $CDATE | cut -c1-8) - HMS="$(echo $CDATE | cut -c9-10)0000" - if [ -f $COMIN/rundata/${WAV_MOD_TAG}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS} ] - then - ln -s $COMIN/rundata/${WAV_MOD_TAG}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS} ./out_pnt.${waveuoutpGRD} + HMS="${cyc}0000" + if [[ -f "${COM_WAVE_HISTORY}/${WAV_MOD_TAG}.out_pnt.${waveuoutpGRD}.${PDY}.${HMS}" ]]; then + ln -s "${COM_WAVE_HISTORY}/${WAV_MOD_TAG}.out_pnt.${waveuoutpGRD}.${PDY}.${HMS}" \ + "./out_pnt.${waveuoutpGRD}" else echo '*************************************************** ' - echo " FATAL ERROR : NO RAW POINT OUTPUT FILE out_pnt.${waveuoutpGRD}.${YMD}.${HMS} " + echo " FATAL ERROR : NO RAW POINT OUTPUT FILE out_pnt.${waveuoutpGRD}.${PDY}.${HMS} " echo '*************************************************** ' echo ' ' set_trace - echo "$WAV_MOD_TAG post $waveuoutpGRD $CDATE $cycle : field output missing." + echo "${WAV_MOD_TAG} post ${waveuoutpGRD} ${PDY}${cyc} ${cycle} : field output missing." err=4; export err;${errchk} fi @@ -351,11 +348,11 @@ source "$HOMEgfs/ush/preamble.sh" while [ $fhr -le $FHMAX_WAV_PNT ]; do echo " Creating the wave point scripts at : $(date)" - ymdh=$($NDATE $fhr $CDATE) - YMD=$(echo $ymdh | cut -c1-8) - HMS="$(echo $ymdh | cut -c9-10)0000" + ymdh=$($NDATE "${fhr}" "${PDY}${cyc}") + YMD=${ymdh:0:8} + HMS="${ymdh:8:2}0000" YMDHMS=${YMD}${HMS} - FH3=$(printf %03i $fhr) + FH3=$(printf %03i ${fhr}) rm -f tmpcmdfile.${FH3} touch tmpcmdfile.${FH3} @@ -367,7 +364,7 @@ source "$HOMEgfs/ush/preamble.sh" export BULLDATA=${DATA}/output_$YMDHMS cp $DATA/mod_def.${waveuoutpGRD} mod_def.${waveuoutpGRD} - pfile=$COMIN/rundata/${WAV_MOD_TAG}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS} + pfile="${COM_WAVE_HISTORY}/${WAV_MOD_TAG}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS}" if [ -f ${pfile} ] then ln -fs ${pfile} ./out_pnt.${waveuoutpGRD} diff --git a/scripts/exgfs_wave_prdgen_bulls.sh b/scripts/exgfs_wave_prdgen_bulls.sh index b902e26d4c..e75df8dfd1 100755 --- a/scripts/exgfs_wave_prdgen_bulls.sh +++ b/scripts/exgfs_wave_prdgen_bulls.sh @@ -23,7 +23,7 @@ source "$HOMEgfs/ush/preamble.sh" # 0.a Basic modes of operation # PATH for working and home directories - export RUNwave=${RUNwave:-${RUN}${COMPONENT}} + export RUNwave=${RUNwave:-${RUN}wave} export envir=${envir:-ops} export cyc=${cyc:-00} export cycle=${cycle:-t${cyc}z} @@ -58,11 +58,11 @@ source "$HOMEgfs/ush/preamble.sh" # 1. Get necessary files set +x - echo " Copying bulletins from $COMIN" + echo " Copying bulletins from ${COM_WAVE_STATION}" set_trace # 1.a Link the input file and untar it - BullIn=$COMIN/station/${RUNwave}.$cycle.cbull_tar + BullIn="${COM_WAVE_STATION}/${RUNwave}.${cycle}.cbull_tar" if [ -f $BullIn ]; then cp $BullIn cbull.tar else @@ -120,7 +120,7 @@ source "$HOMEgfs/ush/preamble.sh" if [ -f $PARMwave/bull_awips_gfswave ]; then cp $PARMwave/bull_awips_gfswave awipsbull.data else - echo "ABNORMAL EXIT: NO AWIPS BULLETIN HEADER DATA FILE" + msg="ABNORMAL EXIT: NO AWIPS BULLETIN HEADER DATA FILE" set +x echo ' ' echo '******************************************* ' @@ -146,8 +146,7 @@ source "$HOMEgfs/ush/preamble.sh" # 2.c Generate list of bulletins to process echo ' Generating buoy list ...' - echo 'bulls=$(sed -e 's/export b//g' -e 's/=/ /' awipsbull.data | grep -v "#" |awk '{ print $1}')' - bulls=$(sed -e 's/export b//g' -e 's/=/ /' awipsbull.data | grep -v "#" |awk '{ print $1}') + bulls=$(sed -e 's/export b//g' -e 's/=/ /' awipsbull.data | grep -v "#" |awk '{print $1}') # 2.d Looping over buoys running formbul echo ' Looping over buoys ... \n' @@ -176,14 +175,14 @@ source "$HOMEgfs/ush/preamble.sh" set_trace - formbul.pl -d $headr -f $fname -j $job -m ${RUNwave} \ - -p $PCOM -s NO -o $oname > formbul.out 2>&1 + formbul.pl -d "${headr}" -f "${fname}" -j "${job}" -m "${RUNwave}" \ + -p "${COM_WAVE_WMO}" -s "NO" -o "${oname}" > formbul.out 2>&1 OK=$? if [ "$OK" != '0' ] || [ ! -f $oname ]; then set_trace cat formbul.out - echo "ABNORMAL EXIT: ERROR IN formbul" + msg="ABNORMAL EXIT: ERROR IN formbul" set +x echo ' ' echo '************************************** ' @@ -202,20 +201,20 @@ source "$HOMEgfs/ush/preamble.sh" done # 3. Send output files to the proper destination - set_trace - if [ "$SENDCOM" = YES ]; then - cp awipsbull.$cycle.${RUNwave} $PCOM/awipsbull.$cycle.${RUNwave} - if [ "$SENDDBN_NTC" = YES ]; then - make_ntc_bull.pl WMOBH NONE KWBC NONE $DATA/awipsbull.$cycle.${RUNwave} $PCOM/awipsbull.$cycle.${RUNwave} - else - if [ "${envir}" = "para" ] || [ "${envir}" = "test" ] || [ "${envir}" = "dev" ]; then - echo "Making NTC bulletin for parallel environment, but do not alert." - set_trace - (export SENDDBN=NO; make_ntc_bull.pl WMOBH NONE KWBC NONE \ - $DATA/awipsbull.$cycle.${RUNwave} $PCOM/awipsbull.$cycle.${RUNwave}) - fi - fi - fi +set_trace +if [ "$SENDCOM" = YES ]; then + cp "awipsbull.${cycle}.${RUNwave}" "${COM_WAVE_WMO}/awipsbull.${cycle}.${RUNwave}" + if [ "$SENDDBN_NTC" = YES ]; then + make_ntc_bull.pl "WMOBH" "NONE" "KWBC" "NONE" "${DATA}/awipsbull.${cycle}.${RUNwave}" \ + "${COM_WAVE_WMO}/awipsbull.${cycle}.${RUNwave}" + else + if [ "${envir}" = "para" ] || [ "${envir}" = "test" ] || [ "${envir}" = "dev" ]; then + echo "Making NTC bulletin for parallel environment, but do not alert." + (export SENDDBN=NO; make_ntc_bull.pl "WMOBH" "NONE" "KWBC" "NONE" \ + "${DATA}/awipsbull.${cycle}.${RUNwave}" "${COM_WAVE_WMO}/awipsbull.${cycle}.${RUNwave}") + fi + fi +fi # --------------------------------------------------------------------------- # # 4. Clean up diff --git a/scripts/exgfs_wave_prdgen_gridded.sh b/scripts/exgfs_wave_prdgen_gridded.sh index b688cf3e0b..de7f2c4974 100755 --- a/scripts/exgfs_wave_prdgen_gridded.sh +++ b/scripts/exgfs_wave_prdgen_gridded.sh @@ -23,7 +23,7 @@ source "$HOMEgfs/ush/preamble.sh" # 0.a Basic modes of operation - export RUNwave=${RUNwave:-${RUN}${COMPONENT}} + export RUNwave=${RUNwave:-${RUN}wave} export envir=${envir:-ops} export fstart=${fstart:-0} export FHMAX_WAV=${FHMAX_WAV:-180} #180 Total of hours to process @@ -40,12 +40,13 @@ source "$HOMEgfs/ush/preamble.sh" export DATA=${DATA:-${DATAROOT:?}/${job}.$$} mkdir -p $DATA cd $DATA - export wavelog=${DATA}/${COMPONENTwave}_prdggridded.log + export wavelog=${DATA}/${RUNwave}_prdggridded.log echo "Starting MWW3 GRIDDED PRODUCTS SCRIPT" # Output grids - grids=${grids:-ao_9km at_10m ep_10m wc_10m glo_30m} -# grids=${grids:-ak_10m at_10m ep_10m wc_10m glo_30m} + # grids=${grids:-ao_9km at_10m ep_10m wc_10m glo_30m} +grids=${grids:-ak_10m at_10m ep_10m wc_10m glo_30m} +# export grids=${wavepostGRD} maxtries=${maxtries:-720} # 0.b Date and time stuff export date=$PDY @@ -97,7 +98,7 @@ source "$HOMEgfs/ush/preamble.sh" esac # - GRIBIN=$COMIN/gridded/$RUNwave.$cycle.$grdID.f${fhr}.grib2 + GRIBIN="${COM_WAVE_GRID}/${RUNwave}.${cycle}.${grdID}.f${fhr}.grib2" GRIBIN_chk=$GRIBIN.idx icnt=1 @@ -110,7 +111,7 @@ source "$HOMEgfs/ush/preamble.sh" sleep 5 fi if [ $icnt -ge $maxtries ]; then - echo "ABNORMAL EXIT: NO GRIB FILE FOR GRID $GRIBIN" + msg="ABNORMAL EXIT: NO GRIB FILE FOR GRID $GRIBIN" echo ' ' echo '**************************** ' echo '*** ERROR : NO GRIB FILE *** ' @@ -185,7 +186,7 @@ source "$HOMEgfs/ush/preamble.sh" if [ "$OK" != '0' ] then - echo "ABNORMAL EXIT: ERROR IN grb2index MWW3 for grid $grdID" + msg="ABNORMAL EXIT: ERROR IN grb2index MWW3 for grid $grdID" #set +x echo ' ' echo '******************************************** ' @@ -214,7 +215,7 @@ source "$HOMEgfs/ush/preamble.sh" OK=$? if [ "$OK" != '0' ]; then cat tocgrib2.out - echo "ABNORMAL EXIT: ERROR IN tocgrib2" + msg="ABNORMAL EXIT: ERROR IN tocgrib2" #set +x echo ' ' echo '*************************************** ' @@ -236,16 +237,16 @@ source "$HOMEgfs/ush/preamble.sh" then #set +x echo " Saving $AWIPSGRB.$grdOut.f${fhr} as grib2.$cycle.awipsww3_${grdID}.f${fhr}" - echo " in $PCOM" + echo " in ${COM_WAVE_WMO}" #set_trace - cp $AWIPSGRB.$grdID.f${fhr} $PCOM/grib2.$cycle.f${fhr}.awipsww3_${grdOut} + cp "${AWIPSGRB}.${grdID}.f${fhr}" "${COM_WAVE_WMO}/grib2.${cycle}.f${fhr}.awipsww3_${grdOut}" #set +x fi if [ "$SENDDBN" = 'YES' ] then echo " Sending $AWIPSGRB.$grdID.f${fhr} to DBRUN." - $DBNROOT/bin/dbn_alert GRIB_LOW $RUN $job $PCOM/grib2.$cycle.f${fhr}.awipsww3_${grdOut} + "${DBNROOT}/bin/dbn_alert" GRIB_LOW "${RUN}" "${job}" "${COM_WAVE_WMO}/grib2.${cycle}.f${fhr}.awipsww3_${grdOut}" fi rm -f $AWIPSGRB.$grdID.f${fhr} tocgrib2.out done # For grids diff --git a/scripts/exgfs_wave_prep.sh b/scripts/exgfs_wave_prep.sh index b4abbc816a..be006c1c85 100755 --- a/scripts/exgfs_wave_prep.sh +++ b/scripts/exgfs_wave_prep.sh @@ -46,7 +46,7 @@ source "$HOMEgfs/ush/preamble.sh" # Set wave model ID tag to include member number # if ensemble; waveMEMB var empty in deterministic - export WAV_MOD_TAG=${CDUMP}wave${waveMEMB} + export WAV_MOD_TAG=${RUN}wave${waveMEMB} cd $DATA mkdir outtmp @@ -66,13 +66,6 @@ source "$HOMEgfs/ush/preamble.sh" echo ' ' set_trace - if [ "$INDRUN" = 'no' ] - then - FHMAX_WAV=${FHMAX_WAV:-3} - else - FHMAX_WAV=${FHMAX_WAV:-384} - fi - # 0.b Date and time stuff # Beginning time for outpupt may differ from SDATE if DOIAU=YES @@ -161,20 +154,20 @@ source "$HOMEgfs/ush/preamble.sh" touch cmdfile grdINP='' - if [ "${WW3ATMINP}" = 'YES' ]; then grdINP="${grdINP} $WAVEWND_FID" ; fi - if [ "${WW3ICEINP}" = 'YES' ]; then grdINP="${grdINP} $WAVEICE_FID" ; fi - if [ "${WW3CURINP}" = 'YES' ]; then grdINP="${grdINP} $WAVECUR_FID" ; fi + if [ "${WW3ATMINP}" = 'YES' ]; then grdINP="${grdINP} $WAVEWND_FID" ; fi + if [ "${WW3ICEINP}" = 'YES' ]; then grdINP="${grdINP} $WAVEICE_FID" ; fi + if [ "${WW3CURINP}" = 'YES' ]; then grdINP="${grdINP} $WAVECUR_FID" ; fi ifile=1 for grdID in $grdINP $waveGRD do - if [ -f "$COMIN/rundata/${CDUMP}wave.mod_def.${grdID}" ] + if [ -f "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" ] then set +x - echo " Mod def file for $grdID found in ${COMIN}/rundata. copying ...." + echo " Mod def file for $grdID found in ${COM_WAVE_PREP}. copying ...." set_trace - cp $COMIN/rundata/${CDUMP}wave.mod_def.${grdID} mod_def.$grdID + cp ${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID} mod_def.$grdID else set +x @@ -191,9 +184,9 @@ source "$HOMEgfs/ush/preamble.sh" done # 1.b Netcdf Preprocessor template files - if [ "$WW3ATMINP" = 'YES' ]; then itype="$itype wind" ; fi - if [ "$WW3ICEINP" = 'YES' ]; then itype="$itype ice" ; fi - if [ "$WW3CURINP" = 'YES' ]; then itype="$itype cur" ; fi + if [[ "${WW3ATMINP}" == 'YES' ]]; then itype="${itype:-} wind" ; fi + if [[ "${WW3ICEINP}" == 'YES' ]]; then itype="${itype:-} ice" ; fi + if [[ "${WW3CURINP}" == 'YES' ]]; then itype="${itype:-} cur" ; fi for type in $itype do @@ -326,22 +319,22 @@ source "$HOMEgfs/ush/preamble.sh" export RPDY=$($NDATE -24 ${RPDY}00 | cut -c1-8) fi #Set the first time for RTOFS files to be the beginning time of simulation - ymdh_rtofs=$ymdh_beg + ymdh_rtofs=$ymdh_beg if [ "$FHMAX_WAV_CUR" -le 72 ]; then - rtofsfile1=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f024_prog.nc - rtofsfile2=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f048_prog.nc - rtofsfile3=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f072_prog.nc + rtofsfile1="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f024_prog.nc" + rtofsfile2="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f048_prog.nc" + rtofsfile3="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f072_prog.nc" if [ ! -f $rtofsfile1 ] || [ ! -f $rtofsfile2 ] || [ ! -f $rtofsfile3 ]; then #Needed current files are not available, so use RTOFS from previous day export RPDY=$($NDATE -24 ${RPDY}00 | cut -c1-8) fi else - rtofsfile1=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f096_prog.nc - rtofsfile2=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f120_prog.nc - rtofsfile3=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f144_prog.nc - rtofsfile4=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f168_prog.nc - rtofsfile5=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f192_prog.nc + rtofsfile1="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f096_prog.nc" + rtofsfile2="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f120_prog.nc" + rtofsfile3="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f144_prog.nc" + rtofsfile4="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f168_prog.nc" + rtofsfile5="${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_f192_prog.nc" if [ ! -f $rtofsfile1 ] || [ ! -f $rtofsfile2 ] || [ ! -f $rtofsfile3 ] || [ ! -f $rtofsfile4 ] || [ ! -f $rtofsfile5 ]; then #Needed current files are not available, so use RTOFS from previous day @@ -349,8 +342,6 @@ source "$HOMEgfs/ush/preamble.sh" fi fi - export COMIN_WAV_CUR=$COMIN_WAV_RTOFS/${WAVECUR_DID}.${RPDY} - ymdh_end_rtofs=$($NDATE ${FHMAX_WAV_CUR} ${RPDY}00) if [ "$ymdh_end" -lt "$ymdh_end_rtofs" ]; then ymdh_end_rtofs=$ymdh_end @@ -369,8 +360,8 @@ source "$HOMEgfs/ush/preamble.sh" fhr_rtofs=$(${NHOUR} ${ymdh_rtofs} ${RPDY}00) fh3_rtofs=$(printf "%03d" "${fhr_rtofs#0}") - curfile1h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fh3_rtofs}_prog.nc - curfile3h=${COMIN_WAV_CUR}/rtofs_glo_2ds_${fext}${fh3_rtofs}_prog.nc + curfile1h=${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_${fext}${fh3_rtofs}_prog.nc + curfile3h=${COM_RTOFS}/${WAVECUR_DID}.${RPDY}/rtofs_glo_2ds_${fext}${fh3_rtofs}_prog.nc if [ -s ${curfile1h} ] && [ "${FLGHF}" = "T" ] ; then curfile=${curfile1h} @@ -474,7 +465,7 @@ source "$HOMEgfs/ush/preamble.sh" cat $file >> cur.${WAVECUR_FID} done - cp -f cur.${WAVECUR_FID} ${COMOUT}/rundata/${CDUMP}wave.${WAVECUR_FID}.$cycle.cur + cp -f cur.${WAVECUR_FID} ${COM_WAVE_PREP}/${RUN}wave.${WAVECUR_FID}.$cycle.cur else echo ' ' @@ -494,6 +485,4 @@ source "$HOMEgfs/ush/preamble.sh" # 4. Ending output -exit $err - # End of MWW3 preprocessor script ------------------------------------------- # diff --git a/scripts/exglobal_archive.sh b/scripts/exglobal_archive.sh index 38ff1db48c..1997eec9eb 100755 --- a/scripts/exglobal_archive.sh +++ b/scripts/exglobal_archive.sh @@ -14,89 +14,99 @@ if [ "${ARCHICS_CYC}" -lt 0 ]; then fi # CURRENT CYCLE -APREFIX="${CDUMP}.t${cyc}z." +APREFIX="${RUN}.t${cyc}z." # Realtime parallels run GFS MOS on 1 day delay # If realtime parallel, back up CDATE_MOS one day -CDATE_MOS=${CDATE} +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +CDATE_MOS=${PDY}${cyc} if [ "${REALTIME}" = "YES" ]; then - CDATE_MOS=$(${NDATE} -24 "${CDATE}") + CDATE_MOS=$(${NDATE} -24 "${PDY}${cyc}") fi -PDY_MOS=$(echo "${CDATE_MOS}" | cut -c1-8) +PDY_MOS="${CDATE_MOS:0:8}" ############################################################### # Archive online for verification and diagnostics ############################################################### -COMIN=${COMINatmos:-"${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos"} -cd "${COMIN}" - source "${HOMEgfs}/ush/file_utils.sh" [[ ! -d ${ARCDIR} ]] && mkdir -p "${ARCDIR}" -nb_copy "${APREFIX}"gsistat "${ARCDIR}"/gsistat."${CDUMP}"."${CDATE}" -nb_copy "${APREFIX}"pgrb2.1p00.anl "${ARCDIR}"/pgbanl."${CDUMP}"."${CDATE}".grib2 +nb_copy "${COM_ATMOS_ANALYSIS}/${APREFIX}gsistat" "${ARCDIR}/gsistat.${RUN}.${PDY}${cyc}" +nb_copy "${COM_ATMOS_GRIB_1p00}/${APREFIX}pgrb2.1p00.anl" "${ARCDIR}/pgbanl.${RUN}.${PDY}${cyc}.grib2" # Archive 1 degree forecast GRIB2 files for verification -if [ "${CDUMP}" = "gfs" ]; then +if [[ "${RUN}" == "gfs" ]]; then fhmax=${FHMAX_GFS} fhr=0 while [ "${fhr}" -le "${fhmax}" ]; do fhr2=$(printf %02i "${fhr}") fhr3=$(printf %03i "${fhr}") - nb_copy "${APREFIX}"pgrb2.1p00.f"${fhr3}" "${ARCDIR}"/pgbf"${fhr2}"."${CDUMP}"."${CDATE}".grib2 + nb_copy "${COM_ATMOS_GRIB_1p00}/${APREFIX}pgrb2.1p00.f${fhr3}" "${ARCDIR}/pgbf${fhr2}.${RUN}.${PDY}${cyc}.grib2" fhr=$((10#${fhr} + 10#${FHOUT_GFS} )) done fi -if [ "${CDUMP}" = "gdas" ]; then +if [[ "${RUN}" == "gdas" ]]; then flist="000 003 006 009" for fhr in ${flist}; do - fname=${APREFIX}pgrb2.1p00.f${fhr} + fname="${COM_ATMOS_GRIB_1p00}/${APREFIX}pgrb2.1p00.f${fhr}" + # TODO Shouldn't the archived files also use three-digit tags? fhr2=$(printf %02i $((10#${fhr}))) - nb_copy "${fname}" "${ARCDIR}"/pgbf"${fhr2}"."${CDUMP}"."${CDATE}".grib2 + nb_copy "${fname}" "${ARCDIR}/pgbf${fhr2}.${RUN}.${PDY}${cyc}.grib2" done fi -if [ -s avno.t"${cyc}"z.cyclone.trackatcfunix ]; then - PLSOT4=$(echo "${PSLOT}"|cut -c 1-4 |tr '[a-z]' '[A-Z]') - cat avno.t"${cyc}"z.cyclone.trackatcfunix | sed s:AVNO:"${PLSOT4}":g > "${ARCDIR}"/atcfunix."${CDUMP}"."${CDATE}" - cat avnop.t"${cyc}"z.cyclone.trackatcfunix | sed s:AVNO:"${PLSOT4}":g > "${ARCDIR}"/atcfunixp."${CDUMP}"."${CDATE}" +if [[ -s "${COM_ATMOS_TRACK}/avno.t${cyc}z.cyclone.trackatcfunix" ]]; then + # shellcheck disable=2153 + PSLOT4=${PSLOT:0:4} + # shellcheck disable= + PSLOT4=${PSLOT4^^} + sed "s:AVNO:${PSLOT4}:g" < "${COM_ATMOS_TRACK}/avno.t${cyc}z.cyclone.trackatcfunix" \ + > "${ARCDIR}/atcfunix.${RUN}.${PDY}${cyc}" + sed "s:AVNO:${PSLOT4}:g" < "${COM_ATMOS_TRACK}/avnop.t${cyc}z.cyclone.trackatcfunix" \ + > "${ARCDIR}/atcfunixp.${RUN}.${PDY}${cyc}" fi -if [ "${CDUMP}" = "gdas" ] && [ -s gdas.t"${cyc}"z.cyclone.trackatcfunix ]; then - PLSOT4=$(echo "${PSLOT}"|cut -c 1-4 |tr '[a-z]' '[A-Z]') - cat gdas.t"${cyc}"z.cyclone.trackatcfunix | sed s:AVNO:"${PLSOT4}":g > "${ARCDIR}"/atcfunix."${CDUMP}"."${CDATE}" - cat gdasp.t"${cyc}"z.cyclone.trackatcfunix | sed s:AVNO:"${PLSOT4}":g > "${ARCDIR}"/atcfunixp."${CDUMP}"."${CDATE}" +if [[ "${RUN}" == "gdas" ]] && [[ -s "${COM_ATMOS_TRACK}/gdas.t${cyc}z.cyclone.trackatcfunix" ]]; then + # shellcheck disable=2153 + PSLOT4=${PSLOT:0:4} + # shellcheck disable= + PSLOT4=${PSLOT4^^} + sed "s:AVNO:${PSLOT4}:g" < "${COM_ATMOS_TRACK}/gdas.t${cyc}z.cyclone.trackatcfunix" \ + > "${ARCDIR}/atcfunix.${RUN}.${PDY}${cyc}" + sed "s:AVNO:${PSLOT4}:g" < "${COM_ATMOS_TRACK}/gdasp.t${cyc}z.cyclone.trackatcfunix" \ + > "${ARCDIR}/atcfunixp.${RUN}.${PDY}${cyc}" fi -if [ "${CDUMP}" = "gfs" ]; then - 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}"/. +if [ "${RUN}" = "gfs" ]; then + nb_copy "${COM_ATMOS_GENESIS}/storms.gfso.atcf_gen.${PDY}${cyc}" "${ARCDIR}/." + nb_copy "${COM_ATMOS_GENESIS}/storms.gfso.atcf_gen.altg.${PDY}${cyc}" "${ARCDIR}/." + nb_copy "${COM_ATMOS_TRACK}/trak.gfso.atcfunix.${PDY}${cyc}" "${ARCDIR}/." + nb_copy "${COM_ATMOS_TRACK}/trak.gfso.atcfunix.altg.${PDY}${cyc}" "${ARCDIR}/." - mkdir -p "${ARCDIR}"/tracker."${CDATE}"/"${CDUMP}" + mkdir -p "${ARCDIR}/tracker.${PDY}${cyc}/${RUN}" blist="epac natl" for basin in ${blist}; do if [[ -f ${basin} ]]; then - cp -rp "${basin}" "${ARCDIR}"/tracker."${CDATE}"/"${CDUMP}" + cp -rp "${COM_ATMOS_TRACK}/${basin}" "${ARCDIR}/tracker.${PDY}${cyc}/${RUN}" fi done fi # Archive required gaussian gfs forecast files for Fit2Obs -if [ "${CDUMP}" = "gfs" ] && [ "${FITSARC}" = "YES" ]; then +if [[ "${RUN}" == "gfs" ]] && [[ "${FITSARC}" = "YES" ]]; then VFYARC=${VFYARC:-${ROTDIR}/vrfyarch} [[ ! -d ${VFYARC} ]] && mkdir -p "${VFYARC}" - mkdir -p "${VFYARC}"/"${CDUMP}"."${PDY}"/"${cyc}" - prefix=${CDUMP}.t${cyc}z + mkdir -p "${VFYARC}/${RUN}.${PDY}/${cyc}" + prefix="${RUN}.t${cyc}z" fhmax=${FHMAX_FITS:-${FHMAX_GFS}} fhr=0 while [[ ${fhr} -le ${fhmax} ]]; do fhr3=$(printf %03i "${fhr}") - sfcfile=${prefix}.sfcf${fhr3}.nc - sigfile=${prefix}.atmf${fhr3}.nc - nb_copy "${sfcfile}" "${VFYARC}"/"${CDUMP}"."${PDY}"/"${cyc}"/ - nb_copy "${sigfile}" "${VFYARC}"/"${CDUMP}"."${PDY}"/"${cyc}"/ + sfcfile="${COM_ATMOS_MASTER}/${prefix}.sfcf${fhr3}.nc" + sigfile="${COM_ATMOS_MASTER}/${prefix}.atmf${fhr3}.nc" + nb_copy "${sfcfile}" "${VFYARC}/${RUN}.${PDY}/${cyc}/" + nb_copy "${sigfile}" "${VFYARC}/${RUN}.${PDY}/${cyc}/" (( fhr = 10#${fhr} + 6 )) done fi @@ -107,171 +117,167 @@ fi if [[ ${HPSSARCH} = "YES" || ${LOCALARCH} = "YES" ]]; then ############################################################### -# --set the archiving command and create local directories, if necessary -TARCMD="htar" -HSICMD="hsi" -if [[ ${LOCALARCH} = "YES" ]]; then - TARCMD="tar" - HSICMD='' - [ ! -d "${ATARDIR}"/"${CDATE}" ] && mkdir -p "${ATARDIR}"/"${CDATE}" - [ ! -d "${ATARDIR}"/"${CDATE_MOS}" ] && [ -d "${ROTDIR}"/gfsmos."${PDY_MOS}" ] && [ "${cyc}" -eq 18 ] && mkdir -p "${ATARDIR}"/"${CDATE_MOS}" -fi - -#--determine when to save ICs for warm start and forecast-only runs -SAVEWARMICA="NO" -SAVEWARMICB="NO" -SAVEFCSTIC="NO" -firstday=$(${NDATE} +24 "${SDATE}") -mm=$(echo "${CDATE}"|cut -c 5-6) -dd=$(echo "${CDATE}"|cut -c 7-8) -nday=$(( (10#${mm}-1)*30+10#${dd} )) -mod=$((nday % ARCH_WARMICFREQ)) -if [ "${CDATE}" -eq "${firstday}" ] && [ "${cyc}" -eq "${ARCHINC_CYC}" ]; then SAVEWARMICA="YES" ; fi -if [ "${CDATE}" -eq "${firstday}" ] && [ "${cyc}" -eq "${ARCHICS_CYC}" ]; then SAVEWARMICB="YES" ; fi -if [ "${mod}" -eq 0 ] && [ "${cyc}" -eq "${ARCHINC_CYC}" ]; then SAVEWARMICA="YES" ; fi -if [ "${mod}" -eq 0 ] && [ "${cyc}" -eq "${ARCHICS_CYC}" ]; then SAVEWARMICB="YES" ; fi - -if [ "${ARCHICS_CYC}" -eq 18 ]; then - nday1=$((nday+1)) - mod1=$((nday1 % ARCH_WARMICFREQ)) - if [ "${mod1}" -eq 0 ] && [ "${cyc}" -eq "${ARCHICS_CYC}" ] ; then SAVEWARMICB="YES" ; fi - if [ "${mod1}" -ne 0 ] && [ "${cyc}" -eq "${ARCHICS_CYC}" ] ; then SAVEWARMICB="NO" ; fi - if [ "${CDATE}" -eq "${SDATE}" ] && [ "${cyc}" -eq "${ARCHICS_CYC}" ] ; then SAVEWARMICB="YES" ; fi -fi - -mod=$((nday % ARCH_FCSTICFREQ)) -if [ "${mod}" -eq 0 ] || [ "${CDATE}" -eq "${firstday}" ]; then SAVEFCSTIC="YES" ; fi - - -ARCH_LIST="${COMIN}/archlist" -[[ -d ${ARCH_LIST} ]] && rm -rf "${ARCH_LIST}" -mkdir -p "${ARCH_LIST}" -cd "${ARCH_LIST}" + # --set the archiving command and create local directories, if necessary + TARCMD="htar" + HSICMD="hsi" + if [[ ${LOCALARCH} = "YES" ]]; then + TARCMD="tar" + HSICMD='' + [[ ! -d "${ATARDIR}/${PDY}${cyc}" ]] && mkdir -p "${ATARDIR}/${PDY}${cyc}" + [[ ! -d "${ATARDIR}/${CDATE_MOS}" ]] && [[ -d "${ROTDIR}/gfsmos.${PDY_MOS}" ]] && [[ "${cyc}" -eq 18 ]] && mkdir -p "${ATARDIR}/${CDATE_MOS}" + fi -"${HOMEgfs}"/ush/hpssarch_gen.sh "${CDUMP}" -status=$? -if [ "${status}" -ne 0 ]; then - echo "${HOMEgfs}/ush/hpssarch_gen.sh ${CDUMP} failed, ABORT!" - exit "${status}" -fi + #--determine when to save ICs for warm start and forecast-only runs + SAVEWARMICA="NO" + SAVEWARMICB="NO" + SAVEFCSTIC="NO" + firstday=$(${NDATE} +24 "${SDATE}") + mm="${PDY:2:2}" + dd="${PDY:4:2}" + # TODO: This math yields multiple dates sharing the same nday + nday=$(( (10#${mm}-1)*30+10#${dd} )) + mod=$((nday % ARCH_WARMICFREQ)) + if [[ "${PDY}${cyc}" -eq "${firstday}" ]] && [[ "${cyc}" -eq "${ARCHINC_CYC}" ]]; then SAVEWARMICA="YES" ; fi + if [[ "${PDY}${cyc}" -eq "${firstday}" ]] && [[ "${cyc}" -eq "${ARCHICS_CYC}" ]]; then SAVEWARMICB="YES" ; fi + if [[ "${mod}" -eq 0 ]] && [[ "${cyc}" -eq "${ARCHINC_CYC}" ]]; then SAVEWARMICA="YES" ; fi + if [[ "${mod}" -eq 0 ]] && [[ "${cyc}" -eq "${ARCHICS_CYC}" ]]; then SAVEWARMICB="YES" ; fi + + if [[ "${ARCHICS_CYC}" -eq 18 ]]; then + nday1=$((nday+1)) + mod1=$((nday1 % ARCH_WARMICFREQ)) + if [[ "${mod1}" -eq 0 ]] && [[ "${cyc}" -eq "${ARCHICS_CYC}" ]] ; then SAVEWARMICB="YES" ; fi + if [[ "${mod1}" -ne 0 ]] && [[ "${cyc}" -eq "${ARCHICS_CYC}" ]] ; then SAVEWARMICB="NO" ; fi + if [[ "${PDY}${cyc}" -eq "${SDATE}" ]] && [[ "${cyc}" -eq "${ARCHICS_CYC}" ]] ; then SAVEWARMICB="YES" ; fi + fi -cd "${ROTDIR}" + mod=$((nday % ARCH_FCSTICFREQ)) + if [[ "${mod}" -eq 0 ]] || [[ "${PDY}${cyc}" -eq "${firstday}" ]]; then SAVEFCSTIC="YES" ; fi -if [ "${CDUMP}" = "gfs" ]; then - targrp_list="gfsa gfsb" + ARCH_LIST="${DATA}/archlist" + [[ -d ${ARCH_LIST} ]] && rm -rf "${ARCH_LIST}" + mkdir -p "${ARCH_LIST}" + cd "${ARCH_LIST}" || exit 2 - if [ "${ARCH_GAUSSIAN:-"NO"}" = "YES" ]; then - targrp_list="${targrp_list} gfs_flux gfs_netcdfb gfs_pgrb2b" - if [ "${MODE}" = "cycled" ]; then - targrp_list="${targrp_list} gfs_netcdfa" - fi + "${HOMEgfs}/ush/hpssarch_gen.sh" "${RUN}" + status=$? + if [ "${status}" -ne 0 ]; then + echo "${HOMEgfs}/ush/hpssarch_gen.sh ${RUN} failed, ABORT!" + exit "${status}" fi - if [ "${DO_WAVE}" = "YES" ] && [ "${WAVE_CDUMP}" != "gdas" ]; then - targrp_list="${targrp_list} gfswave" - fi + cd "${ROTDIR}" || exit 2 - if [ "${DO_OCN}" = "YES" ]; then - targrp_list="${targrp_list} ocn_ice_grib2_0p5 ocn_ice_grib2_0p25 ocn_2D ocn_3D ocn_xsect ocn_daily gfs_flux_1p00" - fi + if [[ "${RUN}" = "gfs" ]]; then - if [ "${DO_ICE}" = "YES" ]; then - targrp_list="${targrp_list} ice" - fi + targrp_list="gfsa gfsb" - # Aerosols - if [ "${DO_AERO}" = "YES" ]; then - for targrp in chem; do - ${TARCMD} -P -cvf "${ATARDIR}"/"${CDATE}"/"${targrp}".tar $(cat "${ARCH_LIST}"/"${targrp}".txt) - status=$? - if [ "${status}" -ne 0 ] && [ "${CDATE}" -ge "${firstday}" ]; then - echo "HTAR ${CDATE} ${targrp}.tar failed" - exit "${status}" + if [ "${ARCH_GAUSSIAN:-"NO"}" = "YES" ]; then + targrp_list="${targrp_list} gfs_flux gfs_netcdfb gfs_pgrb2b" + if [ "${MODE}" = "cycled" ]; then + targrp_list="${targrp_list} gfs_netcdfa" fi - done - fi + fi - #for restarts - if [ "${SAVEFCSTIC}" = "YES" ]; then - targrp_list="${targrp_list} gfs_restarta" - fi + if [ "${DO_WAVE}" = "YES" ] && [ "${WAVE_RUN}" != "gdas" ]; then + targrp_list="${targrp_list} gfswave" + fi - #for downstream products - if [ "${DO_BUFRSND}" = "YES" ] || [ "${WAFSF}" = "YES" ]; then - targrp_list="${targrp_list} gfs_downstream" - fi + if [ "${DO_OCN}" = "YES" ]; then + targrp_list="${targrp_list} ocn_ice_grib2_0p5 ocn_ice_grib2_0p25 ocn_2D ocn_3D ocn_xsect ocn_daily gfs_flux_1p00" + fi - #--save mdl gfsmos output from all cycles in the 18Z archive directory - if [ -d gfsmos."${PDY_MOS}" ] && [ "${cyc}" -eq 18 ]; then - set +e - ${TARCMD} -P -cvf "${ATARDIR}"/"${CDATE_MOS}"/gfsmos.tar ./gfsmos."${PDY_MOS}" - status=$? - if [ "${status}" -ne 0 ] && [ "${CDATE}" -ge "${firstday}" ]; then - echo "$(echo "${TARCMD}" | tr 'a-z' 'A-Z') ${CDATE} gfsmos.tar failed" - exit "${status}" + if [ "${DO_ICE}" = "YES" ]; then + targrp_list="${targrp_list} ice" fi - set_strict - fi -elif [ "${CDUMP}" = "gdas" ]; then - targrp_list="gdas" + # Aerosols + if [ "${DO_AERO}" = "YES" ]; then + for targrp in chem; do + # TODO: Why is this tar being done here instead of being added to the list? + ${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${targrp}.tar" $(cat "${ARCH_LIST}/${targrp}.txt") + status=$? + if [[ "${status}" -ne 0 ]] && [[ "${PDY}${cyc}" -ge "${firstday}" ]]; then + echo "HTAR ${PDY}${cyc} ${targrp}.tar failed" + exit "${status}" + fi + done + fi - #gdaswave - if [ "${DO_WAVE}" = "YES" ]; then - targrp_list="${targrp_list} gdaswave" - fi + #for restarts + if [ "${SAVEFCSTIC}" = "YES" ]; then + targrp_list="${targrp_list} gfs_restarta" + fi - #gdasocean - if [ "${DO_OCN}" = "YES" ]; then - targrp_list="${targrp_list} gdasocean" - fi + #for downstream products + if [ "${DO_BUFRSND}" = "YES" ] || [ "${WAFSF}" = "YES" ]; then + targrp_list="${targrp_list} gfs_downstream" + fi - #gdasice - if [ "${DO_ICE}" = "YES" ]; then - targrp_list="${targrp_list} gdasice" - fi + #--save mdl gfsmos output from all cycles in the 18Z archive directory + if [[ -d "gfsmos.${PDY_MOS}" ]] && [[ "${cyc}" -eq 18 ]]; then + set +e + # TODO: Why is this tar being done here instead of being added to the list? + ${TARCMD} -P -cvf "${ATARDIR}/${CDATE_MOS}/gfsmos.tar" "./gfsmos.${PDY_MOS}" + status=$? + if [[ "${status}" -ne 0 ]] && [[ "${PDY}${cyc}" -ge "${firstday}" ]]; then + echo "${TARCMD^^} ${PDY}${cyc} gfsmos.tar failed" + exit "${status}" + fi + set_strict + fi + elif [[ "${RUN}" = "gdas" ]]; then - if [ "${SAVEWARMICA}" = "YES" ] || [ "${SAVEFCSTIC}" = "YES" ]; then - targrp_list="${targrp_list} gdas_restarta" + targrp_list="gdas" + #gdaswave if [ "${DO_WAVE}" = "YES" ]; then - targrp_list="${targrp_list} gdaswave_restart" + targrp_list="${targrp_list} gdaswave" fi + + #gdasocean if [ "${DO_OCN}" = "YES" ]; then - targrp_list="${targrp_list} gdasocean_restart" + targrp_list="${targrp_list} gdasocean" fi + + #gdasice if [ "${DO_ICE}" = "YES" ]; then - targrp_list="${targrp_list} gdasice_restart" + targrp_list="${targrp_list} gdasice" fi - fi - if [ "${SAVEWARMICB}" = "YES" ] || [ "${SAVEFCSTIC}" = "YES" ]; then - targrp_list="${targrp_list} gdas_restartb" - fi -fi + if [ "${SAVEWARMICA}" = "YES" ] || [ "${SAVEFCSTIC}" = "YES" ]; then + targrp_list="${targrp_list} gdas_restarta" + if [ "${DO_WAVE}" = "YES" ]; then targrp_list="${targrp_list} gdaswave_restart"; fi + if [ "${DO_OCN}" = "YES" ]; then targrp_list="${targrp_list} gdasocean_restart"; fi + if [ "${DO_ICE}" = "YES" ]; then targrp_list="${targrp_list} gdasice_restart"; fi + 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=$? - case ${targrp} in - 'gdas'|'gdas_restarta') - ${HSICMD} chgrp rstprod "${ATARDIR}/${CDATE}/${targrp}.tar" - ${HSICMD} chmod 640 "${ATARDIR}/${CDATE}/${targrp}.tar" - ;; - *) ;; - esac - if [ "${status}" -ne 0 ] && [ "${CDATE}" -ge "${firstday}" ]; then - echo "$(echo "${TARCMD}" | tr 'a-z' 'A-Z') ${CDATE} ${targrp}.tar failed" - exit "${status}" + if [ "${SAVEWARMICB}" = "YES" ] || [ "${SAVEFCSTIC}" = "YES" ]; then + targrp_list="${targrp_list} gdas_restartb" + fi fi - set_strict -done -# Turn extended globbing back off -shopt -u extglob + + # Turn on extended globbing options + shopt -s extglob + for targrp in ${targrp_list}; do + set +e + ${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${targrp}.tar" $(cat "${ARCH_LIST}/${targrp}.txt") + status=$? + case ${targrp} in + 'gdas'|'gdas_restarta') + ${HSICMD} chgrp rstprod "${ATARDIR}/${CDATE}/${targrp}.tar" + ${HSICMD} chmod 640 "${ATARDIR}/${CDATE}/${targrp}.tar" + ;; + *) ;; + esac + if [ "${status}" -ne 0 ] && [ "${PDY}${cyc}" -ge "${firstday}" ]; then + echo "FATAL ERROR: ${TARCMD} ${PDY}${cyc} ${targrp}.tar failed" + exit "${status}" + fi + set_strict + done + # Turn extended globbing back off + shopt -u extglob ############################################################### fi ##end of HPSS archive @@ -282,15 +288,17 @@ fi ##end of HPSS archive ############################################################### # Clean up previous cycles; various depths # PRIOR CYCLE: Leave the prior cycle alone -GDATE=$(${NDATE} -"${assim_freq}" "${CDATE}") +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") # PREVIOUS to the PRIOR CYCLE GDATE=$(${NDATE} -"${assim_freq}" "${GDATE}") -gPDY=$(echo "${GDATE}" | cut -c1-8) -gcyc=$(echo "${GDATE}" | cut -c9-10) +gPDY="${GDATE:0:8}" +gcyc="${GDATE:8:2}" # Remove the TMPDIR directory -COMIN="${RUNDIR}/${GDATE}" +# TODO Only prepbufr is currently using this directory, and all jobs should be +# cleaning up after themselves anyway +COMIN="${DATAROOT}/${GDATE}" [[ -d ${COMIN} ]] && rm -rf "${COMIN}" if [[ "${DELETE_COM_IN_ARCHIVE_JOB:-YES}" == NO ]] ; then @@ -301,86 +309,135 @@ fi # for successful cycles (defaults from 24h to 120h). If GLDAS is # active, retain files needed by GLDAS update. Independent of GLDAS, # retain files needed by Fit2Obs +# TODO: This whole section needs to be revamped to remove marine component +# directories and not look at the rocoto log. DO_GLDAS=${DO_GLDAS:-"NO"} -GDATEEND=$(${NDATE} -"${RMOLDEND:-24}" "${CDATE}") -GDATE=$(${NDATE} -"${RMOLDSTD:-120}" "${CDATE}") -GLDAS_DATE=$(${NDATE} -96 "${CDATE}") -RTOFS_DATE=$(${NDATE} -48 "${CDATE}") +GDATEEND=$(${NDATE} -"${RMOLDEND:-24}" "${PDY}${cyc}") +GDATE=$(${NDATE} -"${RMOLDSTD:-120}" "${PDY}${cyc}") +GLDAS_DATE=$(${NDATE} -96 "${PDY}${cyc}") +RTOFS_DATE=$(${NDATE} -48 "${PDY}${cyc}") +function remove_files() { + # TODO: move this to a new location + local directory=$1 + shift + if [[ ! -d ${directory} ]]; then + echo "No directory ${directory} to remove files from, skiping" + return + fi + local exclude_list="" + if (($# > 0)); then + exclude_list=$* + fi + local file_list + declare -a file_list + readarray -t file_list < <(find -L "${directory}" -type f) + if (( ${#file_list[@]} == 0 )); then return; fi + # echo "Number of files to remove before exclusions: ${#file_list[@]}" + for exclude in ${exclude_list}; do + echo "Excluding ${exclude}" + declare -a file_list_old=("${file_list[@]}") + readarray file_list < <(printf -- '%s\n' "${file_list_old[@]}" | grep -v "${exclude}") + # echo "Number of files to remove after exclusion: ${#file_list[@]}" + if (( ${#file_list[@]} == 0 )); then return; fi + done + # echo "Number of files to remove after exclusions: ${#file_list[@]}" + + for file in "${file_list[@]}"; do + rm -f "${file}" + done + # Remove directory if empty + rmdir "${directory}" || true +} + while [ "${GDATE}" -le "${GDATEEND}" ]; do - gPDY=$(echo "${GDATE}" | cut -c1-8) - gcyc=$(echo "${GDATE}" | cut -c9-10) - COMIN="${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/atmos" - COMINwave="${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/wave" - COMINocean="${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/ocean" - COMINice="${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/ice" - COMINmed="${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/med" + gPDY="${GDATE:0:8}" + gcyc="${GDATE:8:2}" COMINrtofs="${ROTDIR}/rtofs.${gPDY}" - if [ -d "${COMIN}" ]; then + if [ -d "${COM_TOP}" ]; then rocotolog="${EXPDIR}/logs/${GDATE}.log" if [ -f "${rocotolog}" ]; then set +e testend=$(tail -n 1 "${rocotolog}" | grep "This cycle is complete: Success") rc=$? set_strict + if [ "${rc}" -eq 0 ]; then - if [ -d "${COMINwave}" ]; then rm -rf "${COMINwave}" ; fi - if [ -d "${COMINocean}" ]; then rm -rf "${COMINocean}" ; fi - if [ -d "${COMINice}" ]; then rm -rf "${COMINice}" ; fi - if [ -d "${COMINmed}" ]; then rm -rf "${COMINmed}" ; fi - if [ -d "${COMINrtofs}" ] && [ "${GDATE}" -lt "${RTOFS_DATE}" ]; then rm -rf "${COMINrtofs}" ; fi - if [ "${CDUMP}" != "gdas" ] || [ "${DO_GLDAS}" = "NO" ] || [ "${GDATE}" -lt "${GLDAS_DATE}" ]; then - if [ "${CDUMP}" = "gdas" ]; then - for file in $(ls "${COMIN}" |grep -v prepbufr |grep -v cnvstat |grep -v atmanl.nc); do - rm -rf "${COMIN}"/"${file}" - done - else - rm -rf "${COMIN}" - fi - else - if [ "${DO_GLDAS}" = "YES" ]; then - for file in $(ls "${COMIN}" |grep -v sflux |grep -v RESTART |grep -v prepbufr |grep -v cnvstat |grep -v atmanl.nc); do - rm -rf "${COMIN}"/"${file}" - done - for file in $(ls "${COMIN}"/RESTART |grep -v sfcanl ); do - rm -rf "${COMIN}"/RESTART/"${file}" - done - else - for file in $(ls "${COMIN}" |grep -v prepbufr |grep -v cnvstat |grep -v atmanl.nc); do - rm -rf "${COMIN}"/"${file}" - done - fi + # Obs + exclude_list="prepbufr" + templates="COM_OBS" + for template in ${templates}; do + YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Atmos + exclude_list="cnvstat atmanl.nc" + if [[ ${DO_GLDAS} == "YES" ]] && [[ ${RUN} =~ "gdas" ]] && [[ "${GDATE}" -ge "${GLDAS_DATE}" ]]; then + exclude_list="${exclude_list} sflux sfcanl" fi + templates=$(compgen -A variable | grep 'COM_ATMOS_.*_TMPL') + for template in ${templates}; do + YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Wave + exclude_list="" + templates=$(compgen -A variable | grep 'COM_WAVE_.*_TMPL') + for template in ${templates}; do + YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Ocean + exclude_list="" + templates=$(compgen -A variable | grep 'COM_OCEAN_.*_TMPL') + for template in ${templates}; do + YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Ice + exclude_list="" + templates=$(compgen -A variable | grep 'COM_ICE_.*_TMPL') + for template in ${templates}; do + YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Aerosols (GOCART) + exclude_list="" + templates=$(compgen -A variable | grep 'COM_CHEM_.*_TMPL') + for template in ${templates}; do + YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + # Mediator + exclude_list="" + templates=$(compgen -A variable | grep 'COM_MED_.*_TMPL') + for template in ${templates}; do + YMD="${gPDY}" HH="${gcyc}" generate_com "directory:${template}" + remove_files "${directory}" "${exclude_list[@]}" + done + + if [ -d "${COMINrtofs}" ] && [ "${GDATE}" -lt "${RTOFS_DATE}" ]; then rm -rf "${COMINrtofs}" ; fi fi fi fi - # Remove any empty directories - if [ -d "${COMIN}" ]; then - [[ ! "$(ls -A "${COMIN}")" ]] && rm -rf "${COMIN}" - fi - - if [ -d "${COMINwave}" ]; then - [[ ! "$(ls -A "${COMINwave}")" ]] && rm -rf "${COMINwave}" - fi - - if [ -d "${COMINocean}" ]; then - [[ ! "$(ls -A "${COMINocean}")" ]] && rm -rf "${COMINocean}" - fi - - if [ -d "${COMINice}" ]; then - [[ ! "$(ls -A "${COMINice}")" ]] && rm -rf "${COMINice}" - fi - - if [ -d "${COMINmed}" ]; then - [[ ! "$(ls -A "${COMINmed}")" ]] && rm -rf "${COMINmed}" - fi - # Remove mdl gfsmos directory - if [ "${CDUMP}" = "gfs" ]; then + if [ "${RUN}" = "gfs" ]; then COMIN="${ROTDIR}/gfsmos.${gPDY}" if [ -d "${COMIN}" ] && [ "${GDATE}" -lt "${CDATE_MOS}" ]; then rm -rf "${COMIN}" ; fi fi + # Remove any empty directories + target_dir="${ROTDIR:?}/${RUN}.${gPDY}/${gcyc}/" + if [[ -d ${target_dir} ]]; then + find "${target_dir}" -empty -type d -delete + fi + GDATE=$(${NDATE} +"${assim_freq}" "${GDATE}") done @@ -389,32 +446,32 @@ done # gaussian files to prevent the files from being removed by automatic # scrubber present on some machines. -if [ "${CDUMP}" = "gfs" ]; then +if [ "${RUN}" = "gfs" ]; then fhmax=$((FHMAX_FITS+36)) - RDATE=$(${NDATE} -"${fhmax}" "${CDATE}") + RDATE=$(${NDATE} -"${fhmax}" "${PDY}${cyc}") rPDY=$(echo "${RDATE}" | cut -c1-8) - COMIN="${VFYARC}/${CDUMP}.${rPDY}" + COMIN="${VFYARC}/${RUN}.${rPDY}" [[ -d ${COMIN} ]] && rm -rf "${COMIN}" - TDATE=$(${NDATE} -"${FHMAX_FITS}" "${CDATE}") - while [ "${TDATE}" -lt "${CDATE}" ]; do + TDATE=$(${NDATE} -"${FHMAX_FITS}" "${PDY}${cyc}") + while [ "${TDATE}" -lt "${PDY}${cyc}" ]; do tPDY=$(echo "${TDATE}" | cut -c1-8) tcyc=$(echo "${TDATE}" | cut -c9-10) - TDIR=${VFYARC}/${CDUMP}.${tPDY}/${tcyc} + TDIR=${VFYARC}/${RUN}.${tPDY}/${tcyc} [[ -d ${TDIR} ]] && touch "${TDIR}"/* TDATE=$(${NDATE} +6 "${TDATE}") done fi -# Remove $CDUMP.$rPDY for the older of GDATE or RDATE -GDATE=$(${NDATE} -"${RMOLDSTD:-120}" "${CDATE}") +# Remove $RUN.$rPDY for the older of GDATE or RDATE +GDATE=$(${NDATE} -"${RMOLDSTD:-120}" "${PDY}${cyc}") fhmax=${FHMAX_GFS} -RDATE=$(${NDATE} -"${fhmax}" "${CDATE}") +RDATE=$(${NDATE} -"${fhmax}" "${PDY}${cyc}") if [ "${GDATE}" -lt "${RDATE}" ]; then RDATE=${GDATE} fi rPDY=$(echo "${RDATE}" | cut -c1-8) -COMIN="${ROTDIR}/${CDUMP}.${rPDY}" +COMIN="${ROTDIR}/${RUN}.${rPDY}" [[ -d ${COMIN} ]] && rm -rf "${COMIN}" diff --git a/scripts/exglobal_atmos_analysis.sh b/scripts/exglobal_atmos_analysis.sh index af75d6c75b..ccedbdabda 100755 --- a/scripts/exglobal_atmos_analysis.sh +++ b/scripts/exglobal_atmos_analysis.sh @@ -93,112 +93,112 @@ export gesenvir=${gesenvir:-${envir}} # Observations OPREFIX=${OPREFIX:-""} OSUFFIX=${OSUFFIX:-""} -PREPQC=${PREPQC:-${COMIN_OBS}/${OPREFIX}prepbufr${OSUFFIX}} -PREPQCPF=${PREPQCPF:-${COMIN_OBS}/${OPREFIX}prepbufr.acft_profiles${OSUFFIX}} -NSSTBF=${NSSTBF:-${COMIN_OBS}/${OPREFIX}nsstbufr${OSUFFIX}} -SATWND=${SATWND:-${COMIN_OBS}/${OPREFIX}satwnd.tm00.bufr_d${OSUFFIX}} -OSCATBF=${OSCATBF:-${COMIN_OBS}/${OPREFIX}oscatw.tm00.bufr_d${OSUFFIX}} -RAPIDSCATBF=${RAPIDSCATBF:-${COMIN_OBS}/${OPREFIX}rapidscatw.tm00.bufr_d${OSUFFIX}} -GSNDBF=${GSNDBF:-${COMIN_OBS}/${OPREFIX}goesnd.tm00.bufr_d${OSUFFIX}} -GSNDBF1=${GSNDBF1:-${COMIN_OBS}/${OPREFIX}goesfv.tm00.bufr_d${OSUFFIX}} -B1HRS2=${B1HRS2:-${COMIN_OBS}/${OPREFIX}1bhrs2.tm00.bufr_d${OSUFFIX}} -B1MSU=${B1MSU:-${COMIN_OBS}/${OPREFIX}1bmsu.tm00.bufr_d${OSUFFIX}} -B1HRS3=${B1HRS3:-${COMIN_OBS}/${OPREFIX}1bhrs3.tm00.bufr_d${OSUFFIX}} -B1HRS4=${B1HRS4:-${COMIN_OBS}/${OPREFIX}1bhrs4.tm00.bufr_d${OSUFFIX}} -B1AMUA=${B1AMUA:-${COMIN_OBS}/${OPREFIX}1bamua.tm00.bufr_d${OSUFFIX}} -B1AMUB=${B1AMUB:-${COMIN_OBS}/${OPREFIX}1bamub.tm00.bufr_d${OSUFFIX}} -B1MHS=${B1MHS:-${COMIN_OBS}/${OPREFIX}1bmhs.tm00.bufr_d${OSUFFIX}} -ESHRS3=${ESHRS3:-${COMIN_OBS}/${OPREFIX}eshrs3.tm00.bufr_d${OSUFFIX}} -ESAMUA=${ESAMUA:-${COMIN_OBS}/${OPREFIX}esamua.tm00.bufr_d${OSUFFIX}} -ESAMUB=${ESAMUB:-${COMIN_OBS}/${OPREFIX}esamub.tm00.bufr_d${OSUFFIX}} -ESMHS=${ESMHS:-${COMIN_OBS}/${OPREFIX}esmhs.tm00.bufr_d${OSUFFIX}} -HRS3DB=${HRS3DB:-${COMIN_OBS}/${OPREFIX}hrs3db.tm00.bufr_d${OSUFFIX}} -AMUADB=${AMUADB:-${COMIN_OBS}/${OPREFIX}amuadb.tm00.bufr_d${OSUFFIX}} -AMUBDB=${AMUBDB:-${COMIN_OBS}/${OPREFIX}amubdb.tm00.bufr_d${OSUFFIX}} -MHSDB=${MHSDB:-${COMIN_OBS}/${OPREFIX}mhsdb.tm00.bufr_d${OSUFFIX}} -AIRSBF=${AIRSBF:-${COMIN_OBS}/${OPREFIX}airsev.tm00.bufr_d${OSUFFIX}} -IASIBF=${IASIBF:-${COMIN_OBS}/${OPREFIX}mtiasi.tm00.bufr_d${OSUFFIX}} -ESIASI=${ESIASI:-${COMIN_OBS}/${OPREFIX}esiasi.tm00.bufr_d${OSUFFIX}} -IASIDB=${IASIDB:-${COMIN_OBS}/${OPREFIX}iasidb.tm00.bufr_d${OSUFFIX}} -AMSREBF=${AMSREBF:-${COMIN_OBS}/${OPREFIX}amsre.tm00.bufr_d${OSUFFIX}} -AMSR2BF=${AMSR2BF:-${COMIN_OBS}/${OPREFIX}amsr2.tm00.bufr_d${OSUFFIX}} -GMI1CRBF=${GMI1CRBF:-${COMIN_OBS}/${OPREFIX}gmi1cr.tm00.bufr_d${OSUFFIX}} # GMI temporarily disabled due to array overflow. -SAPHIRBF=${SAPHIRBF:-${COMIN_OBS}/${OPREFIX}saphir.tm00.bufr_d${OSUFFIX}} -SEVIRIBF=${SEVIRIBF:-${COMIN_OBS}/${OPREFIX}sevcsr.tm00.bufr_d${OSUFFIX}} -AHIBF=${AHIBF:-${COMIN_OBS}/${OPREFIX}ahicsr.tm00.bufr_d${OSUFFIX}} -SSTVIIRS=${SSTVIIRS:-${COMIN_OBS}/${OPREFIX}sstvcw.tm00.bufr_d${OSUFFIX}} -ABIBF=${ABIBF:-${COMIN_OBS}/${OPREFIX}gsrcsr.tm00.bufr_d${OSUFFIX}} -CRISBF=${CRISBF:-${COMIN_OBS}/${OPREFIX}cris.tm00.bufr_d${OSUFFIX}} -ESCRIS=${ESCRIS:-${COMIN_OBS}/${OPREFIX}escris.tm00.bufr_d${OSUFFIX}} -CRISDB=${CRISDB:-${COMIN_OBS}/${OPREFIX}crisdb.tm00.bufr_d${OSUFFIX}} -CRISFSBF=${CRISFSBF:-${COMIN_OBS}/${OPREFIX}crisf4.tm00.bufr_d${OSUFFIX}} -ESCRISFS=${ESCRISFS:-${COMIN_OBS}/${OPREFIX}escrsf.tm00.bufr_d${OSUFFIX}} -CRISFSDB=${CRISFSDB:-${COMIN_OBS}/${OPREFIX}crsfdb.tm00.bufr_d${OSUFFIX}} -ATMSBF=${ATMSBF:-${COMIN_OBS}/${OPREFIX}atms.tm00.bufr_d${OSUFFIX}} -ESATMS=${ESATMS:-${COMIN_OBS}/${OPREFIX}esatms.tm00.bufr_d${OSUFFIX}} -ATMSDB=${ATMSDB:-${COMIN_OBS}/${OPREFIX}atmsdb.tm00.bufr_d${OSUFFIX}} -SSMITBF=${SSMITBF:-${COMIN_OBS}/${OPREFIX}ssmit.tm00.bufr_d${OSUFFIX}} -SSMISBF=${SSMISBF:-${COMIN_OBS}/${OPREFIX}ssmisu.tm00.bufr_d${OSUFFIX}} -SBUVBF=${SBUVBF:-${COMIN_OBS}/${OPREFIX}osbuv8.tm00.bufr_d${OSUFFIX}} -OMPSNPBF=${OMPSNPBF:-${COMIN_OBS}/${OPREFIX}ompsn8.tm00.bufr_d${OSUFFIX}} -OMPSTCBF=${OMPSTCBF:-${COMIN_OBS}/${OPREFIX}ompst8.tm00.bufr_d${OSUFFIX}} -OMPSLPBF=${OMPSLPBF:-${COMIN_OBS}/${OPREFIX}ompslp.tm00.bufr_d${OSUFFIX}} -GOMEBF=${GOMEBF:-${COMIN_OBS}/${OPREFIX}gome.tm00.bufr_d${OSUFFIX}} -OMIBF=${OMIBF:-${COMIN_OBS}/${OPREFIX}omi.tm00.bufr_d${OSUFFIX}} -MLSBF=${MLSBF:-${COMIN_OBS}/${OPREFIX}mls.tm00.bufr_d${OSUFFIX}} -SMIPCP=${SMIPCP:-${COMIN_OBS}/${OPREFIX}spssmi.tm00.bufr_d${OSUFFIX}} -TMIPCP=${TMIPCP:-${COMIN_OBS}/${OPREFIX}sptrmm.tm00.bufr_d${OSUFFIX}} -GPSROBF=${GPSROBF:-${COMIN_OBS}/${OPREFIX}gpsro.tm00.bufr_d${OSUFFIX}} -TCVITL=${TCVITL:-${COMIN_OBS}/${OPREFIX}syndata.tcvitals.tm00} -B1AVHAM=${B1AVHAM:-${COMIN_OBS}/${OPREFIX}avcsam.tm00.bufr_d${OSUFFIX}} -B1AVHPM=${B1AVHPM:-${COMIN_OBS}/${OPREFIX}avcspm.tm00.bufr_d${OSUFFIX}} -HDOB=${HDOB:-${COMIN_OBS}/${OPREFIX}hdob.tm00.bufr_d${OSUFFIX}} +PREPQC=${PREPQC:-${COM_OBS}/${OPREFIX}prepbufr${OSUFFIX}} +PREPQCPF=${PREPQCPF:-${COM_OBS}/${OPREFIX}prepbufr.acft_profiles${OSUFFIX}} +NSSTBF=${NSSTBF:-${COM_OBS}/${OPREFIX}nsstbufr${OSUFFIX}} +SATWND=${SATWND:-${COM_OBS}/${OPREFIX}satwnd.tm00.bufr_d${OSUFFIX}} +OSCATBF=${OSCATBF:-${COM_OBS}/${OPREFIX}oscatw.tm00.bufr_d${OSUFFIX}} +RAPIDSCATBF=${RAPIDSCATBF:-${COM_OBS}/${OPREFIX}rapidscatw.tm00.bufr_d${OSUFFIX}} +GSNDBF=${GSNDBF:-${COM_OBS}/${OPREFIX}goesnd.tm00.bufr_d${OSUFFIX}} +GSNDBF1=${GSNDBF1:-${COM_OBS}/${OPREFIX}goesfv.tm00.bufr_d${OSUFFIX}} +B1HRS2=${B1HRS2:-${COM_OBS}/${OPREFIX}1bhrs2.tm00.bufr_d${OSUFFIX}} +B1MSU=${B1MSU:-${COM_OBS}/${OPREFIX}1bmsu.tm00.bufr_d${OSUFFIX}} +B1HRS3=${B1HRS3:-${COM_OBS}/${OPREFIX}1bhrs3.tm00.bufr_d${OSUFFIX}} +B1HRS4=${B1HRS4:-${COM_OBS}/${OPREFIX}1bhrs4.tm00.bufr_d${OSUFFIX}} +B1AMUA=${B1AMUA:-${COM_OBS}/${OPREFIX}1bamua.tm00.bufr_d${OSUFFIX}} +B1AMUB=${B1AMUB:-${COM_OBS}/${OPREFIX}1bamub.tm00.bufr_d${OSUFFIX}} +B1MHS=${B1MHS:-${COM_OBS}/${OPREFIX}1bmhs.tm00.bufr_d${OSUFFIX}} +ESHRS3=${ESHRS3:-${COM_OBS}/${OPREFIX}eshrs3.tm00.bufr_d${OSUFFIX}} +ESAMUA=${ESAMUA:-${COM_OBS}/${OPREFIX}esamua.tm00.bufr_d${OSUFFIX}} +ESAMUB=${ESAMUB:-${COM_OBS}/${OPREFIX}esamub.tm00.bufr_d${OSUFFIX}} +ESMHS=${ESMHS:-${COM_OBS}/${OPREFIX}esmhs.tm00.bufr_d${OSUFFIX}} +HRS3DB=${HRS3DB:-${COM_OBS}/${OPREFIX}hrs3db.tm00.bufr_d${OSUFFIX}} +AMUADB=${AMUADB:-${COM_OBS}/${OPREFIX}amuadb.tm00.bufr_d${OSUFFIX}} +AMUBDB=${AMUBDB:-${COM_OBS}/${OPREFIX}amubdb.tm00.bufr_d${OSUFFIX}} +MHSDB=${MHSDB:-${COM_OBS}/${OPREFIX}mhsdb.tm00.bufr_d${OSUFFIX}} +AIRSBF=${AIRSBF:-${COM_OBS}/${OPREFIX}airsev.tm00.bufr_d${OSUFFIX}} +IASIBF=${IASIBF:-${COM_OBS}/${OPREFIX}mtiasi.tm00.bufr_d${OSUFFIX}} +ESIASI=${ESIASI:-${COM_OBS}/${OPREFIX}esiasi.tm00.bufr_d${OSUFFIX}} +IASIDB=${IASIDB:-${COM_OBS}/${OPREFIX}iasidb.tm00.bufr_d${OSUFFIX}} +AMSREBF=${AMSREBF:-${COM_OBS}/${OPREFIX}amsre.tm00.bufr_d${OSUFFIX}} +AMSR2BF=${AMSR2BF:-${COM_OBS}/${OPREFIX}amsr2.tm00.bufr_d${OSUFFIX}} +GMI1CRBF=${GMI1CRBF:-${COM_OBS}/${OPREFIX}gmi1cr.tm00.bufr_d${OSUFFIX}} # GMI temporarily disabled due to array overflow. +SAPHIRBF=${SAPHIRBF:-${COM_OBS}/${OPREFIX}saphir.tm00.bufr_d${OSUFFIX}} +SEVIRIBF=${SEVIRIBF:-${COM_OBS}/${OPREFIX}sevcsr.tm00.bufr_d${OSUFFIX}} +AHIBF=${AHIBF:-${COM_OBS}/${OPREFIX}ahicsr.tm00.bufr_d${OSUFFIX}} +SSTVIIRS=${SSTVIIRS:-${COM_OBS}/${OPREFIX}sstvcw.tm00.bufr_d${OSUFFIX}} +ABIBF=${ABIBF:-${COM_OBS}/${OPREFIX}gsrcsr.tm00.bufr_d${OSUFFIX}} +CRISBF=${CRISBF:-${COM_OBS}/${OPREFIX}cris.tm00.bufr_d${OSUFFIX}} +ESCRIS=${ESCRIS:-${COM_OBS}/${OPREFIX}escris.tm00.bufr_d${OSUFFIX}} +CRISDB=${CRISDB:-${COM_OBS}/${OPREFIX}crisdb.tm00.bufr_d${OSUFFIX}} +CRISFSBF=${CRISFSBF:-${COM_OBS}/${OPREFIX}crisf4.tm00.bufr_d${OSUFFIX}} +ESCRISFS=${ESCRISFS:-${COM_OBS}/${OPREFIX}escrsf.tm00.bufr_d${OSUFFIX}} +CRISFSDB=${CRISFSDB:-${COM_OBS}/${OPREFIX}crsfdb.tm00.bufr_d${OSUFFIX}} +ATMSBF=${ATMSBF:-${COM_OBS}/${OPREFIX}atms.tm00.bufr_d${OSUFFIX}} +ESATMS=${ESATMS:-${COM_OBS}/${OPREFIX}esatms.tm00.bufr_d${OSUFFIX}} +ATMSDB=${ATMSDB:-${COM_OBS}/${OPREFIX}atmsdb.tm00.bufr_d${OSUFFIX}} +SSMITBF=${SSMITBF:-${COM_OBS}/${OPREFIX}ssmit.tm00.bufr_d${OSUFFIX}} +SSMISBF=${SSMISBF:-${COM_OBS}/${OPREFIX}ssmisu.tm00.bufr_d${OSUFFIX}} +SBUVBF=${SBUVBF:-${COM_OBS}/${OPREFIX}osbuv8.tm00.bufr_d${OSUFFIX}} +OMPSNPBF=${OMPSNPBF:-${COM_OBS}/${OPREFIX}ompsn8.tm00.bufr_d${OSUFFIX}} +OMPSTCBF=${OMPSTCBF:-${COM_OBS}/${OPREFIX}ompst8.tm00.bufr_d${OSUFFIX}} +OMPSLPBF=${OMPSLPBF:-${COM_OBS}/${OPREFIX}ompslp.tm00.bufr_d${OSUFFIX}} +GOMEBF=${GOMEBF:-${COM_OBS}/${OPREFIX}gome.tm00.bufr_d${OSUFFIX}} +OMIBF=${OMIBF:-${COM_OBS}/${OPREFIX}omi.tm00.bufr_d${OSUFFIX}} +MLSBF=${MLSBF:-${COM_OBS}/${OPREFIX}mls.tm00.bufr_d${OSUFFIX}} +SMIPCP=${SMIPCP:-${COM_OBS}/${OPREFIX}spssmi.tm00.bufr_d${OSUFFIX}} +TMIPCP=${TMIPCP:-${COM_OBS}/${OPREFIX}sptrmm.tm00.bufr_d${OSUFFIX}} +GPSROBF=${GPSROBF:-${COM_OBS}/${OPREFIX}gpsro.tm00.bufr_d${OSUFFIX}} +TCVITL=${TCVITL:-${COM_OBS}/${OPREFIX}syndata.tcvitals.tm00} +B1AVHAM=${B1AVHAM:-${COM_OBS}/${OPREFIX}avcsam.tm00.bufr_d${OSUFFIX}} +B1AVHPM=${B1AVHPM:-${COM_OBS}/${OPREFIX}avcspm.tm00.bufr_d${OSUFFIX}} +HDOB=${HDOB:-${COM_OBS}/${OPREFIX}hdob.tm00.bufr_d${OSUFFIX}} # Guess files GPREFIX=${GPREFIX:-""} GSUFFIX=${GSUFFIX:-".nc"} -SFCG03=${SFCG03:-${COMIN_GES}/${GPREFIX}sfcf003${GSUFFIX}} -SFCG04=${SFCG04:-${COMIN_GES}/${GPREFIX}sfcf004${GSUFFIX}} -SFCG05=${SFCG05:-${COMIN_GES}/${GPREFIX}sfcf005${GSUFFIX}} -SFCGES=${SFCGES:-${COMIN_GES}/${GPREFIX}sfcf006${GSUFFIX}} -SFCG07=${SFCG07:-${COMIN_GES}/${GPREFIX}sfcf007${GSUFFIX}} -SFCG08=${SFCG08:-${COMIN_GES}/${GPREFIX}sfcf008${GSUFFIX}} -SFCG09=${SFCG09:-${COMIN_GES}/${GPREFIX}sfcf009${GSUFFIX}} -ATMG03=${ATMG03:-${COMIN_GES}/${GPREFIX}atmf003${GSUFFIX}} -ATMG04=${ATMG04:-${COMIN_GES}/${GPREFIX}atmf004${GSUFFIX}} -ATMG05=${ATMG05:-${COMIN_GES}/${GPREFIX}atmf005${GSUFFIX}} -ATMGES=${ATMGES:-${COMIN_GES}/${GPREFIX}atmf006${GSUFFIX}} -ATMG07=${ATMG07:-${COMIN_GES}/${GPREFIX}atmf007${GSUFFIX}} -ATMG08=${ATMG08:-${COMIN_GES}/${GPREFIX}atmf008${GSUFFIX}} -ATMG09=${ATMG09:-${COMIN_GES}/${GPREFIX}atmf009${GSUFFIX}} -GBIAS=${GBIAS:-${COMIN_GES}/${GPREFIX}abias} -GBIASPC=${GBIASPC:-${COMIN_GES}/${GPREFIX}abias_pc} -GBIASAIR=${GBIASAIR:-${COMIN_GES}/${GPREFIX}abias_air} -GRADSTAT=${GRADSTAT:-${COMIN_GES}/${GPREFIX}radstat} +SFCG03=${SFCG03:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}sfcf003${GSUFFIX}} +SFCG04=${SFCG04:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}sfcf004${GSUFFIX}} +SFCG05=${SFCG05:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}sfcf005${GSUFFIX}} +SFCGES=${SFCGES:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}sfcf006${GSUFFIX}} +SFCG07=${SFCG07:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}sfcf007${GSUFFIX}} +SFCG08=${SFCG08:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}sfcf008${GSUFFIX}} +SFCG09=${SFCG09:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}sfcf009${GSUFFIX}} +ATMG03=${ATMG03:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf003${GSUFFIX}} +ATMG04=${ATMG04:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf004${GSUFFIX}} +ATMG05=${ATMG05:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf005${GSUFFIX}} +ATMGES=${ATMGES:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf006${GSUFFIX}} +ATMG07=${ATMG07:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf007${GSUFFIX}} +ATMG08=${ATMG08:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf008${GSUFFIX}} +ATMG09=${ATMG09:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf009${GSUFFIX}} +GBIAS=${GBIAS:-${COM_ATMOS_ANALYSIS_PREV}/${GPREFIX}abias} +GBIASPC=${GBIASPC:-${COM_ATMOS_ANALYSIS_PREV}/${GPREFIX}abias_pc} +GBIASAIR=${GBIASAIR:-${COM_ATMOS_ANALYSIS_PREV}/${GPREFIX}abias_air} +GRADSTAT=${GRADSTAT:-${COM_ATMOS_ANALYSIS_PREV}/${GPREFIX}radstat} # Analysis files export APREFIX=${APREFIX:-""} -SFCANL=${SFCANL:-${COMOUT}/${APREFIX}sfcanl.nc} -DTFANL=${DTFANL:-${COMOUT}/${APREFIX}dtfanl.nc} -ATMANL=${ATMANL:-${COMOUT}/${APREFIX}atmanl.nc} -ABIAS=${ABIAS:-${COMOUT}/${APREFIX}abias} -ABIASPC=${ABIASPC:-${COMOUT}/${APREFIX}abias_pc} -ABIASAIR=${ABIASAIR:-${COMOUT}/${APREFIX}abias_air} -ABIASe=${ABIASe:-${COMOUT}/${APREFIX}abias_int} -RADSTAT=${RADSTAT:-${COMOUT}/${APREFIX}radstat} -GSISTAT=${GSISTAT:-${COMOUT}/${APREFIX}gsistat} -PCPSTAT=${PCPSTAT:-${COMOUT}/${APREFIX}pcpstat} -CNVSTAT=${CNVSTAT:-${COMOUT}/${APREFIX}cnvstat} -OZNSTAT=${OZNSTAT:-${COMOUT}/${APREFIX}oznstat} +SFCANL=${SFCANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}sfcanl.nc} +DTFANL=${DTFANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}dtfanl.nc} +ATMANL=${ATMANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmanl.nc} +ABIAS=${ABIAS:-${COM_ATMOS_ANALYSIS}/${APREFIX}abias} +ABIASPC=${ABIASPC:-${COM_ATMOS_ANALYSIS}/${APREFIX}abias_pc} +ABIASAIR=${ABIASAIR:-${COM_ATMOS_ANALYSIS}/${APREFIX}abias_air} +ABIASe=${ABIASe:-${COM_ATMOS_ANALYSIS}/${APREFIX}abias_int} +RADSTAT=${RADSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}radstat} +GSISTAT=${GSISTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}gsistat} +PCPSTAT=${PCPSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}pcpstat} +CNVSTAT=${CNVSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}cnvstat} +OZNSTAT=${OZNSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}oznstat} # Increment files -ATMINC=${ATMINC:-${COMOUT}/${APREFIX}atminc.nc} +ATMINC=${ATMINC:-${COM_ATMOS_ANALYSIS}/${APREFIX}atminc.nc} # Obs diag RUN_SELECT=${RUN_SELECT:-"NO"} USE_SELECT=${USE_SELECT:-"NO"} USE_RADSTAT=${USE_RADSTAT:-"YES"} -SELECT_OBS=${SELECT_OBS:-${COMOUT}/${APREFIX}obsinput} +SELECT_OBS=${SELECT_OBS:-${COM_ATMOS_ANALYSIS}/${APREFIX}obsinput} GENDIAG=${GENDIAG:-"YES"} DIAG_SUFFIX=${DIAG_SUFFIX:-""} if [ ${netcdf_diag} = ".true." ] ; then @@ -212,7 +212,7 @@ nm="" if [ ${CFP_MP} = "YES" ]; then nm=0 fi -DIAG_DIR=${DIAG_DIR:-${COMOUT}/gsidiags} +DIAG_DIR=${DIAG_DIR:-${COM_ATMOS_ANALYSIS}/gsidiags} # Set script / GSI control parameters DOHYBVAR=${DOHYBVAR:-"NO"} @@ -243,8 +243,8 @@ JCAP=${JCAP:--9999} # there is no jcap in these files # Get header information from Ensemble Guess files if [ ${DOHYBVAR} = "YES" ]; then - SFCGES_ENSMEAN=${SFCGES_ENSMEAN:-${COMIN_GES_ENS}/${GPREFIX_ENS}sfcf006.ensmean.nc} - export ATMGES_ENSMEAN=${ATMGES_ENSMEAN:-${COMIN_GES_ENS}/${GPREFIX_ENS}atmf006.ensmean.nc} + SFCGES_ENSMEAN=${SFCGES_ENSMEAN:-${COM_ATMOS_HISTORY_ENS_PREV}/${GPREFIX_ENS}sfcf006.ensmean.nc} + export ATMGES_ENSMEAN=${ATMGES_ENSMEAN:-${COM_ATMOS_HISTORY_ENS_PREV}/${GPREFIX_ENS}atmf006.ensmean.nc} LONB_ENKF=${LONB_ENKF:-$(${NCLEN} ${ATMGES_ENSMEAN} grid_xt)} # get LONB_ENKF LATB_ENKF=${LATB_ENKF:-$(${NCLEN} ${ATMGES_ENSMEAN} grid_yt)} # get LATB_ENFK LEVS_ENKF=${LEVS_ENKF:-$(${NCLEN} ${ATMGES_ENSMEAN} pfull)} # get LATB_ENFK @@ -337,18 +337,18 @@ fi # Set 4D-EnVar specific variables if [ ${DOHYBVAR} = "YES" -a ${l4densvar} = ".true." -a ${lwrite4danl} = ".true." ]; then - ATMA03=${ATMA03:-${COMOUT}/${APREFIX}atma003.nc} - ATMI03=${ATMI03:-${COMOUT}/${APREFIX}atmi003.nc} - ATMA04=${ATMA04:-${COMOUT}/${APREFIX}atma004.nc} - ATMI04=${ATMI04:-${COMOUT}/${APREFIX}atmi004.nc} - ATMA05=${ATMA05:-${COMOUT}/${APREFIX}atma005.nc} - ATMI05=${ATMI05:-${COMOUT}/${APREFIX}atmi005.nc} - ATMA07=${ATMA07:-${COMOUT}/${APREFIX}atma007.nc} - ATMI07=${ATMI07:-${COMOUT}/${APREFIX}atmi007.nc} - ATMA08=${ATMA08:-${COMOUT}/${APREFIX}atma008.nc} - ATMI08=${ATMI08:-${COMOUT}/${APREFIX}atmi008.nc} - ATMA09=${ATMA09:-${COMOUT}/${APREFIX}atma009.nc} - ATMI09=${ATMI09:-${COMOUT}/${APREFIX}atmi009.nc} + ATMA03=${ATMA03:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma003.nc} + ATMI03=${ATMI03:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi003.nc} + ATMA04=${ATMA04:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma004.nc} + ATMI04=${ATMI04:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi004.nc} + ATMA05=${ATMA05:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma005.nc} + ATMI05=${ATMI05:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi005.nc} + ATMA07=${ATMA07:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma007.nc} + ATMI07=${ATMI07:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi007.nc} + ATMA08=${ATMA08:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma008.nc} + ATMI08=${ATMI08:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi008.nc} + ATMA09=${ATMA09:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma009.nc} + ATMI09=${ATMI09:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi009.nc} fi ################################################################################ @@ -533,11 +533,13 @@ if [ ${DOHYBVAR} = "YES" ]; then fi for imem in $(seq 1 ${NMEM_ENKF}); do - memchar="mem"$(printf %03i ${imem}) + memchar="mem$(printf %03i "${imem}")" + MEMDIR=${memchar} RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} generate_com COM_ATMOS_HISTORY + for fhr in ${fhrs}; do - ${NLN} ${COMIN_GES_ENS}/${memchar}/atmos/${GPREFIX_ENS}atmf0${fhr}${ENKF_SUFFIX}.nc ./ensemble_data/sigf${fhr}_ens_${memchar} + ${NLN} ${COM_ATMOS_HISTORY}/${GPREFIX_ENS}atmf0${fhr}${ENKF_SUFFIX}.nc ./ensemble_data/sigf${fhr}_ens_${memchar} if [ ${cnvw_option} = ".true." ]; then - ${NLN} ${COMIN_GES_ENS}/${memchar}/atmos/${GPREFIX_ENS}sfcf0${fhr}.nc ./ensemble_data/sfcf${fhr}_ens_${memchar} + ${NLN} ${COM_ATMOS_HISTORY}/${GPREFIX_ENS}sfcf0${fhr}.nc ./ensemble_data/sfcf${fhr}_ens_${memchar} fi done done @@ -976,7 +978,7 @@ 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)" > ${COM_ATMOS_ANALYSIS}/${APREFIX}loginc.txt ################################################################################ diff --git a/scripts/exglobal_atmos_analysis_calc.sh b/scripts/exglobal_atmos_analysis_calc.sh index 5c005ac892..b353d3c52b 100755 --- a/scripts/exglobal_atmos_analysis_calc.sh +++ b/scripts/exglobal_atmos_analysis_calc.sh @@ -26,18 +26,9 @@ pwd=$(pwd) export FIXgsm=${FIXgsm:-$HOMEgfs/fix/am} # Base variables -CDATE=${CDATE:-"2001010100"} CDUMP=${CDUMP:-"gdas"} GDUMP=${GDUMP:-"gdas"} -# Derived base variables -GDATE=$($NDATE -$assim_freq $CDATE) -BDATE=$($NDATE -3 $CDATE) -PDY=$(echo $CDATE | cut -c1-8) -cyc=$(echo $CDATE | cut -c9-10) -bPDY=$(echo $BDATE | cut -c1-8) -bcyc=$(echo $BDATE | cut -c9-10) - # Utilities export NCP=${NCP:-"/bin/cp"} export NMV=${NMV:-"/bin/mv"} @@ -82,22 +73,22 @@ SENDDBN=${SENDDBN:-"NO"} # Guess files GPREFIX=${GPREFIX:-""} -ATMG03=${ATMG03:-${COMIN_GES}/${GPREFIX}atmf003.nc} -ATMG04=${ATMG04:-${COMIN_GES}/${GPREFIX}atmf004.nc} -ATMG05=${ATMG05:-${COMIN_GES}/${GPREFIX}atmf005.nc} -ATMGES=${ATMGES:-${COMIN_GES}/${GPREFIX}atmf006.nc} -ATMG07=${ATMG07:-${COMIN_GES}/${GPREFIX}atmf007.nc} -ATMG08=${ATMG08:-${COMIN_GES}/${GPREFIX}atmf008.nc} -ATMG09=${ATMG09:-${COMIN_GES}/${GPREFIX}atmf009.nc} +ATMG03=${ATMG03:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf003.nc} +ATMG04=${ATMG04:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf004.nc} +ATMG05=${ATMG05:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf005.nc} +ATMGES=${ATMGES:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf006.nc} +ATMG07=${ATMG07:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf007.nc} +ATMG08=${ATMG08:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf008.nc} +ATMG09=${ATMG09:-${COM_ATMOS_HISTORY_PREV}/${GPREFIX}atmf009.nc} # Analysis files export APREFIX=${APREFIX:-""} -SFCANL=${SFCANL:-${COMOUT}/${APREFIX}sfcanl.nc} -DTFANL=${DTFANL:-${COMOUT}/${APREFIX}dtfanl.nc} -ATMANL=${ATMANL:-${COMOUT}/${APREFIX}atmanl.nc} +SFCANL=${SFCANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}sfcanl.nc} +DTFANL=${DTFANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}dtfanl.nc} +ATMANL=${ATMANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmanl.nc} # Increment files -ATMINC=${ATMINC:-${COMOUT}/${APREFIX}atminc.nc} +ATMINC=${ATMINC:-${COM_ATMOS_ANALYSIS}/${APREFIX}atminc.nc} # Set script / GSI control parameters DOHYBVAR=${DOHYBVAR:-"NO"} @@ -114,18 +105,18 @@ fi # Set 4D-EnVar specific variables if [ $DOHYBVAR = "YES" -a $l4densvar = ".true." -a $lwrite4danl = ".true." ]; then - ATMA03=${ATMA03:-${COMOUT}/${APREFIX}atma003.nc} - ATMI03=${ATMI03:-${COMOUT}/${APREFIX}atmi003.nc} - ATMA04=${ATMA04:-${COMOUT}/${APREFIX}atma004.nc} - ATMI04=${ATMI04:-${COMOUT}/${APREFIX}atmi004.nc} - ATMA05=${ATMA05:-${COMOUT}/${APREFIX}atma005.nc} - ATMI05=${ATMI05:-${COMOUT}/${APREFIX}atmi005.nc} - ATMA07=${ATMA07:-${COMOUT}/${APREFIX}atma007.nc} - ATMI07=${ATMI07:-${COMOUT}/${APREFIX}atmi007.nc} - ATMA08=${ATMA08:-${COMOUT}/${APREFIX}atma008.nc} - ATMI08=${ATMI08:-${COMOUT}/${APREFIX}atmi008.nc} - ATMA09=${ATMA09:-${COMOUT}/${APREFIX}atma009.nc} - ATMI09=${ATMI09:-${COMOUT}/${APREFIX}atmi009.nc} + ATMA03=${ATMA03:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma003.nc} + ATMI03=${ATMI03:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi003.nc} + ATMA04=${ATMA04:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma004.nc} + ATMI04=${ATMI04:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi004.nc} + ATMA05=${ATMA05:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma005.nc} + ATMI05=${ATMI05:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi005.nc} + ATMA07=${ATMA07:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma007.nc} + ATMI07=${ATMI07:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi007.nc} + ATMA08=${ATMA08:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma008.nc} + ATMI08=${ATMI08:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi008.nc} + ATMA09=${ATMA09:-${COM_ATMOS_ANALYSIS}/${APREFIX}atma009.nc} + ATMI09=${ATMI09:-${COM_ATMOS_ANALYSIS}/${APREFIX}atmi009.nc} fi ################################################################################ @@ -194,7 +185,7 @@ if [ $DOGAUSFCANL = "YES" ]; then export err=$?; err_chk fi -echo "$CDUMP $CDATE atmanl and sfcanl done at $(date)" > $COMOUT/${APREFIX}loganl.txt +echo "${CDUMP} ${PDY}${cyc} atmanl and sfcanl done at $(date)" > "${COM_ATMOS_ANALYSIS}/${APREFIX}loganl.txt" ################################################################################ # Postprocessing diff --git a/scripts/exglobal_atmos_sfcanl.sh b/scripts/exglobal_atmos_sfcanl.sh index 7b76bc5359..65c9b26250 100755 --- a/scripts/exglobal_atmos_sfcanl.sh +++ b/scripts/exglobal_atmos_sfcanl.sh @@ -24,18 +24,13 @@ source "${HOMEgfs}/ush/preamble.sh" # Directories. pwd=$(pwd) -# Base variables -CDATE=${CDATE:-"2001010100"} -CDUMP=${CDUMP:-"gdas"} -GDUMP=${GDUMP:-"gdas"} - # Derived base variables -GDATE=$(${NDATE} -${assim_freq} ${CDATE}) -BDATE=$(${NDATE} -3 ${CDATE}) -PDY=$(echo ${CDATE} | cut -c1-8) -cyc=$(echo ${CDATE} | cut -c9-10) -bPDY=$(echo ${BDATE} | cut -c1-8) -bcyc=$(echo ${BDATE} | cut -c9-10) +# Ignore possible spelling error (nothing is misspelled) +# shellcheck disable=SC2153 +GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}") +BDATE=$(${NDATE} -3 "${PDY}${cyc}") +bPDY=${BDATE:0:8} +bcyc=${BDATE:8:2} # Utilities export NCP=${NCP:-"/bin/cp"} @@ -104,7 +99,7 @@ GPREFIX=${GPREFIX:-""} # Analysis files export APREFIX=${APREFIX:-""} -DTFANL=${DTFANL:-${COMOUT}/${APREFIX}dtfanl.nc} +DTFANL=${DTFANL:-${COM_ATMOS_ANALYSIS}/${APREFIX}dtfanl.nc} # Get dimension information based on CASE res=$(echo ${CASE} | cut -c2-) @@ -123,7 +118,7 @@ fi cd ${DATA} || exit 99 if [[ ${DONST} = "YES" ]]; then - export NSSTBF="${COMIN_OBS}/${OPREFIX}nsstbufr" + export NSSTBF="${COM_OBS}/${OPREFIX}nsstbufr" ${NLN} ${NSSTBF} nsstbufr fi @@ -141,15 +136,15 @@ fi ############################################################## # Update surface fields in the FV3 restart's using global_cycle -mkdir -p ${COMOUT}/RESTART +mkdir -p "${COM_ATMOS_RESTART}" # Global cycle requires these files -export FNTSFA=${FNTSFA:-${COMIN_OBS}/${OPREFIX}rtgssthr.grb} -export FNACNA=${FNACNA:-${COMIN}/${OPREFIX}seaice.5min.blend.grb} -export FNSNOA=${FNSNOA:-${COMIN}/${OPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} -[[ ! -f ${FNSNOA} ]] && export FNSNOA="${COMIN}/${OPREFIX}snogrb_t1534.3072.1536" -FNSNOG=${FNSNOG:-${COMIN_GES}/${GPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} -[[ ! -f ${FNSNOG} ]] && FNSNOG="${COMIN_GES}/${GPREFIX}snogrb_t1534.3072.1536" +export FNTSFA=${FNTSFA:-${COM_OBS}/${OPREFIX}rtgssthr.grb} +export FNACNA=${FNACNA:-${COM_OBS}/${OPREFIX}seaice.5min.blend.grb} +export FNSNOA=${FNSNOA:-${COM_OBS}/${OPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} +[[ ! -f ${FNSNOA} ]] && export FNSNOA="${COM_OBS}/${OPREFIX}snogrb_t1534.3072.1536" +FNSNOG=${FNSNOG:-${COM_OBS_PREV}/${GPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}} +[[ ! -f ${FNSNOG} ]] && FNSNOG="${COM_OBS_PREV}/${GPREFIX}snogrb_t1534.3072.1536" # Set CYCLVARS by checking grib date of current snogrb vs that of prev cycle if [[ ${RUN_GETGES} = "YES" ]]; then @@ -168,7 +163,7 @@ else fi if [[ ${DONST} = "YES" ]]; then - export NST_FILE=${GSI_FILE:-${COMOUT}/${APREFIX}dtfanl.nc} + export NST_FILE=${GSI_FILE:-${COM_ATMOS_ANALYSIS}/${APREFIX}dtfanl.nc} else export NST_FILE="NULL" fi @@ -177,35 +172,37 @@ if [[ ${DOIAU} = "YES" ]]; then # update surface restarts at the beginning of the window, if IAU # For now assume/hold dtfanl.nc valid at beginning of window for n in $(seq 1 ${ntiles}); do - ${NCP} ${COMIN_GES}/RESTART/${bPDY}.${bcyc}0000.sfc_data.tile${n}.nc ${COMOUT}/RESTART/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc - ${NLN} ${COMIN_GES}/RESTART/${bPDY}.${bcyc}0000.sfc_data.tile${n}.nc ${DATA}/fnbgsi.00${n} - ${NLN} ${COMOUT}/RESTART/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc ${DATA}/fnbgso.00${n} - ${NLN} ${FIXfv3}/${CASE}/${CASE}_grid.tile${n}.nc ${DATA}/fngrid.00${n} - ${NLN} ${FIXfv3}/${CASE}/${CASE}_oro_data.tile${n}.nc ${DATA}/fnorog.00${n} + ${NCP} "${COM_ATMOS_RESTART_PREV}/${bPDY}.${bcyc}0000.sfc_data.tile${n}.nc" \ + "${COM_ATMOS_RESTART}/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc" + ${NLN} "${COM_ATMOS_RESTART_PREV}/${bPDY}.${bcyc}0000.sfc_data.tile${n}.nc" "${DATA}/fnbgsi.00${n}" + ${NLN} "${COM_ATMOS_RESTART}/${bPDY}.${bcyc}0000.sfcanl_data.tile${n}.nc" "${DATA}/fnbgso.00${n}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_grid.tile${n}.nc" "${DATA}/fngrid.00${n}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_oro_data.tile${n}.nc" "${DATA}/fnorog.00${n}" done export APRUNCY=${APRUN_CYCLE} export OMP_NUM_THREADS_CY=${NTHREADS_CYCLE} export MAX_TASKS_CY=${ntiles} - ${CYCLESH} + CDATE="${PDY}${cyc}" ${CYCLESH} export err=$?; err_chk fi # Update surface restarts at middle of window for n in $(seq 1 ${ntiles}); do - ${NCP} ${COMIN_GES}/RESTART/${PDY}.${cyc}0000.sfc_data.tile${n}.nc ${COMOUT}/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc - ${NLN} ${COMIN_GES}/RESTART/${PDY}.${cyc}0000.sfc_data.tile${n}.nc ${DATA}/fnbgsi.00${n} - ${NLN} ${COMOUT}/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc ${DATA}/fnbgso.00${n} - ${NLN} ${FIXfv3}/${CASE}/${CASE}_grid.tile${n}.nc ${DATA}/fngrid.00${n} - ${NLN} ${FIXfv3}/${CASE}/${CASE}_oro_data.tile${n}.nc ${DATA}/fnorog.00${n} + ${NCP} "${COM_ATMOS_RESTART_PREV}/${PDY}.${cyc}0000.sfc_data.tile${n}.nc" \ + "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc" + ${NLN} "${COM_ATMOS_RESTART_PREV}/${PDY}.${cyc}0000.sfc_data.tile${n}.nc" "${DATA}/fnbgsi.00${n}" + ${NLN} "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile${n}.nc" "${DATA}/fnbgso.00${n}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_grid.tile${n}.nc" "${DATA}/fngrid.00${n}" + ${NLN} "${FIXfv3}/${CASE}/${CASE}_oro_data.tile${n}.nc" "${DATA}/fnorog.00${n}" done export APRUNCY=${APRUN_CYCLE} export OMP_NUM_THREADS_CY=${NTHREADS_CYCLE} export MAX_TASKS_CY=${ntiles} -${CYCLESH} +CDATE="${PDY}${cyc}" ${CYCLESH} export err=$?; err_chk diff --git a/scripts/exglobal_atmos_tropcy_qc_reloc.sh b/scripts/exglobal_atmos_tropcy_qc_reloc.sh index 490a5bba4e..380441a6c9 100755 --- a/scripts/exglobal_atmos_tropcy_qc_reloc.sh +++ b/scripts/exglobal_atmos_tropcy_qc_reloc.sh @@ -17,8 +17,6 @@ cd $DATA cat break > $pgmout -export COMSP=$COMOUT/${RUN}.${cycle}. - tmhr=$(echo $tmmark|cut -c3-4) cdate10=$( ${NDATE:?} -$tmhr $PDY$cyc) @@ -60,7 +58,7 @@ if [ "$PROCESS_TROPCY" = 'YES' ]; then fi - cd $COMOUT + cd "${COM_OBS}" || exit 1 pwd ls -ltr *syndata* cd $ARCHSYND @@ -79,10 +77,10 @@ else # don't want to wipe out these files) # - [ ! -s ${COMSP}syndata.tcvitals.$tmmark ] && \ - cp /dev/null ${COMSP}syndata.tcvitals.$tmmark - [ ! -s ${COMSP}jtwc-fnoc.tcvitals.$tmmark ] && \ - cp /dev/null ${COMSP}jtwc-fnoc.tcvitals.$tmmark + [ ! -s "${COM_OBS}/${RUN}.t${cyc}z.syndata.tcvitals.${tmmark}" ] && \ + cp "/dev/null" "${COM_OBS}/${RUN}.t${cyc}z.syndata.tcvitals.${tmmark}" + [ ! -s "${COM_OBS}/${RUN}.t${cyc}z.jtwc-fnoc.tcvitals.${tmmark}" ] && \ + cp "/dev/null" "${COM_OBS}/${RUN}.t${cyc}z.jtwc-fnoc.tcvitals.${tmmark}" # endif loop $PROCESS_TROPCY fi @@ -110,25 +108,25 @@ if [ "$DO_RELOCATE" = 'YES' ]; then [ $RUN = gfs -o $RUN = gdas -o $NET = cfs ] && qual_last="" if [ $BKGFREQ -eq 1 ]; then - [ -s sgm3prep ] && cp sgm3prep ${COMSP}sgm3prep${qual_last} - [ -s sgm2prep ] && cp sgm2prep ${COMSP}sgm2prep${qual_last} - [ -s sgm1prep ] && cp sgm1prep ${COMSP}sgm1prep${qual_last} - [ -s sgesprep ] && cp sgesprep ${COMSP}sgesprep${qual_last} - [ -s sgp1prep ] && cp sgp1prep ${COMSP}sgp1prep${qual_last} - [ -s sgp2prep ] && cp sgp2prep ${COMSP}sgp2prep${qual_last} - [ -s sgp3prep ] && cp sgp3prep ${COMSP}sgp3prep${qual_last} + if [[ -s sgm3prep ]]; then cp "sgm3prep" "${COM_OBS}/${RUN}.t${cyc}z.sgm3prep${qual_last}"; fi + if [[ -s sgm2prep ]]; then cp "sgm2prep" "${COM_OBS}/${RUN}.t${cyc}z.sgm2prep${qual_last}"; fi + if [[ -s sgm1prep ]]; then cp "sgm1prep" "${COM_OBS}/${RUN}.t${cyc}z.sgm1prep${qual_last}"; fi + if [[ -s sgesprep ]]; then cp "sgesprep" "${COM_OBS}/${RUN}.t${cyc}z.sgesprep${qual_last}"; fi + if [[ -s sgp1prep ]]; then cp "sgp1prep" "${COM_OBS}/${RUN}.t${cyc}z.sgp1prep${qual_last}"; fi + if [[ -s sgp2prep ]]; then cp "sgp2prep" "${COM_OBS}/${RUN}.t${cyc}z.sgp2prep${qual_last}"; fi + if [[ -s sgp3prep ]]; then cp "sgp3prep" "${COM_OBS}/${RUN}.t${cyc}z.sgp3prep${qual_last}"; fi elif [ $BKGFREQ -eq 3 ]; then - [ -s sgm3prep ] && cp sgm3prep ${COMSP}sgm3prep${qual_last} - [ -s sgesprep ] && cp sgesprep ${COMSP}sgesprep${qual_last} - [ -s sgp3prep ] && cp sgp3prep ${COMSP}sgp3prep${qual_last} + if [[ -s sgm3prep ]]; then cp "sgm3prep" "${COM_OBS}/${RUN}.t${cyc}z.sgm3prep${qual_last}"; fi + if [[ -s sgesprep ]]; then cp "sgesprep" "${COM_OBS}/${RUN}.t${cyc}z.sgesprep${qual_last}"; fi + if [[ -s sgp3prep ]]; then cp "sgp3prep" "${COM_OBS}/${RUN}.t${cyc}z.sgp3prep${qual_last}"; fi fi -# The existence of ${COMSP}tropcy_relocation_status.$tmmark file will tell the +# The existence of ${COM_OBS}/${RUN}.t${cyc}z.tropcy_relocation_status.$tmmark file will tell the # subsequent PREP processing that RELOCATION processing occurred, if this file # does not already exist at this point, echo "RECORDS PROCESSED" into it to # further tell PREP processing that records were processed by relocation and # the global sigma guess was modified by tropical cyclone relocation -# Note: If ${COMSP}tropcy_relocation_status.$tmmark already exists at this +# Note: If ${COM_OBS}/${RUN}.t${cyc}z.tropcy_relocation_status.$tmmark already exists at this # point it means that it contains the string "NO RECORDS to process" # and was created by the child script tropcy_relocate.sh because records # were not processed by relocation and the global sigma guess was NOT @@ -136,8 +134,9 @@ if [ "$DO_RELOCATE" = 'YES' ]; then # were found in the relocation step) # ---------------------------------------------------------------------------- - [ ! -s ${COMSP}tropcy_relocation_status.$tmmark ] && \ - echo "RECORDS PROCESSED" > ${COMSP}tropcy_relocation_status.$tmmark + if [[ ! -s "${COM_OBS}/${RUN}.t${cyc}z.tropcy_relocation_status.${tmmark}" ]]; then + echo "RECORDS PROCESSED" > "${COM_OBS}/${RUN}.t${cyc}z.tropcy_relocation_status.${tmmark}" + fi # endif loop $DO_RELOCATE fi diff --git a/scripts/exglobal_diag.sh b/scripts/exglobal_diag.sh index 3ff07d48f6..3aa1093fad 100755 --- a/scripts/exglobal_diag.sh +++ b/scripts/exglobal_diag.sh @@ -25,18 +25,10 @@ source "$HOMEgfs/ush/preamble.sh" pwd=$(pwd) # Base variables -CDATE=${CDATE:-"2001010100"} +CDATE="${PDY}${cyc}" CDUMP=${CDUMP:-"gdas"} GDUMP=${GDUMP:-"gdas"} -# Derived base variables -GDATE=$($NDATE -$assim_freq $CDATE) -BDATE=$($NDATE -3 $CDATE) -PDY=$(echo $CDATE | cut -c1-8) -cyc=$(echo $CDATE | cut -c9-10) -bPDY=$(echo $BDATE | cut -c1-8) -bcyc=$(echo $BDATE | cut -c9-10) - # Utilities export NCP=${NCP:-"/bin/cp"} export NMV=${NMV:-"/bin/mv"} @@ -61,10 +53,10 @@ SENDDBN=${SENDDBN:-"NO"} # Analysis files export APREFIX=${APREFIX:-""} -RADSTAT=${RADSTAT:-${COMOUT}/${APREFIX}radstat} -PCPSTAT=${PCPSTAT:-${COMOUT}/${APREFIX}pcpstat} -CNVSTAT=${CNVSTAT:-${COMOUT}/${APREFIX}cnvstat} -OZNSTAT=${OZNSTAT:-${COMOUT}/${APREFIX}oznstat} +RADSTAT=${RADSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}radstat} +PCPSTAT=${PCPSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}pcpstat} +CNVSTAT=${CNVSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}cnvstat} +OZNSTAT=${OZNSTAT:-${COM_ATMOS_ANALYSIS}/${APREFIX}oznstat} # Remove stat file if file already exists [[ -s $RADSTAT ]] && rm -f $RADSTAT @@ -86,7 +78,7 @@ nm="" if [ $CFP_MP = "YES" ]; then nm=0 fi -DIAG_DIR=${DIAG_DIR:-${COMOUT}/gsidiags} +DIAG_DIR=${DIAG_DIR:-${COM_ATMOS_ANALYSIS}/gsidiags} REMOVE_DIAG_DIR=${REMOVE_DIAG_DIR:-"NO"} # Set script / GSI control parameters diff --git a/scripts/exglobal_forecast.sh b/scripts/exglobal_forecast.sh index 8bd6776dda..d86691d5ec 100755 --- a/scripts/exglobal_forecast.sh +++ b/scripts/exglobal_forecast.sh @@ -77,9 +77,9 @@ # Main body starts here ####################### -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" -SCRIPTDIR=$(dirname $(readlink -f "$0") )/../ush +SCRIPTDIR="${HOMEgfs}/ush" echo "MAIN: environment loaded for $machine platform,Current Script locates in $SCRIPTDIR." # include all subroutines. Executions later. diff --git a/scripts/run_reg2grb2.sh b/scripts/run_reg2grb2.sh index 668368056e..ab2c80043e 100755 --- a/scripts/run_reg2grb2.sh +++ b/scripts/run_reg2grb2.sh @@ -1,11 +1,11 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" #requires grib_util module -MOM6REGRID=${MOM6REGRID:-$HOMEgfs} -export mask_file=$MOM6REGRID/fix/reg2grb2/mask.0p25x0p25.grb2 +MOM6REGRID=${MOM6REGRID:-${HOMEgfs}} +export mask_file="${MOM6REGRID}/fix/reg2grb2/mask.0p25x0p25.grb2" # offline testing: #export DATA= @@ -14,25 +14,25 @@ export mask_file=$MOM6REGRID/fix/reg2grb2/mask.0p25x0p25.grb2 #export outfile=$DATA/DATA0p5/out/ocnh2012010106.01.2012010100.grb2 # # workflow testing: -export icefile=icer${CDATE}.${ENSMEM}.${IDATE}_0p25x0p25_CICE.nc -export ocnfile=ocnr${CDATE}.${ENSMEM}.${IDATE}_0p25x0p25_MOM6.nc -export outfile=ocn_ice${CDATE}.${ENSMEM}.${IDATE}_0p25x0p25.grb2 -export outfile0p5=ocn_ice${CDATE}.${ENSMEM}.${IDATE}_0p5x0p5.grb2 +export icefile="icer${VDATE}.${ENSMEM}.${IDATE}_0p25x0p25_CICE.nc" +export ocnfile="ocnr${VDATE}.${ENSMEM}.${IDATE}_0p25x0p25_MOM6.nc" +export outfile="ocn_ice${VDATE}.${ENSMEM}.${IDATE}_0p25x0p25.grb2" +export outfile0p5="ocn_ice${VDATE}.${ENSMEM}.${IDATE}_0p5x0p5.grb2" export mfcstcpl=${mfcstcpl:-1} export IGEN_OCNP=${IGEN_OCNP:-197} # PT This is the forecast date -export year=$(echo $CDATE | cut -c1-4) -export month=$(echo $CDATE | cut -c5-6) -export day=$(echo $CDATE | cut -c7-8) -export hour=$(echo $CDATE | cut -c9-10) +export year=${VDATE:0:4} +export month=${VDATE:4:2} +export day=${VDATE:6:2} +export hour=${VDATE:8:2} # PT This is the initialization date -export syear=$(echo $IDATE | cut -c1-4) -export smonth=$(echo $IDATE | cut -c5-6) -export sday=$(echo $IDATE | cut -c7-8) -export shour=$(echo $IDATE | cut -c9-10) +export syear=${IDATE:0:4} +export smonth=${IDATE:4:2} +export sday=${IDATE:6:2} +export shour=${IDATE:8:2} # PT Need to get this from above - could be 6 or 1 hour export hh_inc_ocn=6 @@ -63,10 +63,10 @@ export flatn=90. export flonw=0.0 export flone=359.75 -ln -sf $mask_file ./iceocnpost.g2 -$executable > reg2grb2.$CDATE.$IDATE.out +ln -sf "${mask_file}" ./iceocnpost.g2 +${executable} > "reg2grb2.${VDATE}.${IDATE}.out" # interpolated from 0p25 to 0p5 grid grid2p05="0 6 0 0 0 0 0 0 720 361 0 0 90000000 0 48 -90000000 359500000 500000 500000 0" -$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 6d18eeb693..103e9a759e 100755 --- a/scripts/run_regrid.sh +++ b/scripts/run_regrid.sh @@ -1,26 +1,27 @@ #! /usr/bin/env bash -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" -MOM6REGRID=${MOM6REGRID:-$HOMEgfs} -export EXEC_DIR=$MOM6REGRID/exec -export USH_DIR=$MOM6REGRID/ush -export COMOUTocean=$COMOUTocean -export COMOUTice=$COMOUTice -export IDATE=$IDATE -export ENSMEM=$ENSMEM -export FHR=$fhr -export DATA=$DATA -export FIXreg2grb2=$FIXreg2grb2 +MOM6REGRID="${MOM6REGRID:-${HOMEgfs}}" +export EXEC_DIR="${MOM6REGRID}/exec" +export USH_DIR="${MOM6REGRID}/ush" +export COMOUTocean="${COM_OCEAN_HISTORY}" +export COMOUTice="${COM_ICE_HISTORY}" +export IDATE="${IDATE}" +export VDATE="${VDATE}" +export ENSMEM="${ENSMEM}" +export FHR="${fhr}" +export DATA="${DATA}" +export FIXreg2grb2="${FIXreg2grb2}" ###### DO NOT MODIFY BELOW UNLESS YOU KNOW WHAT YOU ARE DOING ####### #Need NCL module to be loaded: -echo $NCARG_ROOT -export NCL=$NCARG_ROOT/bin/ncl +echo "${NCARG_ROOT}" +export NCL="${NCARG_ROOT}/bin/ncl" ls -alrt -$NCL $USH_DIR/icepost.ncl -$NCL $USH_DIR/ocnpost.ncl +${NCL} "${USH_DIR}/icepost.ncl" +${NCL} "${USH_DIR}/ocnpost.ncl" ##################################################################### diff --git a/ush/calcanl_gfs.py b/ush/calcanl_gfs.py index fcf272b3ee..a325ec35b3 100755 --- a/ush/calcanl_gfs.py +++ b/ush/calcanl_gfs.py @@ -341,9 +341,9 @@ def calcanl_gfs(DoIAU, l4DEnsVar, Write4Danl, ComOut, APrefix, DoIAU = gsi_utils.isTrue(os.getenv('DOIAU', 'NO')) l4DEnsVar = gsi_utils.isTrue(os.getenv('l4densvar', 'NO')) Write4Danl = gsi_utils.isTrue(os.getenv('lwrite4danl', 'NO')) - ComIn_Ges = os.getenv('COMIN_GES', './') + ComIn_Ges = os.getenv('COM_ATMOS_HISTORY_PREV', './') GPrefix = os.getenv('GPREFIX', './') - ComOut = os.getenv('COMOUT', './') + ComOut = os.getenv('COM_ATMOS_ANALYSIS', './') APrefix = os.getenv('APREFIX', '') NThreads = os.getenv('NTHREADS_CHGRES', 1) FixDir = os.getenv('FIXgsm', './') diff --git a/ush/calcinc_gfs.py b/ush/calcinc_gfs.py index 6ed1e50422..cb334ac836 100755 --- a/ush/calcinc_gfs.py +++ b/ush/calcinc_gfs.py @@ -70,7 +70,7 @@ def calcinc_gfs(DoIAU, l4DEnsVar, Write4Danl, ComOut, APrefix, IAUHrs, DoIAU = gsi_utils.isTrue(os.getenv('DOIAU', 'NO')) l4DEnsVar = gsi_utils.isTrue(os.getenv('l4densvar', 'NO')) Write4Danl = gsi_utils.isTrue(os.getenv('lwrite4danl', 'NO')) - ComOut = os.getenv('COMOUT', './') + ComOut = os.getenv('COM_ATMOS_ANALYSIS', './') APrefix = os.getenv('APREFIX', '') NThreads = os.getenv('NTHREADS_CALCINC', 1) IMP_Physics = os.getenv('imp_physics', 11) diff --git a/ush/forecast_det.sh b/ush/forecast_det.sh index 575f35696a..06329e0762 100755 --- a/ush/forecast_det.sh +++ b/ush/forecast_det.sh @@ -19,7 +19,7 @@ FV3_GFS_det(){ res_latlon_dynamics="''" # Determine if this is a warm start or cold start - if [[ -f "${gmemdir}/RESTART/${sPDY}.${scyc}0000.coupler.res" ]]; then + if [[ -f "${COM_ATMOS_RESTART_PREV}/${sPDY}.${scyc}0000.coupler.res" ]]; then export warm_start=".true." fi @@ -40,22 +40,22 @@ FV3_GFS_det(){ #------------------------------------------------------- # determine if restart IC exists to continue from a previous forecast RERUN=${RERUN:-"NO"} - filecount=$(find "${RSTDIR_ATM:-/dev/null}" -type f | wc -l) + filecount=$(find "${COM_ATMOS_RESTART:-/dev/null}" -type f | wc -l) if [[ ( ${CDUMP} = "gfs" || ( ${RUN} = "gefs" && ${CDATE_RST} = "" )) && ${rst_invt1} -gt 0 && ${FHMAX} -gt ${rst_invt1} && ${filecount} -gt 10 ]]; then reverse=$(echo "${restart_interval[@]} " | tac -s ' ') for xfh in ${reverse} ; do yfh=$((xfh-(IAU_OFFSET/2))) - SDATE=$(${NDATE} +${yfh} "${CDATE}") + SDATE=$(${NDATE} ${yfh} "${CDATE}") PDYS=$(echo "${SDATE}" | cut -c1-8) cycs=$(echo "${SDATE}" | cut -c9-10) - flag1=${RSTDIR_ATM}/${PDYS}.${cycs}0000.coupler.res - flag2=${RSTDIR_ATM}/coupler.res + flag1=${COM_ATMOS_RESTART}/${PDYS}.${cycs}0000.coupler.res + flag2=${COM_ATMOS_RESTART}/coupler.res #make sure that the wave restart files also exist if cplwav=true waverstok=".true." if [[ "${cplwav}" = ".true." ]]; then for wavGRD in ${waveGRD} ; do - if [[ ! -f "${RSTDIR_WAVE}/${PDYS}.${cycs}0000.restart.${wavGRD}" ]]; then + if [[ ! -f "${COM_WAVE_RESTART}/${PDYS}.${cycs}0000.restart.${wavGRD}" ]]; then waverstok=".false." fi done diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 13485bbd1e..99ff18d377 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -40,25 +40,23 @@ FV3_GFS_postdet(){ if [ $RERUN = "NO" ]; then #............................. - # Link all restart files from $gmemdir - for file in $(ls $gmemdir/RESTART/${sPDY}.${scyc}0000.*.nc); do + # Link all restart files from previous cycle + for file in "${COM_ATMOS_RESTART_PREV}/${sPDY}.${scyc}0000."*.nc; do file2=$(echo $(basename $file)) file2=$(echo $file2 | cut -d. -f3-) # remove the date from file fsuf=$(echo $file2 | cut -d. -f1) $NLN $file $DATA/INPUT/$file2 done - # Replace sfc_data with sfcanl_data restart files from $memdir (if found) + # Replace sfc_data with sfcanl_data restart files from current cycle (if found) if [ "${MODE}" = "cycled" ] && [ "${CCPP_SUITE}" = "FV3_GFS_v16" ]; then # TODO: remove if statement when global_cycle can handle NOAHMP - for file in $(ls $memdir/RESTART/${sPDY}.${scyc}0000.sfcanl_data.tile?.nc); do - if [[ -f $file ]]; then - file2=$(echo $(basename $file)) - file2=$(echo $file2 | cut -d. -f3-) # remove the date from file - fsufanl=$(echo $file2 | cut -d. -f1) - file2=$(echo $file2 | sed -e "s/sfcanl_data/sfc_data/g") - rm -f $DATA/INPUT/$file2 - $NLN $file $DATA/INPUT/$file2 - fi + for file in "${COM_ATMOS_RESTART}/${sPDY}.${scyc}0000."*.nc; do + file2=$(echo $(basename $file)) + file2=$(echo $file2 | cut -d. -f3-) # remove the date from file + fsufanl=$(echo $file2 | cut -d. -f1) + file2=$(echo $file2 | sed -e "s/sfcanl_data/sfc_data/g") + rm -f $DATA/INPUT/$file2 + $NLN $file $DATA/INPUT/$file2 done fi @@ -77,9 +75,9 @@ EOF for i in $(echo $IAUFHRS | sed "s/,/ /g" | rev); do incfhr=$(printf %03i $i) if [ $incfhr = "006" ]; then - increment_file=$memdir/${CDUMP}.t${cyc}z.${PREFIX_ATMINC}atminc.nc + increment_file="${COM_ATMOS_ANALYSIS}/${RUN}.t${cyc}z.${PREFIX_ATMINC}atminc.nc" else - increment_file=$memdir/${CDUMP}.t${cyc}z.${PREFIX_ATMINC}atmi${incfhr}.nc + increment_file="${COM_ATMOS_ANALYSIS}/${RUN}.t${cyc}z.${PREFIX_ATMINC}atmi${incfhr}.nc" fi if [ ! -f $increment_file ]; then echo "ERROR: DOIAU = $DOIAU, but missing increment file for fhr $incfhr at $increment_file" @@ -92,7 +90,7 @@ EOF read_increment=".false." res_latlon_dynamics="" else - increment_file=$memdir/${CDUMP}.t${cyc}z.${PREFIX_ATMINC}atminc.nc + increment_file="${COM_ATMOS_ANALYSIS}/${RUN}.t${cyc}z.${PREFIX_ATMINC}atminc.nc" if [ -f $increment_file ]; then $NLN $increment_file $DATA/INPUT/fv3_increment.nc read_increment=".true." @@ -105,7 +103,7 @@ EOF export warm_start=".true." PDYT=$(echo $CDATE_RST | cut -c1-8) cyct=$(echo $CDATE_RST | cut -c9-10) - for file in $(ls $RSTDIR_ATM/${PDYT}.${cyct}0000.*); do + for file in "${COM_ATMOS_RESTART}/${PDYT}.${cyct}0000."*; do file2=$(echo $(basename $file)) file2=$(echo $file2 | cut -d. -f3-) $NLN $file $DATA/INPUT/$file2 @@ -130,7 +128,7 @@ EOF #............................. else ## cold start - for file in $(ls ${memdir}/INPUT/*.nc); do + for file in "${COM_ATMOS_INPUT}/"*.nc; do file2=$(echo $(basename $file)) fsuf=$(echo $file2 | cut -c1-3) if [ $fsuf = "gfs" -o $fsuf = "sfc" ]; then @@ -482,6 +480,8 @@ EOF LONB_STP=${LONB_STP:-$LONB_CASE} LATB_STP=${LATB_STP:-$LATB_CASE} cd $DATA + if [[ ! -d ${COM_ATMOS_HISTORY} ]]; then mkdir -p ${COM_ATMOS_HISTORY}; fi + if [[ ! -d ${COM_ATMOS_MASTER} ]]; then mkdir -p ${COM_ATMOS_MASTER}; fi if [ $QUILTING = ".true." -a $OUTPUT_GRID = "gaussian_grid" ]; then fhr=$FHMIN for fhr in $OUTPUT_FH; do @@ -492,11 +492,11 @@ EOF logi=logf${FH3} pgbi=GFSPRS.GrbF${FH2} flxi=GFSFLX.GrbF${FH2} - atmo=$memdir/${CDUMP}.t${cyc}z.atmf${FH3}.nc - sfco=$memdir/${CDUMP}.t${cyc}z.sfcf${FH3}.nc - logo=$memdir/${CDUMP}.t${cyc}z.logf${FH3}.txt - pgbo=$memdir/${CDUMP}.t${cyc}z.master.grb2f${FH3} - flxo=$memdir/${CDUMP}.t${cyc}z.sfluxgrbf${FH3}.grib2 + atmo=${COM_ATMOS_HISTORY}/${RUN}.t${cyc}z.atmf${FH3}.nc + sfco=${COM_ATMOS_HISTORY}/${RUN}.t${cyc}z.sfcf${FH3}.nc + logo=${COM_ATMOS_HISTORY}/${RUN}.t${cyc}z.logf${FH3}.txt + pgbo=${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.master.grb2f${FH3} + flxo=${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.sfluxgrbf${FH3}.grib2 eval $NLN $atmo $atmi eval $NLN $sfco $sfci eval $NLN $logo $logi @@ -507,11 +507,11 @@ EOF done else for n in $(seq 1 $ntiles); do - eval $NLN nggps2d.tile${n}.nc $memdir/nggps2d.tile${n}.nc - eval $NLN nggps3d.tile${n}.nc $memdir/nggps3d.tile${n}.nc - eval $NLN grid_spec.tile${n}.nc $memdir/grid_spec.tile${n}.nc - eval $NLN atmos_static.tile${n}.nc $memdir/atmos_static.tile${n}.nc - eval $NLN atmos_4xdaily.tile${n}.nc $memdir/atmos_4xdaily.tile${n}.nc + eval $NLN nggps2d.tile${n}.nc ${COM_ATMOS_HISTORY}/nggps2d.tile${n}.nc + eval $NLN nggps3d.tile${n}.nc ${COM_ATMOS_HISTORY}/nggps3d.tile${n}.nc + eval $NLN grid_spec.tile${n}.nc ${COM_ATMOS_HISTORY}/grid_spec.tile${n}.nc + eval $NLN atmos_static.tile${n}.nc ${COM_ATMOS_HISTORY}/atmos_static.tile${n}.nc + eval $NLN atmos_4xdaily.tile${n}.nc ${COM_ATMOS_HISTORY}/atmos_4xdaily.tile${n}.nc done fi } @@ -542,16 +542,16 @@ data_out_GFS() { if [ $SEND = "YES" ]; then # Copy model restart files - if [[ ${CDUMP} =~ "gdas" ]] && (( rst_invt1 > 0 )); then + if [[ ${RUN} =~ "gdas" ]] && (( rst_invt1 > 0 )); then cd $DATA/RESTART - mkdir -p $memdir/RESTART + mkdir -p "${COM_ATMOS_RESTART}" for rst_int in $restart_interval ; do if [ $rst_int -ge 0 ]; then RDATE=$($NDATE +$rst_int $CDATE) rPDY=$(echo $RDATE | cut -c1-8) rcyc=$(echo $RDATE | cut -c9-10) - for file in $(ls ${rPDY}.${rcyc}0000.*) ; do - $NCP $file $memdir/RESTART/$file + for file in "${rPDY}.${rcyc}0000."* ; do + ${NCP} "${file}" "${COM_ATMOS_RESTART}/${file}" done fi done @@ -564,12 +564,12 @@ data_out_GFS() { RDATE=$($NDATE +$rst_iau $CDATE) rPDY=$(echo $RDATE | cut -c1-8) rcyc=$(echo $RDATE | cut -c9-10) - for file in $(ls ${rPDY}.${rcyc}0000.*) ; do - $NCP $file $memdir/RESTART/$file + for file in "${rPDY}.${rcyc}0000."* ; do + ${NCP} "${file}" "${COM_ATMOS_RESTART}/${file}" done fi - elif [[ ${CDUMP} =~ "gfs" ]]; then - $NCP $DATA/input.nml ${ROTDIR}/${RUN}.${PDY}/${cyc}/atmos/ + elif [[ ${RUN} =~ "gfs" ]]; then + ${NCP} "${DATA}/input.nml" "${COM_ATMOS_HISTORY}/input.nml" fi fi @@ -588,11 +588,11 @@ WW3_postdet() { grdALL=$(printf "%s\n" "${array[@]}" | sort -u | tr '\n' ' ') for wavGRD in ${grdALL}; do - $NCP $ROTDIR/${CDUMP}.${PDY}/${cyc}/wave/rundata/${COMPONENTwave}.mod_def.$wavGRD $DATA/mod_def.$wavGRD + ${NCP} "${COM_WAVE_PREP}/${COMPONENTwave}.mod_def.${wavGRD}" "${DATA}/mod_def.${wavGRD}" done - else - #if shel, only 1 waveGRD which is linked to mod_def.ww3 - $NCP $ROTDIR/${CDUMP}.${PDY}/${cyc}/wave/rundata/${COMPONENTwave}.mod_def.$waveGRD $DATA/mod_def.ww3 + else + #if shel, only 1 waveGRD which is linked to mod_def.ww3 + ${NCP} "${COM_WAVE_PREP}/${COMPONENTwave}.mod_def.${waveGRD}" "${DATA}/mod_def.ww3" fi @@ -604,25 +604,18 @@ WW3_postdet() { $NLN -sf $FIXwave/$MESH_WAV $DATA/ fi - export WAVHCYC=${WAVHCYC:-6} - export WRDATE=$($NDATE -${WAVHCYC} $CDATE) - export WRPDY=$(echo $WRDATE | cut -c1-8) - export WRcyc=$(echo $WRDATE | cut -c9-10) - 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=${RUNwave}${WAV_MEMBER:-} #Copy initial condition files: for wavGRD in $waveGRD ; do if [ $warm_start = ".true." -o $RERUN = "YES" ]; then if [ $RERUN = "NO" ]; then - waverstfile=${WRDIR}/${sPDY}.${scyc}0000.restart.${wavGRD} - else - waverstfile=${RSTDIR_WAVE}/${PDYT}.${cyct}0000.restart.${wavGRD} + waverstfile=${COM_WAVE_RESTART_PREV}/${sPDY}.${scyc}0000.restart.${wavGRD} + else + waverstfile=${COM_WAVE_RESTART}/${PDYT}.${cyct}0000.restart.${wavGRD} fi - else - waverstfile=${RSTDIR_WAVE}/${sPDY}.${scyc}0000.restart.${wavGRD} + else + waverstfile=${COM_WAVE_RESTART}/${sPDY}.${scyc}0000.restart.${wavGRD} fi if [ ! -f ${waverstfile} ]; then if [ $RERUN = "NO" ]; then @@ -642,14 +635,14 @@ WW3_postdet() { if [ $waveMULTIGRID = ".true." ]; then for wavGRD in $waveGRD ; do - $NLN $datwave/${wavprfx}.log.${wavGRD}.${PDY}${cyc} log.${wavGRD} + ${NLN} "${COM_WAVE_HISTORY}/${wavprfx}.log.${wavGRD}.${PDY}${cyc}" "log.${wavGRD}" done - else - $NLN $datwave/${wavprfx}.log.${waveGRD}.${PDY}${cyc} log.ww3 + else + ${NLN} "${COM_WAVE_HISTORY}/${wavprfx}.log.${waveGRD}.${PDY}${cyc}" "log.ww3" fi if [ "$WW3ICEINP" = "YES" ]; then - wavicefile=$COMINwave/rundata/${CDUMPwave}.${WAVEICE_FID}.${cycle}.ice + wavicefile="${COM_WAVE_PREP}/${RUNwave}.${WAVEICE_FID}.${cycle}.ice" if [ ! -f $wavicefile ]; then echo "ERROR: WW3ICEINP = ${WW3ICEINP}, but missing ice file" echo "Abort!" @@ -659,7 +652,7 @@ WW3_postdet() { fi if [ "$WW3CURINP" = "YES" ]; then - wavcurfile=$COMINwave/rundata/${CDUMPwave}.${WAVECUR_FID}.${cycle}.cur + wavcurfile="${COM_WAVE_PREP}/${RUNwave}.${WAVECUR_FID}.${cycle}.cur" if [ ! -f $wavcurfile ]; then echo "ERROR: WW3CURINP = ${WW3CURINP}, but missing current file" echo "Abort!" @@ -668,10 +661,12 @@ WW3_postdet() { $NLN $wavcurfile $DATA/current.${WAVECUR_FID} fi + if [[ ! -d ${COM_WAVE_HISTORY} ]]; then mkdir -p "${COM_WAVE_HISTORY}"; fi + # Link output files cd $DATA if [ $waveMULTIGRID = ".true." ]; then - $NLN $datwave/${wavprfx}.log.mww3.${PDY}${cyc} log.mww3 + ${NLN} "${COM_WAVE_HISTORY}/${wavprfx}.log.mww3.${PDY}${cyc}" "log.mww3" fi # Loop for gridded output (uses FHINC) @@ -682,10 +677,10 @@ WW3_postdet() { HMS="$(echo $YMDH | cut -c9-10)0000" if [ $waveMULTIGRID = ".true." ]; then for wavGRD in ${waveGRD} ; do - $NLN $datwave/${wavprfx}.out_grd.${wavGRD}.${YMD}.${HMS} $DATA/${YMD}.${HMS}.out_grd.${wavGRD} + ${NLN} "${COM_WAVE_HISTORY}/${wavprfx}.out_grd.${wavGRD}.${YMD}.${HMS}" "${DATA}/${YMD}.${HMS}.out_grd.${wavGRD}" done - else - $NLN $datwave/${wavprfx}.out_grd.${waveGRD}.${YMD}.${HMS} $DATA/${YMD}.${HMS}.out_grd.ww3 + else + ${NLN} "${COM_WAVE_HISTORY}/${wavprfx}.out_grd.${waveGRD}.${YMD}.${HMS}" "${DATA}/${YMD}.${HMS}.out_grd.ww3" fi FHINC=$FHOUT_WAV if [ $FHMAX_HF_WAV -gt 0 -a $FHOUT_HF_WAV -gt 0 -a $fhr -lt $FHMAX_HF_WAV ]; then @@ -701,9 +696,9 @@ WW3_postdet() { YMD=$(echo $YMDH | cut -c1-8) HMS="$(echo $YMDH | cut -c9-10)0000" if [ $waveMULTIGRID = ".true." ]; then - $NLN $datwave/${wavprfx}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS} $DATA/${YMD}.${HMS}.out_pnt.${waveuoutpGRD} - else - $NLN $datwave/${wavprfx}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS} $DATA/${YMD}.${HMS}.out_pnt.ww3 + ${NLN} "${COM_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS}" "${DATA}/${YMD}.${HMS}.out_pnt.${waveuoutpGRD}" + else + ${NLN} "${COM_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${YMD}.${HMS}" "${DATA}/${YMD}.${HMS}.out_pnt.ww3" fi FHINC=$FHINCP_WAV @@ -713,9 +708,9 @@ WW3_postdet() { WW3_nml() { echo "SUB ${FUNCNAME[0]}: Copying input files for WW3" - WAV_MOD_TAG=${CDUMP}wave${waveMEMB} + WAV_MOD_TAG=${RUN}wave${waveMEMB} if [ "${USE_WAV_RMP:-YES}" = "YES" ]; then - if (( $( ls -1 $FIXwave/rmp_src_to_dst_conserv_* > /dev/null | wc -l) > 0 )); then + if (( $( ls -1 $FIXwave/rmp_src_to_dst_conserv_* 2> /dev/null | wc -l) > 0 )); then for file in $(ls $FIXwave/rmp_src_to_dst_conserv_*) ; do $NLN $file $DATA/ done @@ -736,7 +731,7 @@ WW3_out() { CPL_out() { echo "SUB ${FUNCNAME[0]}: Copying output data for general cpl fields" if [ $esmf_profile = ".true." ]; then - $NCP $DATA/ESMF_Profile.summary $ROTDIR/$CDUMP.$PDY/$cyc/ + ${NCP} "${DATA}/ESMF_Profile.summary" "${COM_ATMOS_HISTORY}/ESMF_Profile.summary" fi } @@ -744,12 +739,12 @@ MOM6_postdet() { echo "SUB ${FUNCNAME[0]}: MOM6 after run type determination" # Copy MOM6 ICs - $NLN "${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/ocean/RESTART/${PDY}.${cyc}0000.MOM.res.nc" "${DATA}/INPUT/MOM.res.nc" + ${NLN} "${COM_OCEAN_RESTART_PREV}/${PDY}.${cyc}0000.MOM.res.nc" "${DATA}/INPUT/MOM.res.nc" case $OCNRES in "025") for nn in $(seq 1 4); do - if [[ -f "${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/ocean/RESTART/${PDY}.${cyc}0000.MOM.res_${nn}.nc" ]]; then - $NLN "${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/ocean/RESTART/${PDY}.${cyc}0000.MOM.res_${nn}.nc" "${DATA}/INPUT/MOM.res_${nn}.nc" + if [[ -f "${COM_OCEAN_RESTART_PREV}/${PDY}.${cyc}0000.MOM.res_${nn}.nc" ]]; then + ${NLN} "${COM_OCEAN_RESTART_PREV}/${PDY}.${cyc}0000.MOM.res_${nn}.nc" "${DATA}/INPUT/MOM.res_${nn}.nc" fi done ;; @@ -757,11 +752,11 @@ MOM6_postdet() { # Link increment if [[ "${DO_JEDIOCNVAR:-NO}" = "YES" ]]; then - if [[ ! -f "${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ocean/${CDUMP}.t${cyc}z.ocninc.nc" ]]; then + if [[ ! -f "${COM_OCEAN_ANALYSIS}/${RUN}.t${cyc}z.ocninc.nc" ]]; then echo "FATAL ERROR: Ocean increment not found, ABORT!" exit 111 fi - $NLN "${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ocean/${CDUMP}.t${cyc}z.ocninc.nc" "${DATA}/INPUT/mom6_increment.nc" + ${NLN} "${COM_OCEAN_ANALYSIS}/${RUN}.t${cyc}z.ocninc.nc" "${DATA}/INPUT/mom6_increment.nc" fi # Copy MOM6 fixed files @@ -776,11 +771,11 @@ MOM6_postdet() { exit 3 fi - # Copy mediator restart file to RUNDIR # TODO: mediator should have its own CMEPS_postdet() function - if [[ "${warm_start}" = '.true.' ]]; then - local mediator_file="${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/med/RESTART/${PDY}.${cyc}0000.ufs.cpld.cpl.r.nc" + # Copy mediator restart files to RUNDIR # TODO: mediator should have its own CMEPS_postdet() function + if [[ $warm_start = ".true." ]]; then + local mediator_file="${COM_MED_RESTART}/${PDY}.${cyc}0000.ufs.cpld.cpl.r.nc" if [[ -f "${mediator_file}" ]]; then - $NLN "${mediator_file}" "${DATA}/ufs.cpld.cpl.r.nc" + ${NCP} "${mediator_file}" "${DATA}/ufs.cpld.cpl.r.nc" rm -f "${DATA}/rpointer.cpl" touch "${DATA}/rpointer.cpl" echo "ufs.cpld.cpl.r.nc" >> "${DATA}/rpointer.cpl" @@ -809,17 +804,18 @@ MOM6_postdet() { fi # Create COMOUTocean - [[ ! -d $COMOUTocean ]] && mkdir -p $COMOUTocean + [[ ! -d ${COM_OCEAN_HISTORY} ]] && mkdir -p "${COM_OCEAN_HISTORY}" # Link output files - if [[ "${CDUMP}" =~ "gfs" ]]; then - # Link output files for CDUMP = gfs + if [[ "${RUN}" =~ "gfs" ]]; then + # Link output files for RUN = gfs # TODO: get requirements on what files need to be written out and what these dates here are and what they mean export ENSMEM=${ENSMEM:-01} export IDATE=$CDATE - fhrlst=$OUTPUT_FH + fhrlst=${OUTPUT_FH} + if [[ ! -d ${COM_OCEAN_HISTORY} ]]; then mkdir -p ${COM_OCEAN_HISTORY}; fi for fhr in $fhrlst; do if [ $fhr = 'anl' ]; then # Looking at OUTPUT_FH, this is never true, TODO: remove this block @@ -847,41 +843,41 @@ MOM6_postdet() { source_file="ocn_${YYYY_MID}_${MM_MID}_${DD_MID}_${HH_MID}.nc" dest_file="ocn${VDATE}.${ENSMEM}.${IDATE}.nc" - ${NLN} ${COMOUTocean}/${dest_file} ${DATA}/${source_file} + ${NLN} ${COM_OCEAN_HISTORY}/${dest_file} ${DATA}/${source_file} source_file="ocn_daily_${YYYY}_${MM}_${DD}.nc" dest_file=${source_file} if [ ! -a "${DATA}/${source_file}" ]; then - $NLN ${COMOUTocean}/${dest_file} ${DATA}/${source_file} + $NLN ${COM_OCEAN_HISTORY}/${dest_file} ${DATA}/${source_file} fi last_fhr=$fhr done - elif [[ "${CDUMP}" =~ "gdas" ]]; then - # Link output files for CDUMP = gdas + elif [[ "${RUN}" =~ "gdas" ]]; then + # Link output files for RUN = gdas # Save MOM6 backgrounds for fhr in ${OUTPUT_FH}; do local idatestr=$(date -d "${CDATE:0:8} ${CDATE:8:2} + ${fhr} hours" +%Y_%m_%d_%H) local fhr3=$(printf %03i "${fhr}") - $NLN "${COMOUTocean}/${CDUMP}.t${cyc}z.ocnf${fhr3}.nc" "${DATA}/ocn_da_${idatestr}.nc" + $NLN "${COM_OCEAN_HISTORY}/${RUN}.t${cyc}z.ocnf${fhr3}.nc" "${DATA}/ocn_da_${idatestr}.nc" done fi - mkdir -p "${COMOUTocean}/RESTART" + mkdir -p "${COM_OCEAN_RESTART}" # end point restart does not have a timestamp, calculate local rdate=$(date -d "${CDATE:0:8} ${CDATE:8:2} + ${FHMAX} hours" +%Y%m%d%H) # Link ocean restarts from DATA to COM # Coarser than 1/2 degree has a single MOM restart - $NLN "${COMOUTocean}/RESTART/${rdate:0:8}.${rdate:8:2}0000.MOM.res.nc" "${DATA}/MOM6_RESTART/MOM.res.nc" + $NLN "${COM_OCEAN_RESTART}/${rdate:0:8}.${rdate:8:2}0000.MOM.res.nc" "${DATA}/MOM6_RESTART/MOM.res.nc" # 1/4 degree resolution has 4 additional restarts case ${OCNRES} in "025") for nn in $(seq 1 4); do - $NLN "${COMOUTocean}/RESTART/${rdate:0:8}.${rdate:8:2}0000.MOM.res_${nn}.nc" "${DATA}/MOM6_RESTART/MOM.res_${nn}.nc" + $NLN "${COM_OCEAN_RESTART}/${rdate:0:8}.${rdate:8:2}0000.MOM.res_${nn}.nc" "${DATA}/MOM6_RESTART/MOM.res_${nn}.nc" done ;; *) @@ -893,11 +889,11 @@ MOM6_postdet() { local idate=$(date -d "${CDATE:0:8} ${CDATE:8:2} + ${res_int} hours" +%Y%m%d%H) while [[ $idate -lt $rdate ]]; do local idatestr=$(date +%Y-%m-%d-%H -d "${idate:0:8} ${idate:8:2}") - $NLN "${COMOUTocean}/RESTART/${idate:0:8}.${idate:8:2}0000.MOM.res.nc" "${DATA}/MOM6_RESTART/MOM.res.${idatestr}-00-00.nc" + $NLN "${COM_OCEAN_RESTART}/${idate:0:8}.${idate:8:2}0000.MOM.res.nc" "${DATA}/MOM6_RESTART/MOM.res.${idatestr}-00-00.nc" case ${OCNRES} in "025") for nn in $(seq 1 4); do - $NLN "${COMOUTocean}/RESTART/${idate:0:8}.${idate:8:2}0000.MOM.res_${nn}.nc" "${DATA}/MOM6_RESTART/MOM.res.${idatestr}-00-00_${nn}.nc" + $NLN "${COM_OCEAN_RESTART}/${idate:0:8}.${idate:8:2}0000.MOM.res_${nn}.nc" "${DATA}/MOM6_RESTART/MOM.res.${idatestr}-00-00_${nn}.nc" done ;; esac @@ -909,7 +905,7 @@ MOM6_postdet() { # DANGER DANGER DANGER - Linking mediator restarts to COM causes the model to fail with a message like this below: # Abort with message NetCDF: File exists && NC_NOCLOBBER in file pio-2.5.7/src/clib/pioc_support.c at line 2173 # Instead of linking, copy the mediator files after the model finishes - #local COMOUTmed="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/med" + #local COMOUTmed="${ROTDIR}/${RUN}.${PDY}/${cyc}/med" #mkdir -p "${COMOUTmed}/RESTART" #local idate=$(date -d "${CDATE:0:8} ${CDATE:8:2} + ${res_int} hours" +%Y%m%d%H) #while [[ $idate -le $rdate ]]; do @@ -932,15 +928,15 @@ MOM6_nml() { MOM6_out() { echo "SUB ${FUNCNAME[0]}: Copying output data for MOM6" - # Copy MOM_input from DATA to COMOUToucean after the forecast is run (and successfull) - $NCP ${DATA}/INPUT/MOM_input ${COMOUTocean}/MOM_input + # Copy MOM_input from DATA to COM_OCEAN_INPUT after the forecast is run (and successfull) + if [[ ! -d ${COM_OCEAN_INPUT} ]]; then mkdir -p "${COM_OCEAN_INPUT}"; fi + ${NCP} "${DATA}/INPUT/MOM_input" "${COM_OCEAN_INPUT}/" # TODO: mediator should have its own CMEPS_out() function # Copy mediator restarts from DATA to COM # Linking mediator restarts to COM causes the model to fail with a message. # See MOM6_postdet() function for error message - local COMOUTmed="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/med" - mkdir -p "${COMOUTmed}/RESTART" + mkdir -p "${COM_MED_RESTART}" local res_int=$(echo $restart_interval | cut -d' ' -f1) # If this is a list, get the frequency. # This is bound to break w/ IAU local idate=$(date -d "${CDATE:0:8} ${CDATE:8:2} + ${res_int} hours" +%Y%m%d%H) local rdate=$(date -d "${CDATE:0:8} ${CDATE:8:2} + ${FHMAX} hours" +%Y%m%d%H) @@ -949,7 +945,7 @@ MOM6_out() { local idatestr="${idate:0:4}-${idate:4:2}-${idate:6:2}-${seconds}" local mediator_file="${DATA}/RESTART/ufs.cpld.cpl.r.${idatestr}.nc" if [[ -f ${mediator_file} ]]; then - $NCP "${DATA}/RESTART/ufs.cpld.cpl.r.${idatestr}.nc" "${COMOUTmed}/RESTART/${idate:0:8}.${idate:8:2}0000.ufs.cpld.cpl.r.nc" + $NCP "${DATA}/RESTART/ufs.cpld.cpl.r.${idatestr}.nc" "${COM_MED_RESTART}/${idate:0:8}.${idate:8:2}0000.ufs.cpld.cpl.r.nc" else echo "Mediator restart ${mediator_file} not found." fi @@ -977,9 +973,9 @@ CICE_postdet() { dumpfreq_n=${dumpfreq_n:-1000} # Set this to a really large value, as cice, mom6 and cmeps restart interval is controlled by nems.configure dumpfreq=${dumpfreq:-"y"} # "h","d","m" or "y" for restarts at intervals of "hours", "days", "months" or "years" - if [[ "${CDUMP}" =~ "gdas" ]]; then + if [[ "${RUN}" =~ "gdas" ]]; then cice_hist_avg=".false." # DA needs instantaneous - elif [[ "${CDUMP}" =~ "gfs" ]]; then + elif [[ "${RUN}" =~ "gfs" ]]; then cice_hist_avg=".true." # P8 wants averaged over histfreq_n fi @@ -1001,14 +997,14 @@ CICE_postdet() { # Copy/link CICE IC to DATA if [[ "${warm_start}" = ".true." ]]; then - cice_ana="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ice/RESTART/${PDY}.${cyc}0000.cice_model_anl.res.nc" + cice_ana="${COM_ICE_RESTART}/${PDY}.${cyc}0000.cice_model_anl.res.nc" if [[ -e ${cice_ana} ]]; then ${NLN} "${cice_ana}" "${DATA}/cice_model.res.nc" else - ${NLN} "${ROTDIR}/${CDUMP}.${gPDY}/${gcyc}/ice/RESTART/${PDY}.${cyc}0000.cice_model.res.nc" "${DATA}/cice_model.res.nc" + ${NLN} "${COM_ICE_RESTART_PREV}/${PDY}.${cyc}0000.cice_model.res.nc" "${DATA}/cice_model.res.nc" fi else # cold start are typically SIS2 restarts obtained from somewhere else e.g. CPC - $NLN "${ROTDIR}/${CDUMP}.${PDY}/${cyc}/ice/RESTART/${PDY}.${cyc}0000.cice_model.res.nc" "${DATA}/cice_model.res.nc" + $NLN "${COM_ICE_RESTART}/${PDY}.${cyc}0000.cice_model.res.nc" "${DATA}/cice_model.res.nc" fi # TODO: add a check for the restarts to exist, if not, exit eloquently rm -f "${DATA}/ice.restart_file" @@ -1021,11 +1017,11 @@ CICE_postdet() { $NLN -sf $FIXcice/$ICERES/$MESH_OCN_ICE $DATA/ # Link CICE output files - [[ ! -d $COMOUTice ]] && mkdir -p $COMOUTice - mkdir -p ${COMOUTice}/RESTART + if [[ ! -d "${COM_ICE_HISTORY}" ]]; then mkdir -p "${COM_ICE_HISTORY}"; fi + mkdir -p ${COM_ICE_RESTART} - if [[ "${CDUMP}" =~ "gfs" ]]; then - # Link output files for CDUMP = gfs + if [[ "${RUN}" =~ "gfs" ]]; then + # Link output files for RUN = gfs # TODO: make these forecast output files consistent w/ GFS output # TODO: Work w/ NB to determine appropriate naming convention for these files @@ -1048,20 +1044,20 @@ CICE_postdet() { SS=$((10#$HH*3600)) if [[ 10#$fhr -eq 0 ]]; then - $NLN $COMOUTice/iceic$VDATE.$ENSMEM.$IDATE.nc $DATA/CICE_OUTPUT/iceh_ic.${YYYY}-${MM}-${DD}-$(printf "%5.5d" ${SS}).nc + ${NLN} "${COM_ICE_HISTORY}/iceic${VDATE}.${ENSMEM}.${IDATE}.nc" "${DATA}/CICE_OUTPUT/iceh_ic.${YYYY}-${MM}-${DD}-$(printf "%5.5d" ${SS}).nc" else (( interval = fhr - last_fhr )) # Umm.. isn't this histfreq_n? - $NLN $COMOUTice/ice$VDATE.$ENSMEM.$IDATE.nc $DATA/CICE_OUTPUT/iceh_$(printf "%0.2d" $interval)h.${YYYY}-${MM}-${DD}-$(printf "%5.5d" ${SS}).nc + ${NLN} "${COM_ICE_HISTORY}/ice${VDATE}.${ENSMEM}.${IDATE}.nc" "${DATA}/CICE_OUTPUT/iceh_$(printf "%0.2d" $interval)h.${YYYY}-${MM}-${DD}-$(printf "%5.5d" ${SS}).nc" fi last_fhr=$fhr done - elif [[ "${CDUMP}" =~ "gdas" ]]; then + elif [[ "${RUN}" =~ "gdas" ]]; then # Link CICE generated initial condition file from DATA/CICE_OUTPUT to COMOUTice # This can be thought of as the f000 output from the CICE model local seconds=$(to_seconds ${CDATE:8:2}0000) # convert HHMMSS to seconds - $NLN "${COMOUTice}/${CDUMP}.t${cyc}z.iceic.nc" "${DATA}/CICE_OUTPUT/iceh_ic.${CDATE:0:4}-${CDATE:4:2}-${CDATE:6:2}-${seconds}.nc" + $NLN "${COM_ICE_HISTORY}/${RUN}.t${cyc}z.iceic.nc" "${DATA}/CICE_OUTPUT/iceh_ic.${CDATE:0:4}-${CDATE:4:2}-${CDATE:6:2}-${seconds}.nc" # Link instantaneous CICE forecast output files from DATA/CICE_OUTPUT to COMOUTice local fhr="${FHOUT}" @@ -1069,7 +1065,7 @@ CICE_postdet() { local idate=$(date -d "${CDATE:0:8} ${CDATE:8:2} + ${fhr} hours" +%Y%m%d%H) local seconds=$(to_seconds ${idate:8:2}0000) # convert HHMMSS to seconds local fhr3=$(printf %03i ${fhr}) - $NLN "${COMOUTice}/${CDUMP}.t${cyc}z.icef${fhr3}.nc" "${DATA}/CICE_OUTPUT/iceh_inst.${idate:0:4}-${idate:4:2}-${idate:6:2}-${seconds}.nc" + $NLN "${COM_ICE_HISTORY}/${RUN}.t${cyc}z.icef${fhr3}.nc" "${DATA}/CICE_OUTPUT/iceh_inst.${idate:0:4}-${idate:4:2}-${idate:6:2}-${seconds}.nc" local fhr=$((fhr + FHOUT)) done @@ -1083,7 +1079,7 @@ CICE_postdet() { while [[ ${idate} -le ${rdate} ]]; do local seconds=$(to_seconds ${idate:8:2}0000) # convert HHMMSS to seconds local idatestr="${idate:0:4}-${idate:4:2}-${idate:6:2}-${seconds}" - $NLN "${COMOUTice}/RESTART/${idate:0:8}.${idate:8:2}0000.cice_model.res.nc" "${DATA}/CICE_RESTART/cice_model.res.${idatestr}.nc" + $NLN "${COM_ICE_RESTART}/${idate:0:8}.${idate:8:2}0000.cice_model.res.nc" "${DATA}/CICE_RESTART/cice_model.res.${idatestr}.nc" local idate=$(date -d "${idate:0:8} ${idate:8:2} + ${res_int} hours" +%Y%m%d%H) done } @@ -1098,7 +1094,8 @@ CICE_out() { echo "SUB ${FUNCNAME[0]}: Copying output data for CICE" # Copy ice_in namelist from DATA to COMOUTice after the forecast is run (and successfull) - $NCP ${DATA}/ice_in $COMOUTice/ice_in + if [[ ! -d "${COM_ICE_INPUT}" ]]; then mkdir -p "${COM_ICE_INPUT}"; fi + ${NCP} "${DATA}/ice_in" "${COM_ICE_INPUT}/ice_in" } GOCART_rc() { @@ -1135,7 +1132,7 @@ GOCART_rc() { GOCART_postdet() { echo "SUB ${FUNCNAME[0]}: Linking output data for GOCART" - [[ ! -d $COMOUTaero ]] && mkdir -p $COMOUTaero + if [[ ! -d "${COM_CHEM_HISTORY}" ]]; then mkdir -p "${COM_CHEM_HISTORY}"; fi fhrlst=$OUTPUT_FH for fhr in $fhrlst; do @@ -1152,10 +1149,10 @@ GOCART_postdet() { # # Temporarily delete existing files due to noclobber in GOCART # - if [[ -e "${COMOUTaero}/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4" ]]; then - rm "${COMOUTaero}/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4" + if [[ -e "${COM_CHEM_HISTORY}/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4" ]]; then + rm "${COM_CHEM_HISTORY}/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4" fi - $NLN $COMOUTaero/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4 $DATA/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4 + ${NLN} "${COM_CHEM_HISTORY}/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4" "${DATA}/gocart.inst_aod.${YYYY}${MM}${DD}_${HH}00z.nc4" done } diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index 4f0cee0b80..334eacedef 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -60,7 +60,6 @@ DATM_predet(){ FV3_GFS_predet(){ echo "SUB ${FUNCNAME[0]}: Defining variables for FV3GFS" CDUMP=${CDUMP:-gdas} - CDUMPwave="${CDUMP}wave" FHMIN=${FHMIN:-0} FHMAX=${FHMAX:-9} FHOUT=${FHOUT:-3} @@ -214,10 +213,9 @@ FV3_GFS_predet(){ print_freq=${print_freq:-6} #------------------------------------------------------- - if [[ ${CDUMP} =~ "gfs" || ${RUN} = "gefs" ]] && [ ${rst_invt1} -gt 0 ]; then - RSTDIR_ATM=${RSTDIR_ATM:-${ROTDIR}/${CDUMP}.${PDY}/${cyc}/atmos/RERUN_RESTART} - if [ ! -d $RSTDIR_ATM ]; then mkdir -p $RSTDIR_ATM ; fi - $NLN $RSTDIR_ATM RESTART + if [[ ${RUN} =~ "gfs" || ${RUN} = "gefs" ]] && (( rst_invt1 > 0 )); then + if [[ ! -d ${COM_ATMOS_RESTART} ]]; then mkdir -p "${COM_ATMOS_RESTART}" ; fi + ${NLN} "${COM_ATMOS_RESTART}" RESTART # The final restart written at the end doesn't include the valid date # Create links that keep the same name pattern for these files VDATE=$($NDATE +$FHMAX_GFS $CDATE) @@ -229,34 +227,19 @@ FV3_GFS_predet(){ files="${files} ${base}.tile${tile}.nc" done done - for file in $files; do - $NLN $RSTDIR_ATM/$file $RSTDIR_ATM/${vPDY}.${vcyc}0000.$file + for file in ${files}; do + ${NLN} "${COM_ATMOS_RESTART}/${file}" "${COM_ATMOS_RESTART}/${vPDY}.${vcyc}0000.${file}" done else mkdir -p $DATA/RESTART fi - #------------------------------------------------------- - # member directory - if [[ ${MEMBER} -lt 0 || ${RUN} = "gefs" ]]; then - memchar="" - else - memchar=mem$(printf %03i $MEMBER) - fi - memdir=${memdir:-${ROTDIR}/${RUN}.${PDY}/${cyc}/${memchar}/atmos} - if [ ! -d $memdir ]; then mkdir -p $memdir; fi - - GDATE=$($NDATE -$assim_freq $CDATE) - gPDY=$(echo $GDATE | cut -c1-8) - gcyc=$(echo $GDATE | cut -c9-10) - gmemdir=${gmemdir:-${ROTDIR}/${rCDUMP}.${gPDY}/${gcyc}/${memchar}/atmos} - if [[ "$DOIAU" = "YES" ]]; then sCDATE=$($NDATE -3 $CDATE) sPDY=$(echo $sCDATE | cut -c1-8) scyc=$(echo $sCDATE | cut -c9-10) - tPDY=$gPDY - tcyc=$gcyc + tPDY=${gPDY} + tcyc=${gcyc} else sCDATE=$CDATE sPDY=$PDY @@ -270,13 +253,8 @@ FV3_GFS_predet(){ WW3_predet(){ echo "SUB ${FUNCNAME[0]}: Defining variables for WW3" - if [[ $CDUMP =~ "gdas" ]]; then - export RSTDIR_WAVE=$ROTDIR/${CDUMP}.${PDY}/${cyc}/wave/restart - else - export RSTDIR_WAVE=${RSTDIR_WAVE:-$ROTDIR/${CDUMP}.${PDY}/${cyc}/wave/restart} - fi - if [ ! -d $RSTDIR_WAVE ]; then mkdir -p $RSTDIR_WAVE ; fi - $NLN $RSTDIR_WAVE restart_wave + if [[ ! -d "${COM_WAVE_RESTART}" ]]; then mkdir -p "${COM_WAVE_RESTART}" ; fi + ${NLN} "${COM_WAVE_RESTART}" "restart_wave" } CICE_predet(){ @@ -289,5 +267,4 @@ MOM6_predet(){ echo "SUB ${FUNCNAME[0]}: MOM6 before run type determination" if [ ! -d $DATA/MOM6_OUTPUT ]; then mkdir -p $DATA/MOM6_OUTPUT; fi if [ ! -d $DATA/MOM6_RESTART ]; then mkdir -p $DATA/MOM6_RESTART; fi - cd "${DATA}" || exit 8 } diff --git a/ush/fv3gfs_downstream_nems.sh b/ush/fv3gfs_downstream_nems.sh index f52baf465b..48aacf0f07 100755 --- a/ush/fv3gfs_downstream_nems.sh +++ b/ush/fv3gfs_downstream_nems.sh @@ -240,50 +240,50 @@ while [ $nset -le $totalset ]; do if [ $nset = 1 ]; then if [ $fhr3 = anl ]; then - cp pgb2file_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2.0p25.anl - $WGRIB2 -s pgb2file_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2.0p25.anl.idx + cp "pgb2file_${fhr3}_0p25" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.anl" + ${WGRIB2} -s "pgb2file_${fhr3}_0p25" > "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.anl.idx" if [ "$PGBS" = "YES" ]; then - cp pgb2file_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2.0p50.anl - cp pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2.1p00.anl - $WGRIB2 -s pgb2file_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2.0p50.anl.idx - $WGRIB2 -s pgb2file_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2.1p00.anl.idx + cp "pgb2file_${fhr3}_0p5" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.anl" + cp "pgb2file_${fhr3}_1p0" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.anl" + ${WGRIB2} -s "pgb2file_${fhr3}_0p5" > "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.anl.idx" + ${WGRIB2} -s "pgb2file_${fhr3}_1p0" > "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.anl.idx" if [ "$PGB1F" = 'YES' ]; then - cp pgbfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb.1p00.anl - $GRBINDEX $COMOUT/${PREFIX}pgrb.1p00.anl $COMOUT/${PREFIX}pgrb.1p00.anl.idx + cp "pgbfile_${fhr3}_1p0" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb.1p00.anl" + ${GRBINDEX} "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb.1p00.anl" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb.1p00.anl.idx" fi fi else - cp pgb2file_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2.0p25.f${fhr3} - $WGRIB2 -s pgb2file_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2.0p25.f${fhr3}.idx + cp "pgb2file_${fhr3}_0p25" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.f${fhr3}" + ${WGRIB2} -s "pgb2file_${fhr3}_0p25" > "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2.0p25.f${fhr3}.idx" if [ "$PGBS" = "YES" ]; then - cp pgb2file_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2.0p50.f${fhr3} - cp pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2.1p00.f${fhr3} - $WGRIB2 -s pgb2file_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2.0p50.f${fhr3}.idx - $WGRIB2 -s pgb2file_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2.1p00.f${fhr3}.idx + cp "pgb2file_${fhr3}_0p5" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.f${fhr3}" + cp "pgb2file_${fhr3}_1p0" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.f${fhr3}" + ${WGRIB2} -s "pgb2file_${fhr3}_0p5" > "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2.0p50.f${fhr3}.idx" + ${WGRIB2} -s "pgb2file_${fhr3}_1p0" > "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2.1p00.f${fhr3}.idx" if [ "$PGB1F" = 'YES' ]; then - cp pgbfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb.1p00.f${fhr3} - $GRBINDEX $COMOUT/${PREFIX}pgrb.1p00.f${fhr3} $COMOUT/${PREFIX}pgrb.1p00.f${fhr3}.idx + cp "pgbfile_${fhr3}_1p0" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb.1p00.f${fhr3}" + ${GRBINDEX} "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb.1p00.f${fhr3}" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb.1p00.f${fhr3}.idx" fi fi fi elif [ $nset = 2 ]; then if [ $fhr3 = anl ]; then - cp pgb2bfile_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2b.0p25.anl - $WGRIB2 -s pgb2bfile_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2b.0p25.anl.idx + cp "pgb2bfile_${fhr3}_0p25" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.anl" + ${WGRIB2} -s "pgb2bfile_${fhr3}_0p25" > "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.anl.idx" if [ "$PGBS" = "YES" ]; then - cp pgb2bfile_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2b.0p50.anl - cp pgb2bfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2b.1p00.anl - $WGRIB2 -s pgb2bfile_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2b.0p50.anl.idx - $WGRIB2 -s pgb2bfile_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2b.1p00.anl.idx + cp "pgb2bfile_${fhr3}_0p5" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.anl" + cp "pgb2bfile_${fhr3}_1p0" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.anl" + ${WGRIB2} -s "pgb2bfile_${fhr3}_0p5" > "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.anl.idx" + ${WGRIB2} -s "pgb2bfile_${fhr3}_1p0" > "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.anl.idx" fi else - cp pgb2bfile_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr3} - $WGRIB2 -s pgb2bfile_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr3}.idx + cp "pgb2bfile_${fhr3}_0p25" "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.f${fhr3}" + ${WGRIB2} -s "pgb2bfile_${fhr3}_0p25" > "${COM_ATMOS_GRIB_0p25}/${PREFIX}pgrb2b.0p25.f${fhr3}.idx" if [ "$PGBS" = "YES" ]; then - cp pgb2bfile_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr3} - cp pgb2bfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr3} - $WGRIB2 -s pgb2bfile_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr3}.idx - $WGRIB2 -s pgb2bfile_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr3}.idx + cp "pgb2bfile_${fhr3}_0p5" "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.f${fhr3}" + cp "pgb2bfile_${fhr3}_1p0" "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.f${fhr3}" + ${WGRIB2} -s "pgb2bfile_${fhr3}_0p5" > "${COM_ATMOS_GRIB_0p50}/${PREFIX}pgrb2b.0p50.f${fhr3}.idx" + ${WGRIB2} -s "pgb2bfile_${fhr3}_1p0" > "${COM_ATMOS_GRIB_1p00}/${PREFIX}pgrb2b.1p00.f${fhr3}.idx" fi fi fi diff --git a/ush/gaussian_sfcanl.sh b/ush/gaussian_sfcanl.sh index e7be2c034f..f8d2763bb5 100755 --- a/ush/gaussian_sfcanl.sh +++ b/ush/gaussian_sfcanl.sh @@ -87,7 +87,7 @@ # $FIXWGTS # $FIXam/global_hyblev.l65.txt # -# input data : $COMOUT/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile*.nc +# input data : ${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile*.nc # # output data: $PGMOUT # $PGMERR @@ -131,7 +131,6 @@ FIXfv3=${FIXfv3:-$HOMEgfs/fix/orog} FIXam=${FIXam:-$HOMEgfs/fix/am} FIXWGTS=${FIXWGTS:-$FIXfv3/$CASE/fv3_SCRIP_${CASE}_GRIDSPEC_lon${LONB_SFC}_lat${LATB_SFC}.gaussian.neareststod.nc} DATA=${DATA:-$(pwd)} -COMOUT=${COMOUT:-$(pwd)} # Filenames. XC=${XC:-} @@ -160,7 +159,8 @@ else mkdata=YES fi cd $DATA||exit 99 -[[ -d $COMOUT ]]||mkdir -p $COMOUT +[[ -d "${COM_ATMOS_ANALYSIS}" ]] || mkdir -p "${COM_ATMOS_ANALYSIS}" +[[ -d "${COM_ATMOS_RESTART}" ]] || mkdir -p "${COM_ATMOS_RESTART}" cd $DATA ################################################################################ @@ -169,12 +169,10 @@ export PGM=$GAUSFCANLEXE export pgm=$PGM $LOGSCRIPT -PDY=$(echo $CDATE | cut -c1-8) -cyc=$(echo $CDATE | cut -c9-10) -iy=$(echo $CDATE | cut -c1-4) -im=$(echo $CDATE | cut -c5-6) -id=$(echo $CDATE | cut -c7-8) -ih=$(echo $CDATE | cut -c9-10) +iy=${PDY:0:4} +im=${PDY:4:2} +id=${PDY:6:2} +ih=${cyc} export OMP_NUM_THREADS=${OMP_NUM_THREADS_SFC:-1} @@ -182,12 +180,12 @@ export OMP_NUM_THREADS=${OMP_NUM_THREADS_SFC:-1} $NLN $FIXWGTS ./weights.nc # input analysis tiles (with nst records) -$NLN $COMOUT/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile1.nc ./anal.tile1.nc -$NLN $COMOUT/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile2.nc ./anal.tile2.nc -$NLN $COMOUT/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile3.nc ./anal.tile3.nc -$NLN $COMOUT/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile4.nc ./anal.tile4.nc -$NLN $COMOUT/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile5.nc ./anal.tile5.nc -$NLN $COMOUT/RESTART/${PDY}.${cyc}0000.sfcanl_data.tile6.nc ./anal.tile6.nc +${NLN} "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile1.nc" "./anal.tile1.nc" +${NLN} "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile2.nc" "./anal.tile2.nc" +${NLN} "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile3.nc" "./anal.tile3.nc" +${NLN} "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile4.nc" "./anal.tile4.nc" +${NLN} "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile5.nc" "./anal.tile5.nc" +${NLN} "${COM_ATMOS_RESTART}/${PDY}.${cyc}0000.sfcanl_data.tile6.nc" "./anal.tile6.nc" # input orography tiles $NLN $FIXfv3/$CASE/${CASE}_oro_data.tile1.nc ./orog.tile1.nc @@ -200,7 +198,7 @@ $NLN $FIXfv3/$CASE/${CASE}_oro_data.tile6.nc ./orog.tile6.nc $NLN $SIGLEVEL ./vcoord.txt # output gaussian global surface analysis files -$NLN $COMOUT/${APREFIX}sfcanl.nc ./sfc.gaussian.analysis.file +${NLN} "${COM_ATMOS_ANALYSIS}/${APREFIX}sfcanl.nc" "./sfc.gaussian.analysis.file" # Executable namelist cat < fort.41 diff --git a/ush/gfs_bfr2gpk.sh b/ush/gfs_bfr2gpk.sh index c11ec62735..add68536ec 100755 --- a/ush/gfs_bfr2gpk.sh +++ b/ush/gfs_bfr2gpk.sh @@ -10,7 +10,7 @@ # Log: # # K. Brill/HPC 04/12/05 # ######################################################################### -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" # Set GEMPAK paths. @@ -18,32 +18,19 @@ source "$HOMEgfs/ush/preamble.sh" # Go to a working directory. -cd $DATA - -# Set input directory name. - -#BPATH=$COMIN/bufr.t${cyc}z -BPATH=$COMOUT/bufr.t${cyc}z -export BPATH +cd "${DATA}" || exit 2 # Set output directory: - -COMAWP=${COMAWP:-$COMOUT/gempak} -OUTDIR=$COMAWP -if [ ! -d $OUTDIR ]; then mkdir -p $OUTDIR; fi +if [[ ! -d "${COM_ATMOS_GEMPAK}" ]]; then mkdir -p "${COM_ATMOS_GEMPAK}"; fi outfilbase=gfs_${PDY}${cyc} # Get the list of individual station files. date -##filelist=$(/bin/ls -1 $BPATH | grep bufr) -##rm -f bufr.combined -##for file in $filelist; do -## cat $BPATH/$file >> bufr.combined -##done - cat $BPATH/bufr.*.${PDY}${cyc} > bufr.combined +cat "${COM_ATMOS_BUFR}/bufr."*".${PDY}${cyc}" > bufr.combined date + namsnd << EOF > /dev/null SNBUFR = bufr.combined SNOUTF = ${outfilbase}.snd @@ -55,20 +42,20 @@ r ex EOF + date -/bin/rm *.nts +/bin/rm ./*.nts snd=${outfilbase}.snd sfc=${outfilbase}.sfc -cp $snd $OUTDIR/.$snd -cp $sfc $OUTDIR/.$sfc -mv $OUTDIR/.$snd $OUTDIR/$snd -mv $OUTDIR/.$sfc $OUTDIR/$sfc - -if [ $SENDDBN = "YES" ] -then - $DBNROOT/bin/dbn_alert MODEL GFS_PTYP_SFC $job $OUTDIR/$sfc - $DBNROOT/bin/dbn_alert MODEL GFS_PTYP_SND $job $OUTDIR/$snd +cp "${snd}" "${COM_ATMOS_GEMPAK}/.${snd}" +cp "${sfc}" "${COM_ATMOS_GEMPAK}/.${sfc}" +mv "${COM_ATMOS_GEMPAK}/.${snd}" "${COM_ATMOS_GEMPAK}/${snd}" +mv "${COM_ATMOS_GEMPAK}/.${sfc}" "${COM_ATMOS_GEMPAK}/${sfc}" + +if [[ ${SENDDBN} == "YES" ]]; then + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PTYP_SFC "${job}" "${COM_ATMOS_GEMPAK}/${sfc}" + "${DBNROOT}/bin/dbn_alert" MODEL GFS_PTYP_SND "${job}" "${COM_ATMOS_GEMPAK}/${snd}" fi -echo done > $DATA/gembufr.done +echo "done" > "${DATA}/gembufr.done" diff --git a/ush/gfs_bufr.sh b/ush/gfs_bufr.sh index 65d81ce521..b782c707c9 100755 --- a/ush/gfs_bufr.sh +++ b/ush/gfs_bufr.sh @@ -43,7 +43,7 @@ CLASS="class1fv3" cat << EOF > gfsparm &NAMMET levs=${LEVS},makebufr=${bufrflag}, - dird="${COMOUT}/bufr.${cycle}/bufr", + dird="${COM_ATMOS_BUFR}/bufr", nstart=${FSTART},nend=${FEND},nint=${FINT}, nend1=${NEND1},nint1=${NINT1},nint3=${NINT3}, nsfc=80,f00=${f00flag},fformat=${fformat},np1=0 @@ -58,7 +58,7 @@ for (( hr = 10#${FSTART}; hr <= 10#${FEND}; hr = hr + 10#${FINT} )); do # Make sure all files are available: ic=0 while (( ic < 1000 )); do - if [ ! -f "${COMIN}/${RUN}.${cycle}.logf${hh3}.${logfm}" ]; then + if [[ ! -f "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.logf${hh3}.${logfm}" ]]; then sleep 10 ic=$((ic + 1)) else @@ -71,8 +71,8 @@ for (( hr = 10#${FSTART}; hr <= 10#${FEND}; hr = hr + 10#${FINT} )); do fi done #------------------------------------------------------------------ - ln -sf "${COMIN}/${RUN}.${cycle}.atmf${hh3}.${atmfm}" "sigf${hh2}" - ln -sf "${COMIN}/${RUN}.${cycle}.sfcf${hh3}.${atmfm}" "flxf${hh2}" + ln -sf "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atmf${hh3}.${atmfm}" "sigf${hh2}" + ln -sf "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.sfcf${hh3}.${atmfm}" "flxf${hh2}" done # define input BUFR table file. @@ -85,8 +85,8 @@ export err=$? if [ $err -ne 0 ]; then echo "GFS postsnd job error, Please check files " - echo $COMIN/${RUN}.${cycle}.atmf${hh2}.${atmfm} - echo $COMIN/${RUN}.${cycle}.sfcf${hh2}.${atmfm} + echo "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.atmf${hh2}.${atmfm}" + echo "${COM_ATMOS_HISTORY}/${RUN}.${cycle}.sfcf${hh2}.${atmfm}" err_chk fi diff --git a/ush/gfs_sndp.sh b/ush/gfs_sndp.sh index bf0f3a9088..579dd5ae25 100755 --- a/ush/gfs_sndp.sh +++ b/ush/gfs_sndp.sh @@ -32,7 +32,7 @@ cd $DATA/$m for stn in $(cat $file_list) do - cp ${COMOUT}/bufr.${cycle}/bufr.$stn.$PDY$cyc $DATA/${m}/bufrin + cp "${COM_ATMOS_BUFR}/bufr.${stn}.${PDY}${cyc}" "${DATA}/${m}/bufrin" export pgm=tocsbufr.x #. prep_step export FORT11=$DATA/${m}/bufrin @@ -45,11 +45,11 @@ cd $DATA/$m MAXFILESIZE=600000 / EOF - # JY export err=$?; err_chk - export err=$?; #err_chk + export err=$?; if (( err != 0 )); then - echo "ERROR in $pgm" + echo "FATAL ERROR in ${pgm}" err_chk + exit 3 fi cat $DATA/${m}/bufrout >> $DATA/${m}/gfs_collective$m.fil @@ -57,13 +57,12 @@ EOF rm $DATA/${m}/bufrout done -# if test $SENDCOM = 'NO' - if test $SENDCOM = 'YES' - then - if [ $SENDDBN = 'YES' ] ; then - cp $DATA/${m}/gfs_collective$m.fil $pcom/gfs_collective$m.postsnd_$cyc - $DBNROOT/bin/dbn_alert NTC_LOW BUFR $job $pcom/gfs_collective$m.postsnd_$cyc + if [[ ${SENDCOM} == 'YES' ]]; then + if [[ ${SENDDBN} == 'YES' ]] ; then + cp "${DATA}/${m}/gfs_collective${m}.fil" "${COM_ATMOS_WMO}/gfs_collective${m}.postsnd_${cyc}" + "${DBNROOT}/bin/dbn_alert" NTC_LOW BUFR "${job}" \ + "${COM_ATMOS_WMO}/gfs_collective${m}.postsnd_${cyc}" fi - cp $DATA/${m}/gfs_collective$m.fil ${COMOUT}/bufr.${cycle}/. + cp "${DATA}/${m}/gfs_collective${m}.fil" "${COM_ATMOS_BUFR}/." fi diff --git a/ush/hpssarch_gen.sh b/ush/hpssarch_gen.sh index f363a69f02..c2a84441bf 100755 --- a/ush/hpssarch_gen.sh +++ b/ush/hpssarch_gen.sh @@ -8,16 +8,13 @@ source "${HOMEgfs}/ush/preamble.sh" type=${1:-gfs} ##gfs, gdas, enkfgdas or enkfggfs -CDATE=${CDATE:-2018010100} -PDY=$(echo $CDATE | cut -c 1-8) -cyc=$(echo $CDATE | cut -c 9-10) ARCH_GAUSSIAN=${ARCH_GAUSSIAN:-"YES"} ARCH_GAUSSIAN_FHMAX=${ARCH_GAUSSIAN_FHMAX:-36} ARCH_GAUSSIAN_FHINC=${ARCH_GAUSSIAN_FHINC:-6} # Set whether to archive downstream products DO_DOWN=${DO_DOWN:-"NO"} -if [ ${DO_BUFRSND} = "YES" -o ${WAFSF} = "YES" ]; then +if [[ ${DO_BUFRSND} = "YES" || ${WAFSF} = "YES" ]]; then export DO_DOWN="YES" fi @@ -45,7 +42,7 @@ if [[ ${type} = "gfs" ]]; then touch gfs_netcdfb.txt touch gfs_flux.txt - if [ $MODE = "cycled" ]; then + if [[ ${MODE} = "cycled" ]]; then rm -f gfs_netcdfa.txt touch gfs_netcdfa.txt fi @@ -56,31 +53,33 @@ if [[ ${type} = "gfs" ]]; then touch gfs_downstream.txt fi - dirpath="gfs.${PDY}/${cyc}/atmos/" - dirname="./${dirpath}" - obs_dirname="./gfs.${PDY}/${cyc}/obs/" - head="gfs.t${cyc}z." if [[ ${ARCH_GAUSSIAN} = "YES" ]]; then - echo "${dirname}${head}pgrb2b.0p25.anl " >>gfs_pgrb2b.txt - echo "${dirname}${head}pgrb2b.0p25.anl.idx " >>gfs_pgrb2b.txt - echo "${dirname}${head}pgrb2b.1p00.anl " >>gfs_pgrb2b.txt - echo "${dirname}${head}pgrb2b.1p00.anl.idx " >>gfs_pgrb2b.txt - - if [ $MODE = "cycled" ]; then - echo "${dirname}${head}atmanl.nc " >>gfs_netcdfa.txt - echo "${dirname}${head}sfcanl.nc " >>gfs_netcdfa.txt - echo "${dirname}${head}atmi*.nc " >>gfs_netcdfa.txt - echo "${dirname}${head}dtfanl.nc " >>gfs_netcdfa.txt - echo "${dirname}${head}loginc.txt " >>gfs_netcdfa.txt + { + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2b.0p25.anl" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2b.0p25.anl.idx" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2b.1p00.anl" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2b.1p00.anl.idx" + } >> gfs_pgrb2b.txt + + if [[ ${MODE} = "cycled" ]]; then + { + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}atmanl.nc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}sfcanl.nc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}atmi*.nc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}dtfanl.nc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}loginc.txt" + } >> gfs_netcdfa.txt fi fh=0 - while [ $fh -le $ARCH_GAUSSIAN_FHMAX ]; do - fhr=$(printf %03i $fh) - echo "${dirname}${head}atmf${fhr}.nc " >>gfs_netcdfb.txt - echo "${dirname}${head}sfcf${fhr}.nc " >>gfs_netcdfb.txt + while (( fh <= ARCH_GAUSSIAN_FHMAX )); do + fhr=$(printf %03i "${fh}") + { + echo "${COM_ATMOS_HISTORY/${ROTDIR}\//}/${head}atmf${fhr}.nc" + echo "${COM_ATMOS_HISTORY/${ROTDIR}\//}/${head}sfcf${fhr}.nc" + } >> gfs_netcdfb.txt fh=$((fh+ARCH_GAUSSIAN_FHINC)) done fi @@ -88,113 +87,138 @@ if [[ ${type} = "gfs" ]]; then #.................. # Exclude the gfsarch.log file, which will change during the tar operation # This uses the bash extended globbing option - echo "./logs/${CDATE}/gfs!(arch).log " >>gfsa.txt - echo "${dirname}input.nml " >>gfsa.txt - if [[ ${MODE} = "cycled" ]]; then - echo "${dirname}${head}gsistat " >>gfsa.txt - echo "${obs_dirname}${head}nsstbufr " >>gfsa.txt - echo "${obs_dirname}${head}prepbufr " >>gfsa.txt - echo "${obs_dirname}${head}prepbufr.acft_profiles " >>gfsa.txt - fi - echo "${dirname}${head}pgrb2.0p25.anl " >>gfsa.txt - echo "${dirname}${head}pgrb2.0p25.anl.idx " >>gfsa.txt - #Only generated if there are cyclones to track - cyclone_files=(avno.t${cyc}z.cyclone.trackatcfunix - avnop.t${cyc}z.cyclone.trackatcfunix - trak.gfso.atcfunix.${PDY}${cyc} - trak.gfso.atcfunix.altg.${PDY}${cyc} - storms.gfso.atcf_gen.${PDY}${cyc} - storms.gfso.atcf_gen.altg.${PDY}${cyc}) - - for file in ${cyclone_files[@]}; do - [[ -s ${ROTDIR}/${dirname}${file} ]] && echo "${dirname}${file}" >>gfsa.txt - done + { + echo "./logs/${PDY}${cyc}/gfs!(arch).log" + echo "${COM_ATMOS_HISTORY/${ROTDIR}\//}/input.nml" + + if [[ ${MODE} = "cycled" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}gsistat" + echo "${COM_OBS/${ROTDIR}\//}/${head}nsstbufr" + echo "${COM_OBS/${ROTDIR}\//}/${head}prepbufr" + echo "${COM_OBS/${ROTDIR}\//}/${head}prepbufr.acft_profiles" + fi - if [[ ${DO_DOWN} = "YES" ]]; then - if [[ ${DO_BUFRSND} = "YES" ]]; then - echo "${dirname}gempak/gfs_${PDY}${cyc}.sfc " >>gfs_downstream.txt - echo "${dirname}gempak/gfs_${PDY}${cyc}.snd " >>gfs_downstream.txt - echo "${dirname}wmo/gfs_collective*.postsnd_${cyc} " >>gfs_downstream.txt - echo "${dirname}bufr.t${cyc}z " >>gfs_downstream.txt - echo "${dirname}gfs.t${cyc}z.bufrsnd.tar.gz " >>gfs_downstream.txt - fi - if [[ ${WAFSF} = "YES" ]]; then - echo "${dirname}wafsgfs*.t${cyc}z.gribf*.grib2 " >>gfs_downstream.txt - echo "${dirname}gfs.t${cyc}z.wafs_grb45f*.grib2 " >>gfs_downstream.txt - echo "${dirname}gfs.t${cyc}z.wafs_grb45f*.nouswafs.grib2 " >>gfs_downstream.txt - echo "${dirname}WAFS_blended_${PDY}${cyc}f*.grib2 " >>gfs_downstream.txt - echo "${dirname}gfs.t*z.gcip.f*.grib2 " >>gfs_downstream.txt - echo "${dirname}gfs.t${cyc}z.wafs_0p25.f*.grib2 " >>gfs_downstream.txt - echo "${dirname}gfs.t${cyc}z.wafs_0p25_unblended.f*.grib2" >>gfs_downstream.txt - echo "${dirname}WAFS_0p25_blended_${PDY}${cyc}f*.grib2 " >>gfs_downstream.txt - fi - fi + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.anl" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.anl.idx" - echo "${dirname}${head}pgrb2.0p50.anl " >>gfsb.txt - echo "${dirname}${head}pgrb2.0p50.anl.idx " >>gfsb.txt - echo "${dirname}${head}pgrb2.1p00.anl " >>gfsb.txt - echo "${dirname}${head}pgrb2.1p00.anl.idx " >>gfsb.txt + #Only generated if there are cyclones to track + cyclone_files=("avno.t${cyc}z.cyclone.trackatcfunix" + "avnop.t${cyc}z.cyclone.trackatcfunix" + "trak.gfso.atcfunix.${PDY}${cyc}" + "trak.gfso.atcfunix.altg.${PDY}${cyc}") + for file in "${cyclone_files[@]}"; do + [[ -s ${COM_ATMOS_TRACK}/${file} ]] && echo "${COM_ATMOS_TRACK/${ROTDIR}\//}/${file}" + done - fh=0 - while [[ ${fh} -le ${FHMAX_GFS} ]]; do - fhr=$(printf %03i ${fh}) - if [[ ${ARCH_GAUSSIAN} = "YES" ]]; then - echo "${dirname}${head}sfluxgrbf${fhr}.grib2 " >>gfs_flux.txt - echo "${dirname}${head}sfluxgrbf${fhr}.grib2.idx " >>gfs_flux.txt - - echo "${dirname}${head}pgrb2b.0p25.f${fhr} " >>gfs_pgrb2b.txt - echo "${dirname}${head}pgrb2b.0p25.f${fhr}.idx " >>gfs_pgrb2b.txt - if [[ -s ${ROTDIR}/${dirpath}${head}pgrb2b.1p00.f${fhr} ]]; then - echo "${dirname}${head}pgrb2b.1p00.f${fhr} " >>gfs_pgrb2b.txt - echo "${dirname}${head}pgrb2b.1p00.f${fhr}.idx " >>gfs_pgrb2b.txt + genesis_files=("storms.gfso.atcf_gen.${PDY}${cyc}" + "storms.gfso.atcf_gen.altg.${PDY}${cyc}") + for file in "${genesis_files[@]}"; do + [[ -s ${COM_ATMOS_GENESIS}/${file} ]] && echo "${COM_ATMOS_GENESIS/${ROTDIR}\//}/${file}" + done + } >> gfsa.txt + + { + if [[ ${DO_DOWN} = "YES" ]]; then + if [[ ${DO_BUFRSND} = "YES" ]]; then + echo "${COM_ATMOS_GEMPAK/${ROTDIR}\//}/gfs_${PDY}${cyc}.sfc" + echo "${COM_ATMOS_GEMPAK/${ROTDIR}\//}/gfs_${PDY}${cyc}.snd" + echo "${COM_ATMOS_WMO/${ROTDIR}\//}/gfs_collective*.postsnd_${cyc}" + echo "${COM_ATMOS_BUFR/${ROTDIR}\//}/bufr.t${cyc}z" + echo "${COM_ATMOS_BUFR/${ROTDIR}\//}/gfs.t${cyc}z.bufrsnd.tar.gz" + fi + if [[ ${WAFSF} = "YES" ]]; then + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/wafsgfs*.t${cyc}z.gribf*.grib2" + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/gfs.t${cyc}z.wafs_grb45f*.grib2" + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/gfs.t${cyc}z.wafs_grb45f*.nouswafs.grib2" + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/WAFS_blended_${PDY}${cyc}f*.grib2" + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/gfs.t*z.gcip.f*.grib2" + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/gfs.t${cyc}z.wafs_0p25.f*.grib2" + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/gfs.t${cyc}z.wafs_0p25_unblended.f*.grib2" + echo "${COM_ATMOS_WAFS/${ROTDIR}\//}/WAFS_0p25_blended_${PDY}${cyc}f*.grib2" fi fi + } >> gfs_downstream.txt - echo "${dirname}${head}pgrb2.0p25.f${fhr} " >>gfsa.txt - echo "${dirname}${head}pgrb2.0p25.f${fhr}.idx " >>gfsa.txt - echo "${dirname}${head}logf${fhr}.txt " >>gfsa.txt + { + echo "${COM_ATMOS_GRIB_0p50/${ROTDIR}\//}/${head}pgrb2.0p50.anl" + echo "${COM_ATMOS_GRIB_0p50/${ROTDIR}\//}/${head}pgrb2.0p50.anl.idx" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.anl" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.anl.idx" + } >> gfsb.txt - if [[ -s ${ROTDIR}/${dirpath}${head}pgrb2.0p50.f${fhr} ]]; then - echo "${dirname}${head}pgrb2.0p50.f${fhr} " >>gfsb.txt - echo "${dirname}${head}pgrb2.0p50.f${fhr}.idx " >>gfsb.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}pgrb2.1p00.f${fhr} ]]; then - echo "${dirname}${head}pgrb2.1p00.f${fhr} " >>gfsb.txt - echo "${dirname}${head}pgrb2.1p00.f${fhr}.idx " >>gfsb.txt + + fh=0 + while (( fh <= FHMAX_GFS )); do + fhr=$(printf %03i "${fh}") + if [[ ${ARCH_GAUSSIAN} = "YES" ]]; then + { + echo "${COM_ATMOS_MASTER/${ROTDIR}\//}/${head}sfluxgrbf${fhr}.grib2" + echo "${COM_ATMOS_MASTER/${ROTDIR}\//}/${head}sfluxgrbf${fhr}.grib2.idx" + } >> gfs_flux.txt + + { + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2b.0p25.f${fhr}" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2b.0p25.f${fhr}.idx" + if [[ -s "${COM_ATMOS_GRIB_1p00}/${head}pgrb2b.1p00.f${fhr}" ]]; then + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/{head}pgrb2b.1p00.f${fhr}" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/{head}pgrb2b.1p00.f${fhr}.idx" + fi + } >> gfs_pgrb2b.txt fi + { + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.f${fhr}" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.f${fhr}.idx" + echo "${COM_ATMOS_HISTORY/${ROTDIR}\//}/${head}logf${fhr}.txt" + } >> gfsa.txt + + + { + if [[ -s "${COM_ATMOS_GRIB_0p50}/${head}pgrb2.0p50.f${fhr}" ]]; then + echo "${COM_ATMOS_GRIB_0p50/${ROTDIR}\//}/${head}pgrb2.0p50.f${fhr}" + echo "${COM_ATMOS_GRIB_0p50/${ROTDIR}\//}/${head}pgrb2.0p50.f${fhr}.idx" + fi + if [[ -s "${COM_ATMOS_GRIB_1p00}/${head}pgrb2.1p00.f${fhr}" ]]; then + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.f${fhr}" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.f${fhr}.idx" + fi + } >> gfsb.txt + inc=${FHOUT_GFS} - if [ ${FHMAX_HF_GFS} -gt 0 -a ${FHOUT_HF_GFS} -gt 0 -a ${fh} -lt ${FHMAX_HF_GFS} ]; then - inc=${FHOUT_HF_GFS} + if (( FHMAX_HF_GFS > 0 && FHOUT_HF_GFS > 0 && fh < FHMAX_HF_GFS )); then + inc=${FHOUT_HF_GFS} fi fh=$((fh+inc)) done #.................. - if [[ ${MODE} = "cycled" ]]; then - echo "${dirname}RESTART/*0000.sfcanl_data.tile1.nc " >>gfs_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile2.nc " >>gfs_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile3.nc " >>gfs_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile4.nc " >>gfs_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile5.nc " >>gfs_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile6.nc " >>gfs_restarta.txt - elif [[ ${MODE} = "forecast-only" ]]; then - echo "${dirname}INPUT/gfs_ctrl.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/gfs_data.tile1.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/gfs_data.tile2.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/gfs_data.tile3.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/gfs_data.tile4.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/gfs_data.tile5.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/gfs_data.tile6.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/sfc_data.tile1.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/sfc_data.tile2.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/sfc_data.tile3.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/sfc_data.tile4.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/sfc_data.tile5.nc " >>gfs_restarta.txt - echo "${dirname}INPUT/sfc_data.tile6.nc " >>gfs_restarta.txt - fi + { + if [[ ${MODE} = "cycled" ]]; then + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile1.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile2.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile3.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile4.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile5.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile6.nc" + elif [[ ${MODE} = "forecast-only" ]]; then + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/gfs_ctrl.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/gfs_data.tile1.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/gfs_data.tile2.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/gfs_data.tile3.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/gfs_data.tile4.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/gfs_data.tile5.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/gfs_data.tile6.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/sfc_data.tile1.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/sfc_data.tile2.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/sfc_data.tile3.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/sfc_data.tile4.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/sfc_data.tile5.nc" + echo "${COM_ATMOS_INPUT/${ROTDIR}\//}/sfc_data.tile6.nc" + fi + } >> gfs_restarta.txt + #.................. if [[ ${DO_WAVE} = "YES" ]]; then @@ -202,21 +226,17 @@ if [[ ${type} = "gfs" ]]; then rm -rf gfswave.txt touch gfswave.txt - dirpath="gfs.${PDY}/${cyc}/wave/" - dirname="./${dirpath}" - head="gfswave.t${cyc}z." #........................... - echo "${dirname}rundata/ww3_multi* " >>gfswave.txt - echo "${dirname}gridded/${head}* " >>gfswave.txt - echo "${dirname}station/${head}* " >>gfswave.txt - + { + echo "${COM_WAVE_HISTORY/${ROTDIR}\//}/ww3_multi*" + echo "${COM_WAVE_GRID/${ROTDIR}\//}/${head}*" + echo "${COM_WAVE_STATION/${ROTDIR}\//}/${head}*" + } >> gfswave.txt fi if [[ ${DO_OCN} = "YES" ]]; then - dirpath="gfs.${PDY}/${cyc}/ocean/" - dirname="./${dirpath}" head="gfs.t${cyc}z." @@ -234,42 +254,39 @@ if [[ ${type} = "gfs" ]]; then touch ocn_3D.txt touch ocn_xsect.txt touch ocn_daily.txt - echo "${dirname}MOM_input " >>ocn_2D.txt - echo "${dirname}ocn_2D* " >>ocn_2D.txt - echo "${dirname}ocn_3D* " >>ocn_3D.txt - echo "${dirname}ocn*EQ* " >>ocn_xsect.txt - echo "${dirname}ocn_daily* " >>ocn_daily.txt - echo "${dirname}ocn_ice*0p5x0p5.grb2 " >>ocn_ice_grib2_0p5.txt - echo "${dirname}ocn_ice*0p25x0p25.grb2 " >>ocn_ice_grib2_0p25.txt - - dirpath="gfs.${PDY}/${cyc}/atmos/" - dirname="./${dirpath}" - echo "${dirname}${head}flux.1p00.f??? " >>gfs_flux_1p00.txt - echo "${dirname}${head}flux.1p00.f???.idx " >>gfs_flux_1p00.txt + echo "${COM_OCEAN_INPUT/${ROTDIR}\//}/MOM_input" >> ocn_2D.txt + echo "${COM_OCEAN_HISTORY/${ROTDIR}\//}/ocn_2D*" >> ocn_2D.txt + echo "${COM_OCEAN_HISTORY/${ROTDIR}\//}/ocn_3D*" >> ocn_3D.txt + echo "${COM_OCEAN_XSECT/${ROTDIR}\//}/ocn*EQ*" >> ocn_xsect.txt + echo "${COM_OCEAN_DAILY/${ROTDIR}\//}/ocn_daily*" >> ocn_daily.txt + echo "${COM_OCEAN_GRIB_0p50/${ROTDIR}\//}/ocn_ice*0p5x0p5.grb2" >> ocn_ice_grib2_0p5.txt + echo "${COM_OCEAN_GRIB_0p25/${ROTDIR}\//}/ocn_ice*0p25x0p25.grb2" >> ocn_ice_grib2_0p25.txt + + # Also save fluxes from atmosphere + { + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}flux.1p00.f???" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}flux.1p00.f???.idx" + } >> gfs_flux_1p00.txt fi if [[ ${DO_ICE} = "YES" ]]; then - dirpath="gfs.${PDY}/${cyc}/ice/" - dirname="./${dirpath}" - head="gfs.t${cyc}z." rm -f ice.txt touch ice.txt - echo "${dirname}ice_in " >>ice.txt - echo "${dirname}ice*nc " >>ice.txt + { + echo "${COM_ICE_INPUT/${ROTDIR}\//}/ice_in" + echo "${COM_ICE_HISTORY/${ROTDIR}\//}/ice*nc" + } >> ice.txt fi if [[ ${DO_AERO} = "YES" ]]; then - dirpath="gfs.${PDY}/${cyc}/chem" - dirname="./${dirpath}" - head="gocart" rm -f chem.txt touch chem.txt - echo "${dirname}/${head}*" >> chem.txt + echo "${COM_CHEM_HISTORY/${ROTDIR}\//}/${head}*" >> chem.txt fi #----------------------------------------------------- @@ -279,7 +296,7 @@ fi ##end of gfs #----------------------------------------------------- -if [[ ${type} = "gdas" ]]; then +if [[ ${type} == "gdas" ]]; then #----------------------------------------------------- rm -f gdas.txt @@ -289,98 +306,96 @@ if [[ ${type} = "gdas" ]]; then touch gdas_restarta.txt touch gdas_restartb.txt - dirpath="gdas.${PDY}/${cyc}/atmos/" - dirname="./${dirpath}" - obs_dirname="./gdas.${PDY}/${cyc}/obs/" head="gdas.t${cyc}z." #.................. - echo "${dirname}${head}gsistat " >>gdas.txt - echo "${dirname}${head}pgrb2.0p25.anl " >>gdas.txt - echo "${dirname}${head}pgrb2.0p25.anl.idx " >>gdas.txt - echo "${dirname}${head}pgrb2.1p00.anl " >>gdas.txt - echo "${dirname}${head}pgrb2.1p00.anl.idx " >>gdas.txt - echo "${dirname}${head}atmanl.nc " >>gdas.txt - echo "${dirname}${head}sfcanl.nc " >>gdas.txt - if [ -s $ROTDIR/${dirpath}${head}atmanl.ensres.nc ]; then - echo "${dirname}${head}atmanl.ensres.nc " >>gdas.txt - fi - if [ -s $ROTDIR/${dirpath}${head}atma003.ensres.nc ]; then - echo "${dirname}${head}atma003.ensres.nc " >>gdas.txt - fi - if [ -s $ROTDIR/${dirpath}${head}atma009.ensres.nc ]; then - echo "${dirname}${head}atma009.ensres.nc " >>gdas.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}cnvstat ]]; then - echo "${dirname}${head}cnvstat " >>gdas.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}oznstat ]]; then - echo "${dirname}${head}oznstat " >>gdas.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}radstat ]]; then - echo "${dirname}${head}radstat " >>gdas.txt - fi - for fstep in prep anal gldas fcst vrfy radmon minmon oznmon; do - if [[ -s ${ROTDIR}/logs/${CDATE}/gdas${fstep}.log ]]; then - echo "./logs/${CDATE}/gdas${fstep}.log " >>gdas.txt - fi - done - echo "./logs/${CDATE}/gdaspost*.log " >>gdas.txt - - fh=0 - while [[ ${fh} -le 9 ]]; do - fhr=$(printf %03i ${fh}) - echo "${dirname}${head}sfluxgrbf${fhr}.grib2 " >>gdas.txt - echo "${dirname}${head}sfluxgrbf${fhr}.grib2.idx " >>gdas.txt - echo "${dirname}${head}pgrb2.0p25.f${fhr} " >>gdas.txt - echo "${dirname}${head}pgrb2.0p25.f${fhr}.idx " >>gdas.txt - echo "${dirname}${head}pgrb2.1p00.f${fhr} " >>gdas.txt - echo "${dirname}${head}pgrb2.1p00.f${fhr}.idx " >>gdas.txt - echo "${dirname}${head}logf${fhr}.txt " >>gdas.txt - echo "${dirname}${head}atmf${fhr}.nc " >>gdas.txt - echo "${dirname}${head}sfcf${fhr}.nc " >>gdas.txt - fh=$((fh+3)) - done - flist="001 002 004 005 007 008" - for fhr in ${flist}; do - file="${dirname}${head}sfluxgrbf${fhr}.grib2" - # Only add to list if file is present. - if [[ -s "${file}" ]]; then - echo "${file}" >>gdas.txt - echo "${file}.idx" >>gdas.txt + { + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}gsistat" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.anl" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.anl.idx" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.anl" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.anl.idx" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}atmanl.nc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}sfcanl.nc" + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}atmanl.ensres.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}atmanl.ensres.nc" fi - done - + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}atma003.ensres.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}atma003.ensres.nc" + fi + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}atma009.ensres.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}atma009.ensres.nc" + fi + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}cnvstat" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}cnvstat" + fi + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}oznstat" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}oznstat" + fi + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}radstat" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}radstat" + fi + for fstep in prep anal gldas fcst vrfy radmon minmon oznmon; do + if [[ -s "${ROTDIR}/logs/${PDY}${cyc}/gdas${fstep}.log" ]]; then + echo "./logs/${PDY}${cyc}/gdas${fstep}.log" + fi + done + echo "./logs/${PDY}${cyc}/gdaspost*.log" + fh=0 + while [[ ${fh} -le 9 ]]; do + fhr=$(printf %03i "${fh}") + echo "${COM_ATMOS_MASTER/${ROTDIR}\//}/${head}sfluxgrbf${fhr}.grib2" + echo "${COM_ATMOS_MASTER/${ROTDIR}\//}/${head}sfluxgrbf${fhr}.grib2.idx" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.f${fhr}" + echo "${COM_ATMOS_GRIB_0p25/${ROTDIR}\//}/${head}pgrb2.0p25.f${fhr}.idx" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.f${fhr}" + echo "${COM_ATMOS_GRIB_1p00/${ROTDIR}\//}/${head}pgrb2.1p00.f${fhr}.idx" + echo "${COM_ATMOS_HISTORY/${ROTDIR}\//}/${head}logf${fhr}.txt" + echo "${COM_ATMOS_HISTORY/${ROTDIR}\//}/${head}atmf${fhr}.nc" + echo "${COM_ATMOS_HISTORY/${ROTDIR}\//}/${head}sfcf${fhr}.nc" + fh=$((fh+3)) + done + flist="001 002 004 005 007 008" + for fhr in ${flist}; do + file="${COM_ATMOS_MASTER/${ROTDIR}\//}/${head}sfluxgrbf${fhr}.grib2" + if [[ -s "${file}" ]]; then + echo "${file}" + echo "${file}.idx" + fi + done + } >> gdas.txt #.................. - if [[ -s ${ROTDIR}/${dirpath}${head}cnvstat ]]; then - echo "${dirname}${head}cnvstat " >>gdas_restarta.txt + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}cnvstat" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}cnvstat" >> gdas_restarta.txt fi - if [[ -s ${ROTDIR}/${dirpath}${head}radstat ]]; then - echo "${dirname}${head}radstat " >>gdas_restarta.txt + if [[ -s "${COM_ATMOS_ANALYSIS}/${head}radstat" ]]; then + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}radstat" >> gdas_restarta.txt fi - echo "${obs_dirname}${head}nsstbufr " >>gdas_restarta.txt - echo "${obs_dirname}${head}prepbufr " >>gdas_restarta.txt - echo "${obs_dirname}${head}prepbufr.acft_profiles " >>gdas_restarta.txt - echo "${dirname}${head}abias " >>gdas_restarta.txt - echo "${dirname}${head}abias_air " >>gdas_restarta.txt - echo "${dirname}${head}abias_int " >>gdas_restarta.txt - echo "${dirname}${head}abias_pc " >>gdas_restarta.txt - echo "${dirname}${head}atmi*nc " >>gdas_restarta.txt - echo "${dirname}${head}dtfanl.nc " >>gdas_restarta.txt - echo "${dirname}${head}loginc.txt " >>gdas_restarta.txt - - echo "${dirname}RESTART/*0000.sfcanl_data.tile1.nc " >>gdas_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile2.nc " >>gdas_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile3.nc " >>gdas_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile4.nc " >>gdas_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile5.nc " >>gdas_restarta.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile6.nc " >>gdas_restarta.txt + { + echo "${COM_OBS/${ROTDIR}\//}/${head}nsstbufr" + echo "${COM_OBS/${ROTDIR}\//}/${head}prepbufr" + echo "${COM_OBS/${ROTDIR}\//}/${head}prepbufr.acft_profiles" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}abias" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}abias_air" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}abias_int" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}abias_pc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}atmi*nc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}dtfanl.nc" + echo "${COM_ATMOS_ANALYSIS/${ROTDIR}\//}/${head}loginc.txt" + + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile1.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile2.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile3.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile4.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile5.nc" + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}/*0000.sfcanl_data.tile6.nc" + } >> gdas_restarta.txt #.................. - echo "${dirname}RESTART " >>gdas_restartb.txt + echo "${COM_ATMOS_RESTART/${ROTDIR}\//}" >> gdas_restartb.txt #.................. if [[ ${DO_WAVE} = "YES" ]]; then @@ -390,16 +405,15 @@ if [[ ${type} = "gdas" ]]; then rm -rf gdaswave_restart.txt touch gdaswave_restart.txt - dirpath="gdas.${PDY}/${cyc}/wave/" - dirname="./${dirpath}" - head="gdaswave.t${cyc}z." #........................... - echo "${dirname}gridded/${head}* " >>gdaswave.txt - echo "${dirname}station/${head}* " >>gdaswave.txt + { + echo "${COM_WAVE_GRID/${ROTDIR}\//}/${head}*" + echo "${COM_WAVE_STATION/${ROTDIR}\//}/${head}*" + } >> gdaswave.txt - echo "${dirname}restart/* " >>gdaswave_restart.txt + echo "${COM_WAVE_RESTART/${ROTDIR}\//}/*" >> gdaswave_restart.txt fi @@ -411,21 +425,18 @@ if [[ ${type} = "gdas" ]]; then rm -rf gdasocean_restart.txt touch gdasocean_restart.txt - dirpath="gdas.${PDY}/${cyc}/ocean/" - dirname="./${dirpath}" - head="gdas.t${cyc}z." #........................... - echo "${dirname}/${head}* " >>gdasocean.txt - echo "${dirname}/MOM_input " >>gdasocean.txt - - echo "${dirname}/RESTART/* " >>gdasocean_restart.txt + { + echo "${COM_OCEAN_HISTORY/${ROTDIR}\//}/${head}*" + echo "${COM_OCEAN_INPUT/${ROTDIR}\//}" + } >> gdasocean.txt - dirpath="gdas.${PDY}/${cyc}/med/" - dirname="./${dirpath}" - - echo "${dirname}/RESTART/* " >>gdasocean_restart.txt + { + echo "${COM_OCEAN_RESTART/${ROTDIR}\//}/*" + echo "${COM_MED_RESTART/${ROTDIR}\//}/*" + } >> gdasocean_restart.txt fi @@ -436,16 +447,15 @@ if [[ ${type} = "gdas" ]]; then rm -rf gdasice_restart.txt touch gdasice_restart.txt - dirpath="gdas.${PDY}/${cyc}/ice/" - dirname="./${dirpath}" - head="gdas.t${cyc}z." #........................... - echo "${dirname}/${head}* " >>gdasice.txt - echo "${dirname}/ice_in " >>gdasice.txt + { + echo "${COM_ICE_HISTORY/${ROTDIR}\//}/${head}*" + echo "${COM_ICE_INPUT/${ROTDIR}\//}/ice_in" + } >> gdasice.txt - echo "${dirname}/RESTART/* " >>gdasice_restart.txt + echo "${COM_ICE_RESTART/${ROTDIR}\//}/*" >> gdasice_restart.txt fi @@ -456,165 +466,180 @@ fi ##end of gdas #----------------------------------------------------- -if [ ${type} = "enkfgdas" -o ${type} = "enkfgfs" ]; then +if [[ ${type} == "enkfgdas" || ${type} == "enkfgfs" ]]; then #----------------------------------------------------- IAUFHRS_ENKF=${IAUFHRS_ENKF:-6} lobsdiag_forenkf=${lobsdiag_forenkf:-".false."} - nfhrs=$(echo ${IAUFHRS_ENKF} | sed 's/,/ /g') + nfhrs="${IAUFHRS_ENKF/,/}" NMEM_ENKF=${NMEM_ENKF:-80} NMEM_EARCGRP=${NMEM_EARCGRP:-10} ##number of ens memebers included in each tarball NTARS=$((NMEM_ENKF/NMEM_EARCGRP)) [[ ${NTARS} -eq 0 ]] && NTARS=1 [[ $((NTARS*NMEM_EARCGRP)) -lt ${NMEM_ENKF} ]] && NTARS=$((NTARS+1)) -##NTARS2=$((NTARS/2)) # number of earc groups to include analysis/increments + ##NTARS2=$((NTARS/2)) # number of earc groups to include analysis/increments NTARS2=${NTARS} - dirpath="${RUN}.${PDY}/${cyc}/" - dirname="./${dirpath}" head="${RUN}.t${cyc}z." #.................. - rm -f ${RUN}.txt - touch ${RUN}.txt - - echo "${dirname}${head}enkfstat " >>${RUN}.txt - echo "${dirname}${head}gsistat.ensmean " >>${RUN}.txt - if [[ -s ${ROTDIR}/${dirpath}${head}cnvstat.ensmean ]]; then - echo "${dirname}${head}cnvstat.ensmean " >>${RUN}.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}oznstat.ensmean ]]; then - echo "${dirname}${head}oznstat.ensmean " >>${RUN}.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}radstat.ensmean ]]; then - echo "${dirname}${head}radstat.ensmean " >>${RUN}.txt - fi - for FHR in $nfhrs; do # loop over analysis times in window - if [ $FHR -eq 6 ]; then - if [ -s $ROTDIR/${dirpath}${head}atmanl.ensmean.nc ]; then - echo "${dirname}${head}atmanl.ensmean.nc " >>${RUN}.txt - fi - if [ -s $ROTDIR/${dirpath}${head}atminc.ensmean.nc ]; then - echo "${dirname}${head}atminc.ensmean.nc " >>${RUN}.txt + rm -f "${RUN}.txt" + touch "${RUN}.txt" + + { + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}enkfstat" + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}gsistat.ensmean" + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}cnvstat.ensmean" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}cnvstat.ensmean" + fi + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}oznstat.ensmean" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}oznstat.ensmean" + fi + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}radstat.ensmean" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}radstat.ensmean" + fi + for FHR in $nfhrs; do # loop over analysis times in window + if [ $FHR -eq 6 ]; then + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}atmanl.ensmean.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}atmanl.ensmean.nc" fi - else - if [ -s $ROTDIR/${dirpath}${head}atma00${FHR}.ensmean.nc ]; then - echo "${dirname}${head}atma00${FHR}.ensmean.nc " >>${RUN}.txt + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}atminc.ensmean.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}atminc.ensmean.nc" fi - if [ -s $ROTDIR/${dirpath}${head}atmi00${FHR}.ensmean.nc ]; then - echo "${dirname}${head}atmi00${FHR}.ensmean.nc " >>${RUN}.txt + else + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}atma00${FHR}.ensmean.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}atma00${FHR}.ensmean.nc" fi - fi - done # loop over FHR - for fstep in eobs ecen esfc eupd efcs epos ; do - echo "logs/${CDATE}/${RUN}${fstep}*.log " >>${RUN}.txt - done - -# eomg* are optional jobs - for log in ${ROTDIR}/logs/${CDATE}/${RUN}eomg*.log; do - if [[ -s "${log}" ]]; then - echo "logs/${CDATE}/${RUN}eomg*.log " >>${RUN}.txt - fi - break - done + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}atmi00${FHR}.ensmean.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}atmi00${FHR}.ensmean.nc" + fi + fi + done # loop over FHR + for fstep in eobs ecen esfc eupd efcs epos ; do + echo "logs/${PDY}${cyc}/${RUN}${fstep}*.log" + done + # eomg* are optional jobs + for log in "${ROTDIR}/logs/${PDY}${cyc}/${RUN}eomg"*".log"; do + if [[ -s "${log}" ]]; then + echo "logs/${PDY}${cyc}/${RUN}eomg*.log" + fi + break + done -# Ensemble spread file only available with netcdf output - fh=3 - while [ $fh -le 9 ]; do - fhr=$(printf %03i $fh) - echo "${dirname}${head}atmf${fhr}.ensmean.nc " >>${RUN}.txt - echo "${dirname}${head}sfcf${fhr}.ensmean.nc " >>${RUN}.txt - if [ -s $ROTDIR/${dirpath}${head}atmf${fhr}.ensspread.nc ]; then - echo "${dirname}${head}atmf${fhr}.ensspread.nc " >>${RUN}.txt - fi - fh=$((fh+3)) - done + # Ensemble spread file only available with netcdf output + fh=3 + while [ $fh -le 9 ]; do + fhr=$(printf %03i $fh) + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}atmf${fhr}.ensmean.nc" + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}sfcf${fhr}.ensmean.nc" + if [[ -s "${COM_ATMOS_ANALYSIS_ENSSTAT}/${head}atmf${fhr}.ensspread.nc" ]]; then + echo "${COM_ATMOS_ANALYSIS_ENSSTAT/${ROTDIR}\//}/${head}atmf${fhr}.ensspread.nc" + fi + fh=$((fh+3)) + done + } >> "${RUN}.txt" #........................... n=1 - while [[ ${n} -le ${NTARS} ]]; do - #........................... + while (( n <= NTARS )); do + #........................... - rm -f ${RUN}_grp${n}.txt - rm -f ${RUN}_restarta_grp${n}.txt - rm -f ${RUN}_restartb_grp${n}.txt - touch ${RUN}_grp${n}.txt - touch ${RUN}_restarta_grp${n}.txt - touch ${RUN}_restartb_grp${n}.txt - - m=1 - while [[ ${m} -le ${NMEM_EARCGRP} ]]; do - nm=$(((n-1)*NMEM_EARCGRP+m)) - mem=$(printf %03i $nm) - dirpath="${RUN}.${PDY}/${cyc}/mem${mem}/atmos/" - dirname="./${dirpath}" - head="${RUN}.t${cyc}z." - - #--- - for FHR in $nfhrs; do # loop over analysis times in window - if [ $FHR -eq 6 ]; then - if [ $n -le $NTARS2 ]; then - if [ -s $ROTDIR/${dirpath}${head}atmanl.nc ] ; then - echo "${dirname}${head}atmanl.nc " >>${RUN}_grp${n}.txt + rm -f "${RUN}_grp${n}.txt" + rm -f "${RUN}_restarta_grp${n}.txt" + rm -f "${RUN}_restartb_grp${n}.txt" + touch "${RUN}_grp${n}.txt" + touch "${RUN}_restarta_grp${n}.txt" + touch "${RUN}_restartb_grp${n}.txt" + + m=1 + while (( m <= NMEM_EARCGRP )); do + nm=$(((n-1)*NMEM_EARCGRP+m)) + mem=$(printf %03i ${nm}) + head="${RUN}.t${cyc}z." + + MEMDIR="mem${mem}" YMD=${PDY} HH=${cyc} generate_com \ + COM_ATMOS_ANALYSIS_MEM:COM_ATMOS_ANALYSIS_TMPL \ + COM_ATMOS_RESTART_MEM:COM_ATMOS_RESTART_TMPL + + #--- + for FHR in $nfhrs; do # loop over analysis times in window + if [ $FHR -eq 6 ]; then + { + if (( n <= NTARS2 )); then + if [[ -s "${COM_ATMOS_ANALYSIS_MEM}/${head}atmanl.nc" ]] ; then + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}atmanl.nc" + fi + if [[ -s "${COM_ATMOS_ANALYSIS_MEM}/${head}ratminc.nc" ]] ; then + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}ratminc.nc" + fi fi - if [ -s $ROTDIR/${dirpath}${head}ratminc.nc ] ; then - echo "${dirname}${head}ratminc.nc " >>${RUN}_grp${n}.txt - fi - fi - if [ -s $ROTDIR/${dirpath}${head}ratminc.nc ] ; then - echo "${dirname}${head}ratminc.nc " >>${RUN}_restarta_grp${n}.txt - fi - - else - if [ $n -le $NTARS2 ]; then - if [ -s $ROTDIR/${dirpath}${head}atma00${FHR}.nc ] ; then - echo "${dirname}${head}atma00${FHR}.nc " >>${RUN}_grp${n}.txt - fi - if [ -s $ROTDIR/${dirpath}${head}ratmi00${FHR}.nc ] ; then - echo "${dirname}${head}ratmi00${FHR}.nc " >>${RUN}_grp${n}.txt + } >> "${RUN}_grp${n}.txt" + + if [[ -s "${COM_ATMOS_ANALYSIS_MEM}/${head}ratminc.nc" ]] ; then + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}ratminc.nc" \ + >> "${RUN}_restarta_grp${n}.txt" + fi + + else + { + if (( n <= NTARS2 )); then + if [[ -s "${COM_ATMOS_ANALYSIS_MEM}/${head}atma00${FHR}.nc" ]] ; then + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}atma00${FHR}.nc" + fi + if [[ -s "${COM_ATMOS_ANALYSIS_MEM}/${head}ratmi00${FHR}.nc" ]] ; then + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}ratmi00${FHR}.nc" + fi fi - fi - if [ -s $ROTDIR/${dirpath}${head}ratmi00${FHR}.nc ] ; then - echo "${dirname}${head}ratmi00${FHR}.nc " >>${RUN}_restarta_grp${n}.txt - fi - - fi - echo "${dirname}${head}atmf00${FHR}.nc " >>${RUN}_grp${n}.txt - if [ $FHR -eq 6 ]; then - echo "${dirname}${head}sfcf00${FHR}.nc " >>${RUN}_grp${n}.txt + } >> "${RUN}_grp${n}.txt" + if [[ -s "${COM_ATMOS_ANALYSIS_MEM}/${head}ratmi00${FHR}.nc" ]] ; then + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}ratmi00${FHR}.nc" \ + >> "${RUN}_restarta_grp${n}.txt" + fi + fi + { + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}atmf00${FHR}.nc" + if (( FHR == 6 )); then + echo "${COM_ATMOS_ANALYSIS_MEM/${ROTDIR}\//}/${head}sfcf00${FHR}.nc" + fi + } >> "${RUN}_grp${n}.txt" + done # loop over FHR + + if [[ ${lobsdiag_forenkf} == ".false." ]] ; then + { + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}gsistat" + if [[ -s "${COM_ATMOS_RESTART_MEM}/${head}cnvstat" ]] ; then + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}cnvstat" + fi + } >> "${RUN}_grp${n}.txt" + + { + if [[ -s "${COM_ATMOS_RESTART_MEM}/${head}radstat" ]]; then + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}radstat" + fi + if [[ -s "${COM_ATMOS_RESTART_MEM}/${head}cnvstat" ]]; then + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}cnvstat" + fi + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}abias" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}abias_air" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}abias_int" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/${head}abias_pc" + } >> "${RUN}_restarta_grp${n}.txt" fi - done # loop over FHR - - if [[ lobsdiag_forenkf = ".false." ]] ; then - echo "${dirname}${head}gsistat " >>${RUN}_grp${n}.txt - if [[ -s ${ROTDIR}/${dirpath}${head}cnvstat ]] ; then - echo "${dirname}${head}cnvstat " >>${RUN}_grp${n}.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}radstat ]]; then - echo "${dirname}${head}radstat " >>${RUN}_restarta_grp${n}.txt - fi - if [[ -s ${ROTDIR}/${dirpath}${head}cnvstat ]]; then - echo "${dirname}${head}cnvstat " >>${RUN}_restarta_grp${n}.txt - fi - echo "${dirname}${head}abias " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}${head}abias_air " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}${head}abias_int " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}${head}abias_pc " >>${RUN}_restarta_grp${n}.txt - fi - #--- - echo "${dirname}RESTART/*0000.sfcanl_data.tile1.nc " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile2.nc " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile3.nc " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile4.nc " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile5.nc " >>${RUN}_restarta_grp${n}.txt - echo "${dirname}RESTART/*0000.sfcanl_data.tile6.nc " >>${RUN}_restarta_grp${n}.txt - - #--- - echo "${dirname}RESTART " >>${RUN}_restartb_grp${n}.txt - - m=$((m+1)) - done + #--- + { + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/*0000.sfcanl_data.tile1.nc" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/*0000.sfcanl_data.tile2.nc" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/*0000.sfcanl_data.tile3.nc" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/*0000.sfcanl_data.tile4.nc" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/*0000.sfcanl_data.tile5.nc" + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}/*0000.sfcanl_data.tile6.nc" + } >> "${RUN}_restarta_grp${n}.txt" + #--- + echo "${COM_ATMOS_RESTART_MEM/${ROTDIR}\//}" >> "${RUN}_restartb_grp${n}.txt" + + m=$((m+1)) + done #........................... diff --git a/ush/inter_flux.sh b/ush/inter_flux.sh index 2a02b9aa2d..b1f4475e05 100755 --- a/ush/inter_flux.sh +++ b/ush/inter_flux.sh @@ -43,13 +43,13 @@ else fi #--------------------------------------------------------------- - $WGRIB2 $COMOUT/${FLUXFL} $option1 $option21 $option22 $option23 $option24 \ - $option25 $option26 $option27 $option28 \ - -new_grid $grid1p0 fluxfile_${fhr3}_1p00 + ${WGRIB2} "${COM_ATMOS_MASTER}/${FLUXFL}" ${option1} ${option21} ${option22} ${option23} \ + ${option24} ${option25} ${option26} ${option27} ${option28} \ + -new_grid ${grid1p0} fluxfile_${fhr3}_1p00 export err=$?; err_chk - $WGRIB2 -s fluxfile_${fhr3}_1p00 > $COMOUT/${PREFIX}flux.1p00.f${fhr3}.idx - cp fluxfile_${fhr3}_1p00 $COMOUT/${PREFIX}flux.1p00.f${fhr3} + ${WGRIB2} -s "fluxfile_${fhr3}_1p00" > "${COM_ATMOS_GRIB_1p00}/${PREFIX}flux.1p00.f${fhr3}.idx" + cp "fluxfile_${fhr3}_1p00" "${COM_ATMOS_GRIB_1p00}/${PREFIX}flux.1p00.f${fhr3}" #--------------------------------------------------------------- diff --git a/ush/ocnpost.ncl b/ush/ocnpost.ncl index 81f24673fc..27e60b0edf 100755 --- a/ush/ocnpost.ncl +++ b/ush/ocnpost.ncl @@ -93,7 +93,8 @@ begin ; pull from environment COMDIR = getenv("COMOUTocean") IDATE = getenv("IDATE") - FHR2 = getenv("FHR") + VDATE = getenv("VDATE") + FHR2 = getenv("FHR") FHR=FHR2 ENSMEM = getenv("ENSMEM") DATA_TMP = getenv("DATA") @@ -101,7 +102,7 @@ begin ; nemsrc = "/scratch2/NCEPDEV/climate/Bin.Li/S2S/fix/ocean_ice_post/FIXDIR/" ; calculate and break apart verification date - VDATE = tochar(systemfunc("$NDATE "+FHR+" "+IDATE)) + ; VDATE = tochar(systemfunc("$NDATE "+FHR+" "+IDATE)) ; YYYY = tostring(VDATE(0:3)) ; MM = tostring(VDATE(4:5)) ; DD = tostring(VDATE(6:7)) diff --git a/ush/preamble.sh b/ush/preamble.sh index 3cdced6512..0e360cf76e 100644 --- a/ush/preamble.sh +++ b/ush/preamble.sh @@ -35,7 +35,7 @@ _calling_script=$(basename "${BASH_SOURCE[1]}") start_time_human=$(date -d"@${start_time}" -u) echo "Begin ${_calling_script} at ${start_time_human}" -export PS4='+ $(basename ${BASH_SOURCE})[${LINENO}]'"${id}: " +declare -rx PS4='+ $(basename ${BASH_SOURCE[0]:-${FUNCNAME[0]:-"Unknown"}})[${LINENO}]'"${id}: " set_strict() { if [[ ${STRICT:-"YES"} == "YES" ]]; then @@ -87,6 +87,68 @@ postamble() { trap "postamble ${_calling_script} ${start_time} \$?" EXIT # shellcheck disable= +function generate_com() { + # + # Generate a list COM variables from a template by substituting in env variables. + # + # Each argument must have a corresponding template with the name ${ARG}_TMPL. Any + # variables in the template are replaced with their values. Undefined variables + # are just removed without raising an error. + # + # Accepts as options `-r` and `-x`, which do the same thing as the same options in + # `declare`. Variables are automatically marked as `-g` so the variable is visible + # in the calling script. + # + # Syntax: + # generate_com [-rx] $var1[:$tmpl1] [$var2[:$tmpl2]] [...]] + # + # options: + # -r: Make variable read-only (same as `decalre -r`) + # -x: Mark variable for export (same as `declare -x`) + # var1, var2, etc: Variable names whose values will be generated from a template + # and declared + # tmpl1, tmpl2, etc: Specify the template to use (default is "${var}_TMPL") + # + # Examples: + # # Current cycle and RUN, implicitly using template COM_ATMOS_ANALYSIS_TMPL + # YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS + # + # # Previous cycle and gdas using an explicit template + # RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} generate_com -rx \ + # COM_ATMOS_HISTORY_PREV:COM_ATMOS_HISTORY_TMPL + # + # # Current cycle and COM for first member + # MEMDIR='mem001' YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_HISTORY + # + local opts="-g" + local OPTIND=1 + while getopts "rx" option; do + opts="${opts}${option}" + done + shift $((OPTIND-1)) + + for input in "$@"; do + IFS=':' read -ra args <<< "${input}" + local com_var="${args[0]}" + local template + local value + if (( ${#args[@]} > 1 )); then + template="${args[1]}" + else + template="${com_var}_TMPL" + fi + if [[ ! -v "${template}" ]]; then + echo "FATAL ERROR in generate_com: Requested template ${template} not defined!" + exit 2 + fi + value=$(echo "${!template}" | envsubst) + # shellcheck disable=SC2086 + declare ${opts} "${com_var}"="${value}" + done +} +# shellcheck disable= +declare -xf generate_com + # Turn on our settings set_strict set_trace diff --git a/ush/syndat_qctropcy.sh b/ush/syndat_qctropcy.sh index 4f62435c73..5b5b4ba34b 100755 --- a/ush/syndat_qctropcy.sh +++ b/ush/syndat_qctropcy.sh @@ -113,17 +113,19 @@ positional parameter 1" set_trace echo $msg >> $pgmout -# Copy null files into "${COMSP}syndata.tcvitals.$tmmark" and -# "${COMSP}jtwc-fnoc.tcvitals.$tmmark" so later ftp attempts will find and +# Copy null files into "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.$tmmark" and +# "${COM_OBS}/${RUN}.${cycle}.jtwc-fnoc.tcvitals.$tmmark" so later ftp attempts will find and # copy the zero-length file and avoid wasting time with multiple attempts # to remote machine(s) # (Note: Only do so if files don't already exist) if [ $SENDCOM = YES ]; then - [ ! -s ${COMSP}syndata.tcvitals.$tmmark ] && \ - cp /dev/null ${COMSP}syndata.tcvitals.$tmmark - [ ! -s ${COMSP}jtwc-fnoc.tcvitals.$tmmark ] && \ - cp /dev/null ${COMSP}jtwc-fnoc.tcvitals.$tmmark + if [[ ! -s "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.${tmmark}" ]]; then + cp "/dev/null" "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.${tmmark}" + fi + if [[ ! -s "${COM_OBS}/${RUN}.${cycle}.jtwc-fnoc.tcvitals.${tmmark}" ]]; then + cp "/dev/null" "${COM_OBS}/${RUN}.${cycle}.jtwc-fnoc.tcvitals.${tmmark}" + fi fi exit @@ -289,16 +291,18 @@ if [ "$errqct" -gt '0' ];then echo $msg >> $pgmout # In the event of a ERROR in PROGRAM SYNDAT_QCTROPCY, copy null files into -# "${COMSP}syndata.tcvitals.$tmmark" and "${COMSP}jtwc-fnoc.tcvitals.$tmmark" +# "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.$tmmark" and "${COM_OBS}/${RUN}.${cycle}.jtwc-fnoc.tcvitals.$tmmark" # so later ftp attempts will find and copy the zero-length file and avoid # wasting time with multiple attempts to remote machine(s) # (Note: Only do so if files don't already exist) if [ $SENDCOM = YES ]; then - [ ! -s ${COMSP}syndata.tcvitals.$tmmark ] && \ - cp /dev/null ${COMSP}syndata.tcvitals.$tmmark - [ ! -s ${COMSP}jtwc-fnoc.tcvitals.$tmmark ] && \ - cp /dev/null ${COMSP}jtwc-fnoc.tcvitals.$tmmark + if [[ ! -s "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.${tmmark}" ]]; then + cp "/dev/null" "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.${tmmark}" + fi + if [[ ! -s ${COM_OBS}/${RUN}.${cycle}.jtwc-fnoc.tcvitals.${tmmark} ]]; then + cp "/dev/null" "${COM_OBS}/${RUN}.${cycle}.jtwc-fnoc.tcvitals.${tmmark}" + fi fi exit @@ -375,15 +379,15 @@ fi # This is the file that connects to the later RELOCATE and/or PREP scripts -[ $SENDCOM = YES ] && cp current ${COMSP}syndata.tcvitals.$tmmark +[ $SENDCOM = YES ] && cp current "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.${tmmark}" # Create the DBNet alert if [ $SENDDBN = "YES" ] then - $DBNROOT/bin/dbn_alert MODEL GDAS_TCVITALS $job ${COMSP}syndata.tcvitals.$tmmark + "${DBNROOT}/bin/dbn_alert" "MODEL" "GDAS_TCVITALS" "${job}" "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.${tmmark}" fi # Write JTWC/FNOC Tcvitals to /com path since not saved anywhere else -[ $SENDCOM = YES ] && cp fnoc "${COMSP}jtwc-fnoc.tcvitals.${tmmark}" +[ $SENDCOM = YES ] && cp fnoc "${COM_OBS}/${RUN}.${cycle}.jtwc-fnoc.tcvitals.${tmmark}" exit diff --git a/ush/tropcy_relocate.sh b/ush/tropcy_relocate.sh index 1383df693c..9b170ddfd0 100755 --- a/ush/tropcy_relocate.sh +++ b/ush/tropcy_relocate.sh @@ -430,22 +430,22 @@ to center relocation date/time;" fi # For center time sigma guess file obtained via getges, store pathname from -# getges into ${COMSP}sgesprep_pre-relocate_pathname.$tmmark and, for now, -# also in ${COMSP}sgesprep_pathname.$tmmark - if relocation processing stops +# getges into ${COM_OBS}/${RUN}.${cycle}.sgesprep_pre-relocate_pathname.$tmmark and, for now, +# also in ${COM_OBS}/${RUN}.${cycle}.sgesprep_pathname.$tmmark - if relocation processing stops # due to an error or due to no input tcvitals records found, then the center # time sigma guess will not be modified and this getges file will be read in # subsequent PREP processing; if relocation processing continues and the -# center sigma guess is modified, then ${COMSP}sgesprep_pathname.$tmmark will +# center sigma guess is modified, then ${COM_OBS}/${RUN}.${cycle}.sgesprep_pathname.$tmmark will # be removed later in this script {the subsequent PREP step will correctly -# update ${COMSP}sgesprep_pathname.$tmmark to point to the sgesprep file +# update ${COM_OBS}/${RUN}.${cycle}.sgesprep_pathname.$tmmark to point to the sgesprep file # updated here by the relocation} # ---------------------------------------------------------------------------- if [ $fhr = "0" ]; then - $USHGETGES/getges.sh -e $envir_getges -n $network_getges -v $CDATE10 \ - -t $stype > ${COMSP}sgesprep_pre-relocate_pathname.$tmmark - cp ${COMSP}sgesprep_pre-relocate_pathname.$tmmark \ - ${COMSP}sgesprep_pathname.$tmmark + "${USHGETGES}/getges.sh" -e "${envir_getges}" -n "${network_getges}" -v "${CDATE10}" \ + -t "${stype}" > "${COM_OBS}/${RUN}.${cycle}.sgesprep_pre-relocate_pathname.${tmmark}" + cp "${COM_OBS}/${RUN}.${cycle}.sgesprep_pre-relocate_pathname.${tmmark}" \ + "${COM_OBS}/${RUN}.${cycle}.sgesprep_pathname.${tmmark}" fi set +x echo @@ -493,7 +493,7 @@ done if [ -f ${tstsp}syndata.tcvitals.$tmmark ]; then cp ${tstsp}syndata.tcvitals.$tmmark tcvitals.now else - cp ${COMSP}syndata.tcvitals.$tmmark tcvitals.now + cp "${COM_OBS}/${RUN}.${cycle}.syndata.tcvitals.${tmmark}" "tcvitals.now" fi @@ -517,7 +517,7 @@ if [ $errgrep -ne 0 ] ; then echo "NO TCVITAL RECORDS FOUND FOR $CDATE10 - EXIT TROPICAL CYCLONE \ RELOCATION PROCESSING" -# The existence of ${COMSP}tropcy_relocation_status.$tmmark file will tell the +# The existence of ${COM_OBS}/${RUN}.${cycle}.tropcy_relocation_status.$tmmark file will tell the # subsequent PREP processing that RELOCATION processing occurred, echo # "NO RECORDS to process" into it to further tell PREP processing that records # were not processed by relocation and the global sigma guess was NOT @@ -525,14 +525,15 @@ RELOCATION PROCESSING" # found) # Note: When tropical cyclone relocation does run to completion and the # global sigma guess is modified, the parent script to this will echo -# "RECORDS PROCESSED" into ${COMSP}tropcy_relocation_status.$tmmark +# "RECORDS PROCESSED" into ${COM_OBS}/${RUN}.${cycle}.tropcy_relocation_status.$tmmark # assuming it doesn't already exist (meaning "NO RECORDS to process" # was NOT echoed into it here) # ---------------------------------------------------------------------------- - echo "NO RECORDS to process" > ${COMSP}tropcy_relocation_status.$tmmark - [ ! -s ${COMSP}tcvitals.relocate.$tmmark ] && \ - cp /dev/null ${COMSP}tcvitals.relocate.$tmmark + echo "NO RECORDS to process" > "${COM_OBS}/${RUN}.${cycle}.tropcy_relocation_status.${tmmark}" + if [[ ! -s "${COM_OBS}/${RUN}.${cycle}.tcvitals.relocate.${tmmark}" ]]; then + cp "/dev/null" "${COM_OBS}/${RUN}.${cycle}.tcvitals.relocate.${tmmark}" + fi else cat VITL >>tcvitals @@ -687,32 +688,32 @@ else rm -f RELOCATE_GES cmd if [ "$SENDCOM" = "YES" ]; then - cp rel_inform1 ${COMSP}inform.relocate.$tmmark - cp tcvitals ${COMSP}tcvitals.relocate.$tmmark + cp "rel_inform1" "${COM_OBS}/${RUN}.${cycle}.inform.relocate.${tmmark}" + cp "tcvitals" "${COM_OBS}/${RUN}.${cycle}.tcvitals.relocate.${tmmark}" if [ "$SENDDBN" = "YES" ]; then if test "$RUN" = "gdas1" then - $DBNROOT/bin/dbn_alert MODEL GDAS1_TCI $job ${COMSP}inform.relocate.$tmmark - $DBNROOT/bin/dbn_alert MODEL GDAS1_TCI $job ${COMSP}tcvitals.relocate.$tmmark + "${DBNROOT}/bin/dbn_alert" "MODEL" "GDAS1_TCI" "${job}" "${COM_OBS}/${RUN}.${cycle}.inform.relocate.${tmmark}" + "${DBNROOT}/bin/dbn_alert" "MODEL" "GDAS1_TCI" "${job}" "${COM_OBS}/${RUN}.${cycle}.tcvitals.relocate.${tmmark}" fi if test "$RUN" = "gfs" then - $DBNROOT/bin/dbn_alert MODEL GFS_TCI $job ${COMSP}inform.relocate.$tmmark - $DBNROOT/bin/dbn_alert MODEL GFS_TCI $job ${COMSP}tcvitals.relocate.$tmmark + "${DBNROOT}/bin/dbn_alert" "MODEL" "GFS_TCI" "${job}" "${COM_OBS}/${RUN}.${cycle}.inform.relocate.${tmmark}" + "${DBNROOT}/bin/dbn_alert" "MODEL" "GFS_TCI" "${job}" "${COM_OBS}/${RUN}.${cycle}.tcvitals.relocate.${tmmark}" fi fi fi # -------------------------------------------------------------------------- # Since relocation processing has ended sucessfully (and the center sigma -# guess has been modified), remove ${COMSP}sgesprep_pathname.$tmmark (which +# guess has been modified), remove ${COM_OBS}/${RUN}.${cycle}.sgesprep_pathname.$tmmark (which # had earlier had getges center sigma guess pathname written into it - in # case of error or no input tcvitals records found) - the subsequent PREP -# step will correctly update ${COMSP}sgesprep_pathname.$tmmark to point to +# step will correctly update ${COM_OBS}/${RUN}.${cycle}.sgesprep_pathname.$tmmark to point to # the sgesprep file updated here by the relocation # -------------------------------------------------------------------------- - rm ${COMSP}sgesprep_pathname.$tmmark + rm "${COM_OBS}/${RUN}.${cycle}.sgesprep_pathname.${tmmark}" echo "TROPICAL CYCLONE RELOCATION PROCESSING SUCCESSFULLY COMPLETED FOR \ $CDATE10" diff --git a/ush/wave_grib2_sbs.sh b/ush/wave_grib2_sbs.sh index 54a298b41c..8511515abb 100755 --- a/ush/wave_grib2_sbs.sh +++ b/ush/wave_grib2_sbs.sh @@ -25,55 +25,54 @@ # --------------------------------------------------------------------------- # # 0. Preparations -source "$HOMEgfs/ush/preamble.sh" +source "${HOMEgfs}/ush/preamble.sh" # 0.a Basic modes of operation - cd $GRIBDATA +cd "${GRIBDATA}" || exit 2 - alertName=$(echo $RUN|tr [a-z] [A-Z]) +alertName=${RUN^^} - grdID=$1 - gribDIR=${grdID}_grib - rm -rfd ${gribDIR} - mkdir ${gribDIR} - err=$? - if [ $err != 0 ] - then - set +x - echo ' ' - echo '******************************************************************************* ' - echo '*** FATAL ERROR : ERROR IN ww3_grib2 (COULD NOT CREATE TEMP DIRECTORY) *** ' - echo '******************************************************************************* ' - echo ' ' - set_trace - exit 1 - fi +grdID=$1 +gribDIR="${grdID}_grib" +rm -rfd "${gribDIR}" +mkdir "${gribDIR}" +err=$? +if [[ ${err} != 0 ]]; then + set +x + echo ' ' + echo '******************************************************************************* ' + echo '*** FATAL ERROR : ERROR IN ww3_grib2 (COULD NOT CREATE TEMP DIRECTORY) *** ' + echo '******************************************************************************* ' + echo ' ' + set_trace + exit 1 +fi - cd ${gribDIR} +cd "${gribDIR}" || exit 2 # 0.b Define directories and the search path. # The tested variables should be exported by the postprocessor script. - GRIDNR=$2 - MODNR=$3 - ymdh=$4 - fhr=$5 - grdnam=$6 - grdres=$7 - gribflags=$8 - ngrib=1 # only one time slice - dtgrib=3600 # only one time slice +GRIDNR=$2 +MODNR=$3 +ymdh=$4 +fhr=$5 +grdnam=$6 +grdres=$7 +gribflags=$8 +ngrib=1 # only one time slice +dtgrib=3600 # only one time slice # SBS one time slice per file - FH3=$(printf %03i $fhr) +FH3=$(printf %03i "${fhr}") # Verify if grib2 file exists from interrupted run - ENSTAG="" - if [ ${waveMEMB} ]; then ENSTAG=".${membTAG}${waveMEMB}" ; fi - outfile=${WAV_MOD_TAG}.${cycle}${ENSTAG}.${grdnam}.${grdres}.f${FH3}.grib2 +ENSTAG="" +if [[ -n ${waveMEMB} ]]; then ENSTAG=".${membTAG}${waveMEMB}" ; fi +outfile="${WAV_MOD_TAG}.${cycle}${ENSTAG}.${grdnam}.${grdres}.f${FH3}.grib2" # Only create file if not present in COM - if [ ! -s ${COMOUT}/gridded/${outfile}.idx ]; then +if [[ ! -s "${COM_WAVE_GRID}/${outfile}.idx" ]]; then set +x echo ' ' @@ -83,11 +82,10 @@ source "$HOMEgfs/ush/preamble.sh" echo " Model ID : $WAV_MOD_TAG" set_trace - if [ -z "$CDATE" ] || [ -z "$cycle" ] || [ -z "$EXECwave" ] || \ - [ -z "$COMOUT" ] || [ -z "$WAV_MOD_TAG" ] || [ -z "$SENDCOM" ] || \ - [ -z "$gribflags" ] || \ - [ -z "$GRIDNR" ] || [ -z "$MODNR" ] || [ -z "$SENDDBN" ] - then + if [[ -z "${PDY}" ]] || [[ -z ${cyc} ]] || [[ -z "${cycle}" ]] || [[ -z "${EXECwave}" ]] || \ + [[ -z "${COM_WAVE_GRID}" ]] || [[ -z "${WAV_MOD_TAG}" ]] || [[ -z "${SENDCOM}" ]] || \ + [[ -z "${gribflags}" ]] || [[ -z "${GRIDNR}" ]] || [[ -z "${MODNR}" ]] || \ + [[ -z "${SENDDBN}" ]]; then set +x echo ' ' echo '***************************************************' @@ -98,75 +96,76 @@ source "$HOMEgfs/ush/preamble.sh" exit 1 fi -# 0.c Starting time for output + # 0.c Starting time for output - tstart="$(echo $ymdh | cut -c1-8) $(echo $ymdh | cut -c9-10)0000" + tstart="${ymdh:0:8} ${ymdh:8:2}0000" set +x - echo " Starting time : $tstart" - echo " Time step : Single SBS - echo " Number of times : Single SBS - echo " GRIB field flags : $gribflags" + echo " Starting time : ${tstart}" + echo " Time step : Single SBS" + echo " Number of times : Single SBS" + echo " GRIB field flags : ${gribflags}" echo ' ' set_trace -# 0.e Links to working directory + # 0.e Links to working directory - ln -s ${DATA}/mod_def.$grdID mod_def.ww3 - ln -s ${DATA}/output_${ymdh}0000/out_grd.$grdID out_grd.ww3 + ln -s "${DATA}/mod_def.${grdID}" "mod_def.ww3" + ln -s "${DATA}/output_${ymdh}0000/out_grd.${grdID}" "out_grd.ww3" -# --------------------------------------------------------------------------- # -# 1. Generate GRIB file with all data -# 1.a Generate input file for ww3_grib2 -# Template copied in mother script ... + # --------------------------------------------------------------------------- # + # 1. Generate GRIB file with all data + # 1.a Generate input file for ww3_grib2 + # Template copied in mother script ... set +x echo " Generate input file for ww3_grib2" set_trace - sed -e "s/TIME/$tstart/g" \ - -e "s/DT/$dtgrib/g" \ - -e "s/NT/$ngrib/g" \ - -e "s/GRIDNR/$GRIDNR/g" \ - -e "s/MODNR/$MODNR/g" \ - -e "s/FLAGS/$gribflags/g" \ - ${DATA}/ww3_grib2.${grdID}.inp.tmpl > ww3_grib.inp + sed -e "s/TIME/${tstart}/g" \ + -e "s/DT/${dtgrib}/g" \ + -e "s/NT/${ngrib}/g" \ + -e "s/GRIDNR/${GRIDNR}/g" \ + -e "s/MODNR/${MODNR}/g" \ + -e "s/FLAGS/${gribflags}/g" \ + "${DATA}/ww3_grib2.${grdID}.inp.tmpl" > ww3_grib.inp echo "ww3_grib.inp" cat ww3_grib.inp -# 1.b Run GRIB packing program + + # 1.b Run GRIB packing program set +x echo " Run ww3_grib2" - echo " Executing $EXECwave/ww3_grib" + echo " Executing ${EXECwave}/ww3_grib" set_trace export pgm=ww3_grib;. prep_step - $EXECwave/ww3_grib > grib2_${grdnam}_${FH3}.out 2>&1 + "${EXECwave}/ww3_grib" > "grib2_${grdnam}_${FH3}.out" 2>&1 export err=$?;err_chk - if [ ! -s gribfile ]; then - set +x - echo ' ' - echo '************************************************ ' - echo '*** FATAL ERROR : ERROR IN ww3_grib encoding *** ' - echo '************************************************ ' - echo ' ' - set_trace - exit 3 - fi - - if [ $fhr -gt 0 ]; then - $WGRIB2 gribfile -set_date $CDATE -set_ftime "$fhr hour fcst" -grib ${COMOUT}/gridded/${outfile} + if [ ! -s gribfile ]; then + set +x + echo ' ' + echo '************************************************ ' + echo '*** FATAL ERROR : ERROR IN ww3_grib encoding *** ' + echo '************************************************ ' + echo ' ' + set_trace + exit 3 + fi + + if (( fhr > 0 )); then + ${WGRIB2} gribfile -set_date "${PDY}${cyc}" -set_ftime "${fhr} hour fcst" -grib "${COM_WAVE_GRID}/${outfile}" err=$? else - $WGRIB2 gribfile -set_date $CDATE -set_ftime "$fhr hour fcst" -set table_1.4 1 -set table_1.2 1 -grib ${COMOUT}/gridded/${outfile} + ${WGRIB2} gribfile -set_date "${PDY}${cyc}" -set_ftime "${fhr} hour fcst" \ + -set table_1.4 1 -set table_1.2 1 -grib "${COM_WAVE_GRID}/${outfile}" err=$? fi - if [ $err != 0 ] - then + if [[ ${err} != 0 ]]; then set +x echo ' ' echo '********************************************* ' @@ -177,65 +176,62 @@ source "$HOMEgfs/ush/preamble.sh" exit 3 fi -# Create index - $WGRIB2 -s $COMOUT/gridded/${outfile} > $COMOUT/gridded/${outfile}.idx + # Create index + ${WGRIB2} -s "${COM_WAVE_GRID}/${outfile}" > "${COM_WAVE_GRID}/${outfile}.idx" -# Create grib2 subgrid is this is the source grid - if [ "${grdID}" = "${WAV_SUBGRBSRC}" ]; then + # Create grib2 subgrid is this is the source grid + if [[ "${grdID}" = "${WAV_SUBGRBSRC}" ]]; then for subgrb in ${WAV_SUBGRB}; do subgrbref=$(echo ${!subgrb} | cut -d " " -f 1-20) subgrbnam=$(echo ${!subgrb} | cut -d " " -f 21) subgrbres=$(echo ${!subgrb} | cut -d " " -f 22) subfnam="${WAV_MOD_TAG}.${cycle}${ENSTAG}.${subgrbnam}.${subgrbres}.f${FH3}.grib2" - $COPYGB2 -g "${subgrbref}" -i0 -x ${COMOUT}/gridded/${outfile} ${COMOUT}/gridded/${subfnam} - $WGRIB2 -s $COMOUT/gridded/${subfnam} > $COMOUT/gridded/${subfnam}.idx + ${COPYGB2} -g "${subgrbref}" -i0 -x "${COM_WAVE_GRID}/${outfile}" "${COM_WAVE_GRID}/${subfnam}" + ${WGRIB2} -s "${COM_WAVE_GRID}/${subfnam}" > "${COM_WAVE_GRID}/${subfnam}.idx" done fi -# 1.e Save in /com - - if [ ! -s $COMOUT/gridded/${outfile} ] - then - set +x - echo ' ' - echo '********************************************* ' - echo '*** FATAL ERROR : ERROR IN ww3_grib2 *** ' - echo '********************************************* ' - echo ' ' - echo " Error in moving grib file ${outfile} to com" - echo ' ' - set_trace - exit 4 - fi - if [ ! -s $COMOUT/gridded/${outfile} ] - then - set +x - echo ' ' - echo '*************************************************** ' - echo '*** FATAL ERROR : ERROR IN ww3_grib2 INDEX FILE *** ' - echo '*************************************************** ' - echo ' ' - echo " Error in moving grib file ${outfile}.idx to com" - echo ' ' - set_trace - exit 4 - fi - - if [[ "$SENDDBN" = 'YES' ]] && [[ ${outfile} != *global.0p50* ]] - then - set +x - echo " Alerting GRIB file as $COMOUT/gridded/${outfile}" - echo " Alerting GRIB index file as $COMOUT/gridded/${outfile}.idx" - set_trace - $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 - echo "${outfile} is global.0p50, not alert out" - fi + # 1.e Save in /com + if [[ ! -s "${COM_WAVE_GRID}/${outfile}" ]]; then + set +x + echo ' ' + echo '********************************************* ' + echo '*** FATAL ERROR : ERROR IN ww3_grib2 *** ' + echo '********************************************* ' + echo ' ' + echo " Error in moving grib file ${outfile} to com" + echo ' ' + set_trace + exit 4 + fi + if [[ ! -s "${COM_WAVE_GRID}/${outfile}.idx" ]]; then + set +x + echo ' ' + echo '*************************************************** ' + echo '*** FATAL ERROR : ERROR IN ww3_grib2 INDEX FILE *** ' + echo '*************************************************** ' + echo ' ' + echo " Error in moving grib file ${outfile}.idx to com" + echo ' ' + set_trace + exit 4 + fi -# --------------------------------------------------------------------------- # -# 3. Clean up the directory + if [[ "${SENDDBN}" = 'YES' ]] && [[ ${outfile} != *global.0p50* ]]; then + set +x + echo " Alerting GRIB file as ${COM_WAVE_GRID}/${outfile}" + echo " Alerting GRIB index file as ${COM_WAVE_GRID}/${outfile}.idx" + set_trace + "${DBNROOT}/bin/dbn_alert" MODEL "${alertName}_WAVE_GB2" "${job}" "${COM_WAVE_GRID}/${outfile}" + "${DBNROOT}/bin/dbn_alert" MODEL "${alertName}_WAVE_GB2_WIDX" "${job}" "${COM_WAVE_GRID}/${outfile}.idx" + else + echo "${outfile} is global.0p50 or SENDDBN is NO, no alert sent" + fi + + + # --------------------------------------------------------------------------- # + # 3. Clean up the directory rm -f gribfile @@ -244,15 +240,15 @@ source "$HOMEgfs/ush/preamble.sh" set_trace cd ../ - mv -f ${gribDIR} done.${gribDIR} + mv -f "${gribDIR}" "done.${gribDIR}" - else - set +x - echo ' ' - echo " File ${COMOUT}/gridded/${outfile} found, skipping generation process" - echo ' ' - set_trace - fi +else + set +x + echo ' ' + echo " File ${COM_WAVE_GRID}/${outfile} found, skipping generation process" + echo ' ' + set_trace +fi # End of ww3_grib2.sh -------------------------------------------------- # diff --git a/ush/wave_grid_interp_sbs.sh b/ush/wave_grid_interp_sbs.sh index 4ccae7640d..bf34068874 100755 --- a/ush/wave_grid_interp_sbs.sh +++ b/ush/wave_grid_interp_sbs.sh @@ -65,9 +65,9 @@ source "$HOMEgfs/ush/preamble.sh" echo " Model ID : $WAV_MOD_TAG" set_trace - if [ -z "$CDATE" ] || [ -z "$cycle" ] || [ -z "$EXECwave" ] || \ - [ -z "$COMOUT" ] || [ -z "$WAV_MOD_TAG" ] || [ -z "$SENDCOM" ] || \ - [ -z "$SENDDBN" ] || [ -z "$waveGRD" ] + if [[ -z "${PDY}" ]] || [[ -z "${cyc}" ]] || [[ -z "${cycle}" ]] || [[ -z "${EXECwave}" ]] || \ + [[ -z "${COM_WAVE_PREP}" ]] || [[ -z "${WAV_MOD_TAG}" ]] || [[ -z "${SENDCOM}" ]] || \ + [[ -z "${SENDDBN}" ]] || [ -z "${waveGRD}" ] then set +x echo ' ' @@ -75,7 +75,7 @@ source "$HOMEgfs/ush/preamble.sh" echo '*** EXPORTED VARIABLES IN postprocessor NOT SET ***' echo '***************************************************' echo ' ' - echo "$CDATE $cycle $EXECwave $COMOUT $WAV_MOD_TAG $SENDCOM $SENDDBN $waveGRD" + echo "${PDY}${cyc} ${cycle} ${EXECwave} ${COM_WAVE_PREP} ${WAV_MOD_TAG} ${SENDCOM} ${SENDDBN} ${waveGRD}" set_trace exit 1 fi @@ -103,7 +103,7 @@ source "$HOMEgfs/ush/preamble.sh" # 1. Generate GRID file with all data # 1.a Generate Input file - time="$(echo $ymdh | cut -c1-8) $(echo $ymdh | cut -c9-10)0000" + time="${ymdh:0:8} ${ymdh:8:2}0000" sed -e "s/TIME/$time/g" \ -e "s/DT/$dt/g" \ @@ -175,14 +175,14 @@ source "$HOMEgfs/ush/preamble.sh" if [ "$SENDCOM" = 'YES' ] then set +x - echo " Saving GRID file as $COMOUT/rundata/$WAV_MOD_TAG.out_grd.$grdID.${CDATE}" + echo " Saving GRID file as ${COM_WAVE_PREP}/${WAV_MOD_TAG}.out_grd.${grdID}.${PDY}${cyc}" set_trace - cp ${DATA}/output_${ymdh}0000/out_grd.$grdID $COMOUT/rundata/$WAV_MOD_TAG.out_grd.$grdID.${CDATE} + cp "${DATA}/output_${ymdh}0000/out_grd.${grdID}" "${COM_WAVE_PREP}/${WAV_MOD_TAG}.out_grd.${grdID}.${PDY}${cyc}" # if [ "$SENDDBN" = 'YES' ] # then # set +x -# echo " Alerting GRID file as $COMOUT/rundata/$WAV_MOD_TAG.out_grd.$grdID.${CDATE} +# echo " Alerting GRID file as $COMOUT/rundata/$WAV_MOD_TAG.out_grd.$grdID.${PDY}${cyc} # set_trace # diff --git a/ush/wave_grid_moddef.sh b/ush/wave_grid_moddef.sh index 2809d1779a..5b1b212a16 100755 --- a/ush/wave_grid_moddef.sh +++ b/ush/wave_grid_moddef.sh @@ -101,7 +101,7 @@ source "$HOMEgfs/ush/preamble.sh" if [ -f mod_def.ww3 ] then - cp mod_def.ww3 $COMOUT/rundata/${CDUMP}wave.mod_def.${grdID} + cp mod_def.ww3 "${COM_WAVE_PREP}/${RUN}wave.mod_def.${grdID}" mv mod_def.ww3 ../mod_def.$grdID else set +x diff --git a/ush/wave_prnc_cur.sh b/ush/wave_prnc_cur.sh index 7b193313d3..6b1ab19db2 100755 --- a/ush/wave_prnc_cur.sh +++ b/ush/wave_prnc_cur.sh @@ -29,18 +29,19 @@ curfile=$2 fhr=$3 flagfirst=$4 fh3=$(printf "%03d" "${fhr#0}") +fext='f' # Timing has to be made relative to the single 00z RTOFS cycle for that PDY mkdir -p rtofs_${ymdh_rtofs} cd rtofs_${ymdh_rtofs} -ncks -x -v sst,sss,layer_density $curfile cur_uv_${PDY}_${fext}${fh3}.nc -ncks -O -a -h -x -v Layer cur_uv_${PDY}_${fext}${fh3}.nc cur_temp1.nc +ncks -x -v sst,sss,layer_density "${curfile} cur_uv_${PDY}_${fext}${fh3}.nc" +ncks -O -a -h -x -v Layer "cur_uv_${PDY}_${fext}${fh3}.nc" "cur_temp1.nc" ncwa -h -O -a Layer cur_temp1.nc cur_temp2.nc ncrename -h -O -v MT,time -d MT,time cur_temp2.nc ncks -v u_velocity,v_velocity cur_temp2.nc cur_temp3.nc -mv -f cur_temp3.nc cur_uv_${PDY}_${fext}${fh3}_flat.nc +mv -f "cur_temp3.nc" "cur_uv_${PDY}_${fext}${fh3}_flat.nc" # Convert to regular lat lon file # If weights need to be regenerated due to CDO ver change, use: @@ -48,19 +49,19 @@ mv -f cur_temp3.nc cur_uv_${PDY}_${fext}${fh3}_flat.nc cp ${FIXwave}/weights_rtofs_to_r4320x2160.nc ./weights.nc # Interpolate to regular 5 min grid -$CDO remap,r4320x2160,weights.nc cur_uv_${PDY}_${fext}${fh3}_flat.nc cur_5min_01.nc +${CDO} remap,r4320x2160,weights.nc "cur_uv_${PDY}_${fext}${fh3}_flat.nc" "cur_5min_01.nc" # Perform 9-point smoothing twice to make RTOFS data less noisy when # interpolating from 1/12 deg RTOFS grid to 1/6 deg wave grid if [ "WAV_CUR_CDO_SMOOTH" = "YES" ]; then - $CDO -f nc -smooth9 cur_5min_01.nc cur_5min_02.nc - $CDO -f nc -smooth9 cur_5min_02.nc cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc + ${CDO} -f nc -smooth9 "cur_5min_01.nc" "cur_5min_02.nc" + ${CDO} -f nc -smooth9 "cur_5min_02.nc" "cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc" else - mv cur_5min_01.nc cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc + mv "cur_5min_01.nc" "cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc" fi # Cleanup -rm -f cur_temp[123].nc cur_5min_??.nc cur_glo_uv_${PDY}_${fext}${fh3}.nc weights.nc +rm -f cur_temp[123].nc cur_5min_??.nc "cur_glo_uv_${PDY}_${fext}${fh3}.nc weights.nc" if [ ${flagfirst} = "T" ] then @@ -70,8 +71,8 @@ else fi rm -f cur.nc -ln -s cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc cur.nc -ln -s ${DATA}/mod_def.${WAVECUR_FID} ./mod_def.ww3 +ln -s "cur_glo_uv_${PDY}_${fext}${fh3}_5min.nc" "cur.nc" +ln -s "${DATA}/mod_def.${WAVECUR_FID}" ./mod_def.ww3 export pgm=ww3_prnc;. prep_step $EXECwave/ww3_prnc 1> prnc_${WAVECUR_FID}_${ymdh_rtofs}.out 2>&1 diff --git a/ush/wave_prnc_ice.sh b/ush/wave_prnc_ice.sh index 4d9ac1fb3c..a32a2b7e43 100755 --- a/ush/wave_prnc_ice.sh +++ b/ush/wave_prnc_ice.sh @@ -47,18 +47,18 @@ source "$HOMEgfs/ush/preamble.sh" echo '! Make ice fields |' echo '+--------------------------------+' echo " Model TAG : $WAV_MOD_TAG" - echo " Model ID : ${CDUMP}wave" + echo " Model ID : ${RUN}wave" echo " Ice grid ID : $WAVEICE_FID" echo " Ice file : $WAVICEFILE" echo ' ' set_trace echo "Making ice fields." - if [ -z "$YMDH" ] || [ -z "$cycle" ] || \ - [ -z "$COMOUT" ] || [ -z "$FIXwave" ] || [ -z "$EXECwave" ] || \ - [ -z "$WAV_MOD_TAG" ] || [ -z "$WAVEICE_FID" ] || [ -z "$SENDCOM" ] || \ - [ -z "$COMIN_WAV_ICE" ] - then + if [[ -z "${YMDH}" ]] || [[ -z "${cycle}" ]] || \ + [[ -z "${COM_WAVE_PREP}" ]] || [[ -z "${FIXwave}" ]] || [[ -z "${EXECwave}" ]] || \ + [[ -z "${WAV_MOD_TAG}" ]] || [[ -z "${WAVEICE_FID}" ]] || [[ -z "${SENDCOM}" ]] || \ + [[ -z "${COM_OBS}" ]]; then + set +x echo ' ' echo '**************************************************' @@ -78,7 +78,7 @@ source "$HOMEgfs/ush/preamble.sh" # 1. Get the necessary files # 1.a Copy the ice data file - file=${COMIN_WAV_ICE}/${WAVICEFILE} + file=${COM_OBS}/${WAVICEFILE} if [ -f $file ] then @@ -175,13 +175,13 @@ source "$HOMEgfs/ush/preamble.sh" icefile=${WAV_MOD_TAG}.${WAVEICE_FID}.$cycle.ice elif [ "${WW3ATMIENS}" = "F" ] then - icefile=${CDUMP}wave.${WAVEICE_FID}.$cycle.ice + icefile=${RUN}wave.${WAVEICE_FID}.$cycle.ice fi set +x - echo " Saving ice.ww3 as $COMOUT/rundata/${icefile}" + echo " Saving ice.ww3 as ${COM_WAVE_PREP}/${icefile}" set_trace - cp ice.ww3 $COMOUT/rundata/${icefile} + cp ice.ww3 "${COM_WAVE_PREP}/${icefile}" rm -f ice.ww3 # --------------------------------------------------------------------------- # diff --git a/ush/wave_tar.sh b/ush/wave_tar.sh index bc98ea2d2a..9264aac5f3 100755 --- a/ush/wave_tar.sh +++ b/ush/wave_tar.sh @@ -76,9 +76,8 @@ source "$HOMEgfs/ush/preamble.sh" # 0.c Define directories and the search path. # The tested variables should be exported by the postprocessor script. - if [ -z "$cycle" ] || [ -z "$COMOUT" ] || [ -z "$WAV_MOD_TAG" ] || \ - [ -z "$SENDCOM" ] || [ -z "$SENDDBN" ] || [ -z "${STA_DIR}" ] - then + if [[ -z "${cycle}" ]] || [[ -z "${COM_WAVE_STATION}" ]] || [[ -z "${WAV_MOD_TAG}" ]] || \ + [[ -z "${SENDCOM}" ]] || [[ -z "${SENDDBN}" ]] || [[ -z "${STA_DIR}" ]]; then set +x echo ' ' echo '*****************************************************' @@ -180,10 +179,10 @@ source "$HOMEgfs/ush/preamble.sh" set +x echo ' ' - echo " Moving tar file ${file_name} to $COMOUT ..." + echo " Moving tar file ${file_name} to ${COM_WAVE_STATION} ..." set_trace - cp ${file_name} $COMOUT/station/. + cp "${file_name}" "${COM_WAVE_STATION}/." exit=$? @@ -203,10 +202,11 @@ source "$HOMEgfs/ush/preamble.sh" then set +x echo ' ' - echo " Alerting TAR file as $COMOUT/station/${file_name}" + echo " Alerting TAR file as ${COM_WAVE_STATION}/${file_name}" echo ' ' set_trace - $DBNROOT/bin/dbn_alert MODEL ${alertName}_WAVE_TAR $job $COMOUT/station/${file_name} + "${DBNROOT}/bin/dbn_alert MODEL" "${alertName}_WAVE_TAR" "${job}" \ + "${COM_WAVE_STATION}/${file_name}" fi # --------------------------------------------------------------------------- # diff --git a/workflow/rocoto/workflow_tasks.py b/workflow/rocoto/workflow_tasks.py index ab915c1f2a..6308abd9fa 100644 --- a/workflow/rocoto/workflow_tasks.py +++ b/workflow/rocoto/workflow_tasks.py @@ -4,6 +4,7 @@ from typing import List from applications import AppConfig import rocoto.rocoto as rocoto +from pygw.template import Template, TemplateConstants __all__ = ['Tasks', 'create_wf_task', 'get_wf_tasks'] @@ -69,6 +70,51 @@ def _is_this_a_gdas_task(cdump, task_name): if cdump != 'enkfgdas': raise TypeError(f'{task_name} must be part of the "enkfgdas" cycle and not {cdump}') + def _template_to_rocoto_cycstring(self, template: str, subs_dict: dict = {}) -> str: + ''' + Takes a string templated with ${ } and converts it into a string suitable + for use in a rocoto . Some common substitutions are defined by + default. Any additional variables in the template and overrides of the + defaults can be passed in by an optional dict. + + Variables substitued by default: + ${ROTDIR} -> '&ROTDIR;' + ${RUN} -> self.cdump + ${DUMP} -> self.cdump + ${MEMDIR} -> '' + ${YMD} -> '@Y@m@d' + ${HH} -> '@H' + + Parameters + ---------- + template: str + Template string with variables to be replaced + subs_dict: dict, optional + Dictionary containing substitutions + + Returns + ------- + str + Updated string with variables substituted + + ''' + + # Defaults + rocoto_conversion_dict = { + 'ROTDIR': '&ROTDIR;', + 'RUN': self.cdump, + 'DUMP': self.cdump, + 'MEMDIR': '', + 'YMD': '@Y@m@d', + 'HH': '@H' + } + + rocoto_conversion_dict.update(subs_dict) + + return Template.substitute_structure(template, + TemplateConstants.DOLLAR_CURLY_BRACE, + rocoto_conversion_dict.get) + def get_resource(self, task_name): """ Given a task name (task_name) and its configuration (task_names), @@ -202,13 +248,14 @@ def coupled_ic(self): def getic(self): - files = ['INPUT/sfc_data.tile6.nc', - 'RESTART/@Y@m@d.@H0000.sfcanl_data.tile6.nc'] + atm_input_path = self._template_to_rocoto_cycstring(self._base['COM_ATMOS_INPUT_TMPL']) + atm_restart_path = self._template_to_rocoto_cycstring(self._base['COM_ATMOS_RESTART_TMPL']) deps = [] - for file in files: - dep_dict = {'type': 'data', 'data': f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/{file}'} - deps.append(rocoto.add_dependency(dep_dict)) + dep_dict = {'type': 'data', 'data': f'{atm_input_path}/sfc_data.tile6.nc'} + deps.append(rocoto.add_dependency(dep_dict)) + dep_dict = {'type': 'data', 'data': f'{atm_restart_path}/@Y@m@d.@H0000.sfcanl_data.tile6.nc'} + deps.append(rocoto.add_dependency(dep_dict)) dependencies = rocoto.create_dependency(dep_condition='nor', dep=deps) resources = self.get_resource('getic') @@ -218,16 +265,14 @@ def getic(self): def init(self): - files = ['gfs.t@Hz.sanl', - 'gfs.t@Hz.atmanl.nemsio', - 'gfs.t@Hz.atmanl.nc', - 'atmos/gfs.t@Hz.atmanl.nc', - 'atmos/RESTART/@Y@m@d.@H0000.sfcanl_data.tile6.nc'] + atm_anl_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_ANALYSIS_TMPL"]) + atm_restart_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_RESTART_TMPL"]) deps = [] - for file in files: - dep_dict = {'type': 'data', 'data': f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/{file}'} - deps.append(rocoto.add_dependency(dep_dict)) + dep_dict = {'type': 'data', 'data': f'{atm_anl_path}/gfs.t@Hz.atmanl.nc'} + deps.append(rocoto.add_dependency(dep_dict)) + dep_dict = {'type': 'data', 'data': f'{atm_restart_path}/@Y@m@d.@H0000.sfcanl_data.tile6.nc'} + deps.append(rocoto.add_dependency(dep_dict)) dependencies = rocoto.create_dependency(dep_condition='or', dep=deps) if self.app_config.do_hpssarch: @@ -245,15 +290,19 @@ def prep(self): dump_suffix = self._base["DUMP_SUFFIX"] gfs_cyc = self._base["gfs_cyc"] dmpdir = self._base["DMPDIR"] + atm_hist_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_HISTORY_TMPL"], {'RUN': 'gdas'}) + dump_path = self._template_to_rocoto_cycstring(self._base["COM_OBSDMP_TMPL"], + {'DMPDIR': dmpdir, 'DUMP_SUFFIX': dump_suffix}) + gfs_enkf = True if self.app_config.do_hybvar and 'gfs' in self.app_config.eupd_cdumps else False deps = [] dep_dict = {'type': 'metatask', 'name': 'gdaspost', 'offset': '-06:00:00'} deps.append(rocoto.add_dependency(dep_dict)) - data = f'&ROTDIR;/gdas.@Y@m@d/@H/atmos/gdas.t@Hz.atmf009.nc' + data = f'{atm_hist_path}/gdas.t@Hz.atmf009.nc' dep_dict = {'type': 'data', 'data': data, 'offset': '-06:00:00'} deps.append(rocoto.add_dependency(dep_dict)) - data = f'{dmpdir}/{self.cdump}{dump_suffix}.@Y@m@d/@H/atmos/{self.cdump}.t@Hz.updated.status.tm00.bufr_d' + data = f'{dump_path}/{self.cdump}.t@Hz.updated.status.tm00.bufr_d' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) dependencies = rocoto.create_dependency(dep_condition='and', dep=deps) @@ -298,11 +347,14 @@ def waveprep(self): def aerosol_init(self): + input_path = self._template_to_rocoto_cycstring(self._base['COM_ATMOS_INPUT_TMPL']) + restart_path = self._template_to_rocoto_cycstring(self._base['COM_ATMOS_RESTART_TMPL']) + deps = [] # Files from current cycle files = ['gfs_ctrl.nc'] + [f'gfs_data.tile{tile}.nc' for tile in range(1, self.n_tiles + 1)] for file in files: - data = f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/atmos/INPUT/{file}' + data = f'{input_path}/{file}' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) @@ -320,7 +372,7 @@ def aerosol_init(self): [f'@Y@m@d.@H0000.fv_tracer.res.tile{tile}.nc' for tile in range(1, self.n_tiles + 1)] for file in files: - data = [f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/atmos/RERUN_RESTART/', file] + data = [f'{restart_path}', file] dep_dict = {'type': 'data', 'data': data, 'offset': [offset, None]} deps.append(rocoto.add_dependency(dep_dict)) @@ -449,11 +501,14 @@ def aeroanlinit(self): dump_suffix = self._base["DUMP_SUFFIX"] dmpdir = self._base["DMPDIR"] + atm_hist_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_HISTORY_TMPL"], {'RUN': 'gdas'}) + dump_path = self._template_to_rocoto_cycstring(self._base["COM_OBSDMP_TMPL"], + {'DMPDIR': dmpdir, 'DUMP_SUFFIX': dump_suffix}) deps = [] dep_dict = {'type': 'metatask', 'name': 'gdaspost', 'offset': '-06:00:00'} deps.append(rocoto.add_dependency(dep_dict)) - data = f'&ROTDIR;/gdas.@Y@m@d/@H/atmos/gdas.t@Hz.atmf009.nc' + data = f'{atm_hist_path}/gdas.t@Hz.atmf009.nc' dep_dict = {'type': 'data', 'data': data, 'offset': '-06:00:00'} deps.append(rocoto.add_dependency(dep_dict)) dep_dict = {'type': 'task', 'name': f'{self.cdump}prep'} @@ -492,9 +547,10 @@ def ocnanalprep(self): dump_suffix = self._base["DUMP_SUFFIX"] dmpdir = self._base["DMPDIR"] + ocean_hist_path = self._template_to_rocoto_cycstring(self._base["COM_OCEAN_HISTORY"]) deps = [] - data = f'&ROTDIR;/gdas.@Y@m@d/@H/ocean/gdas.t@Hz.ocnf009.nc' + data = f'{ocean_hist_path}/gdas.t@Hz.ocnf009.nc' dep_dict = {'type': 'data', 'data': data, 'offset': '-06:00:00'} deps.append(rocoto.add_dependency(dep_dict)) dependencies = rocoto.create_dependency(dep=deps) @@ -607,10 +663,12 @@ def _fcst_forecast_only(self): deps = [] if self.app_config.do_atm: - data = f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/atmos/INPUT/sfc_data.tile6.nc' + atm_input_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_INPUT_TMPL"]) + atm_restart_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_RESTART_TMPL"]) + data = f'{atm_input_path}/sfc_data.tile6.nc' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) - data = f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/atmos/RESTART/@Y@m@d.@H0000.sfcanl_data.tile6.nc' + data = f'{atm_restart_path}/@Y@m@d.@H0000.sfcanl_data.tile6.nc' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) dependencies.append(rocoto.create_dependency(dep_condition='or', dep=deps)) @@ -744,7 +802,8 @@ def _get_postgroups(cdump, config, add_anl=False): return grp, dep, lst deps = [] - data = f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/atmos/{self.cdump}.t@Hz.log#dep#.txt' + atm_hist_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_HISTORY_TMPL"]) + data = f'{atm_hist_path}/{self.cdump}.t@Hz.log#dep#.txt' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) dep_dict = {'type': 'task', 'name': f'{self.cdump}fcst'} @@ -773,7 +832,8 @@ def _get_postgroups(cdump, config, add_anl=False): def wavepostsbs(self): deps = [] for wave_grid in self._configs['wavepostsbs']['waveGRD'].split(): - data = f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/wave/rundata/{self.cdump}wave.out_grd.{wave_grid}.@Y@m@d.@H0000' + wave_hist_path = self._template_to_rocoto_cycstring(self._base["COM_WAVE_HISTORY_TMPL"]) + data = f'{wave_hist_path}/{self.cdump}wave.out_grd.{wave_grid}.@Y@m@d.@H0000' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) dependencies = rocoto.create_dependency(dep_condition='and', dep=deps) @@ -796,7 +856,8 @@ def wavepostbndpnt(self): def wavepostbndpntbll(self): deps = [] - data = f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/atmos/{self.cdump}.t@Hz.logf180.txt' + wave_hist_path = self._template_to_rocoto_cycstring(self._base["COM_WAVE_HISTORY_TMPL"]) + data = f'{wave_hist_path}/{self.cdump}.t@Hz.logf180.txt' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) dependencies = rocoto.create_dependency(dep=deps) @@ -873,10 +934,12 @@ def _wafs_task(self, task_name): if task_name not in ['wafs', 'wafsgcip', 'wafsgrib2', 'wafsgrib20p25']: raise KeyError(f'Invalid WAFS task: {task_name}') + wafs_path = self._template_to_rocoto_cycstring(self._base["COM_ATMOS_WAFS_TMPL"]) + deps = [] fhrlst = [6] + [*range(12, 36 + 3, 3)] for fhr in fhrlst: - data = f'&ROTDIR;/{self.cdump}.@Y@m@d/@H/atmos/{self.cdump}.t@Hz.wafs.grb2if{fhr:03d}' + data = f'{wafs_path}/{self.cdump}.t@Hz.wafs.grb2if{fhr:03d}' dep_dict = {'type': 'data', 'data': data} deps.append(rocoto.add_dependency(dep_dict)) dependencies = rocoto.create_dependency(dep_condition='and', dep=deps) diff --git a/workflow/setup_expt.py b/workflow/setup_expt.py index 6c478db46a..19b36711a5 100755 --- a/workflow/setup_expt.py +++ b/workflow/setup_expt.py @@ -73,14 +73,46 @@ def fill_COMROT_cycled(host, inputs): rdatestr = datetime_to_YMDH(inputs.idate - to_timedelta('T06H')) idatestr = datetime_to_YMDH(inputs.idate) - if inputs.start in ['warm']: # This is warm start experiment (only meaningful for atmos) - atmos_dir = med_dir = 'RESTART' - elif inputs.start in ['cold']: # This is a cold start experiment - atmos_dir = 'INPUT' - med_dir = '' # no mediator files for a "cold start" - chem_dir = '' # aerosols do not have a 'directory' + if os.path.isdir(os.path.join(inputs.icsdir, 'model_data', 'atmos')): + flat_structure = False + else: + flat_structure = True + + # Destination always uses the new COM structure + # These should match the templates defined in config.com + if inputs.start in ['warm']: + dst_atm_dir = os.path.join('model_data', 'atmos', 'restart') + dst_med_dir = os.path.join('model_data', 'med', 'restart') + else: + dst_atm_dir = os.path.join('model_data', 'atmos', 'input') + dst_med_dir = '' # no mediator files for a "cold start" do_med = False - ocean_dir = ice_dir = 'RESTART' # ocean and ice have the same filenames for warm and cold + dst_ocn_rst_dir = os.path.join('model_data', 'ocean', 'restart') + dst_ocn_anl_dir = os.path.join('model_data', 'ocean', 'analysis') + dst_ice_dir = os.path.join('model_data', 'ice', 'restart') + dst_atm_anl_dir = os.path.join('analysis', 'atmos') + + if flat_structure: + # ICs are in the old flat COM structure + if inputs.start in ['warm']: # This is warm start experiment (only meaningful for atmos) + src_atm_dir = os.path.join('atmos', 'RESTART') + src_med_dir = os.path.join('med', 'RESTART') + elif inputs.start in ['cold']: # This is a cold start experiment + src_atm_dir = os.path.join('atmos', 'INPUT') + src_med_dir = '' # no mediator files for a "cold start" + do_med = False + # ocean and ice have the same filenames for warm and cold + src_ocn_rst_dir = os.path.join('ocean', 'RESTART') + src_ocn_rst_dir = 'ocean' + src_ice_dir = os.path.join('ice', 'RESTART') + src_atm_anl_dir = 'atmos' + else: + src_atm_dir = dst_atm_dir + src_med_dir = dst_med_dir + src_ocn_rst_dir = dst_ocn_rst_dir + src_ocn_anl_dir = dst_ocn_anl_dir + src_ice_dir = dst_ice_dir + src_atm_anl_dir = dst_atm_anl_dir def link_files_from_src_to_dst(src_dir, dst_dir): files = os.listdir(src_dir) @@ -99,8 +131,8 @@ def link_files_from_src_to_dst(src_dir, dst_dir): for ii in range(1, inputs.nens + 1): memdir = f'mem{ii:03d}' # Link atmospheric files - dst_dir = os.path.join(comrot, enkfdir, memdir, 'atmos', atmos_dir) - src_dir = os.path.join(inputs.icsdir, enkfdir, memdir, 'atmos', atmos_dir) + dst_dir = os.path.join(comrot, enkfdir, memdir, dst_atm_dir) + src_dir = os.path.join(inputs.icsdir, enkfdir, memdir, src_atm_dir) makedirs_if_missing(dst_dir) link_files_from_src_to_dst(src_dir, dst_dir) # ocean, ice, etc. TBD ... @@ -112,40 +144,41 @@ def link_files_from_src_to_dst(src_dir, dst_dir): detdir = f'{inputs.cdump}.{rdatestr[:8]}/{rdatestr[8:]}' elif inputs.start in ['cold']: detdir = f'{inputs.cdump}.{idatestr[:8]}/{idatestr[8:]}' - dst_dir = os.path.join(comrot, detdir, 'atmos', atmos_dir) - src_dir = os.path.join(inputs.icsdir, detdir, 'atmos', atmos_dir) + + dst_dir = os.path.join(comrot, detdir, dst_atm_dir) + src_dir = os.path.join(inputs.icsdir, detdir, src_atm_dir) makedirs_if_missing(dst_dir) link_files_from_src_to_dst(src_dir, dst_dir) # Link ocean files if do_ocean: detdir = f'{inputs.cdump}.{rdatestr[:8]}/{rdatestr[8:]}' - dst_dir = os.path.join(comrot, detdir, 'ocean', ocean_dir) - src_dir = os.path.join(inputs.icsdir, detdir, 'ocean', ocean_dir) + dst_dir = os.path.join(comrot, detdir, dst_ocn_rst_dir) + src_dir = os.path.join(inputs.icsdir, detdir, 'ocean', src_ocn_rst_dir) makedirs_if_missing(dst_dir) link_files_from_src_to_dst(src_dir, dst_dir) # First 1/2 cycle needs a MOM6 increment incdir = f'{inputs.cdump}.{idatestr[:8]}/{idatestr[8:]}' incfile = f'{inputs.cdump}.t{idatestr[8:]}z.ocninc.nc' - src_file = os.path.join(inputs.icsdir, incdir, 'ocean', incfile) - dst_file = os.path.join(comrot, incdir, 'ocean', incfile) - makedirs_if_missing(os.path.join(comrot, incdir, 'ocean')) + src_file = os.path.join(inputs.icsdir, incdir, src_ocn_anl_dir, incfile) + dst_file = os.path.join(comrot, incdir, dst_ocn_anl_dir, incfile) + makedirs_if_missing(os.path.join(comrot, incdir, dst_ocn_anl_dir)) os.symlink(src_file, dst_file) # Link ice files if do_ice: detdir = f'{inputs.cdump}.{rdatestr[:8]}/{rdatestr[8:]}' - dst_dir = os.path.join(comrot, detdir, 'ice', ice_dir) - src_dir = os.path.join(inputs.icsdir, detdir, 'ice', ice_dir) + dst_dir = os.path.join(comrot, detdir, 'ice', dst_ice_dir) + src_dir = os.path.join(inputs.icsdir, detdir, 'ice', src_ice_dir) makedirs_if_missing(dst_dir) link_files_from_src_to_dst(src_dir, dst_dir) # Link mediator files if do_med: detdir = f'{inputs.cdump}.{rdatestr[:8]}/{rdatestr[8:]}' - dst_dir = os.path.join(comrot, detdir, 'med', med_dir) - src_dir = os.path.join(inputs.icsdir, detdir, 'med', med_dir) + dst_dir = os.path.join(comrot, detdir, 'med', dst_med_dir) + src_dir = os.path.join(inputs.icsdir, detdir, 'med', src_med_dir) makedirs_if_missing(dst_dir) link_files_from_src_to_dst(src_dir, dst_dir) @@ -162,8 +195,8 @@ def link_files_from_src_to_dst(src_dir, dst_dir): # Link bias correction and radiance diagnostics files detdir = f'{inputs.cdump}.{idatestr[:8]}/{idatestr[8:]}' - src_dir = os.path.join(inputs.icsdir, detdir, 'atmos') - dst_dir = os.path.join(comrot, detdir, 'atmos') + src_dir = os.path.join(inputs.icsdir, detdir, src_atm_anl_dir) + dst_dir = os.path.join(comrot, detdir, dst_atm_anl_dir) makedirs_if_missing(dst_dir) for ftype in ['abias', 'abias_pc', 'abias_air', 'radstat']: fname = f'{inputs.cdump}.t{idatestr[8:]}z.{ftype}'