sentinelhub.api.byoc
Module implementing an interface with Sentinel Hub Bring Your Own COG API.
- class sentinelhub.api.byoc.ByocCollectionBand(source=None, band_index=None, bit_depth=8, sample_format='UINT', no_data=None, other_data=<factory>)[source]
Bases:
object
Dataclass to hold BYOC collection band specification
- Parameters:
source (str | None) –
band_index (int | None) –
bit_depth (int) –
sample_format (str) –
no_data (float | None) –
other_data (CatchAllVar | None) –
- source: str | None = None
- band_index: int | None = None
- bit_depth: int = 8
- sample_format: str = 'UINT'
- no_data: float | None = None
- other_data: CatchAllVar | None
- dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
- classmethod from_dict(kvs, *, infer_missing=False)
- Parameters:
kvs (dict | list | str | int | float | bool | None) –
- Return type:
A
- classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
- Parameters:
s (str | bytes | bytearray) –
- Return type:
A
- classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
- Parameters:
infer_missing (bool) –
many (bool) –
partial (bool) –
- Return type:
SchemaF[A]
- to_dict(encode_json=False)
- Return type:
Dict[str, dict | list | str | int | float | bool | None]
- to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
- Parameters:
skipkeys (bool) –
ensure_ascii (bool) –
check_circular (bool) –
allow_nan (bool) –
indent (int | str | None) –
separators (Tuple[str, str] | None) –
default (Callable | None) –
sort_keys (bool) –
- Return type:
str
- class sentinelhub.api.byoc.ByocCollectionAdditionalData(bands=None, max_meters_per_pixel=None, max_meters_per_pixel_override=None, other_data=<factory>)[source]
Bases:
object
Dataclass to hold BYOC collection additional data
- Parameters:
bands (Dict[str, ByocCollectionBand] | None) –
max_meters_per_pixel (float | None) –
max_meters_per_pixel_override (float | None) –
other_data (CatchAllVar | None) –
- bands: Dict[str, ByocCollectionBand] | None = None
- max_meters_per_pixel: float | None = None
- max_meters_per_pixel_override: float | None = None
- other_data: CatchAllVar | None
- dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
- classmethod from_dict(kvs, *, infer_missing=False)
- Parameters:
kvs (dict | list | str | int | float | bool | None) –
- Return type:
A
- classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
- Parameters:
s (str | bytes | bytearray) –
- Return type:
A
- classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
- Parameters:
infer_missing (bool) –
many (bool) –
partial (bool) –
- Return type:
SchemaF[A]
- to_dict(encode_json=False)
- Return type:
Dict[str, dict | list | str | int | float | bool | None]
- to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
- Parameters:
skipkeys (bool) –
ensure_ascii (bool) –
check_circular (bool) –
allow_nan (bool) –
indent (int | str | None) –
separators (Tuple[str, str] | None) –
default (Callable | None) –
sort_keys (bool) –
- Return type:
str
- class sentinelhub.api.byoc.ByocCollection(name, s3_bucket, additional_data=None, collection_id=None, user_id=None, created=None, no_data=None, other_data=<factory>)[source]
Bases:
BaseCollection
Dataclass to hold BYOC collection data
- Parameters:
name (str) –
s3_bucket (str) –
additional_data (ByocCollectionAdditionalData | None) –
collection_id (str | None) –
user_id (str | None) –
created (datetime | None) –
no_data (int | float | None) –
other_data (CatchAllVar | None) –
- additional_data: ByocCollectionAdditionalData | None = None
- dataclass_json_config = {'letter_case': <function camelcase>}
- classmethod from_dict(kvs, *, infer_missing=False)
- Parameters:
kvs (dict | list | str | int | float | bool | None) –
- Return type:
A
- classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
- Parameters:
s (str | bytes | bytearray) –
- Return type:
A
- classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
- Parameters:
infer_missing (bool) –
many (bool) –
partial (bool) –
- Return type:
SchemaF[A]
- to_dict(encode_json=False)
- Return type:
Dict[str, dict | list | str | int | float | bool | None]
- to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
- Parameters:
skipkeys (bool) –
ensure_ascii (bool) –
check_circular (bool) –
allow_nan (bool) –
indent (int | str | None) –
separators (Tuple[str, str] | None) –
default (Callable | None) –
sort_keys (bool) –
- Return type:
str
- class sentinelhub.api.byoc.ByocTile(path, status=None, tile_id=None, tile_geometry=None, cover_geometry=None, created=None, sensing_time=None, ingestion_start=None, additional_data=None, other_data=<factory>)[source]
Bases:
object
Dataclass to hold BYOC tile data
- Parameters:
- path: str
- status: str | None = None
- tile_id: str | None = None
- created: datetime | None = None
- sensing_time: datetime | None = None
- ingestion_start: datetime | None = None
- additional_data: dict | None = None
- other_data: CatchAllVar | None
- dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
- classmethod from_dict(kvs, *, infer_missing=False)
- Parameters:
kvs (dict | list | str | int | float | bool | None) –
- Return type:
A
- classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
- Parameters:
s (str | bytes | bytearray) –
- Return type:
A
- classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
- Parameters:
infer_missing (bool) –
many (bool) –
partial (bool) –
- Return type:
SchemaF[A]
- to_dict(encode_json=False)
- Return type:
Dict[str, dict | list | str | int | float | bool | None]
- to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
- Parameters:
skipkeys (bool) –
ensure_ascii (bool) –
check_circular (bool) –
allow_nan (bool) –
indent (int | str | None) –
separators (Tuple[str, str] | None) –
default (Callable | None) –
sort_keys (bool) –
- Return type:
str
- class sentinelhub.api.byoc.SentinelHubBYOC(config=None)[source]
Bases:
SentinelHubService
An interface class for Sentinel Hub Bring your own COG (BYOC) API
For more info check BYOC API reference.
- Parameters:
config (SHConfig | None) – A configuration object with required parameters sh_client_id, sh_client_secret, and sh_auth_base_url which is used for authentication and sh_base_url which defines the service deployment that will be used.
- iter_collections(search=None, **kwargs)[source]
Retrieve collections
- Parameters:
search (str | None) – A search query
kwargs (Any) – Any other request parameters
- Returns:
iterator over collections
- Return type:
- get_collection(collection)[source]
Get collection by its id
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
- Returns:
dictionary of the collection
- Return type:
Dict[str, Any]
- create_collection(collection)[source]
Create a new collection
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – ByocCollection object or a dictionary
- Returns:
dictionary of the created collection
- Return type:
Dict[str, Any]
- update_collection(collection)[source]
Update an existing collection
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – ByocCollection object or a dictionary
- Return type:
Dict[str, Any] | list | str | float | int | None
- delete_collection(collection)[source]
Delete existing collection by its id
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
- Return type:
Dict[str, Any] | list | str | float | int | None
- copy_tiles(from_collection, to_collection)[source]
Copy tiles from one collection to another
- Parameters:
from_collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
to_collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
- Return type:
Dict[str, Any] | list | str | float | int | None
- iter_tiles(collection, sort=None, path=None, **kwargs)[source]
Iterator over collection tiles
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
sort (str | None) – Order in which to return tiles
path (str | None) – An exact path where tiles are located
kwargs (Any) – Any other request parameters
- Returns:
An iterator over payloads of tiles from the collection
- Return type:
- get_tile(collection, tile)[source]
Get a tile of collection
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
tile (ByocTile | dict | str) – a ByocTile, dict or tile id string
- Returns:
dictionary of the tile
- Return type:
Dict[str, Any]
- create_tile(collection, tile)[source]
Create tile within collection
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
tile (ByocTile | dict | str) – a ByocTile or dict
- Returns:
dictionary of the tile
- Return type:
Dict[str, Any]
- update_tile(collection, tile)[source]
Update a tile within collection
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
tile (ByocTile | dict | str) – a ByocTile or dict
- Return type:
Dict[str, Any] | list | str | float | int | None
- delete_tile(collection, tile)[source]
Delete a tile from collection
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
tile (ByocTile | dict | str) – a ByocTile, dict or tile id string
- Return type:
Dict[str, Any] | list | str | float | int | None
- reingest_tile(collection, tile)[source]
Re-ingests a tile into a collection
- Parameters:
collection (ByocCollection | DataCollection | dict | str) – a ByocCollection, dict or collection id string
tile (ByocTile | dict | str) – a ByocTile, dict or tile id string
- Return type:
Dict[str, Any] | list | str | float | int | None