Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make proper j-job for METplus #2090

Merged
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
43 changes: 43 additions & 0 deletions jobs/JGFS_ATMOS_VERIFICATION
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +35 to +40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do away with the if-block check now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I added the TODO. Will come back to it later.


if [[ ${KEEPDATA:-"NO"} = "NO" ]] ; then rm -rf "${DATAROOT}" ; fi # TODO: This should be $DATA

88 changes: 4 additions & 84 deletions jobs/rocoto/metp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?