sentinelhub.api.batch.statistical

Module implementing an interface with Sentinel Hub Batch Processing API.

class sentinelhub.api.batch.statistical.S3Specification(_typename, _fields=None, /, **kwargs)[source]

Bases: dict

Specification of a S3 path.

url: str
accessKey: str
secretAccessKey: str
region: typing_extensions.NotRequired[str]
class sentinelhub.api.batch.statistical.AccessSpecification(_typename, _fields=None, /, **kwargs)[source]

Bases: dict

Specification of a S3 input or output.

s3: S3Specification
class sentinelhub.api.batch.statistical.SentinelHubBatchStatistical(config=None)[source]

Bases: BaseBatchClient[BatchStatisticalRequest]

An interface class for Sentinel Hub Batch Statistical API

Check Batch Statistical API for more information.

Parameters

config – 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.

create(*, input_features, input_data, aggregation, calculations, output, **kwargs)[source]

Create a new batch statistical request

Batch Statistical API reference

Parameters
Return type

BatchStatisticalRequest

create_from_request(statistical_request, input_features, output, **kwargs)[source]

Create a new batch statistical request from an existing statistical request.

Parameters
  • statistical_request (SentinelHubStatistical) – A Sentinel Hub Statistical request.

  • input_features (AccessSpecification) – A dictionary describing the S3 path and credentials to access the input GeoPackage.

  • output (AccessSpecification) – A dictionary describing the S3 path and credentials to access the output folder.

  • kwargs (Any) – Any other arguments to be added to a dictionary of parameters

Returns

A Batch Statistical request with the same calculations and aggregations but using geometries specified in the input GeoPackage.

Return type

BatchStatisticalRequest

static s3_specification(url, access_key, secret_access_key, region=None)[source]

A helper method to build a dictionary used for specifying S3 paths

Parameters
  • url (str) – A URL pointing to an S3 bucket or an object in an S3 bucket.

  • access_key (str) – AWS access key that allows programmatic access to the S3 bucket specified in the url field.

  • secret_access_key (str) – AWS secret access key which must correspond to the AWS access key.

  • region (Optional[str]) – The region where the S3 bucket is located. If omitted, the region of the Sentinel Hub deployment that the request is submitted to is assumed.

Returns

A dictionary of S3 specifications used by the Batch Statistical API

Return type

AccessSpecification

get_request(batch_request)[source]

Collects information about a single batch request

Batch Statistical API reference

Returns

Batch request info

Parameters

batch_request (Union[str, dict, BatchStatisticalRequest]) –

Return type

BatchStatisticalRequest

get_status(batch_request)[source]

Collects information about a status of a request

Batch Statistical API reference

Returns

Batch request status dictionary

Parameters

batch_request (Union[str, dict, BatchStatisticalRequest]) –

Return type

Dict[str, Any]

start_analysis(batch_request)[source]

Starts analysis of a batch job request

Batch Statistical API reference

Parameters

batch_request (Union[str, dict, BatchStatisticalRequest]) – It could be a batch request object, a raw batch request payload or only a batch request ID.

Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

start_job(batch_request)[source]

Starts running a batch job

Batch Statistical API reference

Parameters

batch_request (Union[str, dict, BatchStatisticalRequest]) – It could be a batch request object, a raw batch request payload or only a batch request ID.

Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

cancel_job(batch_request)[source]

Cancels a batch job

Batch Statistical API reference

Parameters

batch_request (Union[str, dict, BatchStatisticalRequest]) – It could be a batch request object, a raw batch request payload or only a batch request ID.

Return type

Optional[Union[Dict[str, Any], list, str, float, int]]

class sentinelhub.api.batch.statistical.BatchStatisticalRequest(request_id, completion_percentage, request, status, user_id=None, created=None, cost_pu=None, user_action=None, user_action_updated=None, error=None, other_data=<factory>)[source]

Bases: BaseBatchRequest

A dataclass object that holds information about a batch statistical request

Parameters
request_id: str
completion_percentage: float
request: dict
status: BatchRequestStatus
user_id: Optional[str] = None
created: Optional[datetime] = None
cost_pu: Optional[float] = None
user_action: Optional[BatchUserAction] = None
user_action_updated: Optional[str] = None
error: Optional[str] = None
dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
classmethod from_dict(kvs, *, infer_missing=False)

Transforms itself into a dictionary form.

Parameters

kvs (Optional[Union[dict, list, str, int, float, bool]]) –

Return type

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
Parameters

s (Union[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)

Transforms itself into a dictionary form.

Return type

Dict[str, Optional[Union[dict, list, str, int, float, bool]]]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
Parameters
Return type

str

other_data: Optional[CatchAllVar]