Session 4: MODE and MTD

Session 4: MODE and MTD admin Wed, 06/12/2019 - 16:58

METplus Practical Session 4

During this practical session, you will run the tools indicated below:

You may navigate through this tutorial by following the links at the bottom of each page or by using the menu navigation.

Since you already set up your runtime enviroment in Session 1, you should be ready to go! To be sure, run through the following instructions to check that your environment is set correctly.

Prerequisites: Verify Environment is Set Correctly

Before running these instructions, you will need to ensure that you have a few environment variables set up correctly. If they are not set correctly, these instructions will not work properly.

  1. Check that you have METPLUS_TUTORIAL_DIR set correctly:
echo ${METPLUS_TUTORIAL_DIR}

If you don't see a path in your user directory output to the screen, set this environment variable in your user profile before continuing.

METPLUS_TUTORIAL_DIR is the location of all of your tutorial work, including configuration files, output data, and any other notes you'd like to keep.
  1. Check that you have METPLUS_BUILD_BASE, MET_BUILD_BASE, and METPLUS_DATA set correctly:
echo ${METPLUS_BUILD_BASE}
echo ${MET_BUILD_BASE}
echo ${METPLUS_DATA}

If any of these variables are not set, please set them. They will be referenced throughout the tutorial.

METPLUS_BUILD_BASE is the full path to the METplus installation (/path/to/METplus-X.Y)
MET_BUILD_BASE is the full path to the MET installation (/path/to/met-X.Y)
METPLUS_DATA is the location of the sample test data directory
  1. Check that you have loaded the MET module correctly:
which point_stat

You should see the usage statement for Point-Stat. The version number listed should correspond to the version listed in MET_BUILD_BASE. If it does not, you will need to either reload the met module, or add ${MET_BUILD_BASE}/bin to your PATH.

  1. Check that METPLUS_PARM_BASE was set correctly.
echo ${METPLUS_PARM_BASE}

If you don't see the full path to your METplus/parm directory under the tutorial directory, please set it. See the instructions in Session 1 for more information.

METPLUS_PARM_BASE is the full path to the user's configuration file directory (${METPLUS_TUTORIAL_DIR}/METplus/parm)
  1. Check that the correct version of master_metplus.py is in your PATH:
which master_metplus.py

If you don't see the full path to script from the shared installation, please set it. It should look the same as the output from this command:

echo ${METPLUS_BUILD_BASE}/ush/master_metplus.py

See the instructions in Session 1 for more information.

You are now ready to move on to the next section.

MET Tool: MODE

MET Tool: MODE cindyhg Tue, 06/25/2019 - 07:58

MODE Tool: General

MODE Functionality

MODE, the Method for Object-Based Diagnostic Evaluation, provides an object-based verification for comparing gridded forecasts to gridded observations. MODE may be used in a generalized way to compare any two fields containing data from which objects may be well defined. It has most commonly been applied to precipitation fields and radar reflectivity. The steps performed in MODE consist of:

  • Define objects in the forecast and observation fields based on user-defined parameters.
  • Compute attributes for each of those objects: such as area, centroid, axis angle, and intensity.
  • For each forecast/observation object pair, compute differences between their attributes: such as area ratio, centroid distance, angle difference, and intensity ratio.
  • Use fuzzy logic to compute a total interest value for each forecast/observation object pair based on user-defined weights.
  • Based on the computed interest values, match objects across fields and merge objects within the same field.
  • Write output statistics summarizing the characteristics of the single objects, the pairs of objects, and the matched/merged objects.

MODE may be configured to use a few different sets of logic with which to perform matching and merging. In this tutorial, we'll use the most simple approach, but users are encouraged to read Chapter 14 of the MET User's Guide for a more thorough description of MODE's capabilities.

MODE Usage

View the usage statement for MODE by simply typing the following:

mode
Usage: mode  
  fcst_file Input gridded forecast file containing the field to be verified
  obs_file Input gridded observation file containing the verifying field
  config_file MODEConfig file containing the desired configuration settings
  [-config_merge merge_config_file] Overrides the default fuzzy engine settings for merging within the fcst/obs fields (optional).
  [-outdir path] Overrides the default output directory (optional).
  [-log file] Outputs log messages to the specified file
  [-v level] Level of logging
  [-compress level] NetCDF compression level

The forecast and observation fields must be on the same grid. You can use copygb to regrid GRIB1 files, wgrib2 to regrid GRIB2 files, or use the automated regridding functionality within the MET config files.

At a minimum, the input gridded fcst_file, the input gridded obs_file, and the configuration config_file must be passed in on the command line.

MODE Tool: Configure

MODE Tool: Configure cindyhg Tue, 06/25/2019 - 08:01

MODE Tool: Configure

Start by making an output directory for MODE and changing directories:

mkdir -p ${METPLUS_TUTORIAL_DIR}/output/met_output/mode
cd ${METPLUS_TUTORIAL_DIR}/output/met_output/mode

The behavior of MODE is controlled by the contents of the configuration file passed to it on the command line. The default MODE configuration file may be found in the data/config/MODEConfig_default file. Prior to modifying the configuration file, users are advised to make copies of existing configuration files:

cp ${METPLUS_DATA}/met_test/scripts/config/MODEConfig_APCP_12 MODEConfig_APCP_12
cp ${METPLUS_DATA}/met_test/scripts/config/MODEConfig_APCP_24 MODEConfig_APCP_24
cp ${METPLUS_DATA}/met_test/scripts/config/MODEConfig_RH MODEConfig_RH

We'll be using these three configuration files during this session. Open up the MODEConfig_APCP_12 file to view it.

vi MODEConfig_APCP_12

The configuration items for MODE are used to specify how the object-based verification approach is to be performed. In MODE, as in the other MET statistics tools, you can compare any two fields. When necessary, the items in the configuration file are specified separately for the forecast and observation fields. In most cases though, users will be comparing the same forecast and observation fields. The configurable items include parameters for the following:

  • The forecast and observation fields and vertical levels or accumulation intervals to be compared
  • Options to mask out a portion of or threshold the raw fields
  • The forecast and observation object definition parameters
  • Options to filter out objects that don't meet a size or intensity criteria
  • Flags to control the logic for matching/merging
  • Weights to be applied for the fuzzy engine matching/merging algorithm
  • Interest functions to be used for the fuzzy engine matching/merging algorithm
  • Total interest threshold for matching/merging
  • Various plotting options

While the MODE configuration file contains many options, beginning users will typically only need to modify a few of them. You may find a complete description of the configurable items in section 14.3.2 of the MET User's Guide. Please take some time to review them.

We'll start here using by running the configuration files we copied over, as-is.

MODE Tool: Run

MODE Tool: Run cindyhg Tue, 06/25/2019 - 08:02

MODE Tool: Run

Next, run MODE three times on the command line using those three configuration files with the following commands:

mode \
${METPLUS_DATA}/met_test/out/pcp_combine/sample_fcst_12L_2005080712V_12A.nc \
${METPLUS_DATA}/met_test/out/pcp_combine/sample_obs_2005080712V_12A.nc \
MODEConfig_APCP_12 \
-outdir . \
-v 2
mode \
${METPLUS_DATA}/met_test/data/sample_fcst/2005080700/wrfprs_ruc13_24.tm00_G212 \
${METPLUS_DATA}/met_test/out/pcp_combine/sample_obs_2005080800V_24A.nc \
MODEConfig_APCP_24 \
-outdir . \
-v 2
mode \
${METPLUS_DATA}/met_test/data/sample_fcst/2005080700/wrfprs_ruc13_12.tm00_G212 \
${METPLUS_DATA}/met_test/data/sample_fcst/2005080712/wrfprs_ruc13_00.tm00_G212 \
MODEConfig_RH \
-outdir . \
-v 2

These commands make use of sample data that's distributed with the MET tarball. They run MODE on 12-hour accumulated precipitation, 24-hour accumulated precipitation, and on a field of relative humidity.

MODE Tool: Output

MODE Tool: Output cindyhg Tue, 06/25/2019 - 08:04

MODE Tool: Output

The output of MODE typically consists of 4 files: 2 ASCII statistics files, 1 NetCDF object file, and 1 PostScript summary plot. The output of any of these files may be disabled using the appropriate MODE command line argument. In this example, the output is written to the current mode directory, as we requested on the command line.

The MODE output file naming convention is similar to that of the other MET tools. It contains timing information about the forecast being evaluated (forecast valid, lead, and accumulation times). If you rerun MODE on the same fields but with a slightly different configuration, the new output will override the old output, unless you redirect it to a different directory using the -outdir command line argument. You can also edit the output_prefix in the MODE configuration file to customize the output file names. The 4 MODE output files are described briefly below:

  • The PostScript file ends in .ps and was described on the previous page.
  • The NetCDF object file ends in _obj.nc and contains the object indices.
  • The ASCII contingency table statistics file and ends in _cts.txt.
  • The ASCII object statistics file ends in _obj.txt and contains all of the object and object comparison data.

You can use ghostview (gv) to look at the postscript file output from each of these three forecasts.

gv mode_240000L_20050808_000000V_240000A.ps &

There are multiple pages of output. Take a moment to look them over:

  1. Page 1 summarizes the entire MODE run. Thumbnail images show the input data, resolved objects, and numbers identifying each object for both the forecast and observation fields. The color indicates object matching between the forecast and observation fields. Royal blue indicates an unmatched object. The object definition information is listed at the bottom of the page, and a sorted list of total object interest is listed on the right side.

  2. Page 2 is an expanded view of the forecast thumbnail images.
  3. Page 3 is an expanded view of the observation thumbnail images.
  4. Page 3 is an expanded view of the observation thumbnail images.
  5. Page 4 has images showing the forecast objects with observation object outlines overlaid, and vice-versa.
  6. Page 5 shows images and statistics for matching object clusters (i.e. one or more forecast objects matching one or more observation objects). These statistics also appear in the ASCII output from MODE.
  7. When double-thresholding or fuzzy engine merging is enabled, additional PostScript pages are added to illustrate those methods.

You may view the output NetCDF file using ncview. Execute the following command to view the NetCDF object output of MODE:

ncview mode_120000L_20050807_120000V_120000A_obj.nc &

Click through the 2D variable names in the ncview window to see plots of the four object fields in the file (NOTE: if a window pops up informing you "the min and max are both...", just Click "OK" and then the field will render). The fcst_obj_id and obs_obj_id contain the indices for the forecast and observation objects defined by MODE. The fcst_clus_id and obs_clus_idcontain indices for the matched cluster objects.

What are the benefits of spatial methods over traditional statistics? The weaknesses? What are some examples where an object-based verification would be inappropriate?

To accumulate the output of the object based verification, you use the MODE-Analysis Tool. We will use this next.

Use Case: MODE

Use Case: MODE cindyhg Tue, 06/25/2019 - 08:07

METplus Use Case: MODE

The MODE use case utilizes the MET Pcp-Combine and Mode tools.

Optional: Refer to the MET Users Guide for a description of the MET tools used in this use case. 
Optional: Refer to A-Z Config Glossary section of the METplus Users Guide for a reference to METplus variables used in this use case.

Setup

Create Custom Configuration File

Define a unique directory under output that you will use for this use case. Create a configuration file to override OUTPUT_BASE to that directory.

vi ${METPLUS_PARM_BASE}/user_config/mode.output.conf

Set OUTPUT_BASE to contain a subdirectory specific to the Mode use case. Make sure to put it under the [dir] section.

[dir]
OUTPUT_BASE = {ENV[METPLUS_TUTORIAL_DIR]}/output/mode

Using this custom configuration file and the Mode use case configuration files that are distributed with METplus, you should be able to run the use case using the sample input data set without any other changes.

Review Use Case Configuration File: hrefmean-vs-mrms-qpe.conf

Open the file and look at all of the configuration variables that are defined.

less ${METPLUS_PARM_BASE}/use_cases/mode/examples/hrefmean-vs-mrms-qpe.conf

Note that variables in hrefmean-vs-mrms-qpe.conf reference other config variables that have been defined in other configuration files. For example:

OBS_MODE_INPUT_DIR = {INPUT_BASE}/mode/MRMS_QPE_Data

This references INPUT_BASE which is the METplus data configuration file (metplus_config/metplus_data.conf). METplus config variables can reference other config variables even if they are defined in a config file that is read afterwards.

Run METplus

Run the following command:

master_metplus.py -c use_cases/mode/examples/hrefmean-vs-mrms-qpe.conf -c user_config/mode.output.conf

METplus is finished running when control returns to your terminal console and you see the following text:

INFO: METplus has successfully finished running.

Review the Output Files

You should have output files in the following directories:

ls ${METPLUS_TUTORIAL_DIR}/output/mode/uswrp/met_out/HREF_MEAN/201706210000/mode
  • mode_HREF_MEAN_APCP_vs_MRMS_QPE_P06M_NONE_A06_000000L_20170622_000000V_NAA_R1_T1_cts.txt
  • mode_HREF_MEAN_APCP_vs_MRMS_QPE_P06M_NONE_A06_000000L_20170622_000000V_NAA_R1_T1_obj.nc
  • mode_HREF_MEAN_APCP_vs_MRMS_QPE_P06M_NONE_A06_000000L_20170622_000000V_NAA_R1_T1_obj.txt
  • mode_HREF_MEAN_APCP_vs_MRMS_QPE_P06M_NONE_A06_000000L_20170622_000000V_NAA_R1_T1.ps

Take a look at some of the files to see what was generated.

less ${METPLUS_TUTORIAL_DIR}/output/mode/uswrp/met_out/HREF_MEAN/201706210000/mode/mode_HREF_MEAN_APCP_vs_MRMS_QPE_P06M_NONE_A06_000000L_20170622_000000V_NAA_R1_T1_obj.txt

Review the Log Files

Log files for this run are found in ${METPLUS_TUTORIAL_DIR}/output/mode/logs. The filename contains a timestamp of the current day.

less ${METPLUS_TUTORIAL_DIR}/output/mode/logs/master_metplus.log.`date +%Y%m%d`

NOTE: If you ran METplus on a different day than today, the log file will correspond to the day you ran. Remove the date command and replace it with the date you ran if that is the case.

Review the Final Configuration File

The final configuration file is metplus_final.conf. This contains all of the configuration variables used in the run.

less ${METPLUS_TUTORIAL_DIR}/output/mode/metplus_final.conf

MET Tool: MTD

MET Tool: MTD cindyhg Tue, 06/25/2019 - 08:13

MODE-Time-Domain: General

MODE-Time-Domain Functionality

The MODE-Time-Domain (MTD) tool was added in MET version 6.0. It applies an object-based verification technique in comparing a gridded forecast to a gridded analysis. It defines 3-dimensional space/time objects, tracking 2-dimensional objects through time. It writes summary object information to ASCII statistics files and writes object fields to NetCDF format. The MTD tool can be used to quantify the duration of events and timinig errors.

MODE-Time-Domain Usage

View the usage statement for MODE-Time-Domain by simply typing the following:

mtd

The forecast and observation fields must be on the same grid. You can use copygb to regrid GRIB1 files, wgrib2 to regrid GRIB2 files, or use the automated regridding functionality within the MET config files.

At a minimum, the -fcst and -obs options must be used to specify the data to be processed. Alternatively, the -single option specifies that MTD should be run on a single dataset. The -config option specifies the name of the configuration file.

MTD: Configure

MTD: Configure cindyhg Tue, 06/25/2019 - 08:15

MTD: Configure

Start by making an output directory for MTD and changing directories:

mkdir -p ${METPLUS_TUTORIAL_DIR}/output/met_output/mtd
cd ${METPLUS_TUTORIAL_DIR}/output/met_output/mtd

The behavior of MTD is controlled by the contents of the configuration file passed to it on the command line. The default MTD configuration file may be found in the data/config/MTDConfig_default file. Prior to modifying the configuration file, users are advised to make a copy of the default:

cp ${MET_BUILD_BASE}/share/met/config/MTDConfig_default MTDConfig_tutorial

The configuration items for MTD are used to specify how the space-time-object-based verification approach is to be performed. Just as MODE may be used to compare any two fields, the same is true of MTD. When necessary, the items in the configuration file are specified separately for the forecast and observation fields. In most cases though, users will be comparing the same forecast and observation fields. The configurable items include specifications for the following:

  • The verification domain.
  • The forecast and observation fields and vertical levels or accumulation intervals to be compared.
  • The forecast and observation object definition parameters.
  • Options to filter out objects that don't meet a minimum volume.
  • Matching/merging weights and interest functions.
  • Total interest threshold for matching/merging.
  • Flags to control output files.

For this tutorial, we'll configure MTD to process the same series of data we ran through the Series-Analysis tool. Just like MODE, MTD compares a single forecast field to a single observation field in each run.

Open up the MTDConfig_tutorial file for editing with the text editor of your choice and edit it as follows:

vi MTDConfig_tutorial

Set the fcst dictionary as follows:

fcst = {
   field = {
      name  = "APCP";
      level = "A03";
   }
   conv_radius = 2;
   conv_thresh = >=2.54;
}

Set the obs dictionary as follows:

obs = {
   field = {
      name  = "APCP_03";
      level = "(*,*)";
   }
   conv_radius = 2;
   conv_thresh = >=2.54;
}

Set:

min_volume = 0;

To retain all objects regardless of their volume.

Save and close this file.

MTD: Run

MTD: Run cindyhg Tue, 06/25/2019 - 08:16

MTD: Run

First, we need to prepare our observations by putting 1-hourly StageII precipitation forecasts into 3-hourly buckets. Create an output directory:

mkdir -p sample_obs/ST2ml_3h

Run the following PCP-Combine commands to prepare the observations:

pcp_combine -sum 00000000_000000 01 20050807_030000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080703V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml
pcp_combine -sum 00000000_000000 01 20050807_060000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080706V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml
pcp_combine -sum 00000000_000000 01 20050807_090000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080709V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml
pcp_combine -sum 00000000_000000 01 20050807_120000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080712V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml
pcp_combine -sum 00000000_000000 01 20050807_150000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080715V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml
pcp_combine -sum 00000000_000000 01 20050807_180000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080718V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml
pcp_combine -sum 00000000_000000 01 20050807_210000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080721V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml
pcp_combine -sum 00000000_000000 01 20050808_000000 03 \
sample_obs/ST2ml_3h/sample_obs_2005080800V_03A.nc \
-pcpdir ${METPLUS_DATA}/met_test/data/sample_obs/ST2ml

Rather than listing 8 input forecast and observation files on the command line, we will write them to a file list first. Since the 0-hour forecast does not contain 3-hourly accumulated precip, we will exclude that from the list. We will use the 3-hourly APCP output from PCP-Combine that we prepared above:

ls -1 ${METPLUS_DATA}/met_test/data/sample_fcst/2005080700/wrfprs* | egrep -v "_00.tm00" > fcst_file_list
ls -1 sample_obs/ST2ml_3h/sample_obs* > obs_file_list

Next, run the following MTD command:

mtd \
-fcst fcst_file_list \
-obs obs_file_list \
-config MTDConfig_tutorial \
-outdir . \
-v 2

Just as with MODE, MTD applies a convolution operation to smooth the data. However, there are two important differences. In MODE, the convolution shape is a circle (radius = conv_radius). In MTD, the convolution shape is a square (width = 2*conv_radius+1) and for time t, the values in that square are averaged for times t-1, t, and t+1. Convolving in space plus time enables MTD to identify more continuous space-time objects.

If your data has high enough time frequency that the features at one timestep overlap those at the next timestep, it may be well-suited for MTD.

MTD: Output

MTD: Output cindyhg Tue, 06/25/2019 - 08:17

MTD: Output

The MTD output typically consists of 6 files: 5 ASCII statistics files and 1 NetCDF object file. MTD does not create any graphical output. In this example, the output is written to the current mtd directory as we requested on the command line.

The MTD output file naming convention begins with mtd_ followed by the last valid time it encountered. The output file names may be modified using the output_prefix option in the configuration file which should be used to prevent the output of one run from over-writing the output of a previous run. The 6 MTD output files are described briefly below:

  • The NetCDF object file ends in .nc and contains gridded fields of the raw data, simple object indices, and cluster object indices for each forecast and observed timestep.
  • The ASCII file ending with _2D.txt contains many columns similar to the output of MODE. This data summarizes the 2-dimensional object attributes for each individual time slice of the 3D forecast and observation objects.
  • The ASCII files ending with _single_simple.txt and _single_cluster.txt contain 3D space-time attributes for simple and cluster objects, respectively.
  • The ASCII files ending with _pair_simple.txt and _pair_cluster.txt contain 3D space-time attributes for pairs of simple and cluster objects, respectively.

Use the ncview utility to view the NetCDF object output of MTD:

ncview mtd_20050807_030000V_obj.nc &

Select the variable named fcst_raw and click the time index to advance through the timesteps. Now, do the same for the fcst_object_id variable. Notice that the objects are defined in the active areas in the raw fields. Also notice some features merging (i.e. combining) as time passes while other features split (i.e. break apart). While they may be disconnected at a particular timestep, they remain part of the same space-time object.

Next, explore the ASCII output files and pay close attention to the header columns. Notice the generalization of the 2D MODE object attributes to 3 dimensions. Area meausure become volume. MTD measure the object speed. Each object has a begining and ending time.

Use Case: MTD

Use Case: MTD cindyhg Tue, 06/25/2019 - 08:20

METplus Use Case: MTD

Reference Material

The MTD (Mode Time Domain) use case utilizes the MET MTD tools.

Optional: Refer to the MET Users Guide for a description of the MET tools used in this use case. 
Optional: Refer to the A-Z Config Glossary section of the METplus Users Guide for a reference to METplus variables used in this use case.

Setup

Create Custom Configuration File

Define a unique directory under output that you will use for this use case. Create a configuration file to override OUTPUT_BASE to that directory.

vi ${METPLUS_PARM_BASE}/user_config/mtd.output.conf

Set OUTPUT_BASE to contain a subdirectory specific to the MTD use case. Make sure to put it under the [dir] section.

[dir]
OUTPUT_BASE = {ENV[METPLUS_TUTORIAL_DIR]}/output/mtd

Using this custom configuration file and the MTD use case configuration files that are distributed with METplus, you should be able to run the use case using the sample input data set without any other changes.

Review Use Case Configuration File: phpt-vs-qpe.conf

Open the file and look at all of the configuration variables that are defined.

less ${METPLUS_PARM_BASE}/use_cases/mode/examples/phpt-vs-qpe.conf

Note that variables in phpt-vs-qpe.conf reference other config variables that have been defined in other configuration files. For example:

OBS_MTD_INPUT_DIR = {INPUT_BASE}/mode/QPE_Data

This references INPUT_BASE which is set in the METplus data configuration file (metplus_config/metplus_data.conf). METplus config variables can reference other config variables even if they are defined in a config file that is read afterwards.

Run METplus

Run the following command:

master_metplus.py -c use_cases/mode/examples/phpt-vs-qpe.conf -c user_config/mtd.output.conf

METplus is finished running when control returns to your terminal console and you see the following text:

INFO: METplus has successfully finished running.

Review the Output Files

You should have output files in the following directories:

ls ${METPLUS_TUTORIAL_DIR}/output/mtd/uswrp/met_out/PHPT/201705100300/mtd
  • mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_2d.txt
  • mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_3d_pair_cluster.txt
  • mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_3d_pair_simple.txt
  • mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_3d_single_cluster.txt
  • mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_3d_single_simple.txt
  • mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_obj.nc

Take a look at some of the files to see what was generated.

Open the output NetCDF file with ncview to look at the data:

ncview ${METPLUS_TUTORIAL_DIR}/output/mtd/uswrp/met_out/PHPT/201705100300/mtd/mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_obj.nc

Click on the buttons in the Var: section (i.e. fcst_raw) to view the fields.

Open an output text file to view the contents:

less ${METPLUS_TUTORIAL_DIR}/output/mtd/uswrp/met_out/PHPT/201705100300/mtd/mtd_PROB_PHPT_APCP_vs_QPE_P01M_NONE_A01_20170510_040000V_3d_pair_simple.txt

Review the Log Files

Log files for this run are found in ${METPLUS_TUTORIAL_DIR}/output/mtd/logs. The filename contains a timestamp of the current day.

less ${METPLUS_TUTORIAL_DIR}/output/mtd/logs/master_metplus.log.`date +%Y%m%d`

NOTE: If you ran METplus on a different day than today, the log file will correspond to the day you ran. Remove the date command and replace it with the date you ran if that is the case.

Review the Final Configuration File

The final configuration file is metplus_final.conf. This contains all of the configuration variables used in the run.

less ${METPLUS_TUTORIAL_DIR}/output/mtd/metplus_final.conf

Additional Exercises

Additional Exercises cindyhg Tue, 06/25/2019 - 08:25

End of Practical Session 4

Congratulations! You have completed Session 4!

If you have extra time, you may want to try these additional METplus exercises.

EXERCISE 4.1: mtd_skip - Change Forecast Lead List to See METplus Skip Files

Instructions: Modify the METplus configuration files to change the forecast leads that are processed by MTD. Following these instructions will give you more insight on how METplus configures MTD.

To do this, copy your MTD configuration file and rename it to mtd.skip.conf for this exercise.
cp ${METPLUS_PARM_BASE}/user_config/mtd.output.conf $METPLUS_PARM_BASE/user_config/mtd.skip.conf 
Open phpt-vs-qpe.conf to remind yourself how fields are defined in METplus
less ${METPLUS_PARM_BASE}/use_cases/mode/examples/phpt-vs-qpe.conf 
Open mtd.skip.conf with an editor and changes values.
vi ${METPLUS_PARM_BASE}/user_config/mtd.skip.conf

Change LEAD_SEQ to process forecast leads 1-4

LEAD_SEQ = 1,2,3,4
You should also change OUTPUT_BASE to a new location so you can keep it separate from the other runs.
OUTPUT_BASE = {ENV[METPLUS_TUTORIAL_DIR]}/output/exercises/mtd_skip
Rerun master_metplus passing in your new custom config file for this exercise 
master_metplus.py -c use_cases/mode/examples/phpt-vs-qpe.conf -c user_config/mtd.skip.conf
Now look at the file lists that were generated by METplus for MTD
less ${METPLUS_TUTORIAL_DIR}/output/exercises/mtd_skip/stage/file_lists/201705100300_mtd_fcst_APCP.txt
less ${METPLUS_TUTORIAL_DIR}/output/exercises/mtd_skip/stage/file_lists/201705100300_mtd_obs_P01M_NONE.txt
Check the log file for any differences from the last run that processed forecast leads 1-3.
less ${METPLUS_TUTORIAL_DIR}/output/exercises/mtd_skip/logs/master_metplus.log.`date +%Y%m%d`
Did you see the WARNING message?
WARNING: Observation file was not found for init 201705100300 and lead 4
If you look in the data directories for this run, you will see that while the forecast for the 4 hour lead exists, the observation file does not. METplus will only add items to the MTD lists if both corresponding files are available.
ls ${METPLUS_DATA}/mode/PHPT/20170510
ls ${METPLUS_DATA}/mode/QPE_Data/20170510

EXERCISE 4.2: unzip - Change Forecast Lead List to See METplus Unzip

Instructions: Modify the METplus configuration files to change the forecast leads that are processed by MTD. Following these instructions will give you more insight on how METplus configures MTD.

To do this, copy your MTD configuration file and rename it to mtd.unzip.conf for this exercise.
 
cp ${METPLUS_PARM_BASE}/user_config/mtd.output.conf ${METPLUS_PARM_BASE}/user_config/mtd.unzip.conf
Open phpt-vs-qpe.conf to remind yourself how fields are defined in METplus 
 
less ${METPLUS_PARM_BASE}/use_cases/mode/examples/phpt-vs-qpe.conf

Open mtd.unzip.conf with an editor and changes values.

vi ${METPLUS_PARM_BASE}/user_config/mtd.unzip.conf
Change LEAD_SEQ to process forecast leads 3 and 6 
 
LEAD_SEQ = 3,6
You should also change OUTPUT_BASE to a new location so you can keep it separate from the other runs. 
OUTPUT_BASE = {ENV[METPLUS_TUTORIAL_DIR]}/output/exercises/unzip
Rerun master_metplus passing in your new custom config file for this exercise 
 
master_metplus.py -c use_cases/mode/examples/phpt-vs-qpe.conf -c user_config/mtd.unzip.conf

Now look at the file list that were generated by METplus for MTD forecast files

less ${METPLUS_TUTORIAL_DIR}/output/exercises/unzip/stage/file_lists/201705100300_mtd_fcst_APCP.txt
Notice that the path of the file for the 6 hour forecast lead has a different path from the 3 hour file.
If you look in the data directories for this run, you will see that the 6 hour forecast file is gzipped.
ls ${METPLUS_DATA}/mode/PHPT/20170510
METplus can recognize that files with gz, bzip2, or zip extensions are compressed and will do so automatically, placing the uncompressed file in the staging directory so that METplus doesn't modify any data in the input directory. METplus can be configured to scrub the staging directory after the run completes to save space, or leave the files so that they may be used by subsequent METplus runs without having to uncompress again (See SCRUB_STAGING_DIR and STAGING_DIR in the METplus User's Guide).