From 26bacc0c7010913e6e6a9de5186a4c7b28c5adcf Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Tue, 28 Nov 2023 02:22:30 -0600 Subject: [PATCH] Make proper j-job for MET+ Creates a proper j-job for the metp job, moving much of the material from the `jobs/rocoto` script there (some of it within `jjob_header`). Also updates the old `COMIN` variable for the COM refactor (although it does not appear used in the verify scripts currently). This is a partial step towards restoring/improving metp functionality and remains untested. Refs #1575 --- jobs/JGFS_ATMOS_VERIFICATION | 43 ++++++++++++++++++ jobs/rocoto/metp.sh | 88 ++---------------------------------- 2 files changed, 47 insertions(+), 84 deletions(-) create mode 100644 jobs/JGFS_ATMOS_VERIFICATION diff --git a/jobs/JGFS_ATMOS_VERIFICATION b/jobs/JGFS_ATMOS_VERIFICATION new file mode 100644 index 0000000000..85f01a53e2 --- /dev/null +++ b/jobs/JGFS_ATMOS_VERIFICATION @@ -0,0 +1,43 @@ +#! /usr/bin/env bash + +source "${HOMEgfs}/ush/preamble.sh" +source "${HOMEgfs}/ush/jjob_header.sh" -e "metp" -c "base metp" + +############################################################### +## Abstract: +## Inline METplus verification and diagnostics driver script +## HOMEgfs : /full/path/to/workflow +## EXPDIR : /full/path/to/config/files +## CDATE : current analysis date (YYYYMMDDHH) +## CDUMP : cycle name (gdas / gfs) +## PDY : current date (YYYYMMDD) +## cyc : current cycle (HH) +## SDATE_GFS : first date of GFS cycle (YYYYMMDDHHMM) +## METPCASE : METplus verification use case (g2g1 | g2o1 | pcp1) +############################################################### + +# TODO: This should not be permitted as DATAROOT is set at the job-card level. +# TODO: DATAROOT is being used as DATA in metp jobs. This should be rectified in metp. +# TODO: The temporary directory is DATA and is created at the top of the J-Job. +# TODO: remove this line +export DATAROOT=${DATA} + +VDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} - ${VRFYBACK_HRS} hours") +export VDATE + +# Since this is currently a one-element list, shellcheck things we would rather run this as a command +# shellcheck disable=SC2041 +for grid in '1p00'; do + prod_dir="COM_ATMOS_GRIB_${grid}" + GRID=${grid} YMD=${PDY} HH=${cyc} generate_com -rx "${prod_dir}:COM_ATMOS_GRIB_GRID_TMPL" +done + +# TODO: If none of these are on, why are we running this job? +if [[ "${RUN_GRID2GRID_STEP1}" == "YES" || "${RUN_GRID2OBS_STEP1}" == "YES" || "${RUN_PRECIP_STEP1}" == "YES" ]]; then + ${VERIF_GLOBALSH} + status=$? + if (( status != 0 )); then exit "${status}"; fi +fi + +if [[ ${KEEPDATA:-"NO"} = "NO" ]] ; then rm -rf "${DATAROOT}" ; fi # TODO: This should be $DATA + diff --git a/jobs/rocoto/metp.sh b/jobs/rocoto/metp.sh index 95ff2d0f4d..2bf833c1d6 100755 --- a/jobs/rocoto/metp.sh +++ b/jobs/rocoto/metp.sh @@ -3,93 +3,13 @@ source "${HOMEgfs}/ush/preamble.sh" ############################################################### -## Abstract: -## Inline METplus verification and diagnostics driver script -## HOMEgfs : /full/path/to/workflow -## EXPDIR : /full/path/to/config/files -## CDATE : current analysis date (YYYYMMDDHH) -## CDUMP : cycle name (gdas / gfs) -## PDY : current date (YYYYMMDD) -## cyc : current cycle (HH) -## SDATE_GFS : first date of GFS cycle (YYYYMMDDHHMM) -## METPCASE : METplus verification use case (g2g1 | g2o1 | pcp1) -############################################################### - -############################################################### -echo -echo "=============== START TO SOURCE FV3GFS WORKFLOW MODULES ===============" -. ${HOMEgfs}/ush/load_fv3gfs_modules.sh +source "${HOMEgfs}/ush/load_fv3gfs_modules.sh" status=$? -[[ ${status} -ne 0 ]] && exit ${status} +if (( status != 0 )); then exit "${status}"; fi export job="metp${METPCASE}" export jobid="${job}.$$" -############################################## -# make temp directory -############################################## -export DATA=${DATA:-${DATAROOT}/${jobid}} -mkdir -p ${DATA} -cd ${DATA} - - -############################################## -# Run setpdy and initialize PDY variables -############################################## -export cycle="t${cyc}z" -setpdy.sh -. ./PDY - -############################################################### -echo -echo "=============== START TO SOURCE RELEVANT CONFIGS ===============" -configs="base metp" -for config in ${configs}; do - . ${EXPDIR}/config.${config} - status=$? - [[ ${status} -ne 0 ]] && exit ${status} -done - - -############################################################### -echo -echo "=============== START TO SOURCE MACHINE RUNTIME ENVIRONMENT ===============" -. ${BASE_ENV}/${machine}.env metp -status=$? -[[ ${status} -ne 0 ]] && exit ${status} - -############################################################### -export COMPONENT="atmos" -export VDATE="$(echo $(${NDATE} -${VRFYBACK_HRS} ${CDATE}) | cut -c1-8)" -export COMIN="${ROTDIR}/${CDUMP}.${PDY}/${cyc}/${COMPONENT}" - -# TODO: This should not be permitted as DATAROOT is set at the job-card level. -# TODO: DATAROOT is being used as DATA in metp jobs. This should be rectified in metp. -# TODO: The temporary directory is DATA and is created at the top of the J-Job. -# TODO: remove this line -export DATAROOT=${DATA} - -############################################################### -echo -echo "=============== START TO RUN METPLUS VERIFICATION ===============" -if [ ${CDUMP} = "gfs" ]; then - - if [ ${RUN_GRID2GRID_STEP1} = "YES" -o ${RUN_GRID2OBS_STEP1} = "YES" -o ${RUN_PRECIP_STEP1} = "YES" ]; then - - ${VERIF_GLOBALSH} - status=$? - [[ ${status} -ne 0 ]] && exit ${status} - [[ ${status} -eq 0 ]] && echo "Succesfully ran ${VERIF_GLOBALSH}" - fi -fi - - -if [ ${CDUMP} = "gdas" ]; then - echo "METplus verification currently not supported for CDUMP=${CDUMP}" -fi -############################################################### -# Force Exit out cleanly -if [ ${KEEPDATA:-"NO"} = "NO" ] ; then rm -rf ${DATAROOT} ; fi # TODO: This should be $DATA - +"${HOMEgfs}/jobs/JGFS_ATMOS_VERIFICATION" -exit 0 +exit $?