Skip to content
Merged
Changes from all commits
Commits
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
38 changes: 14 additions & 24 deletions dev/scripts/exglobal_atmos_analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ if [[ "${GENDIAG}" == "YES" ]]; then
fi
# Make the gsidiags directory to house the GSI diagnostic data
GSIDIAGDIR=${GSIDIAGDIR:-"${pCOMOUT_ATMOS_ANALYSIS}/gsidiags"}
rm -rf "${GSIDIAGDIR}"
mkdir -p "${GSIDIAGDIR}"
fi

##############################################################
Expand Down Expand Up @@ -670,6 +672,18 @@ if [[ "${USE_SELECT}" == "YES" ]]; then
fi
fi

# If diags are to be generated, create the gsi.* directories in GSIDIAGDIR and link them here.
# This will allow the GSI to write directly to the GSIDIAGDIR.
if [[ "${GENDIAG}" == "YES" ]]; then
# The number of directories is controlled by the number of tasks
# (one each + 1, though the last will contain no data)
for task in $(seq 0 "${ntasks}"); do
dir="dir.$(printf %04d "${task}")"
mkdir -p "${GSIDIAGDIR}/${dir}"
${NLN} "${GSIDIAGDIR}/${dir}" "./${dir}"
done
fi

##############################################################
# If requested, copy and de-tar guess radstat file
if [[ "${USE_RADSTAT}" == "YES" ]]; then
Expand Down Expand Up @@ -907,30 +921,6 @@ fi

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

if [[ "${GENDIAG}" == "YES" ]]; then
# 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
fi

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

exit "${err}"
Loading