You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

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 calculates 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:

  • All data is in NetCDF format
  • The computation script requires Python; the input data 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

Step1: Get input data

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

  • Temperature (t) and specific humidity (q), both on each model level, as file "tq_ml.nc".
  • The log of surface pressure (lnsp) and geopotential (z), both on model level 1, as file "zlnsp_ml.nc".

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:
  • No labels