Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1844 docs #2096

Merged
merged 2 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 15 additions & 23 deletions met/docs/Users_Guide/appendixF.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,11 @@ The Ensemble-Stat, Series-Analysis, and MTD tools support the use of file lists
file_type=PYTHON_NUMPY;' \
-title "Python enabled plot_data_plane"

.. _pyembed-point-obs-data:

Python Embedding for Point Observations
=======================================


The ASCII2NC tool supports the "-format python" option. With this option, point observations may be passed as input. An example of this is provided in :numref:`ascii2nc-pyembed`. That example uses the **read_ascii_point.py** sample script which is included with the MET code. It reads ASCII data in MET's 11-column point observation format and stores it in a Pandas dataframe to be read by the ASCII2NC tool with Python.

The **read_ascii_point.py** sample script can be found in:
Expand All @@ -248,33 +249,13 @@ The **read_ascii_point.py** sample script can be found in:

• `MET GitHub repository <https://github.com/dtcenter/MET>`_ in *met/scripts/python*.

Python Embedding for MPR data
=============================

The Stat-Analysis tool supports the "-lookin python" option. With this option, matched pair (MPR) data may be passed as input. An example of this is provided in :numref:`StA-pyembed`. That example uses the **read_ascii_mpr.py** sample script which is included with the MET code. It reads MPR data and stores it in a Pandas dataframe to be read by the Stat-Analysis tool with Python.

The **read_ascii_mpr.py** sample script can be found in:

• MET installation directory in *MET_BASE/python*.

• `MET GitHub repository <https://github.com/dtcenter/MET>`_ in *met/scripts/python*.


Python Embedding for Point Observations as input
================================================


The point2grid, plot_point_obs, ensemble_stat, and point_stat tools use MET point observation NetCDF. They support the python embedding by the prefix 'PYTHON_NUMPY=" and followed by a python script name instead of the MET point observastion NetCDF filename. The customized python script is expected to extend MET_BASE/python/met_point_obs.py and to produce the python variable, **met_point_data**, which is the dictionary of the MET point observation data. They are defined at MET_BASE/python/met_point_obs.py.


.. _pyembed-point-obs-data:

The Point2Grid, Plot-Point-Obs, Ensemble-Stat, and Point-Stat tools also process point observations. They support python embedding of point observations directly on the command line by replacing the input MET NetCDF point observation file name with the python command to be run. The command must begin with the prefix 'PYTHON_NUMPY=' and be followed by the path to python script and any arguments. The full command should be enclosed in single quotes to prevent embedded whitespace from causing parsing errors. The customized python script is expected to extend MET_BASE/python/met_point_obs.py. That script creates a python variable named **met_point_data** which is a dictionary containing formatted point observation data.

.. code-block:: none

met_point_data = {

'use_var_id': Trur/False, # obs_vid are variable index if True, otherwise GRIB codes
'use_var_id': True/False, # obs_vid are variable index if True, otherwise GRIB codes

# Header data
'nhdr': integer_value, # number of headers
Expand Down Expand Up @@ -308,3 +289,14 @@ The point2grid, plot_point_obs, ensemble_stat, and point_stat tools use MET poin
'obs_qty_table': string_array, # quality marks
'obs_var_table': string_array, # variable names
}

Python Embedding for MPR data
=============================

The Stat-Analysis tool supports the "-lookin python" option. With this option, matched pair (MPR) data may be passed as input. An example of this is provided in :numref:`StA-pyembed`. That example uses the **read_ascii_mpr.py** sample script which is included with the MET code. It reads MPR data and stores it in a Pandas dataframe to be read by the Stat-Analysis tool with Python.

The **read_ascii_mpr.py** sample script can be found in:

• MET installation directory in *MET_BASE/python*.

• `MET GitHub repository <https://github.com/dtcenter/MET>`_ in *met/scripts/python*.
2 changes: 1 addition & 1 deletion met/docs/Users_Guide/ensemble-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Optional arguments for ensemble_stat

4. To produce ensemble statistics using gridded observations, use the **-grid_obs file** option to specify a gridded observation file. This option may be used multiple times if your observations are in several files.

5. To produce ensemble statistics using point observations, use the **-point_obs file** option to specify a NetCDF point observation file. This option may be used multiple times if your observations are in several files. The python embedding will be activated if the **file** begines with 'PYTHON_NUMPY=" and followed by a python script name.
5. To produce ensemble statistics using point observations, use the **-point_obs file** option to specify a NetCDF point observation file. This option may be used multiple times if your observations are in several files. Python embedding for point observations is also supported, as described in :numref:`pyembed-point-obs-data`.

6. To override the simple ensemble mean value of the input ensemble members for the ECNT, SSVAR, and ORANK line types, the **-ens_mean file** option specifies an ensemble mean model data file. This option replaces the **-ssvar_mean file** option from earlier versions of MET.

Expand Down
13 changes: 3 additions & 10 deletions met/docs/Users_Guide/plotting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ Plotting Utilities

This section describes how to check your data files using plotting utilities. Point observations can be plotted using the Plot-Point-Obs utility. A single model level can be plotted using the plot_data_plane utility. For object based evaluations, the MODE objects can be plotted using plot_mode_field. Occasionally, a post-processing or timing error can lead to errors in MET. These tools can assist the user by showing the data to be verified to ensure that times and locations match up as expected.

MET version 10.1 adds support for the passing point observations to plot_point_obs using a Python scriptAn example of running plot_point_obs with Python embedding is included below.


plot_point_obs usage
--------------------

Expand All @@ -37,7 +34,7 @@ plot_point_obs has two required arguments and can take optional ones.
Required arguments for plot_point_obs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1. The **nc_file** argument indicates the name of the point observation file to be plotted. This file is the output from one of the point pre-processing tools, such as pb2nc.
1. The **nc_file** argument indicates the name of the point observation file to be plotted. This file is the output from one of the point pre-processing tools, such as pb2nc. Python embedding for point observations is also supported, as described in :numref:`pyembed-point-obs-data`.

2. The **ps_file** argument indicates the name given to the output file containing the plot.

Expand Down Expand Up @@ -70,17 +67,13 @@ An example of the plot_point_obs calling sequence is shown below:

In this example, the Plot-Point-Obs tool will process the input sample_pb.nc file and write a postscript file containing a plot to a file named sample_pb.ps.

This is an equivalent command with the python embedding. This is an example for the python embeddingt.
An equivalent command using python embedding for point observations is shown below. Note that the entire python command is enclosed in single quotes to prevent embedded whitespace for causing parsing errors:

.. code-block:: none

plot_point_obs 'PYTHON_NUMPY=MET_BASE/python/read_met_point_obs.py sample_pb.nc' sample_data.ps


The user should replace the python script with the customized python script for the custom point observation data.

Please refer to :numref:`Appendix F, Section %s <appendixF>` for more details about Python embedding in MET.

Please see section :numref:`pyembed-point-obs-data` for more details about Python embedding in MET.

plot_point_obs configuration file
---------------------------------
Expand Down
4 changes: 2 additions & 2 deletions met/docs/Users_Guide/point-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ Required arguments for point_stat

1. The **fcst_file** argument names the gridded file in either GRIB or NetCDF containing the model data to be verified.

2. The **obs_file** argument indicates the NetCDF file (output of PB2NC or ASCII2NC) containing the point observations to be used for verifying the model.
2. The **obs_file** argument indicates the MET NetCDF point observation file to be used for verifying the model. Python embedding for point observations is also supported, as described in :numref:`pyembed-point-obs-data`.

3. The **config_file** argument indicates the name of the configuration file to be used. The contents of the configuration file are discussed below.

Optional arguments for point_stat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4. The **-point_obs** file may be used to pass additional NetCDF point observation files to be used in the verification. The python embedding will be activated if the **file** begines with 'PYTHON_NUMPY=" and followed by a python script name.
4. The **-point_obs** file may be used to pass additional NetCDF point observation files to be used in the verification. Python embedding for point observations is also supported, as described in :numref:`pyembed-point-obs-data`.

5. The **-obs_valid_beg** time option in YYYYMMDD[_HH[MMSS]] format sets the beginning of the observation matching time window, overriding the configuration file setting.

Expand Down
11 changes: 3 additions & 8 deletions met/docs/Users_Guide/reformat_point.rst
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,7 @@ The NetCDF output of the IODA2NC tool is structured in the same way as the outpu
Point2Grid tool
===============

The Point2Grid tool takes point observations from a NetCDF output file from one of the four previously mentioned MET tools (ascii2nc, madis2nc, pb2nc, lidar2nc) and creates a gridded NetCDF file. The other point observations are GOES-16/17 input files in NetCDF format (especially, Aerosol Optical Depth. Future development will include support for reading input files not produced from MET tools.

MET version 10.1 adds support for the passing point observations to point2grid using a Python script with "input_filename" which begins with the "PYTHON_NUMPY=<python_script_name> [arguments]" instead of MET point observation NetCDF input. An example of running point2grid with Python embedding is included below.

The Point2Grid tool reads point observations from a MET NetCDF point obseravtion file, via python embedding, or from GOES-16/17 input files in NetCDF format (especially, Aerosol Optical Depth) and creates a gridded NetCDF file. Future development may add support for additional input types.

point2grid usage
----------------
Expand Down Expand Up @@ -1012,7 +1009,7 @@ The usage statement for the Point2Grid tool is shown below:
Required arguments for point2grid
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1. The **input_filename** argument indicates the name of the input NetCDF file to be processed. Currently, only NetCDF files produced from the ascii2nc, madis2nc, pb2nc, and lidar2nc are supported. And AOD dataset from GOES16/17 are supported, too. Support for additional file types will be added in future releases.
1. The **input_filename** argument indicates the name of the input file to be processed. The input can be a MET NetCDF point observation file generated by other MET tools or a NetCDF AOD dataset from GOES16/17. Python embedding for point observations is also supported, as described in :numref:`pyembed-point-obs-data`.

The MET point observation NetCDF file name as **input_filename** argument is equivalent with "PYTHON_NUMPY=MET_BASE/python/read_met_point_obs.py netcdf_file name'.

Expand Down Expand Up @@ -1067,9 +1064,7 @@ For the GOES-16 and GOES-17 data, the computing lat/long is time consuming. So t

When processing GOES-16 data, the **-qc** option may also be used to specify the acceptable quality control flag values. The example above regrids the GOES-16 AOD values to NCEP Grid number 212 (which QC flags are high, medium, and low), writing to the output the maximum AOD value falling inside each grid box.


Here is an example of processing the same set of observations but using Python embedding instead:

Listed below is an example of processing the same set of observations but using python embedding instead:

.. code-block:: none

Expand Down