Note
Go to the end to download the full example code.
PairStat: Basic Use Case
met_tool_wrapper/PairStat/PairStat.conf
Scientific Objective
Compare hourly forecasts for temperature, u-, and v-wind components to observations in a 3-hour observation window. Generate statistics of the results.
Datasets
METplus Components
This use case utilizes the METplus PairStat wrapper to search for files that are valid at a given run time and generate a command to run the MET tool pair_stat if all required files are found.
METplus Workflow
PairStat is the only tool called in this example. It processes the following run times:
METplus Configuration
parm/use_cases/met_tool_wrapper/PairStat/PairStat.conf
[config]
# Documentation for this use case can be found at
# https://metplus.readthedocs.io/en/latest/generated/met_tool_wrapper/PairStat/PairStat.html
# For additional information, please see the METplus Users Guide.
# https://metplus.readthedocs.io/en/latest/Users_Guide
###
# Processes to run
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#process-list
###
PROCESS_LIST = PairStat
###
# Time Info
# LOOP_BY options are INIT, VALID, RETRO, and REALTIME
# If set to INIT or RETRO:
# INIT_TIME_FMT, INIT_BEG, INIT_END, and INIT_INCREMENT must also be set
# If set to VALID or REALTIME:
# VALID_TIME_FMT, VALID_BEG, VALID_END, and VALID_INCREMENT must also be set
# LEAD_SEQ is the list of forecast leads to process
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#timing-control
###
LOOP_BY = VALID
VALID_TIME_FMT = %Y%m%d%H
VALID_BEG = 2007033112
VALID_END = 2007033112
VALID_INCREMENT = 1H
LEAD_SEQ = 36
###
# File I/O
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#directory-and-filename-template-info
###
PAIR_STAT_PAIRS_INPUT_DIR = {INPUT_BASE}/met_test/out/point_stat
PAIR_STAT_PAIRS_INPUT_TEMPLATE = point_stat_{lead?fmt=%H%M%S}L_{valid?fmt=%Y%m%d_%H%M%S}V_mpr.txt
#PAIR_STAT_OFFSETS = 0
PAIR_STAT_OUTPUT_DIR = {OUTPUT_BASE}/pair_stat
PAIR_STAT_OUTPUT_TEMPLATE = {valid?fmt=%Y%m%d_%H}_out
#PAIR_STAT_CLIMO_MEAN_INPUT_DIR =
#PAIR_STAT_CLIMO_MEAN_INPUT_TEMPLATE =
#PAIR_STAT_CLIMO_STDEV_INPUT_DIR =
#PAIR_STAT_CLIMO_STDEV_INPUT_TEMPLATE =
###
# Field Info
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#field-info
###
PAIR_STAT_ONCE_PER_FIELD = False
#PAIR_STAT_FCST_FILE_TYPE =
#PAIR_STAT_OBS_FILE_TYPE =
FCST_VAR1_NAME = TMP
FCST_VAR1_LEVELS = P750-900
OBS_VAR1_NAME = TMP
OBS_VAR1_LEVELS = P750-900
FCST_VAR2_NAME = UGRD
FCST_VAR2_LEVELS = Z10
OBS_VAR2_NAME = UGRD
OBS_VAR2_LEVELS = Z10
###
# PairStat Settings
# https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#pairstat
###
PAIR_STAT_FORMAT = mpr
#LOG_PAIR_STAT_VERBOSITY = 2
#PAIR_STAT_CONFIG_FILE = {PARM_BASE}/met_config/PairStatConfig_wrapped
#MODEL =
#PAIR_STAT_DESC =
#PAIR_STAT_FCST_LEAD =
#PAIR_STAT_OBS_LEAD =
#PAIR_STAT_FCST_VALID_BEG =
#PAIR_STAT_FCST_VALID_END =
#PAIR_STAT_FCST_VALID_INC =
#PAIR_STAT_FCST_VALID_EXC =
#PAIR_STAT_FCST_VALID_HOUR =
#PAIR_STAT_OBS_VALID_BEG =
#PAIR_STAT_OBS_VALID_END =
#PAIR_STAT_OBS_VALID_INC =
#PAIR_STAT_OBS_VALID_EXC =
#PAIR_STAT_OBS_VALID_HOUR =
#PAIR_STAT_FCST_INIT_BEG =
#PAIR_STAT_FCST_INIT_END =
#PAIR_STAT_FCST_INIT_INC =
#PAIR_STAT_FCST_INIT_EXC =
#PAIR_STAT_FCST_INIT_HOUR =
#PAIR_STAT_OBS_INIT_BEG =
#PAIR_STAT_OBS_INIT_END =
#PAIR_STAT_OBS_INIT_INC =
#PAIR_STAT_OBS_INIT_EXC =
#PAIR_STAT_OBS_INIT_HOUR =
#PAIR_STAT_CENSOR_THRESH =
#PAIR_STAT_CENSOR_VAL =
#PAIR_STAT_CAT_THRESH =
#PAIR_STAT_CNT_THRESH =
#PAIR_STAT_CNT_LOGIC =
#PAIR_STAT_WIND_THRESH =
#PAIR_STAT_WIND_LOGIC =
#PAIR_STAT_MPR_COLUMN =
#PAIR_STAT_MPR_THRESH =
#PAIR_STAT_MPR_STR_INC =
#PAIR_STAT_MPR_STR_EXC =
#PAIR_STAT_ECLV_POINTS =
#PAIR_STAT_HSS_EC_VALUE =
#PAIR_STAT_RANK_CORR_FLAG =
#PAIR_STAT_CLIMO_MEAN_FILE_NAME =
#PAIR_STAT_CLIMO_MEAN_FIELD =
#PAIR_STAT_CLIMO_MEAN_REGRID_METHOD =
#PAIR_STAT_CLIMO_MEAN_REGRID_WIDTH =
#PAIR_STAT_CLIMO_MEAN_REGRID_VLD_THRESH =
#PAIR_STAT_CLIMO_MEAN_REGRID_SHAPE =
#PAIR_STAT_CLIMO_MEAN_TIME_INTERP_METHOD =
#PAIR_STAT_CLIMO_MEAN_DAY_INTERVAL =
#PAIR_STAT_CLIMO_MEAN_HOUR_INTERVAL =
#PAIR_STAT_CLIMO_STDEV_FILE_NAME =
#PAIR_STAT_CLIMO_STDEV_FIELD =
#PAIR_STAT_CLIMO_STDEV_REGRID_METHOD =
#PAIR_STAT_CLIMO_STDEV_REGRID_WIDTH =
#PAIR_STAT_CLIMO_STDEV_REGRID_VLD_THRESH =
#PAIR_STAT_CLIMO_STDEV_REGRID_SHAPE =
#PAIR_STAT_CLIMO_STDEV_TIME_INTERP_METHOD =
#PAIR_STAT_CLIMO_STDEV_DAY_INTERVAL =
#PAIR_STAT_CLIMO_STDEV_HOUR_INTERVAL =
#PAIR_STAT_FCST_CLIMO_MEAN_FILE_NAME =
#PAIR_STAT_FCST_CLIMO_MEAN_FIELD =
#PAIR_STAT_FCST_CLIMO_MEAN_REGRID_METHOD =
#PAIR_STAT_FCST_CLIMO_MEAN_REGRID_WIDTH =
#PAIR_STAT_FCST_CLIMO_MEAN_REGRID_VLD_THRESH =
#PAIR_STAT_FCST_CLIMO_MEAN_REGRID_SHAPE =
#PAIR_STAT_FCST_CLIMO_MEAN_TIME_INTERP_METHOD =
#PAIR_STAT_FCST_CLIMO_MEAN_DAY_INTERVAL =
#PAIR_STAT_FCST_CLIMO_MEAN_HOUR_INTERVAL =
#PAIR_STAT_FCST_CLIMO_STDEV_FILE_NAME =
#PAIR_STAT_FCST_CLIMO_STDEV_FIELD =
#PAIR_STAT_FCST_CLIMO_STDEV_REGRID_METHOD =
#PAIR_STAT_FCST_CLIMO_STDEV_REGRID_WIDTH =
#PAIR_STAT_FCST_CLIMO_STDEV_REGRID_VLD_THRESH =
#PAIR_STAT_FCST_CLIMO_STDEV_REGRID_SHAPE =
#PAIR_STAT_FCST_CLIMO_STDEV_TIME_INTERP_METHOD =
#PAIR_STAT_FCST_CLIMO_STDEV_DAY_INTERVAL =
#PAIR_STAT_FCST_CLIMO_STDEV_HOUR_INTERVAL =
#PAIR_STAT_OBS_CLIMO_MEAN_FILE_NAME =
#PAIR_STAT_OBS_CLIMO_MEAN_FIELD =
#PAIR_STAT_OBS_CLIMO_MEAN_REGRID_METHOD =
#PAIR_STAT_OBS_CLIMO_MEAN_REGRID_WIDTH =
#PAIR_STAT_OBS_CLIMO_MEAN_REGRID_VLD_THRESH =
#PAIR_STAT_OBS_CLIMO_MEAN_REGRID_SHAPE =
#PAIR_STAT_OBS_CLIMO_MEAN_TIME_INTERP_METHOD =
#PAIR_STAT_OBS_CLIMO_MEAN_DAY_INTERVAL =
#PAIR_STAT_OBS_CLIMO_MEAN_HOUR_INTERVAL =
#PAIR_STAT_OBS_CLIMO_STDEV_FILE_NAME =
#PAIR_STAT_OBS_CLIMO_STDEV_FIELD =
#PAIR_STAT_OBS_CLIMO_STDEV_REGRID_METHOD =
#PAIR_STAT_OBS_CLIMO_STDEV_REGRID_WIDTH =
#PAIR_STAT_OBS_CLIMO_STDEV_REGRID_VLD_THRESH =
#PAIR_STAT_OBS_CLIMO_STDEV_REGRID_SHAPE =
#PAIR_STAT_OBS_CLIMO_STDEV_TIME_INTERP_METHOD =
#PAIR_STAT_OBS_CLIMO_STDEV_DAY_INTERVAL =
#PAIR_STAT_OBS_CLIMO_STDEV_HOUR_INTERVAL =
#PAIR_STAT_CLIMO_CDF_BINS =
#PAIR_STAT_CLIMO_CDF_CENTER_BINS =
#PAIR_STAT_CLIMO_CDF_WRITE_BINS =
#PAIR_STAT_CLIMO_CDF_DIRECT_PROB =
#PAIR_STAT_MASK_GRID =
#PAIR_STAT_MASK_POLY =
#PAIR_STAT_MASK_SID =
#PAIR_STAT_MASK_LLPNT =
#PAIR_STAT_CI_ALPHA =
#PAIR_STAT_BOOT_INTERVAL =
#PAIR_STAT_BOOT_REP_PROP =
#PAIR_STAT_BOOT_N_REP =
#PAIR_STAT_BOOT_RNG =
#PAIR_STAT_BOOT_SEED =
#PAIR_STAT_SEEPS_P1_THRESH =
#PAIR_STAT_OUTPUT_FLAG_FHO =
#PAIR_STAT_OUTPUT_FLAG_CTC =
#PAIR_STAT_OUTPUT_FLAG_CTS =
#PAIR_STAT_OUTPUT_FLAG_MCTC =
#PAIR_STAT_OUTPUT_FLAG_MCTS =
#PAIR_STAT_OUTPUT_FLAG_CNT =
PAIR_STAT_OUTPUT_FLAG_SL1L2 = BOTH
#PAIR_STAT_OUTPUT_FLAG_SAL1L2 =
#PAIR_STAT_OUTPUT_FLAG_VL1L2 =
#PAIR_STAT_OUTPUT_FLAG_VAL1L2 =
#PAIR_STAT_OUTPUT_FLAG_VCNT =
#PAIR_STAT_OUTPUT_FLAG_PCT =
#PAIR_STAT_OUTPUT_FLAG_PSTD =
#PAIR_STAT_OUTPUT_FLAG_PJC =
#PAIR_STAT_OUTPUT_FLAG_PRC =
#PAIR_STAT_OUTPUT_FLAG_ECLV =
PAIR_STAT_OUTPUT_FLAG_MPR = BOTH
#PAIR_STAT_OUTPUT_FLAG_SEEPS =
#PAIR_STAT_OUTPUT_FLAG_SEEPS_MPR =
#PAIR_STAT_POINT_WEIGHT_FLAG =
MET Configuration
Note
See the PairStat MET Configuration section of the User’s Guide for more information on the environment variables used in the file below.
parm/met_config/PairStatConfig_wrapped
////////////////////////////////////////////////////////////////////////////////
//
// Pair-Stat configuration file.
//
// For additional information, please see the MET Users Guide.
//
////////////////////////////////////////////////////////////////////////////////
//
// Output model name to be written
// Non-empty string overrides input data values
//
//model =
${METPLUS_MODEL}
//
// Output description to be written
// Non-empty string overrides input data values
// May be set separately in each "obs.pairs" entry
//
//desc =
${METPLUS_DESC}
////////////////////////////////////////////////////////////////////////////////
//
// Forecast and observation pairs to be verified
//
fcst = {
${METPLUS_FCST_FILE_TYPE}
//pairs = [
${METPLUS_FCST_FIELD}
${METPLUS_FCST_CLIMO_MEAN_DICT}
${METPLUS_FCST_CLIMO_STDEV_DICT}
}
obs = {
${METPLUS_OBS_FILE_TYPE}
//pairs = [
${METPLUS_OBS_FIELD}
${METPLUS_OBS_CLIMO_MEAN_DICT}
${METPLUS_OBS_CLIMO_STDEV_DICT}
}
////////////////////////////////////////////////////////////////////////////////
//fcst_lead =
${METPLUS_FCST_LEAD}
//obs_lead =
${METPLUS_OBS_LEAD}
//fcst_valid_beg =
${METPLUS_FCST_VALID_BEG}
//fcst_valid_end =
${METPLUS_FCST_VALID_END}
//fcst_valid_inc =
${METPLUS_FCST_VALID_INC}
//fcst_valid_exc =
${METPLUS_FCST_VALID_EXC}
//fcst_valid_hour =
${METPLUS_FCST_VALID_HOUR}
//obs_valid_beg =
${METPLUS_OBS_VALID_BEG}
//obs_valid_end =
${METPLUS_OBS_VALID_END}
//obs_valid_inc =
${METPLUS_OBS_VALID_INC}
//obs_valid_exc =
${METPLUS_OBS_VALID_EXC}
//obs_valid_hour =
${METPLUS_OBS_VALID_HOUR}
//fcst_init_beg =
${METPLUS_FCST_INIT_BEG}
//fcst_init_end =
${METPLUS_FCST_INIT_END}
//fcst_init_inc =
${METPLUS_FCST_INIT_INC}
//fcst_init_exc =
${METPLUS_FCST_INIT_EXC}
//fcst_init_hour =
${METPLUS_FCST_INIT_HOUR}
//obs_init_beg =
${METPLUS_OBS_INIT_BEG}
//obs_init_end =
${METPLUS_OBS_INIT_END}
//obs_init_inc =
${METPLUS_OBS_INIT_INC}
//obs_init_exc =
${METPLUS_OBS_INIT_EXC}
//obs_init_hour =
${METPLUS_OBS_INIT_HOUR}
////////////////////////////////////////////////////////////////////////////////
//
// Forecast and observation data censoring, thresholding, and filtering options
// May be set separately in each "fcst.pairs" or "obs.pairs" entry
//
//censor_thresh =
${METPLUS_CENSOR_THRESH}
//censor_val =
${METPLUS_CENSOR_VAL}
//cat_thresh =
${METPLUS_CAT_THRESH}
//cnt_thresh =
${METPLUS_CNT_THRESH}
//cnt_logic =
${METPLUS_CNT_LOGIC}
//wind_thresh =
${METPLUS_WIND_THRESH}
//wind_logic =
${METPLUS_WIND_LOGIC}
////////////////////////////////////////////////////////////////////////////////
//
// Matched pairs filtering and control options
// May be set separately in each "obs.pairs" entry
//
//mpr_column =
${METPLUS_MPR_COLUMN}
//mpr_thresh =
${METPLUS_MPR_THRESH}
//mpr_str_inc =
${METPLUS_MPR_STR_INC}
//mpr_str_exc =
${METPLUS_MPR_STR_EXC}
//eclv_points =
${METPLUS_ECLV_POINTS}
//hss_ec_value =
${METPLUS_HSS_EC_VALUE}
//rank_corr_flag =
${METPLUS_RANK_CORR_FLAG}
////////////////////////////////////////////////////////////////////////////////
//
// Climatology mean data
// May be set separately in the "fcst" and "obs" dictionaries
//
//climo_mean = {
${METPLUS_CLIMO_MEAN_DICT}
//
// Climatology standard deviation data
// May be set separately in the "fcst" and "obs" dictionaries
//
//climo_stdev = {
${METPLUS_CLIMO_STDEV_DICT}
//
// Climatology distribution settings
// May be set separately in each "obs.pairs" entry
//
//climo_cdf = {
${METPLUS_CLIMO_CDF_DICT}
////////////////////////////////////////////////////////////////////////////////
//
// Verification masking regions
// May be set separately in each "obs.pairs" entry
//
//mask = {
${METPLUS_MASK_DICT}
////////////////////////////////////////////////////////////////////////////////
//
// Confidence interval settings
// May be set separately in each "obs.pairs" entry
//
//ci_alpha =
${METPLUS_CI_ALPHA}
//boot = {
${METPLUS_BOOT_DICT}
////////////////////////////////////////////////////////////////////////////////
//
// Threshold for SEEPS p1 (Probability of being dry)
//
//seeps_p1_thresh =
${METPLUS_SEEPS_P1_THRESH}
////////////////////////////////////////////////////////////////////////////////
//
// Statistical output types
// May be set separately in each "obs.pairs" entry
//
//output_flag = {
${METPLUS_OUTPUT_FLAG_DICT}
////////////////////////////////////////////////////////////////////////////////
//point_weight_flag =
${METPLUS_POINT_WEIGHT_FLAG}
tmp_dir = "${MET_TMP_DIR}";
//version = "V12.0.0";
////////////////////////////////////////////////////////////////////////////////
${METPLUS_MET_CONFIG_OVERRIDES}
Running METplus
Provide the use case .conf configuration file to the run_metplus.py script.
/path/to/METplus/parm/use_cases/met_tool_wrapper/PairStat/PairStat.conf
See the Running METplus section of the System Configuration chapter for more details.
Expected Output
A successful run will output the following both to the screen and to the logfile:
INFO: METplus has successfully finished running.
Refer to the value set for OUTPUT_BASE to find where the output data was generated. Output for this use case will be found in pair_stat (relative to OUTPUT_BASE) and will contain the following files:
pair_stat_360000L_20070331_120000V.stat
Keywords
Note
PairStatToolUseCase
Navigate to the METplus Quick Search for Use Cases page to discover other similar use cases.
#