Python Embedding with METplus
Dan Adriaansen on behalf of the METplus Team
NCAR/RAL�NOAA/GSL
and�Developmental Testbed Center
METplus Advanced Training Series: Session 5
15 November 2023
What is Python embedding?
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
The power of Python embedding
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Python Embedding with MET Tools (v11.1.0+)
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Some Python embedding requirements
It starts with compiling the MET software!
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Python Installation (v3.10.4+)
Use
--enable-python compilation flag
This enables access to any Python modules installed in the Python Installation linked against during MET software compilation!
Must include:
Python embedding for gridded data
�
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Python embedding for gridded data
�����
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Python embedding for gridded data
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Checklist for gridded data Python embedding script:
For more information about the required attributes, please see the user documentation here:
https://met.readthedocs.io/en/latest/Users_Guide/appendixF.html#attributes-for-2d-gridded-dataplanes
Python embedding for gridded data
Test your script before proceeding!
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Prior to running your workflow, it is recommended to use plot_data_plane to verify your Python script is working as intended.
Python Keyword
Forecast Field Name Entry
Python embedding for point data
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
*NumPy is not actually used in this context but the keyword is reused from the gridded data instance to signal MET to use Python.
Python embedding for point data
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Python embedding for point data
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Checklist for point data Python embedding script:
Python embedding for point data
Test your script before proceeding!
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Prior to running your workflow, it is recommended to use plot_point_obs to verify your Python script is working as intended.
Python Keyword + Script & Args
Gridded vs. point data differences
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Python keyword + script & args replaces point observation file
Python keyword only replaces gridded file
One script & args per field (2d array)
Gridded vs. point data differences
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Python embedding for MPR data
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Getting started with Python embedding
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Special case: custom Python environment
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Other Python capabilities within METplus
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Summary: Python Embedding with METplus
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved
Thank you!
Questions?
E-mail:
dadriaan @ ucar . edu
Copyright 2023, University Corporation for Atmospheric Research, all rights reserved