Skip to content

Era5ZarrSource

Classes:

  • Era5ZarrSource

    ERA5 source backed by a regular lat/lon Zarr dataset.

Era5ZarrSource

Era5ZarrSource(
    source,
    bounds=None,
    index_pad=5,
    time_index_from=None,
    time_slice=None,
    chunks=None,
    consolidated=True,
    storage_options=None,
    verbose=True,
    forward_fill=True,
    **kwargs,
)

Bases: Era5Source

ERA5 source backed by a regular lat/lon Zarr dataset.

A drop-in alternative to Era5Source for weather data which is not available as a directory of netCDF4 files, but as a Zarr store -- either on a local disk or in the cloud, e.g. the Earth Data Hub ERA5 single-level dataset. All simulation-facing behaviour (the 'sload_*' loaders, the clear variable names, the constants and the long-run-average rasters) is inherited from Era5Source, so that workflows do not have to know which of the two storage formats they are reading from.

The differences to Era5Source arise from the storage format: * The dataset is opened with xarray instead of netCDF4 and is kept in '_dataset', therefore 'load' and 'get' are reimplemented here * The store may use either 'valid_time' or 'time' as its temporal dimension, see _normalise_time_axis * A store which only contains the raw accumulated solar radiation is supplemented with the processed variants on the fly, see _derive_solar_variables * Longitudes may be given on a [0, 360) grid, which is handled transparently in 'get' so that placements can always be given on a [-180, 180) grid * The time span to read can be restricted with 'time_slice', which matters for multi-year cloud stores where reading everything is prohibitively slow

Note

Only regular latitude/longitude grids are supported. Stores using a flattened 'values' dimension (as e.g. published for reduced Gaussian grids) are rejected.

See Also

Era5Source reskit.weather.NCSource

Initialize an ERA5 source from a regular latitude/longitude Zarr store.

Compared to Era5Source, the data is not read from netCDF4 files but from a local or cloud hosted Zarr store, e.g. the Earth Data Hub ERA5 single-level dataset. Flattened 'values' grids as used by some stores are not supported.

Stores which only provide the raw accumulated solar radiation ('ssrd', 'fdir') are supplemented with the processed variants ('ssrd_t_adj', 'fdir_t_adj') on the fly, see _derive_solar_variables. The RESKit ERA5 time convention (TIME_OFFSET) is applied to the timestamps of the store, so that 'time_slice' and 'time_index' share one convention.

Parameters:

  • source

    (str or Dataset) –

    The Zarr store to read, either as an already opened dataset or as a path/URL. * Cloud stores are recognized by their protocol, i.e. 'https://' or 'gs://' * 'https://' stores are read with the credentials of '~/.netrc', which is where the credentials of the Earth Data Hub have to be saved

  • bounds

    (Anything acceptable to geokit.Extent.load(), default: None ) –

    The boundaries of the data which is needed * Usage of this will help with memory management * If None, the full spatial extent of the store is used

  • index_pad

    (int, default: 5 ) –

    The padding to apply to the boundaries * Useful in case of interpolation

  • time_index_from

    (str, default: None ) –

    The variable which has to exist in the store, given either as an ERA5 name or as one of the clear names of Era5Source, e.g. 'elevated_wind_speed'. * Only validates the store, the time convention is independent of this variable

  • time_slice

    (slice, default: None ) –

    Limit the time span which is loaded from the store, given in the time convention of RESKit, i.e. at half hours. Strongly recommended for multi-year cloud stores. * The first requested timestep of derived solar variables still uses the accumulation preceding it in the store

  • chunks

    (dict, default: None ) –

    The chunk sizes to load the store with, e.g. {"valid_time": 48}. Passed on to xarray.open_dataset(), by default the chunking of the store is used.

  • consolidated

    (bool, default: True ) –

    If True, the consolidated metadata of the store is used, by default True

  • storage_options

    (dict, default: None ) –

    Additional options for the storage backend, passed on to xarray.open_dataset(). Only needed to overwrite the defaults for the recognized cloud protocols.

  • verbose

    (bool, default: True ) –

    If True, then status outputs are printed when reading weather data

  • forward_fill

    (bool, default: True ) –

    If True, then a single missing time step at the end of the data is forward-filled

See Also

Era5Source

Methods:

Source code in reskit/weather/Era5Source/Era5ZarrSource.py
def __init__(
    self,
    source,
    bounds=None,
    index_pad=5,
    time_index_from=None,
    time_slice=None,
    chunks=None,
    consolidated=True,
    storage_options=None,
    verbose=True,
    forward_fill=True,
    **kwargs,
):
    """Initialize an ERA5 source from a regular latitude/longitude Zarr store.

    Compared to Era5Source, the data is not read from netCDF4 files but from a local or
    cloud hosted Zarr store, e.g. the Earth Data Hub ERA5 single-level dataset. Flattened
    'values' grids as used by some stores are not supported.

    Stores which only provide the raw accumulated solar radiation ('ssrd', 'fdir') are
    supplemented with the processed variants ('ssrd_t_adj', 'fdir_t_adj') on the fly, see
    _derive_solar_variables. The RESKit ERA5 time convention (TIME_OFFSET) is applied to
    the timestamps of the store, so that 'time_slice' and 'time_index' share one convention.

    Parameters
    ----------
    source : str or xarray.Dataset
        The Zarr store to read, either as an already opened dataset or as a path/URL.
        * Cloud stores are recognized by their protocol, i.e. 'https://' or 'gs://'
        * 'https://' stores are read with the credentials of '~/.netrc', which is where
          the credentials of the Earth Data Hub have to be saved

    bounds : Anything acceptable to geokit.Extent.load(), optional
        The boundaries of the data which is needed
          * Usage of this will help with memory management
          * If None, the full spatial extent of the store is used

    index_pad : int, optional
        The padding to apply to the boundaries
          * Useful in case of interpolation

    time_index_from : str, optional
        The variable which has to exist in the store, given either as an ERA5 name or as
        one of the clear names of Era5Source, e.g. 'elevated_wind_speed'.
        * Only validates the store, the time convention is independent of this variable

    time_slice : slice, optional
        Limit the time span which is loaded from the store, given in the time convention of
        RESKit, i.e. at half hours. Strongly recommended for multi-year cloud stores.
        * The first requested timestep of derived solar variables still uses the
          accumulation preceding it in the store

    chunks : dict, optional
        The chunk sizes to load the store with, e.g. {"valid_time": 48}. Passed on to
        xarray.open_dataset(), by default the chunking of the store is used.

    consolidated : bool, optional
        If True, the consolidated metadata of the store is used, by default True

    storage_options : dict, optional
        Additional options for the storage backend, passed on to xarray.open_dataset().
        Only needed to overwrite the defaults for the recognized cloud protocols.

    verbose : bool, optional
        If True, then status outputs are printed when reading weather data

    forward_fill : bool, optional
        If True, then a single missing time step at the end of the data is forward-filled

    See Also
    --------
    Era5Source
    """
    if kwargs:
        unexpected = ", ".join(sorted(kwargs.keys()))
        raise TypeError(f"Unexpected keyword arguments for Era5ZarrSource: {unexpected}")

    self.fill = forward_fill
    self._flip_lat = True
    self._flip_lon = False
    self._maximal_lon_difference = self.MAX_LON_DIFFERENCE
    self._maximal_lat_difference = self.MAX_LAT_DIFFERENCE
    self.dependent_coordinates = False
    self._verbose = verbose

    ds = self._open_dataset(
        source=source,
        chunks=chunks,
        consolidated=consolidated,
        storage_options=storage_options,
    )

    self.time_name, ds = self._normalise_time_axis(ds)
    ds, self._derived_variables = self._derive_solar_variables(ds, self.time_name)

    # Clear names may map onto several store conventions; the first entry is the
    # canonical name and is used when none of the candidates exist.
    era5_names = {
        "global_horizontal_irradiance": ("ssrd_t_adj", "ssrd"),
        "direct_horizontal_irradiance": ("fdir_t_adj", "fdir"),
        "surface_wind_speed": ("w10", "ws10", "u10"),
        "elevated_wind_speed": ("w100", "ws100", "u100"),
    }
    if time_index_from in era5_names:
        candidates = era5_names[time_index_from]
        time_index_from = next((candidate for candidate in candidates if candidate in ds.data_vars), candidates[0])

    if time_index_from is not None and time_index_from not in ds.data_vars:
        raise ResError(
            f"ERA5 key '{time_index_from}' not known. Check variable 'time_index_from' and store {source}"
        )

    if time_slice is not None:
        if isinstance(time_slice, slice):
            raw_start = pd.Timestamp(time_slice.start) - self.TIME_OFFSET if time_slice.start is not None else None
            raw_stop = pd.Timestamp(time_slice.stop) - self.TIME_OFFSET if time_slice.stop is not None else None
            time_slice = slice(raw_start, raw_stop)
        ds = ds.sel({self.time_name: time_slice})

    if verbose:
        times = pd.DatetimeIndex(pd.to_datetime(ds[self.time_name].values)) + self.TIME_OFFSET
        if times.size:
            print(f"ERA5 Zarr time range: {times[0]} to {times[-1]} ({times.size} time steps)")
        else:
            print("ERA5 Zarr time range: empty, the requested 'time_slice' selects no time steps")

    if "values" in ds.dims:
        raise ResError(
            "This Era5ZarrSource implementation only supports regular latitude/longitude Zarr stores, not flattened 'values' grids."
        )

    self._dataset = ds
    self.variables = self._build_variable_table(ds, source, self._derived_variables)

    self._allLats = np.asarray(ds["latitude"].values)
    self._allLons = np.asarray(ds["longitude"].values)
    self._lonN = self._allLons.size
    self._latN = self._allLats.size
    self._longitude_360 = self._allLons.min() >= 0 and self._allLons.max() > 180

    self._configure_spatial_selection(bounds=bounds, index_pad=index_pad)
    self._apply_dataset_spatial_subset()

    self.extent = gk.Extent(
        self.lons.min(),
        self.lats.min(),
        self.lons.max(),
        self.lats.max(),
        srs=gk.srs.EPSG4326,
    )

    timeindex = pd.DatetimeIndex(pd.to_datetime(self._dataset[self.time_name].values)) + self.TIME_OFFSET
    self._timeindex_raw = timeindex
    self.time_index = timeindex
    self.data = OrderedDict()

    if verbose:
        print(f"Opened ERA5 Zarr source: {source}")

get

Extract the data of a loaded variable at the given locations.

Behaves like NCSource.get(), except that locations are additionally wrapped onto the longitude convention of the store. Placements can therefore always be given on a [-180, 180) grid, no matter whether the store uses [-180, 180) or [0, 360).

Parameters:

  • variable

    (str) –

    The name of the variable in the data library '.data'

  • locations

    (Anything acceptable to geokit.LocationSet) –

    The locations to extract data for, with longitudes on a [-180, 180) grid

  • interpolation

    (str, default: 'near' ) –

    The interpolation mode, e.g. 'near', 'bilinear' or 'cubic', by default 'near'

  • force_as_data_frame

    (bool, default: False ) –

    If True, a pandas DataFrame is returned even for a single location, by default False

  • outside_okay

    (bool, default: False ) –

    If True, locations outside the extent of the source give NaN instead of raising, by default False

  • _indices

    (optional, default: None ) –

    Precomputed location indices, see NCSource.get()

Returns:

  • Series or DataFrame

    The time series of the variable at each location, labelled with the original (unwrapped) coordinates

Source code in reskit/weather/Era5Source/Era5ZarrSource.py
def get(
    self, variable, locations, interpolation="near", force_as_data_frame=False, outside_okay=False, _indices=None
):
    """Extract the data of a loaded variable at the given locations.

    Behaves like NCSource.get(), except that locations are additionally wrapped onto the
    longitude convention of the store. Placements can therefore always be given on a
    [-180, 180) grid, no matter whether the store uses [-180, 180) or [0, 360).

    Parameters
    ----------
    variable : str
        The name of the variable in the data library '.data'
    locations : Anything acceptable to geokit.LocationSet
        The locations to extract data for, with longitudes on a [-180, 180) grid
    interpolation : str, optional
        The interpolation mode, e.g. 'near', 'bilinear' or 'cubic', by default 'near'
    force_as_data_frame : bool, optional
        If True, a pandas DataFrame is returned even for a single location,
        by default False
    outside_okay : bool, optional
        If True, locations outside the extent of the source give NaN instead of raising,
        by default False
    _indices : optional
        Precomputed location indices, see NCSource.get()

    Returns
    -------
    pandas.Series or pandas.DataFrame
        The time series of the variable at each location, labelled with the original
        (unwrapped) coordinates
    """
    if self._longitude_360:
        original_locs = gk.LocationSet(locations)
        wrapped_locs = [(lon % 360.0, lat) for lon, lat in zip(original_locs.lons, original_locs.lats)]
        result = NCSource.get(
            self,
            variable=variable,
            locations=wrapped_locs,
            interpolation=interpolation,
            force_as_data_frame=force_as_data_frame,
            outside_okay=outside_okay,
            _indices=_indices,
        )
        # Restore original location labels (NCSource names columns/series from the locations passed to it)
        original_names = [f"({loc.lon}, {loc.lat})" for loc in original_locs._locations]
        if isinstance(result, pd.DataFrame):
            result.columns = original_names
        else:
            result.name = original_names[0]
        return result
    return NCSource.get(
        self,
        variable=variable,
        locations=locations,
        interpolation=interpolation,
        force_as_data_frame=force_as_data_frame,
        outside_okay=outside_okay,
        _indices=_indices,
    )

load

load(
    variable,
    name=None,
    height_idx=None,
    processor=None,
    overwrite=False,
)

Read a variable from the store into the data library '.data'.

The Zarr counterpart of NCSource.load(). The data is read for the configured spatial subset only, is oriented to match '.lats' and '.lons', and is stored as a plain numpy array of the shape (time, latitude, longitude).

Parameters:

  • variable

    (str) –

    The ERA5 name of the variable to read, as listed in '.variables'

  • name

    (str, default: None ) –

    The key to store the data under in '.data', by default the variable name itself

  • height_idx

    (int, default: None ) –

    The index to select along the height dimension, for variables which have one

  • processor

    (callable, default: None ) –

    A function applied to the raw numpy array before it is stored, e.g. for a unit conversion. Must preserve the shape of the array.

  • overwrite

    (bool, default: False ) –

    If False, a variable which is already in '.data' under 'name' is not read again, by default False

Raises:

  • ResError

    If the variable does not exist in the store, if it does not have the expected dimensions, or if its length along the time axis does not match the time index (and cannot be repaired by forward-filling a single missing last step)

Source code in reskit/weather/Era5Source/Era5ZarrSource.py
def load(self, variable, name=None, height_idx=None, processor=None, overwrite=False):
    """Read a variable from the store into the data library '.data'.

    The Zarr counterpart of NCSource.load(). The data is read for the configured spatial
    subset only, is oriented to match '.lats' and '.lons', and is stored as a plain numpy
    array of the shape (time, latitude, longitude).

    Parameters
    ----------
    variable : str
        The ERA5 name of the variable to read, as listed in '.variables'
    name : str, optional
        The key to store the data under in '.data', by default the variable name itself
    height_idx : int, optional
        The index to select along the height dimension, for variables which have one
    processor : callable, optional
        A function applied to the raw numpy array before it is stored, e.g. for a unit
        conversion. Must preserve the shape of the array.
    overwrite : bool, optional
        If False, a variable which is already in '.data' under 'name' is not read
        again, by default False

    Raises
    ------
    ResError
        If the variable does not exist in the store, if it does not have the expected
        dimensions, or if its length along the time axis does not match the time index
        (and cannot be repaired by forward-filling a single missing last step)
    """
    if name is None:
        name = variable

    if not overwrite and name in self.data:
        return

    if variable not in self.variables.index:
        raise ResError(f"Variable '{variable}' not found in ERA5 Zarr store")

    data = self._dataset[variable]

    if height_idx is not None:
        if len(data.dims) < 4:
            raise ResError(f"Variable '{variable}' does not have a height dimension")
        height_dim = [dim for dim in data.dims if dim not in {self.time_name, "latitude", "longitude"}][0]
        data = data.isel({height_dim: height_idx})

    if "latitude" in data.dims:
        data = data.isel(latitude=slice(self._latStart, self._latStop))
    if "longitude" in data.dims:
        data = data.isel(longitude=slice(self._lonStart, self._lonStop))

    expected_dims = (self.time_name, "latitude", "longitude")
    if data.dims != expected_dims:
        raise ResError(f"Variable '{variable}' is expected to have dimensions {expected_dims}, got {data.dims}")

    tmp = np.asarray(data.values)

    if processor is not None:
        tmp = processor(tmp)

    if tmp.shape[0] != self._timeindex_raw.shape[0]:
        if not self.fill:
            raise ResError(
                "Time mismatch with variable %s. Expected %d, got %d"
                % (variable, self.time_index.shape[0], tmp.shape[0])
            )
        if tmp.shape[0] + 1 != self._timeindex_raw.shape[0]:
            raise ResError("Filling is only intended to fill the last missing step")
        tmp = np.append(tmp, tmp[np.newaxis, -1, :, :], axis=0)

    self.data[name] = tmp[:, :: -1 if self._flip_lat else 1, :: -1 if self._flip_lon else 1]

    if self._verbose:
        shape = tuple(self.data[name].shape)
        print(f"Loaded ERA5 Zarr variable '{variable}' as '{name}' with shape {shape}")

raw_passthrough_variables classmethod

raw_passthrough_variables(cds_variables)

Return the NC short names that are used raw from the ERA5 download — i.e. the variables that survive preprocessing unchanged, with the ones that get replaced by a preprocessed/derived output (see PREPROCESSED_NC_NAMES) removed.

Parameters:

  • cds_variables

    (iterable of str) –

    The ERA5 CDS API variable names a workflow requires (e.g. ["2m_temperature", "surface_pressure", "100m_u_component_of_wind"]).

Returns:

  • list of str

    The corresponding NC short names that pass through unmodified.

Source code in reskit/weather/Era5Source/Era5Source.py
@classmethod
def raw_passthrough_variables(cls, cds_variables):
    """Return the NC short names that are used raw from the ERA5 download — i.e. the
    variables that survive preprocessing unchanged, with the ones that get replaced by
    a preprocessed/derived output (see ``PREPROCESSED_NC_NAMES``) removed.

    Parameters
    ----------
    cds_variables : iterable of str
        The ERA5 CDS API variable names a workflow requires
        (e.g. ``["2m_temperature", "surface_pressure", "100m_u_component_of_wind"]``).

    Returns
    -------
    list of str
        The corresponding NC short names that pass through unmodified.
    """
    return [
        cls.CDS_TO_NC_NAME[cds_name]
        for cds_name in cds_variables
        if cds_name in cls.CDS_TO_NC_NAME and cls.CDS_TO_NC_NAME[cds_name] not in cls.PREPROCESSED_NC_NAMES
    ]

sload_boundary_layer_height

sload_boundary_layer_height()

Standard loader function for the variable 'boundary_layer_height' in meters from the surface

Reads 'blh', or 'boundary_layer_height' for stores which use the long name.

Source code in reskit/weather/Era5Source/Era5ZarrSource.py
def sload_boundary_layer_height(self):
    """Standard loader function for the variable 'boundary_layer_height' in meters
    from the surface

    Reads 'blh', or 'boundary_layer_height' for stores which use the long name.
    """
    return self._load_with_fallback(
        preferred_variable="blh",
        fallback_variable="boundary_layer_height",
        target_name="boundary_layer_height",
    )

sload_direct_horizontal_irradiance

sload_direct_horizontal_irradiance()

Standard loader function for the variable 'direct_horizontal_irradiance' in W/m²

Reads the processed 'fdir_t_adj' if the store provides it, and otherwise falls back on the variant derived from the raw accumulated 'fdir', see _derive_solar_variables.

Source code in reskit/weather/Era5Source/Era5ZarrSource.py
def sload_direct_horizontal_irradiance(self):
    """Standard loader function for the variable 'direct_horizontal_irradiance' in W/m²

    Reads the processed 'fdir_t_adj' if the store provides it, and otherwise falls back
    on the variant derived from the raw accumulated 'fdir', see _derive_solar_variables.
    """
    return self._load_with_fallback(
        preferred_variable="fdir_t_adj",
        fallback_variable="fdir",
        target_name="direct_horizontal_irradiance",
        derived_warning=(
            "Processed ERA5 direct horizontal irradiance ('fdir_t_adj') is not available in this Zarr store; "
            "computing on the fly from raw 'fdir' (J/m² → W/m², time-shifted +1 h)."
        ),
    )

sload_direct_horizontal_irradiance_archive

sload_direct_horizontal_irradiance_archive()

Standard loader function for the variable 'direct_horizontal_irradiance'

Automatically reads the variable "fdir" from the given ERA5 source and saves it as the variable 'direct_horizontal_irradiance' in the data library

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_direct_horizontal_irradiance_archive(self):
    """Standard loader function for the variable 'direct_horizontal_irradiance'

    Automatically reads the variable "fdir" from the given ERA5 source and saves it as the
    variable 'direct_horizontal_irradiance' in the data library
    """
    print(
        "WARNING: Non time corrected ERA5-direct_horizontal_irradiance loaded. Only do this, if you understand the implications of this!"
    )
    return self.load("fdir", name="direct_horizontal_irradiance_archive")

sload_elevated_wind_direction

sload_elevated_wind_direction()

Standard loader function for the variable 'elevated_wind_direction'

Automatically reads the variables "wd" from the given ERA5 source and saves it as the variable 'elevated_wind_direction' in the data library

Where '' is the height specified by Era5Source.ELEVATED_WIND_SPEED_HEIGHT

The "wd" variable also needs to be precomputed from the raw variables "u" and "v" and made available in the raw dataset

TODO: Update function to also be able to handle raw ERA5 inputs for u & v

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_elevated_wind_direction(self):
    """Standard loader function for the variable 'elevated_wind_direction'

    Automatically reads the variables "wd<X>" from the given ERA5 source and saves
    it as the variable 'elevated_wind_direction' in the data library

    Where '<X>' is the height specified by `Era5Source.ELEVATED_WIND_SPEED_HEIGHT`

    The "wd<X>" variable also needs to be precomputed from the raw variables "u<X>"
        and "v<X>" and made available in the raw dataset

    TODO: Update function to also be able to handle raw ERA5 inputs for u & v
    """
    return self.load("wd100", "elevated_wind_direction")

sload_elevated_wind_speed

sload_elevated_wind_speed()

Standard loader function for the variable 'elevated_wind_speed'

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_elevated_wind_speed(self):
    """Standard loader function for the variable 'elevated_wind_speed'"""
    return self._sload_wind_speed(height=self.ELEVATED_WIND_SPEED_HEIGHT, target_name="elevated_wind_speed")

sload_global_horizontal_irradiance

sload_global_horizontal_irradiance()

Standard loader function for the variable 'global_horizontal_irradiance' in W/m²

Reads the processed 'ssrd_t_adj' if the store provides it, and otherwise falls back on the variant derived from the raw accumulated 'ssrd', see _derive_solar_variables.

Source code in reskit/weather/Era5Source/Era5ZarrSource.py
def sload_global_horizontal_irradiance(self):
    """Standard loader function for the variable 'global_horizontal_irradiance' in W/m²

    Reads the processed 'ssrd_t_adj' if the store provides it, and otherwise falls back
    on the variant derived from the raw accumulated 'ssrd', see _derive_solar_variables.
    """
    return self._load_with_fallback(
        preferred_variable="ssrd_t_adj",
        fallback_variable="ssrd",
        target_name="global_horizontal_irradiance",
        derived_warning=(
            "Processed ERA5 global horizontal irradiance ('ssrd_t_adj') is not available in this Zarr store; "
            "computing on the fly from raw 'ssrd' (J/m² → W/m², time-shifted +1 h)."
        ),
    )

sload_global_horizontal_irradiance_archive

sload_global_horizontal_irradiance_archive()

Archive loader function for the variable 'global_horizontal_irradiance. Uses non corrected solar inputs. Use only for reproduceability purposes'

Automatically reads the variable "ssrd" from the given ERA5 source and saves it as the variable 'global_horizontal_irradiance' in the data library

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_global_horizontal_irradiance_archive(self):
    """Archive loader function for the variable 'global_horizontal_irradiance. Uses non corrected solar inputs.
    Use only for reproduceability purposes'

    Automatically reads the variable "ssrd" from the given ERA5 source and saves it as the
    variable 'global_horizontal_irradiance' in the data library
    """
    print("WARNING: Non time corrected ERA5-GHI loaded. Only do this, if you understand the implications of this!")
    return self.load("ssrd", name="global_horizontal_irradiance_archive")

sload_snow_albedo

sload_snow_albedo()

Standard loader function for the variable 'snow_albedo'

unit: dimensionless, instantaneous

Automatically reads the variable "asn" from the given ERA5 source and saves it as the variable 'snow_albedo' in the data library

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_snow_albedo(self):
    """Standard loader function for the variable 'snow_albedo'

    unit: dimensionless, instantaneous

    Automatically reads the variable "asn" from the given ERA5 source and saves it as the
    variable 'snow_albedo' in the data library
    """
    return self.load("asn", name="snow_albedo")

sload_snow_density

sload_snow_density()

Standard loader function for the variable 'snow_density'

unit: kg/m^3, instantaneous

Automatically reads the variable "rsn" from the given ERA5 source and saves it as the variable 'snow_density' in the data library

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_snow_density(self):
    """Standard loader function for the variable 'snow_density'

    unit: kg/m^3, instantaneous

    Automatically reads the variable "rsn" from the given ERA5 source and saves it as the
    variable 'snow_density' in the data library
    """
    return self.load("rsn", name="snow_density")

sload_snow_depth_water_equivalent

sload_snow_depth_water_equivalent()

Standard loader function for the variable 'snow_depth_water_equivalent'

unit: meters, instantaneous

Automatically reads the variable "sd" from the given ERA5 source and saves it as the variable 'snow_depth_water_equivalent' in the data library

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_snow_depth_water_equivalent(self):
    """Standard loader function for the variable 'snow_depth_water_equivalent'

    unit: meters, instantaneous

    Automatically reads the variable "sd" from the given ERA5 source and saves it as the
    variable 'snow_depth_water_equivalent' in the data library
    """
    return self.load("sd", name="snow_depth_water_equivalent")

sload_snowfall_water_equivalent

sload_snowfall_water_equivalent()

Standard loader function for the variable 'snowfall_water_equivalent'

unit: meters per time step, accumulation

Automatically reads the variable "sf" from the given ERA5 source and saves it as the variable 'snowfall_water_equivalent' in the data library

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_snowfall_water_equivalent(self):
    """Standard loader function for the variable 'snowfall_water_equivalent'

    unit: meters per time step, accumulation

    Automatically reads the variable "sf" from the given ERA5 source and saves it as the
    variable 'snowfall_water_equivalent' in the data library
    """
    return self.load("sf", name="snowfall_water_equivalent")

sload_surface_air_temperature

sload_surface_air_temperature()

Standard loader function for the variable 'surface_air_temperature'

Automatically reads the variable "t2m" from the given ERA5 source and saves it as the variable 'surface_air_temperature' in the data library

Temperature values are also converted from kelvin to degrees celsius

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_surface_air_temperature(self):
    """Standard loader function for the variable 'surface_air_temperature'

    Automatically reads the variable "t2m" from the given ERA5 source and saves it as the
    variable 'surface_air_temperature' in the data library

    Temperature values are also converted from kelvin to degrees celsius
    """
    return self.load("t2m", name="surface_air_temperature", processor=lambda x: x - 273.15)

sload_surface_dew_temperature

sload_surface_dew_temperature()

Standard loader function for the variable 'surface_dew_temperature'

Automatically reads the variable "d2m" from the given ERA5 source and saves it as the variable 'surface_dew_temperature' in the data library

Temperature values are also converted from kelvin to degrees celsius

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_surface_dew_temperature(self):
    """Standard loader function for the variable 'surface_dew_temperature'

    Automatically reads the variable "d2m" from the given ERA5 source and saves it as the
    variable 'surface_dew_temperature' in the data library

    Temperature values are also converted from kelvin to degrees celsius
    """
    return self.load("d2m", name="surface_dew_temperature", processor=lambda x: x - 273.15)

sload_surface_pressure

sload_surface_pressure()

Standard loader function for the variable 'surface_pressure'

Automatically reads the variable "sp" from the given ERA5 source and saves it as the variable 'surface_pressure' in the data library

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_surface_pressure(self):
    """Standard loader function for the variable 'surface_pressure'

    Automatically reads the variable "sp" from the given ERA5 source and saves it as the
    variable 'surface_pressure' in the data library
    """
    return self.load("sp", name="surface_pressure")

sload_surface_wind_speed

sload_surface_wind_speed()

Standard loader function for the variable 'surface_wind_speed'

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_surface_wind_speed(self):
    """Standard loader function for the variable 'surface_wind_speed'"""
    return self._sload_wind_speed(height=self.SURFACE_WIND_SPEED_HEIGHT, target_name="surface_wind_speed")

sload_wind_speed_at_100m

sload_wind_speed_at_100m()

Standard loader function for the variable 'wind_speed_at_100m'

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_wind_speed_at_100m(self):
    """Standard loader function for the variable 'wind_speed_at_100m'"""
    return self._sload_wind_speed(height=100, target_name="wind_speed_at_100m")

sload_wind_speed_at_10m

sload_wind_speed_at_10m()

Standard loader function for the variable 'wind_speed_at_10m'

Source code in reskit/weather/Era5Source/Era5Source.py
def sload_wind_speed_at_10m(self):
    """Standard loader function for the variable 'wind_speed_at_10m'"""
    return self._sload_wind_speed(height=10, target_name="wind_speed_at_10m")

var_info

var_info(var)

Print the xarray representation of a variable of the store.

Parameters:

  • var

    (str) –

    The ERA5 name of the variable, as listed in '.variables'

Source code in reskit/weather/Era5Source/Era5ZarrSource.py
def var_info(self, var):
    """Print the xarray representation of a variable of the store.

    Parameters
    ----------
    var : str
        The ERA5 name of the variable, as listed in '.variables'
    """
    assert var in self.variables.index
    print(self._dataset[var])