Skip to content

Commit

Permalink
Resolve ENKF archive script bugs (#2065)
Browse files Browse the repository at this point in the history
Fix two bugs in the exgdas_enkf_earc.sh script:

1) Replace ARCH_LIST with DATA to match changes done in PR #2000
and update path to generated archive list files.
2) Add status check and exit after script attempts to make tarball on HPSS.

Refs #2064
  • Loading branch information
KateFriedman-NOAA committed Nov 15, 2023
1 parent 42d7f2f commit 4e3d82b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions scripts/exgdas_enkf_earc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@ source "${HOMEgfs}/ush/preamble.sh"
export n=$((10#${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}
EARCICS_CYC=$((ARCH_CYC-assim_freq))
if [ "${EARCICS_CYC}" -lt 0 ]; then
EARCICS_CYC=$((EARCICS_CYC+24))
fi

[[ -d ${ARCH_LIST} ]] && rm -rf "${ARCH_LIST}"
mkdir -p "${ARCH_LIST}"
cd "${ARCH_LIST}" || exit 2

"${HOMEgfs}/ush/hpssarch_gen.sh" "${RUN}"
status=$?
if [ "${status}" -ne 0 ]; then
Expand Down Expand Up @@ -66,15 +60,15 @@ if (( 10#${ENSGRP} > 0 )) && [[ ${HPSSARCH} = "YES" || ${LOCALARCH} = "YES" ]];

if [ "${PDY}${cyc}" -gt "${SDATE}" ]; then # Don't run for first half cycle

${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${RUN}_grp${ENSGRP}.tar" $(cat "${ARCH_LIST}/${RUN}_grp${n}.txt")
${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${RUN}_grp${ENSGRP}.tar" $(cat "${DATA}/${RUN}_grp${n}.txt")
status=$?
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}/${PDY}${cyc}/${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 "${DATA}/${RUN}_restarta_grp${n}.txt")
status=$?
if [ "${status}" -ne 0 ]; then
echo "FATAL ERROR: ${TARCMD} ${PDY}${cyc} ${RUN}_restarta_grp${ENSGRP}.tar failed"
Expand All @@ -83,7 +77,7 @@ if (( 10#${ENSGRP} > 0 )) && [[ ${HPSSARCH} = "YES" || ${LOCALARCH} = "YES" ]];
fi

if [ "${SAVEWARMICB}" = "YES" ] && [ "${cyc}" -eq "${EARCICS_CYC}" ]; then
${TARCMD} -P -cvf "${ATARDIR}/${PDY}${cyc}/${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 "${DATA}/${RUN}_restartb_grp${n}.txt")
status=$?
if [ "${status}" -ne 0 ]; then
echo "FATAL ERROR: ${TARCMD} ${PDY}${cyc} ${RUN}_restartb_grp${ENSGRP}.tar failed"
Expand Down Expand Up @@ -122,12 +116,16 @@ if [ "${ENSGRP}" -eq 0 ]; then
break
fi
fi
done < "${ARCH_LIST}/${RUN}.txt"
done < "${DATA}/${RUN}.txt"

# Create the tarball
tar_fl=${ATARDIR}/${PDY}${cyc}/${RUN}.tar
${TARCMD} -P -cvf "${tar_fl}" $(cat "${ARCH_LIST}/${RUN}.txt")
${TARCMD} -P -cvf "${tar_fl}" $(cat "${DATA}/${RUN}.txt")
status=$?
if [[ "${status}" -ne 0 ]]; then
echo "FATAL ERROR: Tarring of ${tar_fl} failed"
exit "${status}"
fi

# If rstprod was found, change the group of the tarball
if [[ "${has_rstprod}" == "YES" ]]; then
Expand Down

0 comments on commit 4e3d82b

Please sign in to comment.