Use Your Python Embedding Script with MET Tools

Use Your Python Embedding Script with MET Tools

Using Your Python Embedding Script with MET Tools

This section will largely follow the instructions in section titled "Python Embedding for Gridded Data", except you will be using your own Python Embedding script.

Recall the four Required Elements for Python Embedding with gridded data:

  1. The path to the MET tool executable you will be using
  2. The Python Embedding keyword
  3. The required argument for the MET tool you are using that must be modified for Python Embedding
  4. Any additional required arguments for the MET tool you are using

In this section, you will use plot_data_plane to run your Python Embedding script. The script you wrote in the "Writing A Python Script For Python Embedding" section supports both PYTHON_NUMPY and PYTHON_XARRAY.

First, verify you are in the Python Embedding practice directory:

cd ${METPLUS_TUTORIAL_DIR}/python_embed

Now try both of the sample commands below to run your Python Embedding script:

PYTHON_NUMPY

${MET_BUILD_BASE}/bin/plot_data_plane PYTHON_NUMPY numpy.ps 'name="practice_gridded_pyembed.py numpy";'

PYTHON_XARRAY

${MET_BUILD_BASE}/bin/plot_data_plane PYTHON_XARRAY xarray.ps 'name="practice_gridded_pyembed.py xarray";'

The resulting image, regardless of which approach you take (except for the string annotation which will change), should look like the following:

Great work! Proceed to the next section to configure METplus Wrappers to run your Python Embedding script.
dadriaan Fri, 01/20/2023 - 14:57