datacube.api.query.Query

class datacube.api.query.Query(index=None, product=None, geopolygon=None, like=None, **search_terms)[source]
__init__(index=None, product=None, geopolygon=None, like=None, **search_terms)[source]

Parses search terms in preparation for querying the Data Cube Index.

Create a Query object by passing it a set of search terms as keyword arguments.

>>> query = Query(product='ls5_nbar_albers', time=('2001-01-01', '2002-01-01'))

Use by accessing search_terms:

>>> query.search_terms['time']  # doctest: +NORMALIZE_WHITESPACE
Range(begin=datetime.datetime(2001, 1, 1, 0, 0, tzinfo=<UTC>),         end=datetime.datetime(2002, 1, 1, 23, 59, 59, 999999, tzinfo=tzutc()))

By passing in an index, the search parameters will be validated as existing on the product.

Used by datacube.Datacube.find_datasets() and datacube.Datacube.load().

Parameters:
  • index (datacube.index.Index) – An optional index object, if checking of field names is desired.
  • product (str) – name of product
  • geopolygon (geometry.Geometry or None) – spatial bounds of the search
  • like (xarray.Dataset) – spatio-temporal bounds of like are used for the search
  • search_terms
    • measurements - list of measurements to retrieve
    • latitude, lat, y, longitude, lon, long, x - tuples (min, max) bounding spatial dimensions
    • crs - spatial coordinate reference system to interpret the spatial bounds
    • group_by - observation grouping method. One of time, solar_day. Default is time

Methods

__init__([index, product, geopolygon, like]) Parses search terms in preparation for querying the Data Cube Index.

Attributes

search_terms Access the search terms as a dictionary.