Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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'.

The Python script:

Code Block
languagepy
titleEI_geopotential_on_ml_getdata.py
linenumberstrue
collapsetrue
#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
server.retrieve({
    "class": "ei",
    "dataset": "interim",
    "expver": "1",
    "levelist": "all",
    "levtype": "ml",
    "param": "t/q",
    "stream": "oper",
    "date": "2015-01-01",    #date: Specify a single date as "2015-08-01" or a period as "2015-08-01/to/2015-08-31".
    "type": "an",        #type: Use an (analysis) unless you have a particular reason to use fc (forecast).
    "time": "00:00:00",        #time: With type=an, time can be any of "00:00:00/06:00:00/12:00:00/18:00:00".  With type=fc, time can be any of "00:00:00/12:00:00",
    "step": "0",        #step: With type=an, step is always "0". With type=fc, step can be any of "3/6/9/12".
    "grid": "0.75/0.75",    #grid: Only regular lat/lon grids are supported.
    "area": "75/-20/10/60",    #area: N/W/S/E, here we have Europe.
    "format": "netcdf",
    "target": "tq_ml.nc",    #target: the name of the output file.
})
server.retrieve({
    "class": "ei",
    "dataset": "interim",
    "expver": "1",
    "levelist": "1",
    "levtype": "ml",
    "param": "z/lnsp",
    "stream": "oper",
    "date": "2015-01-01",
    "type": "an",
    "time": "00:00:00",
    "step": "0",
    "grid": "0.75/0.75",
    "area": "75/-20/10/60",
    "format": "netcdf",
    "target": "zlnsp_ml.nc",
})

Copy the script and save it to your computer._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 'execute' 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.

Run the script.

Outputs: A file 'tq_ml.nc' and a file 'zlnsp_ml.nc', both in the current working directory.

...