Plotting Tools
Plotting Tools griggs Wed, 04/24/2019 - 15:51Plot-Point-Obs
Plot-Point-Obs griggs Wed, 04/24/2019 - 15:53Plot-Point-Obs Functionality
The Plot-Point-Obs tool can be used to create a plot showing the locations of the point observations contained in the NetCDF output of the ASCII2NC, PB2NC, MADIS2NC, or LIDAR2NC tools. Occasionally, a postprocessing or timing error can lead to errors in MET. This tool can assist the user by showing the data to be verified to ensure that times and locations match up as expected.
Plot-Point-Obs Usage
View the usage statement for Plot-Point-Obs by simply typing the following:
At a minimum, the name of the file to be plotted, nc_file, and the output PostScript file, ps_file, must be passed in on the command line. The Plot-Point-Obs tool has command line options for filtering which observations get plotted and the area to be plotted. You may use the -data_file command line argument to specify a data file whose grid should be used for the plot.
Run
Run griggs Wed, 04/24/2019 - 15:54Run Plot-Point-Obs to plot the output from PB2NC on the command line using the following command:
$MET_TUTORIAL_DATA/output/pb2nc/tutorial_pb.nc \
$MET_TUTORIAL_DATA/output/plot_point_obs/tutorial_pb.ps
Next try rerunning Plot-Point-Obs using the -data_file option to plot the points using a different grid:
$MET_TUTORIAL_DATA/output/pb2nc/tutorial_pb.nc \
$MET_TUTORIAL_DATA/output/plot_point_obs/tutorial_pb_zoom.ps \
-data_file $MET_TUTORIAL_DATA/input/sample_fcst/2007033000/nam.t00z.awip1236.tm00.20070330.grb
Output
Output griggs Wed, 04/24/2019 - 15:56Display the first output PostScript file by running the following command:
Each red dot in the plot represents the location of at least one observation value.
Next display the output PostScript file that used a different grid by running the following command:
The plot_point_obs is useful in determining how many observation points actually fall within your verification domain.
The -gc and -msg_typ options may be used to further refine the observations to be plotted.
For example, -gc 11 -msg_typ ADPSFC plots surface observations of temperature (GRIB code 11).
Plot-Data-Plane
Plot-Data-Plane griggs Wed, 04/24/2019 - 15:58Plot-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:
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:00The 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:
$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:
$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:
$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:
$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:02Display the output PostScript files we just generated by running the following commands:
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:
$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:
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:
$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:
Plot-MODE-Field
Plot-MODE-Field griggs Wed, 04/24/2019 - 16:13Plot-MODE-Field Functionality
The Plot-MODE-Field tool reads one or more MODE NetCDF output files and creates PNG images to display the data. While other MET tools produce PostScript images (which may by converted to PNG using the ImageMagick convert tool), the Plot-MODE-Field tool produces PNG files directly. The downside is the additional external dependencies on the Cairo graphics and FreeType libraries. For this reason, the compilation of MODE-Graphics is disabled by default. If you did not configure MET with --enable-mode-graphics, you may proceed to the next tool.
Plot-MODE-Field Usage
View the usage statement for Plot-MODE-Field by simply typing the following:
At a minimum, the -raw | -simple | -cluster argument indicating the types of objects to be plotted, the -obs | -fcst argument specifying whether to plot the observed or forecast field from the MODE output files, the -config path specifying the configuration file to use for specification of plotting options, and the mode_nc_file_list specifying the MODE output files to be used for plotting must be specified on the command line.
Font Data
The Plot-MODE-Field uses GhostScript font data at runtime. Since this tool is optional, the font data is not included in the MET tarball. Prior to running Plot-MODE-Field, users must first download Ghostscript font data. Please follow the link, retrieve the tarball, and save it in the data directory. Unpack the tarball and define the MET_FONT_DIR environment variable to the full path of the newly created data/fonts directory.
Return to the top-level MET directory, if necessary.
Configure
Configure griggs Wed, 04/24/2019 - 16:14The behavior of Plot-MODE-Field is controlled by the contents of the configuration file passed to it on the command line. The default Plot-MODE-Field configuration file may be found in the $MET_BASE/config/PlotModeFieldConfig_default file. Prior to modifying the configuration file, users are advised to make a copy of the default:
Open up the $MET_TUTORIAL_DATA/config/PlotModeFieldConfig_tutorial file for editing with the text editor of your choice.
- In the plot_info dictionary, set output_directory = "${MET_TUTORIAL_DATA}/output/plot_mode_field";
To output the PNG file to the plot_mode_field output directory.
Save and close this file.
Run
Run griggs Wed, 04/24/2019 - 16:16The Plot-MODE-Field utility provides a way to visualize the MODE NetCDF output files through a PNG file. Run Plot-MODE-Field to plot the MODE output on the command line using the following command:
-simple -obs \
-config $MET_TUTORIAL_DATA/config/PlotModeFieldConfig_tutorial \
$MET_TUTORIAL_DATA/output/mode/mode_240000L_20050808_000000V_120000A_obj.nc
Note that mode_240000L_20050808_000000V_120000A_obj.nc was generated earlier in the tutorial by MODE.
Output
Output griggs Wed, 04/24/2019 - 16:17In this example, Plot-MODE-Field visualizes simple objects from an observed precipitation field using parameters from the configuration file PlotModeFieldConfig_tutorial which is indicated by the output file naming convention, _obj_obs_simple.
Display the output PNG file by running the following command:
Feel free to rerun this example to plot other fields. Switch -obs to -fcst for forecast data or -simple to -cluster or -raw.
In this example, we passed a single NetCDF MODE output file to Plot-MODE-Field. However, when you pass it multiple files on the command line it creates a plot for each.