-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GLDAS scripts & fix GLDAS job (#1018)
Absorb GLDAS scripts into global-workflow and fix GLDAS job by updating scripts to use new GLDAS fix file set. * Remove GLDAS scripts from .gitignore * Remove GLDAS script symlinks from link_workflow.sh * Add GLDAS scripts to global-workflow * Updates to GLDAS scripts, includes converting GLDAS script to replace machine checks with CFP variables * Address linter warnings and remove obsolete platforms Refs #622 #1014
- Loading branch information
1 parent
f180a54
commit a665817
Showing
12 changed files
with
785 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#! /usr/bin/env bash | ||
|
||
source "${HOMEgfs:?}/ush/preamble.sh" | ||
|
||
export RUN_ENVIR=${RUN_ENVIR:-"nco"} | ||
|
||
############################# | ||
# Source relevant config files | ||
############################# | ||
export EXPDIR=${EXPDIR:-${HOMEgfs}/parm/config} | ||
configs="base gldas" | ||
config_path=${EXPDIR:-${NWROOT}/gfs.${gfs_ver}/parm/config} | ||
for config in ${configs}; do | ||
# shellcheck disable=SC1090-SC1091 | ||
. "${config_path}/config.${config}" | ||
# shellcheck disable= | ||
status=$? | ||
[[ ${status} -ne 0 ]] && exit "${status}" | ||
done | ||
|
||
|
||
if [[ "${cyc:?}" -ne "${gldas_cyc:?}" ]]; then | ||
echo "GLDAS only runs for ${gldas_cyc} cycle; Skip GLDAS step for cycle ${cyc}" | ||
exit 0 | ||
fi | ||
|
||
gldas_spinup_hours=${gldas_spinup_hours-:72} | ||
xtime=$((gldas_spinup_hours+12)) | ||
if [[ "${CDATE}" -le "$(${NDATE:?} +"${xtime}" "${SDATE:?}")" ]]; then | ||
echo "GLDAS needs fluxes as forcing from cycles in previous ${xtime} hours" | ||
echo "starting from ${SDATE}. This gldas cycle is skipped" | ||
exit 0 | ||
fi | ||
|
||
########################################## | ||
# Source machine runtime environment | ||
########################################## | ||
# shellcheck disable=SC1090-SC1091 | ||
. "${HOMEgfs}/env/${machine:?}.env" gldas | ||
# shellcheck disable= | ||
status=$? | ||
[[ ${status} -ne 0 ]] && exit "${status}" | ||
|
||
|
||
############################################## | ||
# Obtain unique process id (pid) and make temp directory | ||
############################################## | ||
export pid=${pid:-$$} | ||
export outid=${outid:-"LL${job}"} | ||
|
||
export DATA=${DATA:-${DATAROOT}/${jobid:?}} | ||
mkdir -p "${DATA}" | ||
cd "${DATA}" || exit 1 | ||
|
||
|
||
############################################## | ||
# Run setpdy and initialize PDY variables | ||
############################################## | ||
export cycle="t${cyc}z" | ||
setpdy.sh | ||
# shellcheck disable=SC1091 | ||
. ./PDY | ||
# shellcheck disable= | ||
|
||
|
||
############################################## | ||
# Determine Job Output Name on System | ||
############################################## | ||
export pgmout="OUTPUT.${pid}" | ||
export pgmerr=errfile | ||
|
||
|
||
############################################## | ||
# Set variables used in the exglobal script | ||
############################################## | ||
export CDATE=${CDATE:-${PDY}${cyc}} | ||
export CDUMP=${CDUMP:-${RUN:-"gdas"}} | ||
export COMPONENT=${COMPONENT:-atmos} | ||
|
||
|
||
############################################## | ||
# Begin JOB SPECIFIC work | ||
############################################## | ||
export gldas_ver=${gldas_ver:-v2.3.0} | ||
export HOMEgldas=${HOMEgldas:-${HOMEgfs}} | ||
export FIXgldas=${FIXgldas:-${HOMEgldas}/fix/fix_gldas} | ||
export PARMgldas=${PARMgldas:-${HOMEgldas}/parm/gldas} | ||
export EXECgldas=${EXECgldas:-${HOMEgldas}/exec} | ||
export USHgldas=${USHgldas:-${HOMEgldas}/ush} | ||
export PARA_CONFIG=${HOMEgfs}/parm/config/config.gldas | ||
|
||
if [[ "${RUN_ENVIR}" = "nco" ]]; then | ||
export COMIN=${COMIN:-${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT}} | ||
export COMOUT=${COMOUT:-${ROTDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT}} | ||
else | ||
export COMIN="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}" | ||
export COMOUT="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}" | ||
fi | ||
if [[ ! -d ${COMOUT} ]]; then | ||
mkdir -p "${COMOUT}" | ||
chmod 775 "${COMOUT}" | ||
fi | ||
|
||
export COMINgdas=${COMINgdas:-${ROTDIR}} | ||
export DCOMIN=${DCOMIN:-${DCOMROOT:-"/lfs/h1/ops/prod/dcom"}} | ||
|
||
export model=${model:-noah} | ||
export MODEL=${MODEL:-"${model} |tr 'a-z' 'A-Z'"} | ||
|
||
|
||
############################################################### | ||
# Run relevant exglobal script | ||
|
||
${GLDASSH:-${HOMEgldas}/scripts/exgdas_atmos_gldas.sh} | ||
status=$? | ||
[[ ${status} -ne 0 ]] && exit "${status}" | ||
|
||
############################################## | ||
# End JOB SPECIFIC work | ||
############################################## | ||
|
||
############################################## | ||
# Final processing | ||
############################################## | ||
if [[ -e "${pgmout}" ]] ; then | ||
cat "${pgmout}" | ||
fi | ||
|
||
########################################## | ||
# Remove the Temporary working directory | ||
########################################## | ||
cd "${DATAROOT}" || exit 1 | ||
[[ ${KEEPDATA:?} = "NO" ]] && rm -rf "${DATA}" | ||
|
||
exit 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.