sentinelhub.api.batch.statistical
Module implementing an interface with Sentinel Hub Batch Processing API.
- 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 (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.
- static s3_specification(url, access_key=None, secret_access_key=None, iam_role_arn=None, region=None)
A helper method to build a dictionary used for specifying S3 paths. Consult the access documentation for more information.
In general either use iam_role_arn or access_key plus secret_access_key.
- Parameters:
url (str) – A URL pointing to an S3 bucket or an object in an S3 bucket.
access_key (str | None) – AWS access key that allows programmatic access to the S3 bucket specified in the url field.
secret_access_key (str | None) – AWS secret access key which must correspond to the AWS access key.
iam_role_arn (str | None) – IAM role ARN, which allows programmatic access to the S3 bucket specified in the url field using the recommended assume IAM role flow.
region (str | None) – 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:
- create(*, input_features, input_data, aggregation, calculations, output, **kwargs)[source]
Create a new batch statistical request
Batch Statistical API reference
- Parameters:
input_features (AccessSpecification) –
input_data (Sequence[Dict[str, Any] | InputDataDict]) –
aggregation (Dict[str, Any]) –
calculations (Dict[str, Any] | None) –
output (AccessSpecification) –
kwargs (Any) –
- Return type:
- 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:
- get_request(batch_request)[source]
Collects information about a single batch request
Batch Statistical API reference
- Returns:
Batch request info
- Parameters:
batch_request (str | dict | BatchStatisticalRequest) –
- Return type:
- 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 (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 (str | dict | BatchStatisticalRequest) – It could be a batch request object, a raw batch request payload or only a batch request ID.
- Return type:
Dict[str, Any] | list | str | float | int | None
- start_job(batch_request)[source]
Starts running a batch job
Batch Statistical API reference
- Parameters:
batch_request (str | dict | BatchStatisticalRequest) – It could be a batch request object, a raw batch request payload or only a batch request ID.
- Return type:
Dict[str, Any] | list | str | float | int | None
- cancel_job(batch_request)[source]
Cancels a batch job
Batch Statistical API reference
- Parameters:
batch_request (str | dict | BatchStatisticalRequest) – It could be a batch request object, a raw batch request payload or only a batch request ID.
- Return type:
Dict[str, Any] | list | str | float | int | None
- stop_job(batch_request)[source]
Stop a batch job
Batch Statistical API reference
- Parameters:
batch_request (str | dict | BatchStatisticalRequest) – It could be a batch request object, a raw batch request payload or only a batch request ID.
- Return type:
Dict[str, Any] | list | str | float | int | None
- 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 (str | None) –
created (datetime | None) –
cost_pu (float | None) –
user_action (BatchUserAction | None) –
user_action_updated (str | None) –
error (str | None) –
other_data (CatchAllVar | None) –
- request_id: str
- completion_percentage: float
- request: dict
- status: BatchRequestStatus
- user_id: str | None = None
- created: datetime | None = None
- cost_pu: float | None = None
- user_action: BatchUserAction | None = None
- user_action_updated: str | None = None
- error: str | None = None
- other_data: CatchAllVar | 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 (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)
Transforms itself into a dictionary form.
- 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