sentinelhub.api.process

Implementation of Sentinel Hub Process API interface.

class sentinelhub.api.process.SentinelHubRequest(evalscript, input_data, responses, bbox=None, geometry=None, size=None, resolution=None, **kwargs)[source]

Bases: SentinelHubBaseApiRequest

Sentinel Hub Process API interface

For more information check Process API documentation.

For details of certain parameters check the Process API reference.

Parameters:
  • evalscript (str) – Evalscript.

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

  • responses (list[JsonDict]) – A list of output.responses objects as described in the API reference. It can be generated with the helper function SentinelHubRequest.output_response

  • bbox (BBox | None) – Bounding box describing the area of interest.

  • geometry (Geometry | None) – Geometry describing the area of interest.

  • size (tuple[int, int] | None) – Size of the image.

  • resolution (tuple[float, float] | None) – Resolution of the image. It has to be in units compatible with the given CRS.

  • data_folder – location of the directory where the fetched data will 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, evalscript, request_output=None, other_args=None)[source]

Generate the Process API request body

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

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

  • evalscript (str) – Evalscript.

  • request_output (Dict[str, Any] | None) – A dictionary as generated by SentinelHubRequest.output helper method.

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

Return type:

Dict[str, Any]

static output_response(identifier, response_format, other_args=None)[source]

Generate an element of output.responses as described in the Process API reference.

Parameters:
  • identifier (str) – Identifier of the output response.

  • response_format (str | MimeType) – A mime type of one of ‘png’, ‘json’, ‘jpeg’, ‘tiff’.

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

Return type:

Dict[str, Any]

static output(responses, size=None, resolution=None, other_args=None)[source]

Generate an output part of the request as described in the Process API reference

Parameters:
  • responses (list[Dict[str, Any]]) – A list of objects in output.responses as generated by SentinelHubRequest.output_response.

  • size (tuple[int, int] | None) – Size of the image.

  • resolution (tuple[float, float] | None) – Resolution of the image. It has to be in units compatible with the given CRS.

  • other_args (dict | None) – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.

Return type:

Dict[str, Any]

class sentinelhub.api.process.AsyncProcessRequest(*, evalscript=None, evalscript_reference=None, input_data, responses, delivery, bbox=None, geometry=None, size=None, resolution=None, **kwargs)[source]

Bases: SentinelHubBaseApiRequest

Sentinel Hub Async Process API interface

For more information check Async Process API documentation.

For details of certain parameters check the Async Process API reference.

Parameters:
  • evalscript (str | None) – Evalscript.

  • evalscript_reference (AccessSpecification | None) – Evalscript specification.

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

  • responses (list[JsonDict]) – A list of output.responses objects as described in the API reference. It can be generated with the helper function SentinelHubRequest.output_response

  • delivery (AccessSpecification) – S3 specification for dumping the request data.

  • bbox (BBox | None) – Bounding box describing the area of interest.

  • geometry (Geometry | None) – Geometry describing the area of interest.

  • size (tuple[int, int] | None) – Size of the image.

  • resolution (tuple[float, float] | None) – Resolution of the image. It has to be in units compatible with the given CRS.

  • data_folder – location of the directory where the fetched data will be saved.

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

  • kwargs (Any) –

s3_specification(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:

AccessSpecification

property mime_type: MimeType

The mime type of the request.

static body(request_bounds, request_data, evalscript, evalscript_reference, request_output=None, other_args=None)[source]

Generate the Async Process API request body

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

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

  • evalscript (str | None) – Evalscript.

  • request_output (Dict[str, Any] | None) – A dictionary as generated by SentinelHubRequest.output helper method.

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

  • evalscript_reference (AccessSpecification | None) –

Return type:

Dict[str, Any]

static output_response(identifier, response_format, other_args=None)[source]

Generate an element of output.responses as described in the Async Process API reference.

Parameters:
  • identifier (str) – Identifier of the output response.

  • response_format (str | MimeType) – A mime type of one of ‘png’, ‘json’, ‘jpeg’, ‘tiff’.

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

Return type:

Dict[str, Any]

static output(responses, delivery, size=None, resolution=None, other_args=None)[source]

Generate an output part of the request as described in the Async Process API reference

Parameters:
  • responses (list[Dict[str, Any]]) – A list of objects in output.responses as generated by AsyncProcessRequest.output_response.

  • size (tuple[int, int] | None) – Size of the image.

  • resolution (tuple[float, float] | None) – Resolution of the image. It has to be in units compatible with the given CRS.

  • other_args (dict | None) – Additional dictionary of arguments. If provided, the resulting dictionary will get updated by it.

  • delivery (AccessSpecification) –

Return type:

Dict[str, Any]

sentinelhub.api.process.get_async_running_status(ids, config=None)[source]

Returns a mapping that describes which requests are running.

Parameters:
  • ids (Iterable[str]) – A collection of async request IDs.

  • config (SHConfig | None) – A custom instance of config class to override parameters from the saved configuration.

Returns:

A mapping that specifies whether a process is running for each of the IDs.

Return type:

dict[str, bool]