Info |
---|
Complete documentation for Metview's Python interface is now available on readthedocs. |
Info |
---|
Metview's Python interface is currently available on internal ECMWF desktop machines, lxc and on the Member State server ecgate as well as the HPCF. It is also on github and PyPi and can be installed with the command " |
Setup
To use it, you need three two things:
- A Python 3 interpreter
- Metview 5 needs to be installed and in your PATHMetview's Python module needs to be accessible from Python
So, to try it right now at ECMWF, do the following from a terminal:
Code Block |
---|
module load python3/new
module swap metview/new
module load metview-python/new |
The internal installation at ECMWF also includes the cfgrib library for obtaining xarray datasets from GRIB. Metview's to_dataset()
function uses this internally from version 0.8.4 onwards.
...
Code Block |
---|
module swap metview/5.4.0new |
Alternatively, you can set this environment variable to point to a specific Metview startup script before starting your Python session.:
Code Block |
---|
export METVIEW_PYTHON_START_CMD=/path/to/my/metview_build/bin/metview |
Running on a busy machine?
When you import metview
, the Metview startup script is run in order to set up the working environment. Usually this is pretty much instant, but on very heavily loaded machines, it may take a few seconds. There is a default timeout of 8 seconds, but this can be increased if needed, by setting the following environment variable, to, for example, 15 seconds:
Code Block |
---|
export METVIEW_PYTHON_START_TIMEOUT=15 |
Further reading
For a quick start, check out some of the examples in the Gallery. They all have Python code, and each contains a tarball containing its code and data.
...