class datacube.Datacube(index=None, config=None, app=None, env=None, validate_connection=True)[source]

Interface to search, read and write a datacube.

__init__(index=None, config=None, app=None, env=None, validate_connection=True)[source]

Create the interface for the query and storage access.

If no index or config is given, the default configuration is used for database connection.

  • index (datacube.index.Index or None.) – The database index to use.

  • config (Union[LocalConfig|str]) –

    A config object or a path to a config file that defines the connection.

    If an index is supplied, config is ignored.

  • app (str) –

    A short, alphanumeric name to identify this application.

    The application name is used to track down problems with database queries, so it is strongly advised that be used. Required if an index is not supplied, otherwise ignored.

  • env (str) –

    Name of the datacube environment to use. ie. the section name in any config files. Defaults to ‘datacube’ for backwards compatibility with old config files.

    Allows you to have multiple datacube instances in one configuration, specified on load, eg. ‘dev’, ‘test’ or ‘landsat’, ‘modis’ etc.

  • validate_connection (bool) – Should we check that the database connection is available and valid


Datacube object


__init__([index, config, app, env, …])

Create the interface for the query and storage access.


Close any open connections

create_storage(coords, geobox, measurements)

Create a xarray.Dataset and (optionally) fill it with data.


Search the index and return all datasets for a product matching the search terms.

find_datasets_lazy([limit, ensure_location])

Find datasets matching query.

group_datasets(datasets, group_by)

Group datasets along defined non-spatial dimensions (ie.

list_measurements([show_archived, with_pandas])

List measurements for each product

list_products([show_archived, with_pandas])

List products in the datacube

load([product, measurements, output_crs, …])

Load data as an xarray object.

load_data(sources, geobox, measurements[, …])

Load data from group_datasets() into an xarray.Dataset.