deafrica_tools.load_era5

Functions to retrieve ERA5 gridded climate data.

Updated Apr 2020 to directly access Zarr format data in PDS

Previous code for downloading and loading netcdf adpated from scripts by Andrew Cherry and Brian Killough.

Functions

load_era5(var, lat, lon, time[, …])

Download and return an ERA5 variable for a defined time window.

deafrica_tools.load_era5.load_era5(var, lat, lon, time, reduce_func=None, resample='1D')

Download and return an ERA5 variable for a defined time window.

Paramètres
  • var (string) – Name of the ERA5 climate variable to download, e.g « air_temperature_at_2_metres »

  • lat (tuple or list) – Latitude range for query.

  • lon (tuple or list) – Longitude range for query.

  • time (string or datetime object or a list or tuple of strings or datetime objects) – Used to define starting and end date dates of the time window.

  • reduce_func (numpy function) – lets you specify a function to apply to each day’s worth of data. The default is np.mean, which computes daily average. To get a sum, use np.sum.

  • resample (string) – Temporal resampling frequency to be used for xarray’s resample function. The default is “1D”, which is daily. Since this is applied on monthly ERA5 data, maximum resampling period is “1M”.

Renvoie

Type renvoyé

A lazy-loaded xarray dataset containing an ERA5 variable for the selected region and time window.