class datacube.api.query.Query(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']  
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().

  • 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

    • ’extra_dimension_name’ (e.g. z) - tuples (min, max) bounding extra dimensions specified by name for 3D datasets. E.g. z=(10, 30).

    • crs - spatial coordinate reference system to interpret the spatial bounds

    • group_by - observation grouping method. One of time, solar_day. Default is time



Access the search terms as a dictionary.

property search_terms

Access the search terms as a dictionary.