3 ##########################################################################
5 # Script Name: met_grid_anl_verf.ksh
7 # Author: J.Wolff & M.Harrold
13 # This script runs the MET/Grid-Stat to verify gridded model output
14 # against gridded precipitation analyses.
16 # START_TIME = The cycle time to use for the initial time.
17 # FCST_TIME_LIST = The three-digit forecasts that is to be verified.
18 # ACCUM_TIME = The two-digit accumulation time: 03 or 24.
19 # DOMAIN_LIST = A list of domains to be verified.
20 # MET_EXE_ROOT = The full path of the MET executables.
21 # MET_CONFIG = The full path of the MET configuration files.
22 # UTIL_EXEC = The full path of the UPP executables.
23 # MOAD_DATAROOT = Top-level data directory of WRF output.
24 # ANL_OBS_DIR = Directory containing observations to be used.
25 # CLIMO_FILE_DIR = Directory containing climo files to be used.
26 # MODEL = The model being evaluated.
28 ##########################################################################
31 SCRIPT=met_grid_anl_verf.ksh
33 # Set path for manual testing of script
34 #export CONSTANT=/scratch4/BMC/gmtb/harrold/gmtb-tierIII/bin/constants.ksh
36 # Make sure ${CONSTANT} exists
37 if [ ! -x "${CONSTANT}" ]; then
38 ${ECHO} "ERROR: ${CONSTANT} does not exist or is not executable"
42 # Read constants into the current shell
45 # Vars used for manual testing of the script
46 #export START_TIME=2016012200
47 #export FCST_TIME="000"
48 #export RES_LIST="0p25"
49 #export GRID_VX_LIST="G3"
50 #export MET_EXE_ROOT=/scratch4/BMC/dtc/MET/met-5.1/bin
51 #export MET_CONFIG=/scratch4/BMC/gmtb/harrold/gmtb-tierIII/parm/met_config
52 #export UTIL_EXEC=/scratch4/BMC/gmtb/gmtb-tierIII/util
53 #export MOAD_DATAROOT=/scratch4/BMC/gmtb/gmtb-tierIII/OUTPUT/prtutornems_0p25/DOMAINS/2016012200
54 #export ROTDIR=/scratch4/BMC/gmtb/gmtb-tierIII/prtutornems_0p25/DOMAINS/2016012200
55 #export ANL_OBS_DIR=/scratch4/BMC/gmtb/gmtb-tierIII/vx_data/analyses/gfs_0p25
56 #export CLIMO_FILE_DIR=/scratch4/NCEPDEV/global/save/Fanglin.Yang/VRFY/vsdb/nwprod/fix
59 # Print run parameters
61 ${ECHO} "${SCRIPT} started at `${DATE}`"
63 ${ECHO} " START_TIME = ${START_TIME}"
64 ${ECHO} " FCST_TIME = ${FCST_TIME}"
65 ${ECHO} " RES_LIST = ${RES_LIST}"
66 ${ECHO} " GRID_VX_LIST = ${GRID_VX_LIST}"
67 ${ECHO} " MET_EXE_ROOT = ${MET_EXE_ROOT}"
68 ${ECHO} " MET_CONFIG = ${MET_CONFIG}"
69 ${ECHO} " UTIL_EXEC = ${UTIL_EXEC}"
70 ${ECHO} " MOAD_DATAROOT = ${MOAD_DATAROOT}"
71 ${ECHO} " ROTDIR = ${ROTDIR}"
72 ${ECHO} " ANL_OBS_DIR = ${ANL_OBS_DIR}"
73 ${ECHO} " MODEL = ${MODEL}"
75 # Make sure $MOAD_DATAROOT exists
76 if [ ! -d "${MOAD_DATAROOT}" ]; then
77 ${ECHO} "MOAD_DATAROOT, ${MOAD_DATAROOT} does not exist; will create it now!"
78 ${MKDIR} -p ${MOAD_DATAROOT}
81 # Make sure ROTDIR exists
82 if [ ! -d "${ROTDIR}" ]; then
83 ${ECHO} "ERROR: ROTDIR, ${ROTDIR} does not exist"
87 # Make sure RAW_OBS directory exists
88 if [ ! -d ${ANL_OBS_DIR} ]; then
89 ${ECHO} "ERROR: ANL_OBS_DIR, ${ANL_OBS_DIR}, does not exist!"
93 # Go to working directory
94 workdir=${MOAD_DATAROOT}/metprd
95 ${MKDIR} -p ${workdir}
101 ${ECHO} "MODEL=${MODEL}"
102 ${ECHO} "VERSION=${VERSION}"
103 ${ECHO} "FCST_TIME=${FCST_TIME}"
105 # Loop through the domain list
106 for RES in ${RES_LIST}; do
111 for GRID_VX in ${GRID_VX_LIST}; do
112 GRID_VX_NUM=`${ECHO} ${GRID_VX} | cut -c2-`
113 typeset -Z3 GRID_VX_NUM
114 GRID_VX_FORMAT="G${GRID_VX_NUM}"
117 export GRID_VX_FORMAT
119 # Specify mask directory structure
120 MASKS=${MET_CONFIG}/masks
123 # Specify the MET Grid-Stat configuration file(s) to be used
124 GS_CONFIG_LIST="${MET_CONFIG}/GridStatConfig_AC_REGRID"
126 # Compute the verification date
127 VDATE=`${UTIL_EXEC}/ndate +${FCST_TIME} ${START_TIME}`
128 VYYYYMMDD=`${ECHO} ${VDATE} | ${CUT} -c1-8`
129 VMMDD=`${ECHO} ${VDATE} | ${CUT} -c5-8`
130 VHH=`${ECHO} ${VDATE} | ${CUT} -c9-10`
131 ${ECHO} 'valid time for ' ${FCST_TIME} 'h forecast = ' ${VDATE}
133 # Get the forecast to verify
134 FCST_FILE=${ROTDIR}/pgrbq${FCST_TIME}.gfs.${START_TIME}.grib2
135 ${ECHO} "FCST_FILE: ${FCST_FILE}"
137 if [ ! -e ${FCST_FILE} ]; then
138 ${ECHO} "ERROR: Could not find UPP output file: ${FCST_FILE}"
142 # Get obs/analysis file to verify with
143 ANL_OBS_FILE=`${LS} ${ANL_OBS_DIR}/${VYYYYMMDD}${VHH}/gfs.t${VHH}z.pgrb2.0p25.anl | head -1`
144 ${ECHO} "ANL_OBS_FILE: ${ANL_OBS_FILE}"
146 if [ ! -e ${ANL_OBS_FILE} ]; then
147 ${ECHO} "ERROR: Could not find observation file: ${ANL_OBS_FILE}"
151 # Get climo mean file
152 CLIMO_MEAN_FILE=`${LS} ${CLIMO_FILE_DIR}/cmean_1d.1959${VMMDD} | head -1`
153 ${ECHO} "CLIMO_MEAN_FILE: ${CLIMO_MEAN_FILE}"
155 if [ ! -e ${CLIMO_MEAN_FILE} ]; then
156 ${ECHO} "ERROR: Could not find observation file: ${CLIMO_MEAN_FILE}"
160 export CLIMO_MEAN_FILE
162 #######################################################################
164 #######################################################################
166 for CONFIG_FILE in ${GS_CONFIG_LIST}; do
168 # Make sure the Grid-Stat configuration file exists
169 if [ ! -e ${CONFIG_FILE} ]; then
170 ${ECHO} "ERROR: ${CONFIG_FILE} does not exist!"
174 ${ECHO} "CALLING: ${MET_EXE_ROOT}/grid_stat ${FCST_FILE} ${ANL_OBS_FILE} ${CONFIG_FILE} -outdir . -v 2"
176 ${MET_EXE_ROOT}/grid_stat \
184 if [ ${error} -ne 0 ]; then
185 ${ECHO} "ERROR: For ${MODEL}, ${MET_EXE_ROOT}/grid_stat crashed Exit status: ${error}"
194 ##########################################################################
196 ${ECHO} "${SCRIPT} completed at `${DATE}`"