Introduction

Some users are interested on geopotential (z) of the different model levels (ml). ECMWF provides two tools for this, a MetView macro and a Python script, which are the recommended methods.

One of our customers, Mark Jackson from Cambridge Environmental Research Consultants (CERC), wanted to calculate geopotential and height above the surface for model levels, and this for one particular location. The existing methods did not suit him: Both methods only work on Linux, and they output geopotential for an area of interest rather than a single point location.

So Mark wrote his own script and kindly provided it to us. The script takes temperature and specific humidity (t and q) on model levels as inputs, 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. It then also calculates the height in meters by dividing the geopotential by the gravity of Earth (9.80665 m/s^2).

This is  a two step process: first you get the required input data, then you perform the actual geopotential and height calculation.

Notes:

Step1: Get input data

The first script downloads ERA-Interim data from ECMWF through the ECMWF Web API:

Python script: EI_geopotential_on_ml_getdata_v1.py

You can change date, type, step, time, grid and area in the script, but make sure you use the same values in both blocks so that the two output files are synchronized. Later the calculation of geopotential will iterate through the date/time/step parameters, calculating values for multiple times.

Step2: Compute geopotential on model levels

Example

First get the required data: 

 

python EI_geopotential_on_ml_getdata_v1.py
Outputs:
Now compute the geopotential:

 

python EI_geopotential_on_ml_compute.py

 

Outputs: