PB2NC: Basic Use Case

met_tool_wrapper/PB2NC/PB2NC.conf

Scientific Objective

Simply converting file formats so point observations can be read by the MET tools.

Datasets

Observations: Various fields in prepBUFR file
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/dtcenter/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 PB2NC wrapper to generate a command to run the MET tool PB2NC if all required files are found.

METplus Workflow

PB2NC is the only tool called in this example. It processes the following run time:

Valid: 2007-03-31_12Z

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/PB2NC/PB2NC.conf

[config]

# Documentation for this use case can be found at
# https://metplus.readthedocs.io/en/latest/generated/met_tool_wrapper/PB2NC/PB2NC.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 = PB2NC


###
# 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 = 1M

LEAD_SEQ = 0


###
# File I/O
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#directory-and-filename-template-info
###

PB2NC_INPUT_DIR = {INPUT_BASE}/met_test/data/sample_obs/prepbufr
PB2NC_INPUT_TEMPLATE = ndas.t{da_init?fmt=%H}z.prepbufr.tm{offset?fmt=%2H}.{da_init?fmt=%Y%m%d}.nr

PB2NC_OFFSETS = 12

PB2NC_SKIP_IF_OUTPUT_EXISTS = True

PB2NC_OUTPUT_DIR = {OUTPUT_BASE}/pb2nc
PB2NC_OUTPUT_TEMPLATE = sample_pb.nc


###
# PB2NC Settings
# https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#pb2nc
###

PB2NC_CONFIG_FILE = {PARM_BASE}/met_config/PB2NCConfig_wrapped

PB2NC_OBS_WINDOW_BEGIN = -1800
PB2NC_OBS_WINDOW_END = 1800

PB2NC_VALID_BEGIN = {valid?fmt=%Y%m%d_%H}
PB2NC_VALID_END = {valid?fmt=%Y%m%d_%H?shift=1d}

PB2NC_GRID = G212
PB2NC_POLY =
PB2NC_STATION_ID =
PB2NC_MESSAGE_TYPE =

PB2NC_PB_REPORT_TYPE = 120, 220, 221, 122, 222, 223, 224, 131, 133, 233, 153, 156, 157, 180, 280, 181, 182, 281, 282, 183, 284, 187, 287

#PB2NC_LEVEL_RANGE_BEG =
#PB2NC_LEVEL_RANGE_END =

PB2NC_LEVEL_CATEGORY = 0, 1, 4, 5, 6

PB2NC_QUALITY_MARK_THRESH = 3

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

PB2NC_TIME_SUMMARY_FLAG = False
PB2NC_TIME_SUMMARY_BEG = 000000
PB2NC_TIME_SUMMARY_END = 235959
PB2NC_TIME_SUMMARY_VAR_NAMES =
PB2NC_TIME_SUMMARY_TYPES = min, max, range, mean, stdev, median, p80

PB2NC_TIME_SUMMARY_RAW_DATA = False
PB2NC_TIME_SUMMARY_STEP = 3600
PB2NC_TIME_SUMMARY_WIDTH = 3600
PB2NC_TIME_SUMMARY_GRIB_CODES =
PB2NC_TIME_SUMMARY_VALID_FREQ = 0
PB2NC_TIME_SUMMARY_VALID_THRESH = 0.0

#PB2NC_OBS_BUFR_MAP =

MET Configuration

METplus sets environment variables based on user settings in the METplus configuration file. See How METplus controls MET config file settings for more details.

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 currently not supported by METplus you’d like to control, please refer to: Overriding Unsupported MET config file settings

Note

See the PB2NC MET Configuration section of the User’s Guide for more information on the environment variables used in the file below:

////////////////////////////////////////////////////////////////////////////////
//
// PB2NC configuration file.
//
// For additional information, see the MET_BASE/config/README file.
//
////////////////////////////////////////////////////////////////////////////////

//
// PrepBufr message type
//
${METPLUS_MESSAGE_TYPE}

//
// Mapping of message type group name to comma-separated list of values
// Derive PRMSL only for SURFACE message types
//
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";                      }
];

//
// Mapping of input PrepBufr message types to output message types
//
message_type_map = [];

//
// PrepBufr station ID
//
${METPLUS_STATION_ID}


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

//
// Observation time window
//
${METPLUS_OBS_WINDOW_DICT}

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

//
// Observation retention regions
//
${METPLUS_MASK_DICT}

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

//
// Observing location elevation
//
elevation_range = {
   beg =  -1000;
   end = 100000;
}

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

//
// Observation types
//
//pb_report_type =
${METPLUS_PB_REPORT_TYPE}

in_report_type  = [];

instrument_type = [];

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

//
// Vertical levels to retain
//
//level_range = {
${METPLUS_LEVEL_RANGE_DICT}

//level_category =
${METPLUS_LEVEL_CATEGORY}

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

//
// BUFR variable names to retain or derive.
// If emtpy, process all available variables.
//
${METPLUS_OBS_BUFR_VAR}

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

//
// Mapping of BUFR variable name to GRIB name. The default map is defined at
// obs_prepbufr_map. This replaces/expends the default map.
//
//obs_bufr_map =
${METPLUS_OBS_BUFR_MAP}

// This map is for PREPBUFR. It will be added into obs_bufr_map.
// Please do not override this map.
//obs_prepbufr_map =


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

//quality_mark_thresh =
${METPLUS_QUALITY_MARK_THRESH}

event_stack_flag    = TOP;

////////////////////////////////////////////////////////////////////////////////
//
// Time periods for the summarization
//
${METPLUS_TIME_SUMMARY_DICT}

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

tmp_dir = "${MET_TMP_DIR}";

//version = "V9.0";

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

${METPLUS_MET_CONFIG_OVERRIDES}

Running METplus

This use case can be run two ways:

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

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

    run_metplus.py -c /path/to/METplus/parm/use_cases/met_tool_wrapper/PB2NC/PB2NC.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 pb2nc (relative to OUTPUT_BASE) and will contain the following file:

  • sample_pb.nc

Keywords

Note

  • PB2NCToolUseCase

Navigate to the METplus Quick Search for Use Cases page to discover other similar use cases.

sphinx_gallery_thumbnail_path = ‘_static/met_tool_wrapper-PB2NC.png’

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

Gallery generated by Sphinx-Gallery