semantique.datacube.STACCube

semantique.datacube.STACCube#

class semantique.datacube.STACCube(layout=None, src=None, **config)[source]#

EO data cube configuration for results from STAC searches.

STACCube loads data from an item collection and fetches the data into an xarray.

Parameters:
  • layout (dict) – The layout file describing the EO data cube. If None, an empty EO data cube is constructed.

  • src (pystac.item_collection.ItemCollection or :class:list` of :class:`pystac.item.Item) – The item search result from a previous STAC search as a src to build the datacube

  • **config

    Additional keyword arguments tuning the data retrieval configuration. Valid options are:

    • trim (bool): Should each retrieved data layer be trimmed? Trimming means that dimension coordinates for which all values are missing are removed from the array. The spatial dimensions are trimmed only at the edges, to maintain their regularity. Defaults to True.

    • group_by_solar_day (bool): Should the time dimension be resampled to the day level, using solar day to keep scenes together? Defaults to True.

    • dtype (str): Dtype of the data source. Will be converted to

    float32/float64 prior to passing it to the semantique processor. Defaults to float32.

    • na_value (int): NA value as encoded in the original data

    Defaults to np.nan.

    • dask_params (dict): Parameters passed to the .compute() function

    when fetching data via the stackstac API. Can be used to control the parallelism in fetching data. Defaults to None, i.e. to use the threaded scheduler as set by dask as a default for arrays.

    • value_type_mapping (dict): How do value type encodings in the layout map to the value types used by semantique? Defaults to a one-to-one mapping:

      {
        "nominal": "nominal",
        "ordinal": "ordinal",
        "binary": "binary",
        "continuous": "continuous",
        "discrete": "discrete"
      }
      
    • resamplers (dict): When data need to be resampled to a different spatial and/or temporal resolution, what resampling technique should be used? Should be specified separately for each possible value type in the layout. Valid techniques are:

      'nearest', 'average', 'bilinear', 'cubic', 'cubic_spline',
      'lanczos', 'mode', 'gauss',  'max', 'min', 'med', 'q1', 'q3'
      

      Defaults to:

      {
        "nominal": "nearest",
        "ordinal": "nearest",
        "binary": "nearest",
        "continuous": "bilinear",
        "discrete": "nearest"
      }
      

__init__(layout=None, src=None, **config)[source]#

Methods

__init__([layout, src])

lookup(*reference)

Lookup the metadata of a referenced data layer.

retrieve(*reference, extent)

Retrieve a data layer from the EO data cube.

Attributes

config

Configuration settings for data retrieval.

layout

The layout file of the EO data cube.

src

pystac.item_collection.ItemCollection or list of pystac.item.Item: The item search result from a previous STAC search.