Metview's Python interface is currently available on internal ECMWF desktop machines, lxc and on the Member State server ecgate. It is also on github and PyPi and can be installed with the command " |
To use it, you need three things:
So, to try it right now, do the following from a terminal:
module load python3/new module swap metview/new module load metview-python |
If you plan to convert fieldsets to xarray datasets, or use the cfgrib module directly, you should also ensure that the ecCodes library is in your LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=$ECCODES_LIB_DIR:$LD_LIBRARY_PATH |
Here's a quick Python program to check that it's working. Copy this into a file called test-metview.py
import metview as mv # call Metview's built-in function to return a lower case string print(mv.lowercase('Hello World!')) # should output "hello world!" |
and run it like this:
python3 test-metview.py |
If this works, then you have successfully set up Metview's Python interface!
For a quick start, check out some of the examples in theĀ Gallery. Most, but not all, of them have Python code, but all of them can be written in Python.
To see the different environments you can write Metview Python scripts in, seeĀ Developing and Running Metview Python Scripts.
To understand what Metview's functions take as input and output in a Python environment, see Using Metview's Python Interface.