5.2.1.2. Ensemble-Stat: Ensemble Statistics using Obs Uncertainty

Demonstrates both features of Ensemble-Stat, basic ensemble postprocessing and computation of ensemble statistics. It also provides an example of using observational error estimates in the computation of those measures. (HRRR-e:RAP-DA:Grib)

Scientific Objective

To provide useful statistical information about the ensemble characteristics such as how dispersive it is and the relationship between spread and skill. This example also shows how to compute simple probability fields called ensemble relative frequency.

Datasets

Relevant information about the datasets that would be beneficial include:

  • Forecast dataset: HRRRE data

  • Observation dataset: HRRRE

  • Sources of data (links, contacts, etc…)

METplus Components

This use case runs PB2NC on the prepBUFR observation data to convert it into NetCDF format so it can be read by MET. Then EnsembleStat is run.

METplus Workflow

The following tools are used for each run time:

PB2NC > EnsembleStat

This example loops by initialization time. For each initialization time it will process forecast leads 0, 1, and 2. There is only one initialization time in this example, so the following will be run:

Run times:

Init: 2018-07-09_12Z
Forecast lead: 0
Init: 2018-07-09_12Z
Forecast lead: 1
Init: 2018-07-09_12Z
Forecast lead: 2

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/model_applications/convection_allowing_models/EnsembleStat_fcstHRRRE_obsHRRRE_Sfc_MultiField.conf

[config]

## Configuration-related settings such as the process list, begin and end times, etc.
PROCESS_LIST = PB2NC, EnsembleStat

# 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 = INIT

# Format of INIT_BEG and INT_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
INIT_TIME_FMT = %Y%m%d%H

# Start time for METplus run - must match INIT_TIME_FMT
INIT_BEG=2018070912

# End time for METplus run - must match INIT_TIME_FMT
INIT_END=2018070912

# Increment between METplus runs (in seconds if no units are specified)
#  Must be >= 60 seconds
INIT_INCREMENT=3600

# 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,1,2

# 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 = times

# Name to identify model (forecast) data in output
MODEL = HRRRE

# The MET ensemble_stat logging level
# 0 quiet to 5 loud, Verbosity setting for MET output, 2 is default.
# This takes precendence over the general MET logging level set in metplus_logging.conf
#LOG_ENSEMBLE_STAT_VERBOSITY = 3

# MET Configuration files for pb2nc
PB2NC_CONFIG_FILE = {CONFIG_DIR}/PB2NCConfig_HRRR

# if True, pb2nc will skip processing a file if the output already exists
# used to speed up runs and reduce redundancy
PB2NC_SKIP_IF_OUTPUT_EXISTS = True

# These are appended with PB2NC to differentiate the GRID, POLY, and MESSAGE_TYPE for point_stat.
PB2NC_GRID =
PB2NC_POLY =
PB2NC_STATION_ID =
PB2NC_MESSAGE_TYPE = ADPUPA, ADPSFC, AIRCFT, PROFLR

# Leave empty to process all
PB2NC_OBS_BUFR_VAR_LIST = POB, QOB, TOB, ZOB, UOB, VOB, D_DPT, D_WDIR, D_WIND, D_RH, D_MIXR, D_PRMSL

# False for no time summary, True otherwise
PB2NC_TIME_SUMMARY_FLAG = False
PB2NC_TIME_SUMMARY_BEG = 000000  ;; start time of time summary in HHMMSS format
PB2NC_TIME_SUMMARY_END = 235959  ;; end time of time summary in HHMMSS format
PB2NC_TIME_SUMMARY_VAR_NAMES = PMO,TOB,TDO,UOB,VOB,PWO,TOCC
PB2NC_TIME_SUMMARY_TYPES = min, max, range, mean, stdev, median, p80  ;; a list of the statistics to summarize

PB2NC_WINDOW_BEGIN = -900
PB2NC_WINDOW_END = 900

OBS_ENSEMBLE_STAT_WINDOW_BEGIN = -900
OBS_ENSEMBLE_STAT_WINDOW_END = 900

# number of expected members for ensemble. Should correspond with the
#  number of items in the list for FCST_ENSEMBLE_STAT_INPUT_TEMPLATE
ENSEMBLE_STAT_N_MEMBERS = 2

# ens.ens_thresh value in the MET config file
# threshold for ratio of valid files to expected files to allow app to run
ENSEMBLE_STAT_ENS_THRESH = 1.0

# Used in the MET config file for: regrid to_grid field
ENSEMBLE_STAT_REGRID_TO_GRID = FCST

ENSEMBLE_STAT_CONFIG_FILE = {CONFIG_DIR}/EnsembleStatConfig_SFC

# MET_OBS_ERR_TABLE is not required.
# If the variable is not defined, or the value is not set
# than the MET default is used.
ENSEMBLE_STAT_MET_OBS_ERR_TABLE = {CONFIG_DIR}/obs_error_table_V8.0.txt

# Variables and levels as specified in the field dictionary of the MET
# configuration file. Specify as FCST_VARn_NAME, FCST_VARn_LEVELS,
# (optional) FCST_VARn_OPTION

ENS_VAR1_NAME = TMP
ENS_VAR1_LEVELS = Z02
ENS_VAR1_THRESH = >=283, >=288, >=293, >=298, >=303

ENS_VAR2_NAME = DPT
ENS_VAR2_LEVELS = Z2
ENS_VAR2_THRESH = >=278, >=283, >=288, >=293, >=298

ENS_VAR3_NAME = UGRD
ENS_VAR3_LEVELS = Z10
ENS_VAR3_THRESH = <=-10, <=-5, <=-2, >=2, >=5, >=10

ENS_VAR4_NAME = VGRD
ENS_VAR4_LEVELS = Z10
ENS_VAR4_THRESH = <=-10, <=-5, <=-2, >=2, >=5, >=10

ENS_VAR5_NAME = WIND
ENS_VAR5_LEVELS = Z10
ENS_VAR5_THRESH = >=2, >=4, >=6, >=8, >=10


FCST_VAR1_NAME = TMP
FCST_VAR1_LEVELS = Z2
BOTH_VAR1_THRESH = >=283, >=288, >=293, >=298, >=303

OBS_VAR1_NAME = {FCST_VAR1_NAME}
OBS_VAR1_LEVELS = {FCST_VAR1_LEVELS}
OBS_VAR1_OPTIONS = ens_ssvar_bin_size = 1.0; ens_phist_bin_size = 0.05;

ENSEMBLE_STAT_OUTPUT_PREFIX = {MODEL}_F{lead?fmt=%3H}_ADPSFC

[dir]
# MET config directory.
# CONFIG_DIR and the value it expands to is set as an environment variable
# and is used in the MET configuration file.
CONFIG_DIR={PARM_BASE}/use_cases/model_applications/convection_allowing_models

# input and output directories for pb2nc
PB2NC_INPUT_DIR = {INPUT_BASE}/model_applications/convection_allowing_models/hrrr_ensemble_sfc/prepbufr
PB2NC_OUTPUT_DIR = {OUTPUT_BASE}/model_applications/convection_allowing_models/EnsembleStat_fcstHRRRE_obsHRRRE_Sfc_MultiField/rap

# input directory for ensemble_stat
FCST_ENSEMBLE_STAT_INPUT_DIR = {INPUT_BASE}/model_applications/convection_allowing_models/hrrr_ensemble_sfc/fcst

# point observation input dir for ensemble_stat (can also set grid obs)
OBS_ENSEMBLE_STAT_POINT_INPUT_DIR = {PB2NC_OUTPUT_DIR}

# output directory for ensemble_stat
ENSEMBLE_STAT_OUTPUT_DIR = {OUTPUT_BASE}/model_applications/convection_allowing_models/EnsembleStat_fcstHRRRE_obsHRRRE_Sfc_MultiField/EnsembleStat


[filename_templates]

# input and output templates for pb2nc
PB2NC_INPUT_TEMPLATE = {da_init?fmt=%Y%m%d}/{da_init?fmt=%Y%j%H%M}.rap.t{da_init?fmt=%2H}z.prepbufr.tm{offset?fmt=%2H}.{da_init?fmt=%Y%m%d}

PB2NC_OUTPUT_TEMPLATE = {valid?fmt=%Y%m%d}/{valid?fmt=%Y%m%d%H}.rap.nc

# input ensemble template - comma separated list of ensemble members
FCST_ENSEMBLE_STAT_INPUT_TEMPLATE =
    {init?fmt=%Y%m%d%H}/postprd_mem0001/wrfprs_conus_mem0001_{lead?fmt=%HH}.grib2,
    {init?fmt=%Y%m%d%H}/postprd_mem0002/wrfprs_conus_mem0002_{lead?fmt=%HH}.grib2

# input template for EnsembleStat can also be defined using a single
# member with wildcard characters to find multiple files
#FCST_ENSEMBLE_STAT_INPUT_TEMPLATE =
#    {init?fmt=%Y%m%d%H}/postprd_mem000?/wrfprs_conus_mem000?_{lead?fmt=%HH}.grib2

OBS_ENSEMBLE_STAT_POINT_INPUT_TEMPLATE = {PB2NC_OUTPUT_TEMPLATE}

ENSEMBLE_STAT_OUTPUT_TEMPLATE = {init?fmt=%Y%m%d%H%M}

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.

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

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

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

//
// Output observation type to be written
//
obtype = "ANALYS";

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

//
// 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    = [];
nc_var_str    = "";

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

//
// Ensemble product fields to be processed
//
ens = {
   ens_thresh = ${ENS_THRESH};
   vld_thresh = 1.0;

   field = [ ${ENS_FIELD}  ];
}

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

//
// Neighborhood ensemble probabilities
//
nbrhd_prob = {
   width      = [ 5 ];
   shape      = CIRCLE;
   vld_thresh = 0.0;
}

//
// NMEP smoothing methods
//
nmep_smooth = {
   vld_thresh      = 0.0;
   shape           = CIRCLE;
   gaussian_dx     = 81.27;
   gaussian_radius = 120;
   type = [
      {
         method = GAUSSIAN;
         width  = 1;
      }
   ];
}


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

cnt_thresh  = [ NA ];
cnt_logic   = UNION;
wind_thresh = [ NA ];
wind_logic  = UNION;

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

//
// Ensemble bin sizes
// May be set separately in each "obs.field" entry
//
obs = {
   field = [ ${OBS_FIELD}   ];
};
obs = { wind_thresh = >2.572; };

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

//
// Point observation filtering options
// May be set separately in each "obs.field" entry
//
message_type       = [ "ADPSFC" ];
sid_exc            = [];
obs_thresh         = [ NA ];
obs_quality        = [];
duplicate_flag     = UNIQUE;
obs_summary        = NONE;
obs_perc_value     = 50;
skip_const         = TRUE;

//
// Observation error options
// Set dist_type to NONE to use the observation error table instead
// May be set separately in each "obs.field" entry
//
obs_error = {
   flag             = TRUE;    // TRUE or FALSE
   dist_type        = NONE;    // Distribution type
   dist_parm        = [];      // Distribution parameters
   inst_bias_scale  = 1.0;     // Instrument bias scale adjustment
   inst_bias_offset = 0.0;     // Instrument bias offset adjustment
   min              = NA;      // Valid range of data
   max              = NA;
}

//
// 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";                      }
];

//
// Ensemble bin sizes
// May be set separately in each "obs.field" entry
//
ens_ssvar_bin_size = 1.0;
ens_phist_bin_size = 0.05;

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

//
// Climatology data
//
climo_mean = {

   file_name = [];
   field     = [];

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

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

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

//
// 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 = [];
   poly = [ "${INPUT_BASE}/model_applications/convection_allowing_models/mask/EAST.nc",
            "${INPUT_BASE}/model_applications/convection_allowing_models/mask/WEST.nc",
            "${INPUT_BASE}/model_applications/convection_allowing_models/mask/CONUS.nc",
            "${INPUT_BASE}/model_applications/convection_allowing_models/mask/LMV.nc" ];
   sid  = [];
   llpnt = [];
}

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

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

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

//
// Interpolation methods
//
interp = {
   field      = BOTH;
   type       = [ { method = BILIN; width = 2; } ];
   vld_thresh = 1.0;
   shape  = SQUARE;
}

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

//
// Statistical output types
//
output_flag = {
   ecnt  = BOTH;
   rhist = BOTH;
   phist = BOTH;
   orank = BOTH;
   ssvar = BOTH;
   relp  = BOTH;
}

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

//
// Ensemble product output types
//
ensemble_flag = {
   latlon    = TRUE;
   mean      = TRUE;
   stdev     = TRUE;
   minus     = FALSE;
   plus      = FALSE;
   min       = FALSE;
   max       = FALSE;
   range     = FALSE;
   vld_count = TRUE;
   frequency = TRUE;
   nep       = FALSE;
   nmep      = FALSE;
   rank      = FALSE;
   weight    = FALSE;
}

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

//
// Random number generator
//
rng = {
   type = "mt19937";
   seed = "1";
}


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

grid_weight_flag = NONE;
output_prefix    = "${OUTPUT_PREFIX}";
//version          = "V9.0";

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

See the following files for more information about the environment variables set in this configuration file.

parm/use_cases/met_tool_wrapper/EnsembleStat/EnsembleStat.py

Running METplus

This use case can be run two ways:

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

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

    master_metplus.py -c /path/to/METplus/parm/use_cases/model_applications/convection_allowing_models/EnsembleStat_fcstHRRRE_obsHRRRE_Sfc_MultiField.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 model_applications/convection_allowing_models/EnsembleStat_fcstHRRRE_obsHRRRE_Sfc_MultiField/201807091200 (relative to OUTPUT_BASE) and will contain the following files:

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V_ecnt.txt

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V_ens.nc

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V_orank.txt

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V_phist.txt

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V_relp.txt

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V_rhist.txt

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V_ssvar.txt

  • ensemble_stat_HRRRE_F000_ADPSFC_20180709_120000V.stat

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V_ecnt.txt

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V_ens.nc

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V_orank.txt

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V_phist.txt

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V_relp.txt

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V_rhist.txt

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V_ssvar.txt

  • ensemble_stat_HRRRE_F001_ADPSFC_20180709_130000V.stat

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V_ecnt.txt

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V_ens.nc

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V_orank.txt

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V_phist.txt

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V_relp.txt

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V_rhist.txt

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V_ssvar.txt

  • ensemble_stat_HRRRE_F002_ADPSFC_20180709_140000V.stat