opensearch

Module for communication with http://opensearch.sentinel-hub.com/resto/api

For more search parameters check: http://opensearch.sentinel-hub.com/resto/api/collections/Sentinel2/describe.xml

exception sentinelhub.opensearch.TileMissingException[source]

Bases: Exception

This exception is raised when requested tile is missing at Sentinel Hub Opensearch service

sentinelhub.opensearch.get_tile_info_id(tile_id)[source]

Get basic information about image tile

Parameters:tile_id (str) – original tile identification string provided by ESA (e.g. ‘S2A_OPER_MSI_L1C_TL_SGS__20160109T230542_A002870_T10UEV_N02.01’)
Returns:dictionary with info provided by Opensearch REST service or None if such tile does not exist on AWS.
Return type:dict or None
Raises:TileMissingException if no tile with tile ID tile_id exists
sentinelhub.opensearch.get_tile_info(tile, time, aws_index=None, all_tiles=False)[source]

Get basic information about image tile

Parameters:
  • tile (str) – tile name (e.g. 'T10UEV')
  • time (str or (str, str)) – A single date or a time interval, times have to be in ISO 8601 string
  • aws_index (int or None) – index of tile on AWS
  • all_tiles (bool) – If True it will return list of all tiles otherwise only the first one
Returns:

dictionary with info provided by Opensearch REST service or None if such tile does not exist on AWS.

Return type:

dict or None

sentinelhub.opensearch.get_area_info(bbox, date_interval, maxcc=None)[source]

Get information about all images from specified area and time range

Parameters:
  • bbox (geometry.BBox) – bounding box of requested area
  • date_interval (tuple(str)) – a pair of time strings in ISO8601 format
  • maxcc (float in range [0, 1] or None) – filter images by maximum percentage of cloud coverage
Returns:

list of dictionaries containing info provided by Opensearch REST service

Return type:

list(dict)

sentinelhub.opensearch.get_area_dates(bbox, date_interval, maxcc=None)[source]

Get list of times of existing images from specified area and time range

Parameters:
  • bbox (geometry.BBox) – bounding box of requested area
  • date_interval (tuple(str)) – a pair of time strings in ISO8601 format
  • maxcc (float in range [0, 1] or None) – filter images by maximum percentage of cloud coverage
Returns:

list of time strings in ISO8601 format

Return type:

list[datetime.datetime]

sentinelhub.opensearch.reduce_by_maxcc(result_list, maxcc)[source]

Filter list image tiles by maximum cloud coverage

Parameters:
  • result_list (list(dict)) – list of dictionaries containing info provided by Opensearch REST service
  • maxcc (float in range [0, 1]) – filter images by maximum percentage of cloud coverage
Returns:

list of dictionaries containing info provided by Opensearch REST service

Return type:

list(dict)

sentinelhub.opensearch.search_iter(tile_id=None, bbox=None, start_date=None, end_date=None, absolute_orbit=None)[source]

A generator function that implements OpenSearch search queries and returns results

All parameters for search are optional.

Parameters:
  • tile_id (str) – original tile identification string provided by ESA (e.g. ‘S2A_OPER_MSI_L1C_TL_SGS__20160109T230542_A002870_T10UEV_N02.01’)
  • bbox (geometry.BBox) – bounding box of requested area
  • start_date (str) – beginning of time range in ISO8601 format
  • end_date (str) – end of time range in ISO8601 format
  • absolute_orbit (int) – An absolute orbit number of Sentinel-2 L1C products as defined by ESA
Returns:

An iterator returning dictionaries with info provided by Sentinel Hub OpenSearch REST service

Return type:

Iterator[dict]