Skip to content

Commit

Permalink
Further cleanup of monitor scripts
Browse files Browse the repository at this point in the history
- Address reviewer comments and further clean up the monitor scripts.
- Remove use of PDATE and replace with PDY and cyc variables.
- Move settings from JJOB scripts to configs.

Refs NOAA-EMC#1925
  • Loading branch information
KateFriedman-NOAA committed Nov 28, 2023
1 parent 3f90e29 commit 054cb39
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 241 deletions.
44 changes: 5 additions & 39 deletions jobs/JGDAS_ATMOS_VERFOZN
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@
source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "verfozn" -c "base verfozn"

export OZNMON_SUFFIX=${OZNMON_SUFFIX:-${NET}}

#---------------------------------------------
# Specify Execution Areas
#
export HOMEgfs_ozn=${HOMEgfs:-${NWROOT}/gfs.${gfs_ver}}
export HOMEgdas_ozn=${HOMEgfs_ozn:-${NWROOT}/gfs.${gfs_ver}}
export PARMgdas_ozn=${PARMgfs_ozn:-${HOMEgfs_ozn}/parm/mon}
export SCRgdas_ozn=${SCRgfs_ozn:-${HOMEgfs_ozn}/scripts}
export FIXgdas_ozn=${FIXgfs_ozn:-${HOMEgfs_ozn}/fix/mon}

export HOMEoznmon=${HOMEoznmon:-${HOMEgfs_ozn}}
export EXECoznmon=${EXECoznmon:-${HOMEoznmon}/exec}
export FIXoznmon=${FIXoznmon:-${HOMEoznmon}/fix}
export USHoznmon=${USHoznmon:-${HOMEoznmon}/ush}

#############################################
# determine PDY and cyc for previous cycle
#############################################
Expand All @@ -35,37 +19,19 @@ export gcyc=${GDATE:8:2}
YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS
YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_OZNMON

export oznstat="${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.oznstat"
export TANKverf_ozn=${TANKverf_ozn:-${COM_ATMOS_OZNMON}}

if [[ ! -d ${TANKverf_ozn} ]]; then mkdir -p -m 775 ${TANKverf_ozn} ; fi

#-----------------------------------
# Other variables
#
export OZN_AREA=${OZN_AREA:-glb}
export oznstat=${oznstat:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.oznstat}
export SATYPE_FILE=${SATYPE_FILE:-${FIXgdas_ozn}/gdas_oznmon_satype.txt}
export PDATE=${PDY}${cyc}
export DO_DATA_RPT=${DO_DATA_RPT:-1}

#-----------------------------------
# source the parm file
#
. ${PARMgdas_ozn}/gdas_oznmon.parm

#---------------------------------------
# Set up validation file
#
if [[ ${VALIDATE_DATA} -eq 1 ]]; then
export ozn_val_file=${ozn_val_file:-${FIXgdas_ozn}/gdas_oznmon_base.tar}
fi

#-------------------------------------------------------
# Execute the script.
#
${OZNMONSH:-${SCRgdas_ozn}/exgdas_atmos_verfozn.sh} ${PDY} ${cyc}
"${SCRgfs}/exgdas_atmos_verfozn.sh"
err=$?
[[ ${err} -ne 0 ]] && exit ${err}
if (( err != 0 )); then
exit "${err}"
fi


################################
Expand Down
45 changes: 4 additions & 41 deletions jobs/JGDAS_ATMOS_VERFRAD
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,10 @@
source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "verfrad" -c "base verfrad"

##############################################
# Specify Execution Areas
##############################################
export HOMEgfs=${HOMEgfs:-${NWROOT}/gfs.${gfs_ver}}
export SCRgfs=${SCRgfs:-${HOMEgfs}/scripts}

export FIXgdas=${FIXgdas:-${HOMEgfs}/fix/mon}
export PARMmon=${PARMmon:-${HOMEgfs}/parm/mon}

export HOMEradmon=${HOMEradmon:-${HOMEgfs}}
export EXECradmon=${EXECradmon:-${HOMEradmon}/exec}
export FIXradmon=${FIXradmon:-${FIXgfs}}
export USHradmon=${USHradmon:-${HOMEradmon}/ush}

###################################
# source the parm file
###################################
parm_file=${parm_file:-${PARMmon}/da_mon.parm}
. ${parm_file}

#############################################
# determine PDY and cyc for previous cycle
#############################################
GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}")
GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${assim_freq} hours")
export gPDY=${GDATE:0:8}
export gcyc=${GDATE:8:2}

Expand All @@ -41,34 +21,17 @@ YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS
YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_RADMON
YMD=${gPDY} HH=${gcyc} generate_com -rx COM_ATMOS_RADMON_PREV:COM_ATMOS_RADMON_TMPL

export biascr="${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.abias"
export radstat="${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.radstat"
export TANKverf_rad=${TANKverf_rad:-${COM_ATMOS_RADMON}}
export TANKverf_radM1=${TANKverf_radM1:-${COM_ATMOS_RADMON_PREV}}

if [[ ! -d ${TANKverf_rad} ]]; then mkdir -p -m 775 ${TANKverf_rad} ; fi
if [[ ! -d ${TANKverf_radM1} ]]; then mkdir -p -m 775 ${TANKverf_radM1} ; fi

#############################################
# Filenames
export biascr=${biascr:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.abias}
export radstat=${radstat:-${COM_ATMOS_ANALYSIS}/gdas.t${cyc}z.radstat}
export satype_file=${satype_file:-${FIXgdas}/gdas_radmon_satype.txt}

# Other variables
export RAD_AREA=${RAD_AREA:-glb}
export MAKE_CTL=${MAKE_CTL:-1}
export MAKE_DATA=${MAKE_DATA:-1}
export USE_ANL=${USE_ANL:-1}
export PDATE=${PDY}${cyc}
export DO_DIAG_RPT=${DO_DIAG_RPT:-1}
export DO_DATA_RPT=${DO_DATA_RPT:-1}

export RADMON_SUFFIX=${RADMON_SUFFIX:-${RUN}}
export CYCLE_INTERVAL=${assim_freq:-6}
export VERBOSE=${VERBOSE:-YES}

########################################################
# Execute the script.
${RADMONSH:-${SCRgfs}/exgdas_atmos_verfrad.sh} ${PDY} ${cyc}
"${SCRgfs}/exgdas_atmos_verfrad.sh"
err=$?
if (( err != 0 )); then
exit "${err}"
Expand Down
30 changes: 6 additions & 24 deletions jobs/JGLOBAL_ATMOS_VMINMON
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@
source "${HOMEgfs}/ush/preamble.sh"
source "${HOMEgfs}/ush/jjob_header.sh" -e "vminmon" -c "base vminmon"

##############################################
# Specify Package Areas
##############################################
export M_FIX=${M_FIX:-${HOMEgfs}/fix/mon}
export SCRgfs=${SCRgfs:-${HOMEgfs}/scripts}
export USHgfs=${USHgfs:-${HOMEgfs}/ush}

#############################################
# Determine PDY and cyc for previous cycle
#############################################
GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}")
GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${assim_freq} hours")
export gPDY=${GDATE:0:8}
export gcyc=${GDATE:8:2}

Expand All @@ -27,31 +20,20 @@ YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS
YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_MINMON
YMD=${gPDY} HH=${gcyc} generate_com -rx COM_ATMOS_MINMON_PREV:COM_ATMOS_MINMON_TMPL

export gsistat="${COM_ATMOS_ANALYSIS}/${RUN}.t${cyc}z.gsistat"
export M_TANKverf=${M_TANKverf:-${COM_ATMOS_MINMON}}
export M_TANKverfM1=${M_TANKverfM1:-${COM_ATMOS_MINMON_PREV}}

if [[ ! -d ${M_TANKverf} ]]; then mkdir -p -m 775 ${M_TANKverf} ; fi
if [[ ! -d ${M_TANKverfM1} ]]; then mkdir -p -m 775 ${M_TANKverfM1} ; fi

########################################
# Set necessary environment variables
########################################
export MINMON_SUFFIX=${MINMON_SUFFIX:-${NET}}
export CYCLE_INTERVAL=${assim_freq}

########################################
# Filenames
########################################
export gsistat=${gsistat:-${COM_ATMOS_ANALYSIS}/${RUN}.t${cyc}z.gsistat}
export mm_gnormfile=${gnormfile:-${M_FIX}/${RUN}_minmon_gnorm.txt}
export mm_costfile=${costfile:-${M_FIX}/${RUN}_minmon_cost.txt}

########################################################
# Execute the script.
"${GMONSH:-${SCRgfs}/exglobal_atmos_vminmon.sh}"
"${SCRgfs}/exglobal_atmos_vminmon.sh"
err=$?
[[ ${err} -ne 0 ]] && exit ${err}

if (( err != 0 )); then
exit "${err}"
fi

################################
# Remove the Working Directory
Expand Down
15 changes: 15 additions & 0 deletions parm/config/gfs/config.verfozn
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,19 @@ echo "BEGIN: config.verfozn"
# Get task specific resources
. "${EXPDIR}/config.resources" verfozn

export DO_DATA_RPT=1
export OZN_AREA="glb"
export OZNMON_SUFFIX=${NET}
export PARMmonitor=${PARMgfs}/monitor
export SATYPE_FILE=${PARMmonitor}/gdas_oznmon_satype.txt

# Source the parm file
export parm_file=${PARMmonitor}/gdas_oznmon.parm
. "${parm_file}"

# Set up validation file
if [[ ${VALIDATE_DATA} -eq 1 ]]; then
export ozn_val_file=${PARMmonitor}/gdas_oznmon_base.tar
fi

echo "END: config.verfozn"
19 changes: 19 additions & 0 deletions parm/config/gfs/config.verfrad
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,23 @@ echo "BEGIN: config.verfrad"
# Get task specific resources
. "${EXPDIR}/config.resources" verfrad

export PARMmonitor=${PARMgfs}/monitor
export satype_file=${PARMmonitor}/gdas_radmon_satype.txt

# Source the parm file
export parm_file=${PARMmonitor}/da_mon.parm
. "${parm_file}"

# Other variables
export RAD_AREA="glb"
export MAKE_CTL=1
export MAKE_DATA=1
export USE_ANL=1
export DO_DIAG_RPT=1
export DO_DATA_RPT=1

export RADMON_SUFFIX=${RUN}
export CYCLE_INTERVAL=${assim_freq:-6}
export VERBOSE="YES"

echo "END: config.verfrad"
7 changes: 7 additions & 0 deletions parm/config/gfs/config.vminmon
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ echo "BEGIN: config.vminmon"
# Get task specific resources
. "${EXPDIR}/config.resources" vminmon

export MINMON_SUFFIX=${MINMON_SUFFIX:-${NET}}
export CYCLE_INTERVAL=${assim_freq:-6}

export PARMmonitor=${PARMgfs}/monitor
export mm_gnormfile=${PARMmonitor}/${RUN}_minmon_gnorm.txt
export mm_costfile=${PARMmonitor}/${RUN}_minmon_cost.txt

echo "END: config.vminmon"
10 changes: 5 additions & 5 deletions scripts/exgdas_atmos_verfozn.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env bash

source "$HOMEgfs/ush/preamble.sh"
source "${HOMEgfs}/ush/preamble.sh"

################################################################################
# exgdas_atmos_verfozn.sh
Expand All @@ -21,10 +21,10 @@ if [[ -s ${oznstat} ]]; then
# Untar oznstat file.
#------------------------------------------------------------------

$NCP $oznstat ./oznstat.$PDATE
$NCP $oznstat ./oznstat.${PDY}${cyc}

tar -xvf oznstat.$PDATE
rm oznstat.$PDATE
tar -xvf oznstat.${PDY}${cyc}
rm oznstat.${PDY}${cyc}

netcdf=0
count=$(ls diag* | grep ".nc4" | wc -l)
Expand All @@ -38,7 +38,7 @@ if [[ -s ${oznstat} ]]; then

export OZNMON_NETCDF=${netcdf}

${HOMEoznmon}/ush/ozn_xtrct.sh
${USHgfs}/ozn_xtrct.sh
err=$?

else
Expand Down
34 changes: 17 additions & 17 deletions scripts/exgdas_atmos_verfrad.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env bash

source "$HOMEgfs/ush/preamble.sh"
source "${HOMEgfs}/ush/preamble.sh"

################################################################################
#### UNIX Script Documentation Block
Expand Down Expand Up @@ -29,11 +29,11 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then
# Untar radstat file.
#------------------------------------------------------------------

$NCP $biascr ./biascr.$PDATE
$NCP $radstat ./radstat.$PDATE
$NCP $biascr ./biascr.${PDY}${cyc}
$NCP $radstat ./radstat.${PDY}${cyc}

tar -xvf radstat.$PDATE
rm radstat.$PDATE
tar -xvf radstat.${PDY}${cyc}
rm radstat.${PDY}${cyc}

#------------------------------------------------------------------
# SATYPE is the list of expected satellite/instrument sources
Expand Down Expand Up @@ -92,23 +92,23 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then

for type in ${SATYPE}; do

if [[ netcdf -eq 0 && -e diag_${type}_ges.${PDATE}.nc4.${Z} ]]; then
if [[ netcdf -eq 0 && -e diag_${type}_ges.${PDY}${cyc}.nc4.${Z} ]]; then
netcdf=1
fi

if [[ $(find . -maxdepth 1 -type f -name "diag_${type}_ges.${PDATE}*.${Z}" | wc -l) -gt 0 ]]; then
mv diag_${type}_ges.${PDATE}*.${Z} ${type}.${Z}
if [[ $(find . -maxdepth 1 -type f -name "diag_${type}_ges.${PDY}${cyc}*.${Z}" | wc -l) -gt 0 ]]; then
mv diag_${type}_ges.${PDY}${cyc}*.${Z} ${type}.${Z}
${UNCOMPRESS} ./${type}.${Z}
else
echo "WARNING: diag_${type}_ges.${PDATE}*.${Z} not available, skipping"
echo "WARNING: diag_${type}_ges.${PDY}${cyc}*.${Z} not available, skipping"
fi

if [[ $USE_ANL -eq 1 ]]; then
if [[ $(find . -maxdepth 1 -type f -name "diag_${type}_anl.${PDATE}*.${Z}" | wc -l) -gt 0 ]]; then
mv diag_${type}_anl.${PDATE}*.${Z} ${type}_anl.${Z}
if [[ $(find . -maxdepth 1 -type f -name "diag_${type}_anl.${PDY}${cyc}*.${Z}" | wc -l) -gt 0 ]]; then
mv diag_${type}_anl.${PDY}${cyc}*.${Z} ${type}_anl.${Z}
${UNCOMPRESS} ./${type}_anl.${Z}
else
echo "WARNING: diag_${type}_anl.${PDATE}*.${Z} not available, skipping"
echo "WARNING: diag_${type}_anl.${PDY}${cyc}*.${Z} not available, skipping"
fi
fi
done
Expand All @@ -117,18 +117,18 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then


#------------------------------------------------------------------
# Run the child sccripts.
# Run the child scripts.
#------------------------------------------------------------------
${USHradmon}/radmon_verf_angle.sh ${PDATE}
${USHgfs}/radmon_verf_angle.sh
rc_angle=$?

${USHradmon}/radmon_verf_bcoef.sh ${PDATE}
${USHgfs}/radmon_verf_bcoef.sh
rc_bcoef=$?

${USHradmon}/radmon_verf_bcor.sh "${PDATE}"
${USHgfs}/radmon_verf_bcor.sh
rc_bcor=$?

${USHradmon}/radmon_verf_time.sh "${PDATE}"
${USHgfs}/radmon_verf_time.sh
rc_time=$?

#--------------------------------------
Expand Down
Loading

0 comments on commit 054cb39

Please sign in to comment.