Plot-Data-Plane

Plot-Data-Plane griggs Wed, 04/24/2019 - 15:58

Plot-Data-Plane Functionality

The Plot-Data-Plane tool reads a single 2-dimensional slice of data from a gridded file and plots it. It can read any of the gridded data files supported by MET, such as GRIB1, GRIB2, and NetCDF. This tool provides a very useful quick look at the data to be verified. It can also display the gridded NetCDF output produced by Grid-Stat, MODE, Wavelet-Stat, Ensemble-Stat, Series-Analysis, etc.

Plot-Data-Plane Usage

View the usage statement for Plot-Data-Plane by simply typing the following:

plot_data_plane

At a minimum, the name of the gridded data file to be plotted, input_filename, the output PostScript file, output_filename, and a configuration string, config_string, defining which 2-D field is to be plotted must be passed in on the command line. Typically, specifying the name and level in the configuration string is sufficient. However, additional settings may be included if needed. For example, in a GRIB file containing multiple lead times, you could add lead_time = 12; to select the 12-hour forecast record. The configuration string is basically an in-line configuration file.

Run

Run griggs Wed, 04/24/2019 - 16:00

The Plot-Data-Plane utility provides a way to visualize the gridded data fields that MET can read. When running Point-Stat, we verified 2-meter temperature, and we'll now run Plot-Data-Plane to visualize that data with the following command:

plot_data_plane \
$MET_TUTORIAL_DATA/input/sample_fcst/2007033000/nam.t00z.awip1236.tm00.20070330.grb \
$MET_TUTORIAL_DATA/output/point_stat/nam.t00z.awip1236.tm00.20070330_TMPZ2.ps \
'name="TMP"; level="Z2";'

Now try running Plot-Data-Plane, plotting the 2-meter temperature from a GRIB2 RTMA file, on the command line using the following command:

plot_data_plane \
$MET_TUTORIAL_DATA/input/sample_obs/rtma/rtma_2012051712_F000.grib2 \
$MET_TUTORIAL_DATA/output/plot_data_plane/rtma_2012051712_F000.ps \
'name="TMP"; level="Z2";'

When running PCP-Combine, we summed up four 3-hourly accumulation forecast files into a single 12-hour accumulation forecast. Run Plot-Data-Plane to plot the NetCDF output from PCP-Combine on the command line using the following command:

plot_data_plane \
$MET_TUTORIAL_DATA/output/pcp_combine/sample_fcst_24L_2005080800V_12A.nc \
$MET_TUTORIAL_DATA/output/pcp_combine/sample_fcst_24L_2005080800V_12A.ps \
'name="APCP_12"; level="A12";'

Next, let's visualize the gridded RMSE data generated by the Series-Analysis tool:

plot_data_plane \
$MET_TUTORIAL_DATA/output/series_analysis/series_analysis_2005080700_2005080800_3A.nc \
$MET_TUTORIAL_DATA/output/series_analysis/series_analysis_2005080700_2005080800_3A_RMSE.ps \
'name="series_cnt_RMSE"; level="(*,*)";'

Output

Output griggs Wed, 04/24/2019 - 16:02

Display the output PostScript files we just generated by running the following commands:

gv $MET_TUTORIAL_DATA/output/point_stat/nam.t00z.awip1236.tm00.20070330_TMPZ2.ps &
gv $MET_TUTORIAL_DATA/output/plot_data_plane/rtma_2012051712_F000.ps &
gv $MET_TUTORIAL_DATA/output/pcp_combine/sample_fcst_24L_2005080800V_12A.ps &
gv $MET_TUTORIAL_DATA/output/series_analysis/series_analysis_2005080700_2005080800_3A_RMSE.ps &

Customizing Plots

The Plot-Data-Plane tool is intended to provide a quick-look at your data, not a full-featured plotting interface. However, there are a few options:

  • The -color_table option overrides the default color table. Look in $MET_BASE/colortables for other color tables or copy one and create your own.
  • The -plot_range option manually sets the plotting range. When color tables specify a range of plotting values as [0, 1], they are automatically rescaled to the min/max values in the dataset. This option manually overrides that min/max plotting scale.
  • The -title option adds a title to the plot.
  • The background map data is specified by the contents of $MET_BASE/config/ConfigMapData. That configuration file specifies the map data files, line colors, line widths, and line types to be plotted. Changes to that file affect all spatial plots generated by the MET tools, including Plot-Data-Plane.

Re-run the plot from the previous page, but specify the color table, plotting limits and title:

plot_data_plane \
$MET_TUTORIAL_DATA/input/sample_fcst/2007033000/nam.t00z.awip1236.tm00.20070330.grb \
$MET_TUTORIAL_DATA/output/point_stat/nam.t00z.awip1236.tm00.20070330_TMPZ2.ps \
'name="TMP"; level="Z2";' \
-color_table $MET_BASE/colortables/NCL_colortables/BlueRed.ctable \
-plot_range 253 293 \
-title "2-m Temperature"

Display the resulting image:

gv $MET_TUTORIAL_DATA/output/point_stat/nam.t00z.awip1236.tm00.20070330_TMPZ2.ps &

The ConfigConstants file can be found in both the data/config and $MET_BASE/config directories. At runtime, the MET tools read all the static data files from the share directory which was generated by running make install. Define the MET_BASE environment variable to point the MET tools to a different location for these static data files.

Image File Conversion

PostScript images are rather large compared to bitmap image formats, such as PNG and GIF. If available on your system, the ImageMagick convert tool provides quick and easy image file conversions. For example, let's convert a PostScript file to PNG format:

convert -rotate 90 -background white -flatten \
$MET_TUTORIAL_DATA/output/point_stat/nam.t00z.awip1236.tm00.20070330_TMPZ2.ps \
$MET_TUTORIAL_DATA/output/point_stat/nam.t00z.awip1236.tm00.20070330_TMPZ2.png

Display the resulting image by opening it in a web browser or by running the ImageMagick display tool:

display $MET_TUTORIAL_DATA/output/point_stat/nam.t00z.awip1236.tm00.20070330_TMPZ2.png &