sentinelhub.api.statistical

Implementation of Sentinel Hub Statistical API interface.

class sentinelhub.api.statistical.SentinelHubStatistical(aggregation, input_data, bbox=None, geometry=None, calculations=None, **kwargs)[source]

Bases: SentinelHubBaseApiRequest

Sentinel Hub Statistical API interface

For more information check Statistical API documentation.

For details of certain parameters check the Statistical API reference.

Parameters:
  • aggregation (JsonDict) – Aggregation part of the payload, which can be generated with aggregation method

  • input_data (Sequence[JsonDict | InputDataDict]) – A list of input dictionary objects as described in the API reference. It can be generated with input_data method

  • bbox (BBox | None) – A bounding box of the request

  • geometry (Geometry | None) – A geometry of the request

  • calculations (JsonDict | None) – Calculations part of the payload.

  • data_folder – Location of the directory where the downloaded data could be saved.

  • config – A custom instance of config class to override parameters from the saved configuration.

  • kwargs (Any) –

property mime_type: MimeType

The mime type of the request.

static body(request_bounds, request_data, aggregation, calculations, other_args=None)[source]

Generate the Process API request body

Parameters:
  • request_bounds (Dict[str, Any]) – A dictionary as generated by bounds helper method.

  • request_data (Sequence[Dict[str, Any]]) – A list of dictionaries as generated by input_data helper method.

  • aggregation (Dict[str, Any]) – A dictionary as generated by aggregation helper method.

  • calculations (Dict[str, Any] | None) – A dictionary defining calculations part of the payload

  • other_args (Dict[str, Any] | None) – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.

Returns:

Request payload dictionary

Return type:

Dict[str, Any]

static aggregation(evalscript, time_interval, aggregation_interval, size=None, resolution=None, other_args=None)[source]

Generate the aggregation part of the Statistical API request body

Parameters:
  • evalscript (str) – An evalscript.

  • time_interval (Tuple[None | str | date, None | str | date]) – An interval with start and end date of the form YYYY-MM-DDThh:mm:ss or YYYY-MM-DD or a datetime object

  • aggregation_interval (str) – How data from given time interval is aggregated together

  • size (tuple[int, int] | None) – A width and height of an image from which data will be aggregated

  • resolution (tuple[float, float] | None) – A resolution in x and y dimensions of an image from which data will be aggregated. Resolution has to be defined in the same units as request bbox or geometry

  • other_args (Dict[str, Any] | None) – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.

Returns:

Aggregation payload dictionary

Return type:

Dict[str, Any]