Meteorographica.data.era5

This package retrieves and loads data from the ERA5 reanalysis.

To retrieve the data, it uses the ECMWF Public data API. You will need to install a key and the client libraries as described in the API documentation. Note that this is the same system used by Meteographica.data.cera20c - the same key and libraries will let you use that as well.

Only hourly data is supported (no daily or monthly averages) for 7 surface variables:

  • Mean-sea-level pressure: ‘mslp’
  • 2m air temperature: ‘air.2m’
  • Precipitation rate: ‘prate’
  • 10m meridional wind: ‘uwnd.10m’
  • 10m zonal wind: ‘vwnd.10m’
  • Sea-surface temperature: ‘sst’
  • Sea-ice coverage: ‘icec’

Data retrieved is stored in directory $SCRATCH/ERA5 - the ‘SCRATCH’ environment variable must be set. Data is retrieved in 1-month batches: ERA 5 comes in two streams: the ‘oper’ stream is a single member analysis at highest resolution, and the ‘enda’ stream is a 10-member ensemble at lower resolution - both are supported.

For example:

import Meteorographica.data.era5 as era5
era5.fetch('prate',2015,3,stream='enda')

Will retrieve precipitation rate data for the whole of March 2015, and

pr=era5.load('prate',2015,3,12,15.25,stream='enda')

will then load the precipitation rates at quarter past 3pm on March 12 2015 from the retrieved dataset as a iris.cube.Cube. Note that as ERA only provides data at hourly or 3-hourly intervals, the value for 15.25 will be interpolated between the outputs. Also, as ERA5 stream ‘enda’ is an ensemble dataset, the result will include all 10 ensemble members.


Meteorographica.data.era5.fetch(variable, year, month, stream='enda')[source]

Get all data for one variable, for one month, from ECMWF’s archive.

Data wil be stored locally in directory $SCRATCH/ERA5, to be retrieved by load(). If the local file that would be produced already exists, this function does nothing.

Parameters:
  • variable (str) – Variable to fetch (e.g. ‘prmsl’).
  • year (int) – Year to get data for.
  • month (int) – Month to get data for (1-12).
  • stream (str) – Analysis stream to use, can be ‘enda’ - ensemble DA, or ‘oper’ - high res single member.
Raises:

StandardError – If variable is not a supported value.


Meteorographica.data.era5.load(variable, year, month, day, hour, stream='enda', fc_init=None)[source]

Load requested data from disc, interpolating if necessary.

Data must be available in directory $SCRATCH/ERA5, previously retrieved by fetch().

Parameters:
  • variable (str) – Variable to fetch (e.g. ‘prmsl’)
  • year (int) – Year to get data for.
  • month (int) – Month to get data for (1-12).
  • day (int) – Day to get data for (1-31).
  • hour (float) – Hour to get data for (0-23.99). Note that this isn’t an integer, for minutes and seconds, use fractions of an hour.
  • fc_init (int) – If not None; 6 or 18. See below.
Returns:

Global field of variable at time.

Return type:

iris.cube.Cube

Note that ERA5 data is only output every 3 hours (enda) or hour (oper), so if hour%3!=0, the result may be linearly interpolated in time. If you want data after 21:00 on the last day of a month, you will need to fetch the next month’s data too, as it will be used in the interpolation.

Precipitation data in ERA5 is a forecast field: twice a day (at 06:00 and 18:00) forecast data is calculated for the next 18 hours. So at 21:00, for example, there are 2 sets of precipitation available: a 3-hour forecast starting at 18 that day, and a 15-hour forecast starting at 06:00, and there is a discontinuity between the two fields. This function will always load the shortest lead-time forecast available unless fc_init is set (to 6 or 18) in which case it will load the forecast starting at the hour specified. You will only need this if you are making videos, or otherwise need time-continuous forecast fields, in which case you will need to be clever in smoothing over the discontinuity. For analysis fields (everything except prate), this issue does not arise and fc_init is ignored.

Raises:StandardError – Data not on disc - see fetch()