The CERA-20C reanalysis: IRData.cera20c

This package retrieves and loads data from the CERA-20C reanalysis.

To retrieve the data, it uses the ECMWF Public data API. You will need to install a key as described in the API documentation. Note that this is the same system used by IRData.era5 - the same key 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/CERA_20C - the ‘SCRATCH’ environment variable must be set.

For example:

import datetime
import IRData.cera20c as cera20c
cera20c.fetch('prate',datetime.datetime(1969,3,12))

will retrieve precipitation rate data for the selected date. CERA20C data is fetched in one-calendar-month blocks, so this will retrieve data for the whole of March 1969. The retrieval is slow, as the data has to be fetched from MARS at ECMWF, but the retrieval is only run if necessary - if that month’s data has been previously fetched and is already on local disc, the fetch command will detect this and return instantly.

Once the data has been fetched,

pr=cera20c.load('prate',datetime.datetime(1969,3,12,15,15))

will then load the precipitation rates at quarter past 3pm on March 12 1969 from the retrieved dataset as a iris.cube.Cube. Note that as CERA only provides data at 3-hourly intervals, the value for 3:15pm will be interpolated between the 15:00 and 18:00 outputs (to get uninterpolated data, only call load for times when CERA-20C has output). Also, as CERA is an ensemble dataset, the result will include all 10 ensemble members.

Note that precipitation in CERA-20C is reported as metres accumulated, and it accumulates over the whole 27-hour forecast, so it reports precip at 15:00 as (accumulated precip at 12:00)+(accumulation in the period 12-15). This module removes the across-timestep accumulation, so ‘loading’ precip at 15:00 only gives the accumulation in the period 12-15, and the units are ‘m accumulated in the last 3-hours’. It is this 3-hour-accumulation that is interpolated if you ‘load’ the precipitation for a period between timesteps.


IRData.cera20c.fetch(variable, dtime)[source]

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

Data wil be stored locally in directory $SCRATCH/CERA-20C, 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’)
  • dtime (datetime.datetime) – Date-time to fetch the data for.
  • month (int) – Month to get data for (1-12).

Will retrieve the data for the year and month of the given date-time. If the selected time is within 6-hours of the end of the calendar month, loading data for that time will also need data from the next calendar month (for interpolation). In this case, also fetch the data for the next calendar month.

Raises:StandardError – If Variable is not a supported value.

IRData.cera20c.load(variable, dtime, fc_init=None)[source]

Load requested data from disc, interpolating if necessary.

Data must be available in directory $SCRATCH/CERA-20C, previously retrieved by fetch().

Parameters:
  • variable (str) – Variable to fetch (e.g. ‘prmsl’)
  • dtime (datetime.datetime) – Date-time to get data for.
  • fc_init (str) – See below
Returns:

Global field of variable at time.

Return type:

iris.cube.Cube

Note that CERA-20C data is only output every 3 hours, so if hour%3!=0, the result will be linearly interpolated in time.

Precipitation data in CERA is a forecast field: once a day (at 18:00) 3-hourly forecast data is calculated for the next 27 hours. So at 21:00, there are 2 sets of precipitation available: a 3-hour forecast starting at 18 that day, and a 27-hour forecast starting at 18:00 the day before; and there is a discontinuity in the fields at that time. This function will always load the shortest lead-time forecast available unless fc_init is set to ‘last’. 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()