5.1.11.1. PointStat: Basic Use Case

This use case will run the MET Point-Stat tool to compare gridded forecast data to point observation data.

Scientific Objective

Compare 3 hour forecast precipitation accumulations to observations of 3 hour precipitation accumulation. Generate statistics of the results.

Datasets

Forecast: NAM temperature, u-wind component, and v-wind component
Observation: prepBURF data that has been converted to NetCDF format via PB2NC
Location: All of the input data required for this use case can be found in the met_test sample data tarball. Click here to the METplus releases page and download sample data for the appropriate release: https://github.com/NCAR/METplus/releases
This tarball should be unpacked into the directory that you will set the value of INPUT_BASE. See ‘Running METplus’ section for more information.
Data Source: Unknown

METplus Components

This use case utilizes the METplus PointStat wrapper to search for files that are valid at a given run time and generate a command to run the MET tool point_stat if all required files are found.

METplus Workflow

PointStat is the only tool called in this example. It processes the following run times:

Valid: 2007-03-30_0Z

METplus Configuration

METplus first loads all of the configuration files found in parm/metplus_config, then it loads any configuration files passed to METplus via the command line with the -c option, i.e. -c parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf

[config]

# List of applications to run - only PointStat for this case
PROCESS_LIST = PointStat

# time looping - 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
LOOP_BY = VALID

# Format of VALID_BEG and VALID_END using % items
# %Y = 4 digit year, %m = 2 digit month, %d = 2 digit day, etc.
# see www.strftime.org for more information
# %Y%m%d%H expands to YYYYMMDDHH
VALID_TIME_FMT = %Y%m%d

# Start time for METplus run - must match VALID_TIME_FMT
VALID_BEG = 20070330

# End time for METplus run - must match VALID_TIME_FMT
VALID_END = 20070330

# Increment between METplus runs (in seconds if no units are specified)
#  Must be >= 60 seconds
VALID_INCREMENT = 1M

# List of forecast leads to process for each run time (init or valid)
# In hours if units are not specified
# If unset, defaults to 0 (don't loop through forecast leads)
LEAD_SEQ = 0

# Order of loops to process data - Options are times, processes
# Not relevant if only one item is in the PROCESS_LIST
# times = run all wrappers in the PROCESS_LIST for a single run time, then
#   increment the run time and run all wrappers again until all times have
#   been evaluated.
# processes = run the first wrapper in the PROCESS_LIST for all times
#   specified, then repeat for the next item in the PROCESS_LIST until all
#   wrappers have been run
LOOP_ORDER = processes

# Verbosity of MET output - overrides LOG_VERBOSITY for PointStat only
#LOG_POINT_STAT_VERBOSITY = 2

# Location of MET config file to pass to GridStat
# References PARM_BASE which is the location of the parm directory corresponding
# to the ush directory of the master_metplus.py script that is called
# or the value of the environment variable METPLUS_PARM_BASE if set
POINT_STAT_CONFIG_FILE ={PARM_BASE}/met_config/PointStatConfig_wrapped

# Time relative to each input file's valid time (in seconds if no units are specified) for data within the file to be
# considered valid. Values are set in the 'obs_window' dictionary in the PointStat config file
OBS_POINT_STAT_WINDOW_BEGIN = -5400
OBS_POINT_STAT_WINDOW_END = 5400

# Optional list of offsets to look for point observation data
POINT_STAT_OFFSETS = 0

# Model/fcst and obs name, e.g. GFS, NAM, GDAS, etc.
MODEL = WRF
OBTYPE =

# Regrid to specified grid.  Indicate NONE if no regridding, or the grid id
# (e.g. G212)
POINT_STAT_REGRID_TO_GRID = NONE

POINT_STAT_OUTPUT_PREFIX =

# sets the -obs_valid_beg command line argument (optional)
# not used for this example
#POINT_STAT_OBS_VALID_BEG = {valid?fmt=%Y%m%d_%H}

# sets the -obs_valid_end command line argument (optional)
# not used for this example
#POINT_STAT_OBS_VALID_END = {valid?fmt=%Y%m%d_%H}

# Verification Masking regions
# Indicate which grid and polygon masking region, if applicable
POINT_STAT_GRID = DTC165, DTC166

# List of full path to poly masking files.  NOTE: Only short lists of poly
# files work (those that fit on one line), a long list will result in an
# environment variable that is too long, resulting in an error.  For long
# lists of poly masking files (i.e. all the mask files in the NCEP_mask
# directory), define these in the MET point_stat configuration file.
POINT_STAT_POLY = MET_BASE/poly/LMV.poly
POINT_STAT_STATION_ID =

# Message types, if all message types are to be returned, leave this empty,
# otherwise indicate the message types of interest.
POINT_STAT_MESSAGE_TYPE = ADPUPA, ADPSFC
# Variables and levels as specified in the field dictionary of the MET
# point_stat configuration file. Specify as FCST_VARn_NAME, FCST_VARn_LEVELS,
# (optional) FCST_VARn_OPTION

# fields to compare
# Note: If FCST_VAR<n>_* is set, then a corresponding OBS_VAR<n>_* variable must be set
# To use one variables for both forecast and observation data, set BOTH_VAR<n>_* instead
FCST_VAR1_NAME = TMP
FCST_VAR1_LEVELS = P750-900
FCST_VAR1_THRESH = <=273, >273
OBS_VAR1_NAME = TMP
OBS_VAR1_LEVELS = P750-900
OBS_VAR1_THRESH = <=273, >273

FCST_VAR2_NAME = UGRD
FCST_VAR2_LEVELS = Z10
FCST_VAR2_THRESH = >=5
OBS_VAR2_NAME = UGRD
OBS_VAR2_LEVELS = Z10
OBS_VAR2_THRESH = >=5

FCST_VAR3_NAME = VGRD
FCST_VAR3_LEVELS = Z10
FCST_VAR3_THRESH = >=5
OBS_VAR3_NAME = VGRD
OBS_VAR3_LEVELS = Z10
OBS_VAR3_THRESH = >=5


# End of [config] section and start of [dir] section
[dir]
FCST_POINT_STAT_INPUT_DIR = {INPUT_BASE}/met_test/data/sample_fcst
OBS_POINT_STAT_INPUT_DIR = {INPUT_BASE}/met_test/out/pb2nc

# directory containing climatology mean input to PointStat
# Not used in this example
POINT_STAT_CLIMO_MEAN_INPUT_DIR =

# directory containing climatology mean input to PointStat
# Not used in this example
POINT_STAT_CLIMO_STDEV_INPUT_DIR =


POINT_STAT_OUTPUT_DIR = {OUTPUT_BASE}/point_stat


# End of [dir] section and start of [filename_templates] section
[filename_templates]

# Template to look for forecast input to PointStat relative to FCST_POINT_STAT_INPUT_DIR
FCST_POINT_STAT_INPUT_TEMPLATE = {valid?fmt=%Y%m%d%H}/nam.t00z.awip1236.tm00.{valid?fmt=%Y%m%d}.grb

# Template to look for observation input to PointStat relative to OBS_POINT_STAT_INPUT_DIR
OBS_POINT_STAT_INPUT_TEMPLATE = sample_pb.nc

# Template to look for climatology input to PointStat relative to POINT_STAT_CLIMO_MEAN_INPUT_DIR
# Not used in this example
POINT_STAT_CLIMO_MEAN_INPUT_TEMPLATE =

# Template to look for climatology input to PointStat relative to POINT_STAT_CLIMO_STDEV_INPUT_DIR
# Not used in this example
POINT_STAT_CLIMO_STDEV_INPUT_TEMPLATE =

MET Configuration

METplus sets environment variables based on the values in the METplus configuration file. These variables are referenced in the MET configuration file. YOU SHOULD NOT SET ANY OF THESE ENVIRONMENT VARIABLES YOURSELF! THEY WILL BE OVERWRITTEN BY METPLUS WHEN IT CALLS THE MET TOOLS! If there is a setting in the MET configuration file that is not controlled by an environment variable, you can add additional environment variables to be set only within the METplus environment using the [user_env_vars] section of the METplus configuration files. See the ‘User Defined Config’ section on the ‘System Configuration’ page of the METplus User’s Guide for more information.

////////////////////////////////////////////////////////////////////////////////
//
// Point-Stat configuration file.
//
// For additional information, see the MET_BASE/config/README file.
//
////////////////////////////////////////////////////////////////////////////////

//
// Output model name to be written
//
model = "${MODEL}";

//
// Output description to be written
// May be set separately in each "obs.field" entry
//
desc = "NA";

////////////////////////////////////////////////////////////////////////////////

//
// Verification grid
//
regrid = {
   to_grid    = ${REGRID_TO_GRID};
   method     = BILIN;
   width      = 2;
   vld_thresh = 0.5;
   shape      = SQUARE;
}

////////////////////////////////////////////////////////////////////////////////

//
// May be set separately in each "field" entry
//
censor_thresh = [];
censor_val    = [];
cat_thresh    = [ NA ];
cnt_thresh    = [ NA ];
cnt_logic     = UNION;
wind_thresh   = [ NA ];
wind_logic    = UNION;
eclv_points   = 0.05;
rank_corr_flag = FALSE;

//
// Forecast and observation fields to be verified
//
fcst = {
    field = [ ${FCST_FIELD} ];
    };

obs = {
    field = [ ${OBS_FIELD} ];
    };

////////////////////////////////////////////////////////////////////////////////

//
// Point observation filtering options
// May be set separately in each "obs.field" entry
//
message_type = ${POINT_STAT_MESSAGE_TYPE};
sid_exc        = [];
obs_quality    = [ "1", "2", "3" ];
duplicate_flag = NONE;
obs_summary    = NONE;
obs_perc_value = 50;

//
// Mapping of message type group name to comma-separated list of values.
//
message_type_group_map = [
   { key = "SURFACE"; val = "ADPSFC,SFCSHP,MSONET";               },
   { key = "ANYAIR";  val = "AIRCAR,AIRCFT";                      },
   { key = "ANYSFC";  val = "ADPSFC,SFCSHP,ADPUPA,PROFLR,MSONET"; },
   { key = "ONLYSF";  val = "ADPSFC,SFCSHP";                      },
   { key = "LANDSF";  val = "ADPSFC,MSONET";                      },
   { key = "WATERSF"; val = "SFCSHP";                             }
];

////////////////////////////////////////////////////////////////////////////////

//
// Climatology data
//
climo_mean = {

   file_name = [ ${CLIMO_MEAN_FILE} ];
   field     = [];

   regrid = {
      method     = NEAREST;
      width      = 1;
      vld_thresh = 0.5;
      shape      = SQUARE;
   }

   time_interp_method = NEAREST;
   day_interval       = 31;
   hour_interval      = 6;
}

climo_stdev = climo_mean;
climo_stdev = {
   file_name = [ ${CLIMO_STDEV_FILE} ];
}

//
// May be set separately in each "obs.field" entry
//
climo_cdf = {
   cdf_bins    = 1;
   center_bins = FALSE;
   write_bins  = TRUE;
}

////////////////////////////////////////////////////////////////////////////////

//
// Point observation time window
//
obs_window = {
  beg = ${OBS_WINDOW_BEGIN};
  end = ${OBS_WINDOW_END};
}

////////////////////////////////////////////////////////////////////////////////

//
// Verification masking regions
//
mask = {
   grid = ${POINT_STAT_GRID};
   poly = ${POINT_STAT_POLY};
   sid     = ${POINT_STAT_STATION_ID};
   llpnt = [];
}

////////////////////////////////////////////////////////////////////////////////

//
// Confidence interval settings
//
ci_alpha  = [ 0.05 ];

boot = {
   interval = PCTILE;
   rep_prop = 1.0;
   n_rep    = 0;
   rng      = "mt19937";
   seed     = "";
}

////////////////////////////////////////////////////////////////////////////////

//
// Interpolation methods
//
interp = {
   vld_thresh = 1.0;
   shape      = SQUARE;

   type = [
      {
         method = BILIN;
         width  = 2;
      }
   ];
}

////////////////////////////////////////////////////////////////////////////////

//
// HiRA verification method
//
hira = {
   flag       = FALSE;
   width      = [ 2, 3, 4, 5 ];
   vld_thresh = 1.0;
   cov_thresh = [ ==0.25 ];
   shape      = SQUARE;
}

////////////////////////////////////////////////////////////////////////////////

//
// Statistical output types
//
output_flag = {
   fho    = NONE;
   ctc    = NONE;
   cts    = NONE;
   mctc   = NONE;
   mcts   = NONE;
   cnt    = NONE;
   sl1l2  = STAT;
   sal1l2 = NONE;
   vl1l2  = STAT;
   val1l2 = NONE;
   vcnt   = NONE;
   pct    = NONE;
   pstd   = NONE;
   pjc    = NONE;
   prc    = NONE;
   ecnt   = NONE; // Only for HiRA.
   eclv   = NONE;
   mpr    = NONE;
}

////////////////////////////////////////////////////////////////////////////////

tmp_dir        = "/tmp";
output_prefix    = "${OUTPUT_PREFIX}";
//version        = "V9.0";

////////////////////////////////////////////////////////////////////////////////

Note the following variables are referenced in the MET configuration file.

  • ${POINT_STAT_MESSAGE_TYPE} - Corresponds to POINT_STAT_MESSAGE_TYPE in the METplus configuration file.

  • ${POINT_STAT_STATION_ID} - Corresponds to POINT_STAT_STATION_ID in the METplus configuration file.

  • ${POINT_STAT_GRID} - Corresponds to POINT_STAT_GRID in the METplus configuration file.

  • ${POINT_STAT_POLY} - Corresponds to POINT_STAT_POLY in the METplus configuration file.

  • ${OBS_WINDOW_BEGIN} - Corresponds to OBS_WINDOW_BEGIN or OBS_POINT_STAT_WINDOW_BEGIN in the METplus configuration file.

  • ${OBS_WINDOW_END} - Corresponds to OBS_WINDOW_END or OBS_POINT_STAT_WINDOW_END in the METplus configuration file.

  • ${MODEL} - Name of forecast input. Corresponds to MODEL in the METplus configuration file.

  • ${FCST_FIELD} - Formatted forecast field information. Generated from [FCST/BOTH]_VAR<n>_[NAME/LEVEL/THRESH/OPTIONS] in the METplus configuration file.

  • ${OBS_FIELD} - Formatted observation field information. Generated from [OBS/BOTH]_VAR<n>_[NAME/LEVEL/THRESH/OPTIONS] in the METplus configuration file.

  • ${REGRID_TO_GRID} - Grid to remap data. Corresponds to POINT_STAT_REGRID_TO_GRID in the METplus configuration file.

  • ${VERIF_MASK} - Optional verification mask file or list of files. Corresponds to POINT_STAT_VERIFICATION_MASK_TEMPLATE in the METplus configuration file.

  • ${CLIMO_MEAN_FILE} - Optional path to climatology mean file. Corresponds to POINT_STAT_CLIMO_MEAN_INPUT_[DIR/TEMPLATE] in the METplus configuration file.

  • ${CLIMO_STDEV_FILE} - Optional path to climatology standard deviation file. Corresponds to POINT_STAT_CLIMO_STDEV_INPUT_[DIR/TEMPLATE] in the METplus configuration file.

  • ${OUTPUT_PREFIX} - String to prepend to the output filenames. Corresponds to POINT_STAT_OUTPUT_PREFIX in the METplus configuration file.

Running METplus

This use case can be run two ways:

  1. Passing in PointStat.conf then a user-specific system configuration file:

    master_metplus.py -c /path/to/METplus/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf -c /path/to/user_system.conf
    
  2. Modifying the configurations in parm/metplus_config, then passing in PointStat.conf:

    master_metplus.py -c /path/to/METplus/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf
    

The former method is recommended. Whether you add them to a user-specific configuration file or modify the metplus_config files, the following variables must be set correctly:

  • INPUT_BASE - Path to directory where sample data tarballs are unpacked (See Datasets section to obtain tarballs). This is not required to run METplus, but it is required to run the examples in parm/use_cases

  • OUTPUT_BASE - Path where METplus output will be written. This must be in a location where you have write permissions

  • MET_INSTALL_DIR - Path to location where MET is installed locally

Example User Configuration File:

[dir]
INPUT_BASE = /path/to/sample/input/data
OUTPUT_BASE = /path/to/output/dir
MET_INSTALL_DIR = /path/to/met-X.Y

NOTE: All of these items must be found under the [dir] section.

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 point_stat (relative to OUTPUT_BASE) and will contain the following files:

  • point_stat_360000L_20070331_120000V.stat

Keywords

sphinx_gallery_thumbnail_path = ‘_static/met_tool_wrapper-PointStat.png’

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery