MET Online Tutorial for METv8.0 | Python Embedding > Run

In this first example, we'll use Python to pass data to the Plot-Data-Plane utility. The Plot-Data-Plane utility provides a way to visualize the gridded data fields that MET can read.

We'll plot ASCII CMORPH convective rain data from a NetCDF file using the following command:

plot_data_plane \
PYTHON_NUMPY $MET_TUTORIAL_DATA/output/python/crain.ps\
'name="${MET_TUTORIAL_DATA}/input/sample_python/plot_data_plane/read_AWS_CMORPH.py ${MET_TUTORIAL_DATA}/input/sample_python/plot_data_plane/AWS_CMORPH_crain-2017043006.txt";'

Note how "PYTHON_NUMPY" is used in place of the input_filename, replacing the path to a gridded data file, in the call to plot_data_plane.

Now try running the Grid-Stat utility using the Python embedding functionality.

grid_stat \
PYTHON_NUMPY PYTHON_NUMPY \
$MET_TUTORIAL_DATA/input/sample_python/grid_stat/GridStatConfig_python_tutorial \
-outdir $MET_TUTORIAL_DATA/output/python -v 1

Note how "PYTHON_NUMPY" is used in place of both the fcst_filename and the obs_filename, replacing the path to a gridded data file, in the call to grid_stat.

Take a look inside the $MET_TUTORIAL_DATA/input/sample_python/grid_stat/GridStatConfig_python_tutorial file. You can see the "name" entry under "field" in the fcst dictionary, where it specifies the Python command to be executed to read the data. In this case, it is 

 field = [
     {
      name = "${MET_BASE}/python/read_ascii_numpy.py ${MET_TUTORIAL_DATA}/input/sample_python/grid_stat/fcst.txt FCST"
     }
];

The same is true for the "name" entry under "field" in the obs dictionary, where it specifies the Python command to be executed to read the data. In this case, it is 

field = [
     {
      name = "${MET_BASE}/python/read_ascii_numpy.py ${MET_TUTORIAL_DATA}/input/sample_python/grid_stat/obs.txt OBS"
     }
];