Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
def4c7c
Add the dataroot_com_path function
DavidHuber-NOAA Jan 27, 2026
4c2db27
Declare on separate lines from command
DavidHuber-NOAA Jan 27, 2026
eceab9a
Merge branch 'develop' into feature/dataroot_util
DavidHuber-NOAA Jan 27, 2026
4074fb7
Use DATAROOT for gsidiags
DavidHuber-NOAA Jan 27, 2026
96e799b
Merge remote-tracking branch 'emc/develop' into feature/rework_diags
DavidHuber-NOAA Jan 27, 2026
9b3dc89
Fix tyop in GENDIAG boolean
DavidHuber-NOAA Jan 28, 2026
784c76f
Use comroot instead of rotdir
DavidHuber-NOAA Jan 28, 2026
745f717
Merge remote-tracking branch 'emc/develop' into feature/dataroot_util
DavidHuber-NOAA Jan 28, 2026
4da84f5
Merge branch 'feature/dataroot_util' into feature/rework_diags
DavidHuber-NOAA Jan 28, 2026
8dcbe68
Fix typos
DavidHuber-NOAA Jan 28, 2026
eb82e50
Merge develop, resolve conflicts
DavidHuber-NOAA Jan 28, 2026
5e9d5d6
Follow symbolic links
DavidHuber-NOAA Jan 28, 2026
3a75c98
Move diagnostic output after releasing the forecast
DavidHuber-NOAA Jan 28, 2026
23f8314
Merge branch 'develop' into feature/rework_diags
DavidHuber-NOAA Jan 28, 2026
14459e1
Address shellcheck issues
DavidHuber-NOAA Jan 28, 2026
97a9f7d
Merge branch 'feature/rework_diags' of github.com:davidhuber-noaa/glo…
DavidHuber-NOAA Jan 28, 2026
a281071
Merge remote-tracking branch 'emc/develop' into feature/rework_diags
DavidHuber-NOAA Jan 30, 2026
d75e347
Fix eobs and make diag variable names more consistent
DavidHuber-NOAA Jan 30, 2026
888b0ed
Ignore sc2153 message for COM variable
DavidHuber-NOAA Jan 30, 2026
8dbcd60
Ignore shellcheck 2153
DavidHuber-NOAA Jan 30, 2026
d19ffbf
Merge remote-tracking branch 'emc/develop' into feature/rework_diags
DavidHuber-NOAA Feb 2, 2026
c1eac3f
Add missing pCOMIN declaration
DavidHuber-NOAA Feb 4, 2026
aa68737
Fix find order
DavidHuber-NOAA Feb 4, 2026
83ac49e
Merge branch 'develop' into feature/rework_diags
DavidHuber-NOAA Feb 4, 2026
14ec6c1
Merge branch 'develop' into feature/rework_diags
DavidHuber-NOAA Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions dev/jobs/JGLOBAL_ATMOS_ANALYSIS
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
MEMDIR='ensstat' RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
COMIN_ATMOS_HISTORY_ENS_PREV:COM_ATMOS_HISTORY_TMPL

# shellcheck disable=SC2153
mkdir -p "${COMOUT_ATMOS_ANALYSIS}"

export ATMGES="${COMIN_ATMOS_HISTORY_PREV}/${GPREFIX}atm.f006.nc"
Expand All @@ -45,6 +46,14 @@ if [[ ! -f "${ATMGES}" ]]; then
err_exit "FILE MISSING: ATMGES == ${ATMGES}"
fi

export GENDIAG="${GENDIAG:-YES}"

# Create a DATAROOT directory variable for the gsidiags if GENDIAG is YES
if [[ "${GENDIAG}" == "YES" ]]; then
pCOMOUT_ATMOS_ANALYSIS="$(dataroot_com_path "${COMOUT_ATMOS_ANALYSIS}")"
export pCOMOUT_ATMOS_ANALYSIS
fi

# Get LEVS
export LEVS
LEVS=$(${NCLEN} "${ATMGES}" pfull) && true
Expand Down
5 changes: 5 additions & 0 deletions dev/jobs/JGLOBAL_ATMOS_ANALYSIS_DIAG
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMOUT_ATMOS_ANALYSIS:COM_ATMOS_ANALYSIS_TMPL
mkdir -m 775 -p "${COMOUT_ATMOS_ANALYSIS}"

# Create a DATAROOT directory variable where the gsidiags live
# shellcheck disable=SC2153
pCOMIN_ATMOS_ANALYSIS="$(dataroot_com_path "${COMIN_ATMOS_ANALYSIS}")"
export pCOMIN_ATMOS_ANALYSIS

###############################################################
# Run relevant script
${ANALDIAGSH:-${SCRgfs}/exglobal_diag.sh} && true
Expand Down
5 changes: 5 additions & 0 deletions dev/jobs/JGLOBAL_ENKF_DIAG
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ MEMDIR="ensstat" YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMIN_ATMOS_ANALYSIS:COM_ATMOS_ANALYSIS_TMPL \
COMOUT_ATMOS_ANALYSIS:COM_ATMOS_ANALYSIS_TMPL

# Create a DATAROOT directory variable where the gsidiags live
# shellcheck disable=SC2153
pCOMIN_ATMOS_ANALYSIS="$(dataroot_com_path "${COMIN_ATMOS_ANALYSIS}")"
export pCOMIN_ATMOS_ANALYSIS

#RUN=${GDUMP} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
# COMIN_OBS_PREV:COM_OBS_TMPL \
# COMIN_ATMOS_ANALYSIS_DET_PREV:COM_ATMOS_ANALYSIS_TMPL
Expand Down
10 changes: 10 additions & 0 deletions dev/jobs/JGLOBAL_ENKF_SELECT_OBS
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ RUN=${RUN/enkf/} YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMIN_OBS:COM_OBS_TMPL
MEMDIR='ensstat' YMD=${PDY} HH=${cyc} declare_from_tmpl -rx \
COMOUT_ATMOS_ANALYSIS:COM_ATMOS_ANALYSIS_TMPL
# shellcheck disable=SC2153
declare -rx COMOUT_ATMOS_ANALYSIS_ENS="${COMOUT_ATMOS_ANALYSIS}"

RUN=${RUN/enkf/} YMD=${PDY} HH=${cyc} declare_from_tmpl -r \
Expand All @@ -40,6 +41,7 @@ MEMDIR='ensstat' RUN=${GDUMP_ENS} YMD=${gPDY} HH=${gcyc} declare_from_tmpl -rx \
RUN="${GDUMP}" YMD=${gPDY} HH=${gcyc} declare_from_tmpl -r \
COMIN_ATMOS_ANALYSIS_DET_PREV:COM_ATMOS_ANALYSIS_TMPL

# shellcheck disable=SC2153
mkdir -p "${COMOUT_ATMOS_ANALYSIS}"

export ATMGES_ENSMEAN="${COMIN_ATMOS_HISTORY_PREV}/${GPREFIX}${GSUFFIX}atm.f006.nc"
Expand All @@ -48,6 +50,14 @@ if [[ ! -f ${ATMGES_ENSMEAN} ]]; then
err_exit "FILE MISSING: ATMGES_ENSMEAN == ${ATMGES_ENSMEAN}"
fi

export GENDIAG="${GENDIAG:-YES}"

# Create a DATAROOT directory variable for the gsidiags if GENDIAG is YES
if [[ "${GENDIAG}" == "YES" ]]; then
pCOMOUT_ATMOS_ANALYSIS="$(dataroot_com_path "${COMOUT_ATMOS_ANALYSIS}")"
export pCOMOUT_ATMOS_ANALYSIS
fi

LEVS=$(${NCLEN} "${ATMGES}" pfull) && true
export err=$?
set_strict
Expand Down
41 changes: 32 additions & 9 deletions dev/scripts/exglobal_atmos_analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,16 @@ else
echo "not using correlated obs error"
fi

# If GENDIAG is selected, verify that pCOMOUT_ATMOS_ANALYSIS is set
if [[ "${GENDIAG}" == "YES" ]]; then
if [[ -z "${pCOMOUT_ATMOS_ANALYSIS}" ]]; then
export err=1
err_exit "pCOMOUT_ATMOS_ANALYSIS must be set when GENDIAG=YES"
fi
# Make the gsidiags directory to house the GSI diagnostic data
GSIDIAGDIR=${GSIDIAGDIR:-"${pCOMOUT_ATMOS_ANALYSIS}/gsidiags"}
fi

##############################################################
# CRTM Spectral and Transmittance coefficients
mkdir -p crtm_coeffs
Expand Down Expand Up @@ -895,19 +905,32 @@ if [[ "${SENDECF}" == "YES" && "${RUN}" != "enkf" ]]; then
ecflow_client --event release_fcst
fi

# Diagnostic files
# if requested, GSI diagnostic file directories for use later
echo "${rCDUMP} ${PDY}${cyc} atminc done at $(date)" > "${COMOUT_ATMOS_ANALYSIS}/${APREFIX}increment.done.txt"

if [[ "${GENDIAG}" == "YES" ]]; then
Comment thread
DavidHuber-NOAA marked this conversation as resolved.
Comment thread
DavidHuber-NOAA marked this conversation as resolved.
tar -cvf gsidiags.tar dir.????
export err=$?
if [[ ${err} -ne 0 ]]; then
err_exit "Failed to tar GSI diagnostic directories!"
# Move the gsidiags dir.* directories to pCOMOUT_ATMOS_ANALYSIS for diagnostic jobs
# First, check that the directories exist (we need at least one, so stop after the first match)
count_dirs=$(find . -maxdepth 1 -type d -name 'dir.????' -printf "." -quit | wc -c)
if [[ ${count_dirs:-0} -gt 0 ]]; then
mkdir -p "${GSIDIAGDIR}"
err=$?

if [[ ! -d "${GSIDIAGDIR}" || ${err} -ne 0 ]]; then
err_exit "Failed to create gsidiags directory at ${GSIDIAGDIR}"
fi

for dir in dir.????; do
mv "${dir}" "${GSIDIAGDIR}/"
export err=$?
if [[ ${err} -ne 0 ]]; then
err_exit "Failed to move ${dir} to ${GSIDIAGDIR}/"
fi
done
else
echo "WARNING: No gsidiags dir.* directories found to move."
fi
cpfs gsidiags.tar "${COMOUT_ATMOS_ANALYSIS}/${APREFIX}gsidiags${DIAG_SUFFIX:-}.tar"
fi

echo "${rCDUMP} ${PDY}${cyc} atminc done at $(date)" > "${COMOUT_ATMOS_ANALYSIS}/${APREFIX}increment.done.txt"

################################################################################

exit "${err}"
32 changes: 24 additions & 8 deletions dev/scripts/exglobal_diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rm -f "${RADSTAT}" "${PCPSTAT}" "${CNVSTAT}" "${OZNSTAT}"

# Obs diag
GENDIAG=${GENDIAG:-"YES"}
Comment thread
DavidHuber-NOAA marked this conversation as resolved.
GSIDIAG=${GSIDIAG:-"${COMIN_ATMOS_ANALYSIS}/${APREFIX}gsidiags${DIAG_SUFFIX:-}.tar"}
GSIDIAGDIR=${GSIDIAGDIR:-"${pCOMIN_ATMOS_ANALYSIS}/gsidiags"}
USE_BUILD_GSINFO=${USE_BUILD_GSINFO:-"NO"}
DIAG_COMPRESS=${DIAG_COMPRESS:-"YES"}
if [[ "${DIAG_COMPRESS:-}" == "YES" ]]; then
Expand All @@ -55,15 +55,30 @@ if [[ "${GENDIAG}" != "YES" ]]; then
exit 0
fi

# Check that the gsidiags directory exists
if [[ ! -d "${GSIDIAGDIR}" ]]; then
export err=1
err_exit "gsidiags directory ${GSIDIAGDIR} does not exist"
fi

################################################################################
# Copy gsidiags.tar file from COMIN to DATA and untar
cpreq "${GSIDIAG}" ./gsidiags.tar
tar -xvf gsidiags.tar
export err=$?
if [[ ${err} -ne 0 ]]; then
err_exit "Unable to unpack gsidiags.tar file!"
# Link to the gsidiags directory if it is populated
count_dirs=$(find "${GSIDIAGDIR}" -maxdepth 1 -type d -name "dir.*" | wc -l)
if [[ ${count_dirs} -eq 0 ]]; then
export err=1
err_exit "No gsidiags directories found in ${GSIDIAGDIR}"
Comment thread
DavidHuber-NOAA marked this conversation as resolved.
fi

# Continue if there is at least one file to process
# Note -quit stops find after the first match
count_files=$(find "${GSIDIAGDIR}"/dir.* -maxdepth 1 -type f -printf '.' -quit | wc -c)
if [[ ${count_files} -eq 0 ]]; then
echo "WARNING: No diagnostic files found to process!"
exit 0
fi

${NLN} "${GSIDIAGDIR}/"dir.* .
Comment thread
DavidHuber-NOAA marked this conversation as resolved.

# Set up lists and variables for various types of diagnostic files.
ntype=3

Expand Down Expand Up @@ -153,7 +168,8 @@ for loop in ${loops}; do
if [[ "${dtype}" == *"avhrr"* ]]; then # recast dtype in avhrr form
dtype="avhrr${dtype##avhrr[23]}"
fi
count=$(find ./ -path "./dir.*/${dtype}_${loop}*" -type f -printf "." | wc -c)
# -L to follow symlinks, as dir.* are symlinks to gsidiags/dir.*
count=$(find -L ./dir.* -path "./dir.*/${dtype}_${loop}*" -type f -printf "." | wc -c)
if [[ ${count} -eq 0 ]]; then
continue
fi
Expand Down
Loading