Skip to content

Commit

Permalink
Add prepstart task.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabdi-noaa committed Mar 9, 2023
1 parent ff6f103 commit ce24266
Show file tree
Hide file tree
Showing 3 changed files with 1,197 additions and 0 deletions.
116 changes: 116 additions & 0 deletions jobs/JREGIONAL_RUN_PREPSTART
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash

#
#-----------------------------------------------------------------------
#
# This J-JOB script stages initial and boundary conditions for
# the analysis and model of the cycle it is running. The initial
# could come from external model or previous cycles forecast.
# The boundary could come from previous many cycles.
#
#-----------------------------------------------------------------------

#
#-----------------------------------------------------------------------
#
# Source the variable definitions file and the bash utility functions.
#
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task "task_run_prepstart" ${GLOBAL_VAR_DEFNS_FP}
. $USHdir/job_preamble.sh "TRUE"
#
#-----------------------------------------------------------------------
#
# Save current shell options (in a global array). Then set new options
# for this script/function.
#
#-----------------------------------------------------------------------
#
{ save_shell_opts; . $USHdir/preamble.sh; } > /dev/null 2>&1
#
#-----------------------------------------------------------------------
#
# Get the full path to the file in which this script/function is located
# (scrfunc_fp), the name of that file (scrfunc_fn), and the directory in
# which the file is located (scrfunc_dir).
#
#-----------------------------------------------------------------------
#
scrfunc_fp=$( readlink -f "${BASH_SOURCE[0]}" )
scrfunc_fn=$( basename "${scrfunc_fp}" )
scrfunc_dir=$( dirname "${scrfunc_fp}" )
#
#-----------------------------------------------------------------------
#
# Print message indicating entry into script.
#
#-----------------------------------------------------------------------
#
print_info_msg "
========================================================================
Entering script: \"${scrfunc_fn}\"
In directory: \"${scrfunc_dir}\"
This is the J-job script for the task that runs a analysis with FV3 for
the specified cycle.
========================================================================"
#
#-----------------------------------------------------------------------
#
# Create the working directory under the cycle directory.
# CYCLE_TYPE is to indicate which type of cycle this job for:
# spinup: this job is for spin-up cycles
# others(prod): this job is for product cycle
#
#-----------------------------------------------------------------------
#
CYCLE_TYPE=${CYCLE_TYPE:-prod}
CYCLE_SUBTYPE=${CYCLE_SUBTYPE:-empty}

# Use the forecast INPUT directory as working directory
if [ "${RUN_ENVIR}" = "nco" ]; then
DATA=$DATAROOT/${TAG}run_fcst_${CYCLE_TYPE}${dot_ensmem/./_}.${share_pid}
else
DATA=${COMIN}${SLASH_ENSMEM_SUBDIR}
fi

if [ ${CYCLE_TYPE} == "spinup" ]; then
DATA="${DATA}/fcst_fv3lam_spinup/INPUT"
if [ ${DO_ENSINIT} == "TRUE" ] && [ ${CYCLE_SUBTYPE} == "ensinit" ]; then
DATA="${DATA}/fcst_fv3lam_ensinit/INPUT"
fi
else
DATA="${DATA}/fcst_fv3lam/INPUT"
fi

mkdir_vrfy -p ${DATA}
cd_vrfy ${DATA}
#
#
#-----------------------------------------------------------------------
#
# Call the ex-script for this J-job and pass to it the necessary varia-
# bles.
#
#-----------------------------------------------------------------------
#
$SCRIPTSdir/exregional_run_prepstart.sh || print_err_msg_exit "\
Call to ex-script corresponding to J-job \"${scrfunc_fn}\" failed."
#
#-----------------------------------------------------------------------
#
# Run job postamble.
#
#-----------------------------------------------------------------------
#
job_postamble
#
#-----------------------------------------------------------------------
#
# Restore the shell options saved at the beginning of this script/func-
# tion.
#
#-----------------------------------------------------------------------
#
{ restore_shell_opts; } > /dev/null 2>&1
Loading

0 comments on commit ce24266

Please sign in to comment.