Skip to content
Merged
Show file tree
Hide file tree
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
154 changes: 154 additions & 0 deletions jobs/JREGIONAL_RUN_PYTHON_GRAPHICS
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
#!/bin/bash

#
#-----------------------------------------------------------------------
#
# This script runs the adb_graphics create_graphics driver for creating
# PNG figures and zipping them for dissemination to the web.
#
#-----------------------------------------------------------------------
#

#
#-----------------------------------------------------------------------
#
# Source the variable definitions file and the bash utility functions.
#
#-----------------------------------------------------------------------
#
. ${GLOBAL_VAR_DEFNS_FP}
. $USHDIR/source_util_funcs.sh
#
#-----------------------------------------------------------------------
#
# Save current shell options (in a global array). Then set new options
# for this script/function.
#
#-----------------------------------------------------------------------
#
{ save_shell_opts; set -u -x; } > /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 the post-processor (UPP)
on the output files corresponding to a specified forecast hour.
========================================================================"
#
#-----------------------------------------------------------------------
#
# Set the run directory and post directories.
#
#-----------------------------------------------------------------------
#

if [ "${RUN_ENVIR}" = "nco" ]; then
COMOUT="${COMOUT_BASEDIR}/$RUN.$PDY/$cyc${SLASH_ENSMEM_SUBDIR}"
postprd_dir="$COMOUT"
run_dir="${COMOUT}/pyprd"
else
postprd_dir="${run_dir}/postprd"
run_dir="${CYCLE_DIR}${SLASH_ENSMEM_SUBDIR}/pyprd"
fi

# Choose an appropriate sites file for the grid
if [[ ${PREDEF_GRID_NAME} =~ CONUS ]] ; then
sites_file=conus_raobs.txt
elif [[ ${PREDEF_GRID_NAME} =~ AK ]] ; then
sites_file=alaska_raobs.txt
else
print_err_msg_exit "\
Choice of sites file is ambiguous. Please help."
fi

# Choose the appropriate file template for graphics type

case ${GRAPHICS_TYPE} in

"maps")

file_tmpl="${NET}.${CDATE:8:2}z.bgdawpf{FCST_TIME:03d}.tm${CDATE:8:2}.grib2"
file_type=prs
extra_args="\
--tiles all
--images ${PYTHON_GRAPHICS_DIR}/image_lists/rrfs_subset.yml hourly"
;;

"skewts")

file_tmpl="${NET}.t${CDATE:8:2}z.bgrd3df{FCST_TIME:03d}.tm00.grib2"
file_type=nat
extra_args="\
--sites ${PYTHON_GRAPHICS_DIR}/static/${sites_file}\
--max_plev 100"
;;

*)
print_err_msg_exit "\
GRAPHICS_TYPE \"${GRAPHICS_TYPE}\" is not recognized."
;;
esac
mkdir_vrfy -p "${run_dir}"
#
#-----------------------------------------------------------------------
#
# Call the graphics driver script.
#
#-----------------------------------------------------------------------
#
cd_vrfy ${PYTHON_GRAPHICS_DIR}
python -u ${PYTHON_GRAPHICS_DIR}/create_graphics.py \
${GRAPHICS_TYPE} \
-d ${postprd_dir} \
-f 0 ${FCST_LEN_HRS} \
--file_tmpl ${file_tmpl} \
--file_type ${file_type} \
-n ${SLURM_CPUS_ON_NODE:-12} \
-o ${run_dir} \
-s ${CDATE} \
-z ${run_dir}/skewt \
${extra_args} ||
print_err_msg_exit "\
Call to pyscript \"${scrfunc_fn}\" failed."
#
#-----------------------------------------------------------------------
#
# Print exit message.
#
#-----------------------------------------------------------------------
#
print_info_msg "
========================================================================
Exiting script: \"${scrfunc_fn}\"
In directory: \"${scrfunc_dir}\"
========================================================================"
#
#-----------------------------------------------------------------------
#
# Restore the shell options saved at the beginning of this script/func-
# tion.
#
#-----------------------------------------------------------------------
#
{ restore_shell_opts; } > /dev/null 2>&1

10 changes: 10 additions & 0 deletions modulefiles/tasks/jet/run_graphics.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#%Module

module purge

module use -a /contrib/miniconda3/modulefiles
module load miniconda3

system "set +u"
system "source activate pygraf"
system "set -u"
2 changes: 1 addition & 1 deletion ush/set_extrn_mdl_params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local func_name="${FUNCNAME[0]}"
#
#-----------------------------------------------------------------------
#
if [[ "${RUN_ENVIR}" = "nco" && ! -z ${COMINgfs} ]]; then
if [[ "${RUN_ENVIR}" == "nco" && ! -z ${COMINgfs} ]]; then

EXTRN_MDL_SYSBASEDIR_ICS="$COMINgfs"

Expand Down
21 changes: 21 additions & 0 deletions ush/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,26 @@ Please clone the external repository containing the code in this directory,
build the executable, and then rerun the workflow."
fi
#
# Get the base directory of the Python Graphics code.
#
external_name="python_graphics"
PYTHON_GRAPHICS_DIR=$( \
get_manage_externals_config_property \
"${mng_extrns_cfg_fn}" "${external_name}" "${property_name}" ) || \
print_err_msg_exit "\
Call to function get_manage_externals_config_property failed."

PYTHON_GRAPHICS_DIR="${SR_WX_APP_TOP_DIR}/${PYTHON_GRAPHICS_DIR}"
if [ ! -d "${PYTHON_GRAPHICS_DIR}" ]; then
print_err_msg_exit "
The base directory in which the Python Graphics source code should be located
(PYTHON_GRAPHICS_DIR) does not exist:
PYTHON_GRAPHICS_DIR = \"${PYTHON_GRAPHICS_DIR}\"
Please clone the external repository containing the code in this directory,
build the executable, and then rerun the workflow."
fi
#
#
#-----------------------------------------------------------------------
#
# Make sure that USE_CUSTOM_POST_CONFIG_FILE is set to a valid value.
Expand Down Expand Up @@ -2363,6 +2383,7 @@ UFS_UTILS_DIR="${UFS_UTILS_DIR}"
SFC_CLIMO_INPUT_DIR="${SFC_CLIMO_INPUT_DIR}"
TOPO_DIR="${TOPO_DIR}"
EMC_POST_DIR="${EMC_POST_DIR}"
PYTHON_GRAPHICS_DIR="${PYTHON_GRAPHICS_DIR}"

ARCHIVEDIR="${ARCHIVEDIR}"
NCARG_ROOT="${NCARG_ROOT}"
Expand Down
32 changes: 31 additions & 1 deletion ush/templates/FV3LAM_wflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ tasks other than GET_EXTRN_ICS_TN, GET_EXTRN_LBCS_TN, and RUN_FCST_TN;
the "HPSS" type is used for the GET_EXTRN_ICS_TN and GET_EXTRN_LBCS_TN
tasks; and the "FCST" type is used for the RUN_FCST_TN task.
-->

{%- if partition_default is not none %}
<!ENTITY RSRV_DEFAULT "<account>&ACCOUNT;</account><queue>&QUEUE_DEFAULT;</queue><partition>{{ partition_default }}</partition>">
{%- else %}
Expand All @@ -86,6 +85,7 @@ tasks; and the "FCST" type is used for the RUN_FCST_TN task.
{%- else %}
<!ENTITY RSRV_FCST "<account>&ACCOUNT;</account><queue>&QUEUE_FCST;</queue>">
{%- endif %}
<!ENTITY RSRV_GRAPHICS "<account>&ACCOUNT;</account><queue>&QUEUE_FCST;</queue><partition>kjet,xjet</partition>">

<!ENTITY DEADLINE_PRE "16:00:00">
<!ENTITY DEADLINE_FCST "23:30:00">
Expand Down Expand Up @@ -481,6 +481,36 @@ MODULES_RUN_TASK_FP script.
</metatask>
{% endif %}

<!--
************************************************************************
************************************************************************
-->

<task name="python_skewt" cycledefs="forecast" maxtries="{{ maxtries_run_post }}">

&RSRV_GRAPHICS;
&WALL_LIMIT_GRAPHICS;

<walltime>{{ wtime_run_fcst }}</walltime>
<nodes>1:ppn=24</nodes>
<native>--exclusive</native>
<jobname><cyclestr>python_@H_skewt</cyclestr></jobname>
<join><cyclestr>&LOGDIR;/python_skewt.log</cyclestr></join>

<command>&LOAD_MODULES_RUN_TASK_FP; "run_graphics" "&JOBSDIR;/JREGIONAL_RUN_PYTHON_GRAPHICS"</command>

<envar><name>GLOBAL_VAR_DEFNS_FP</name><value>&GLOBAL_VAR_DEFNS_FP;</value></envar>
<envar><name>PDY</name><value><cyclestr>@Y@m@d</cyclestr></value></envar>
<envar><name>cyc</name><value><cyclestr>@H</cyclestr></value></envar>
<envar><name>CDATE</name><value><cyclestr>@Y@m@d@H</cyclestr></value></envar>
<envar><name>SLASH_ENSMEM_SUBDIR</name><value><cyclestr>{{ slash_ensmem_subdir }}</cyclestr></value></envar>
<envar><name>GRAPHICS_TYPE</name><value>skewts</value></envar>

<dependency>
<taskdep task="&RUN_POST_TN;_f000"/>
</dependency>
</task>

<!--
************************************************************************
************************************************************************
Expand Down