...
Some users are interested on geopotential (z) of the different model levels (ml). ECMWF provide a script for this calculation, which is the recommended method, but that script requires the ECMWF GRIB API. The script below is intended as a workaround for users who can not work with the ECMWF GRIB API.
The script below uses as inputs temperature and specific humidity on model levels, along with geopotential and the pressure (z and lnsp) on the surface, and it creates as output the geopotential in m^2/s^2 for each model level. You can then also calculate the height in meters by dividing the geopotential by the gravity of Earth (9.80665 m/s^2).
...
- All data is in NetCDF format
- The script requires Python and the ECMWF WebAPI to access ECMWF public datasets
The script only works correctly for ECMWF ERA-Interim data, do not use it with other datasets
Input data has to be gridded, not spectral.
Get input data
For this use case, you need both temperature (t) and Specific humidity (q) for each model level. You also need both surface geopotential (z) and logarithm of surface pressure (lnsp) for model level = 1. In the two scripts below you can change date, time, type, step and gridType, but make sure you use the same values in both scripts, i.e. the files are synchronized. Later the calculation of geopotential will iterate through the date/time/step parameters, allowing you to get the values for multiple times.
...