From 40b93f281dfbd0a3f3aae575801c2ab7081f4171 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Mon, 25 Jan 2021 21:14:56 +0000 Subject: [PATCH 1/9] Adding new job file for python graphics. --- jobs/JREGIONAL_RUN_PYTHON_GRAPHICS | 118 +++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 jobs/JREGIONAL_RUN_PYTHON_GRAPHICS diff --git a/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS b/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS new file mode 100755 index 000000000..8d73d6720 --- /dev/null +++ b/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS @@ -0,0 +1,118 @@ +#!/bin/bash + +# +#----------------------------------------------------------------------- +# +# This script runs the post-processor (UPP) on the NetCDF output files +# of the write component of the FV3-LAM model. +# +#----------------------------------------------------------------------- +# + +# +#----------------------------------------------------------------------- +# +# 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 + +mkdir_vrfy -p "${run_dir}" +# +#----------------------------------------------------------------------- +# +# Call the ex-script for this J-job and pass to it the necessary varia- +# bles. +# +#----------------------------------------------------------------------- +# +python ${PYTHON_GRAPHICS_DIR}/create_graphics.py \ + skewts \ + -d ${post_dir} \ + -f 0 ${FCST_LEN_HRS} \ + --file_tmpl "RRFS_CONUS.t${CDATE:8:2}z.bgrd3df{FCST_TIME:03d}.tm${CDATE:8:2}.grib2" + --file_type nat \ + --max_plev 100 \ + -n ${SLURM_CPUS_ON_NODE:-12} \ + -o ${run_dir} \ + -s ${CDATE} \ + --sites ${PYSCRIPTS}/static/conus_raobs.txt \ + -z ${run_dir}/skewt || +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 + From f2a13698d552215472382b8222033af7d189aad6 Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Mon, 25 Jan 2021 21:26:06 +0000 Subject: [PATCH 2/9] Adding XML task for Python SkewTs. --- jobs/JREGIONAL_RUN_PYTHON_GRAPHICS | 2 +- ush/setup.sh | 21 +++++++++++++++++++++ ush/templates/FV3LAM_wflow.xml | 29 ++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS b/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS index 8d73d6720..19d5c7be1 100755 --- a/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS +++ b/jobs/JREGIONAL_RUN_PYTHON_GRAPHICS @@ -81,7 +81,7 @@ mkdir_vrfy -p "${run_dir}" #----------------------------------------------------------------------- # python ${PYTHON_GRAPHICS_DIR}/create_graphics.py \ - skewts \ + ${GRAPHICS_TYPE} \ -d ${post_dir} \ -f 0 ${FCST_LEN_HRS} \ --file_tmpl "RRFS_CONUS.t${CDATE:8:2}z.bgrd3df{FCST_TIME:03d}.tm${CDATE:8:2}.grib2" diff --git a/ush/setup.sh b/ush/setup.sh index c27e0ad03..9dab50adb 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 e35388434..fbbc28f0d 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_default_tag }}>&QUEUE_FCST;&GRAPHICS_PARTITION;"> @@ -481,6 +481,33 @@ MODULES_RUN_TASK_FP script. {% endif %} + + + + + &RSRV_GRAPHICS; + &WALL_LIMIT_GRAPHICS; + + {{ wtime_run_fcst }} + 1:ppn=1 + --exclusive + python_@H_skewt + &LOGDIR;/python_skewt.log + + &LOAD_MODULES_RUN_TASK_FP; "run_graphics" "&JOBSDIR;/JREGIONAL_RUN_PYTHON_GRAPHICS" + + CDATE@Y@m@d@H + SLASH_ENSMEM_SUBDIR{{ slash_ensmem_subdir }} + GRAPHICS_TYPEskewts + + + &DATAROOT;/@Y@m@d@H/postprd/wrfnat_hrconus_00.grib2 + + + - + &RSRV_GRAPHICS; &WALL_LIMIT_GRAPHICS;