Introduction
Some users are interested on the height of the different model levels. This Python script will allow you to compute the geopotential on each one. The starting point is the geopotential and the pressure (z and lnsp) on the surface. The output will be written in grib format, writing the height for each level.
- The script is based on code from Nils Wedi, the IFS documentation:
- CY41R1 Official IFS Documentation
- part III. Dynamics and numerical procedures
- CY41R1 Official IFS Documentation
For this use case, you need to retrieve in grib format both temperature (t) and Specific humidity (q) for each model level. Besides, you need both surface geopotential (z) and logarithm of surface pressure (lnsp) for model level = 1. Both files have to be synchronized using the same class, stream, date, time, step and gridType. The script will iterate through the date/time/step parameters, allowing you to get the values for multiple times.
Download
Download Script | compute_geopotential_on_ml.py |
Examples
This example will compute the geopotential on the 2015-10-08 time 00 operational analysis model levels (137). Below you can see the MARS request used to retrive both files. You can set a different class/stream/type for the input data.
python compute_geopotential_on_ml.py tq_ml_20151008_00.grib zlnsp_ml_20151008_00.grib python compute_geopotential_on_ml.py tq_ml_20151008_00.grib zlnsp_ml_20151008_00.grib -o my_grib.grib
tq_ml_20151008_00.grib
zlnsp_ml_20151008_00.grib