diff --git a/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS b/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS new file mode 100755 index 000000000..638449040 --- /dev/null +++ b/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS @@ -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 + diff --git a/modulefiles/tasks/jet/run_graphics.local b/modulefiles/tasks/jet/run_graphics.local new file mode 100644 index 000000000..542cc7f45 --- /dev/null +++ b/modulefiles/tasks/jet/run_graphics.local @@ -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" diff --git a/ush/set_extrn_mdl_params.sh b/ush/set_extrn_mdl_params.sh index faef47ec3..0ba15b6cf 100644 --- a/ush/set_extrn_mdl_params.sh +++ b/ush/set_extrn_mdl_params.sh @@ -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" diff --git a/ush/setup.sh b/ush/setup.sh index 609c825ad..aab89d32e 100755 --- a/ush/setup.sh +++ b/ush/setup.sh @@ -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. @@ -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}" diff --git a/ush/templates/FV3LAM_wflow.xml b/ush/templates/FV3LAM_wflow.xml index ff5a9761c..afb538309 100644 --- a/ush/templates/FV3LAM_wflow.xml +++ b/ush/templates/FV3LAM_wflow.xml @@ -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 %} &ACCOUNT;&QUEUE_DEFAULT;{{ partition_default }}"> {%- else %} @@ -86,6 +85,7 @@ tasks; and the "FCST" type is used for the RUN_FCST_TN task. {%- else %} &ACCOUNT;&QUEUE_FCST;"> {%- endif %} +&ACCOUNT;&QUEUE_FCST;kjet,xjet"> @@ -481,6 +481,36 @@ MODULES_RUN_TASK_FP script. {% endif %} + + + + + &RSRV_GRAPHICS; + &WALL_LIMIT_GRAPHICS; + + {{ wtime_run_fcst }} + 1:ppn=24 + --exclusive + python_@H_skewt + &LOGDIR;/python_skewt.log + + &LOAD_MODULES_RUN_TASK_FP; "run_graphics" "&JOBSDIR;/JREGIONAL_RUN_PYTHON_GRAPHICS" + + GLOBAL_VAR_DEFNS_FP&GLOBAL_VAR_DEFNS_FP; + PDY@Y@m@d + cyc@H + CDATE@Y@m@d@H + SLASH_ENSMEM_SUBDIR{{ slash_ensmem_subdir }} + GRAPHICS_TYPEskewts + + + + + +