esmvalcore.io.xcube#

Access data using xcube.

Run the command esmvaltool config copy data-xcube-esacci.yml to update your configuration to use this module. This will create a file with the following content in your configuration directory:

Listing 20 Contents of data-xcube-esacci.yml#
# Read data from the ESA Climate Data Centre (ESA CCI) using xcube.
# More information available at
# https://xcube.readthedocs.io/en/latest/dataaccess.html#esa-climate-data-centre-esa-cci-cciodp-ccizarr-esa-cci-kc.
projects:
  ESACCI:
    data:
      ccizarr:
        type: "esmvalcore.io.xcube.XCubeDataSource"
        data_store_id: "ccizarr"
        priority: 1
        values: &values
          # Use this to define the mapping between the short_name used by
          # ESMValCore and the variable name in the source dataset.
          short_name:
            prw: tcwv
      esa-cci-kc:
        type: "esmvalcore.io.xcube.XCubeDataSource"
        data_store_id: "esa-cci-kc"
        priority: 2
        values: *values
      cciodp:
        type: "esmvalcore.io.xcube.XCubeDataSource"
        data_store_id: "cciodp"
        priority: 3
        values: *values

Classes:

XCubeDataSource(name, project, priority, ...)

Data source for finding files on a local filesystem.

XCubeDataset(name, facets, store, ...)

A dataset that can be used to load data found using xcube.

class esmvalcore.io.xcube.XCubeDataSource(name: str, project: str, priority: int, data_store_id: str, values: dict[str, dict[str, str]] = <factory>, data_store_params: dict[str, ~typing.Any] = <factory>, open_params: dict[str, ~typing.Any] = <factory>)[source]#

Bases: DataSource

Data source for finding files on a local filesystem.

Attributes:

data_store_id

Name of the data store.

data_store_params

Parameters to use when creating the data store.

debug_info

A string containing debug information when no data is found.

name

A name identifying the data source.

open_params

Parameters to use when opening the data.

priority

The priority of the data source.

project

The project that the data source provides data for.

values

Mapping between the ESMValCore and xcube facet values.

Methods:

find_data(**facets)

Find data.

Parameters:
data_store_id: str#

Name of the data store.

A list of available data stores can be found in the xcube documentation.

data_store_params: dict[str, Any]#

Parameters to use when creating the data store.

debug_info: str = ''#

A string containing debug information when no data is found.

find_data(**facets: FacetValue) list[XCubeDataset][source]#

Find data.

Parameters:

**facets (FacetValue) – Find data matching these facets.

Returns:

A list of data elements that have been found.

Return type:

list[XCubeDataset]

name: str#

A name identifying the data source.

open_params: dict[str, Any]#

Parameters to use when opening the data.

priority: int#

The priority of the data source. Lower values have priority.

project: str#

The project that the data source provides data for.

values: dict[str, dict[str, str]]#

Mapping between the ESMValCore and xcube facet values.

class esmvalcore.io.xcube.XCubeDataset(name: str, facets: Facets, store: xcube.core.store.store.DataStore, open_params: dict[str, Any] = <factory>)[source]#

Bases: DataElement

A dataset that can be used to load data found using xcube.

Attributes:

attributes

Attributes are key-value pairs describing the data.

facets

Facets are key-value pairs that were used to find this data.

name

A unique name identifying the data.

open_params

Parameters to use when opening the data.

store

The store containing the data.

Methods:

prepare()

Prepare the data for access.

to_iris()

Load the data as Iris cubes.

Parameters:
  • name (str)

  • facets (Facets)

  • store (xcube.core.store.store.DataStore)

  • open_params (dict[str, Any])

property attributes: dict[str, Any]#

Attributes are key-value pairs describing the data.

facets: Facets#

Facets are key-value pairs that were used to find this data.

name: str#

A unique name identifying the data.

open_params: dict[str, Any]#

Parameters to use when opening the data.

prepare() None[source]#

Prepare the data for access.

Return type:

None

store: xcube.core.store.store.DataStore#

The store containing the data.

to_iris() iris.cube.CubeList[source]#

Load the data as Iris cubes.

Returns:

The loaded data.

Return type:

iris.cube.CubeList