Processing module

Apply advanced processing to geospatial data using the SDK.


Cost class

The Cost data class allows you to compare the cost of a process with custom values.

Cost class attributes
AttributeDescription
strategystr | required
The pricing strategy used to calculate the cost.
creditsint | required
The process cost, in credits.
sizeint
The size of the input STAC item.
unitstr
The unit of measurement used to calculate the size.
OperatorDescription
<Greater than
>Greater than or equal to
<=Less than
=>Less than or equal to
An example with the Cost class

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

template = processing_templates.DetectionTreesSpacept(
  title="Detect trees over UK",
  item=asset.stac_items[0]
)

assert template.cost <= 100
template.cost

  

Job class

The Job data class allows you to view and monitor processing jobs.

Job class attributes
AttributeDescription
process_idstr | required
The process ID in a name format.
idstr | required
The job ID.
account_idstr | required
The account ID.
workspace_idstr
The workspace ID.
definitiondict | required
The inputs and other parameters used to execute the job.
statusJobStatus | required
The job status.
createddatetime | required
The timestamp when the job was created.
updateddatetime | required
The timestamp when the job was last updated.
collection_urlstr
The URL of the resulting STAC collection. Available only if the job status is SUCCESSFUL or CAPTURED.
errorslist[ValidationError]
Job errors. Available only if the job status is INVALID.
creditsint
The job cost, in credits.
starteddatetime
The timestamp when the job was started.
finisheddatetime
The timestamp when the job was finished.

Job class properties
PropertyDescription
collectionpystac.Collection
The resulting STAC collection. Available only if the job status is SUCCESSFUL or CAPTURED.

all

The all class method allows you to view all jobs in your account.

The returned data type is Iterator["Job"].

ArgumentDescription
process_idlist[str]
Process IDs. Use to search for jobs running any of the provided processes.
workspace_idstr
The workspace ID. Use to get jobs from a specific workspace. Otherwise, jobs from the entire account will be returned.
statuslist[JobStatus]
Job statuses. Use to search for jobs with any of the provided statuses.
min_durationint
The minimum duration of a job. Use to get jobs with runtimes greater than or equal to a specific number of seconds. Only jobs with the following statuses will be displayed:
  • RUNNING
  • SUCCESSFUL
  • CAPTURED
  • RELEASED
  • FAILED
max_durationint
The maximum duration of a job. Use to get jobs with runtimes less than or equal to a specific number of seconds. Only jobs with the following statuses will be displayed:
  • RUNNING
  • SUCCESSFUL
  • CAPTURED
  • RELEASED
  • FAILED
sort_byutils.SortingField
The results sorting method that arranges elements in ascending or descending order based on a chosen field. To view the list of possible values, see JobSorting.
An example with all

Python

    up42.Job.all(
    max_duration=500,
    sort_by=up42.JobSorting.process_id
)

  

get

The get class method allows you to retrieve a specific job by its ID.

The returned data type is Job.

An example with get

Python

    up42.Job.get(id="d290f1ee-6c54-4b01-90e6-d701748f0851")

  

track

The track instance method allows you to track the job status until it changes to CAPTURED or RELEASED. It will query the job status every 60 seconds for 3 days.

An example with track

Python

    job.track()

  

JobSorting class

The JobSorting class contains possible sorting parameters for the Job::all method.

Sorting fieldDescription
process_idSorts by process ID. The default order is ascending.
statusSorts by status. The default order is descending.
createdSorts by creation date. The default order is descending.
creditsSorts by the amount of credits. The default order is descending.
Examples with the JobSorting class

Sort by credit amount, from the least to the most expensive:

Python

    up42.Job.all(sort_by=up42.JobSorting.credits.asc)

  

Sort by creation date, from the most recent to the earliest:

Python

    
up42.Job.all(sort_by=up42.JobSorting.created.desc)

  

JobStatus class

The JobStatus class allows you to check the status of a processing job.

StatusDescription
CREATEDThe job has been created, but not yet accepted.
LICENSEDThe EULA has been accepted for this process. The job will move on to the validation stage.
UNLICENSEDThe EULA hasn’t been accepted for this process. The job will fail. Accept the EULA through the console or the API and try again.
VALIDThe job has been validated.
ACCEPTEDThe job has been validated and accepted. The credits corresponding to the price are temporarily withheld until the job is completed.
INVALIDThe job has failed validation. Fix your input parameters and try again.
REJECTEDThe job has been canceled due to an insufficient account balance. Top up your balance and try again.
RUNNINGThe job is in progress.
SUCCESSFULThe job has been completed, and the results have been delivered to your storage.
CAPTUREDThe job has been completed, the results have been delivered to your storage, and any withheld credits have been deducted from your account balance.
RELEASEDThe job has failed. Any withheld credits have been released. Try again, and if the issue persists, contact support.
FAILEDThe job has failed.

JobTemplate class

The JobTemplate class serves as a parent class for all process-specific job templates.

JobTemplate class properties
PropertyDescription
is_validbool
Whether the job is valid.
  • True: the job is valid.
  • False: the job isn’t valid.
errorsset[ValidationError]
A list of errors populated if the job isn’t valid.
costCost
The cost of the execution available only if the job is valid.

An example with the JobTemplate class

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

template = processing_templates.DetectionTreesSpacept(
  title="Detect trees over UK",
  item=asset.stac_items[0]
)

if not template.is_valid:
  print(template.errors)

  

execute

The execute instance method allows you to run a job.

An example with execute

Python

    asset = up42.initialize_asset(asset_id="68567134-27ad-7bd7-4b65-d61adb11fc78")

template = processing_templates.DetectionTreesSpacept(
  title="Detect trees over UK",
  item=asset.stac_items[0]
)

job = template.execute()

  

MultiItemJobTemplate class

The MultiItemJobTemplate data class is used in the templates of those processes that require multiple STAC items as input:

ProcessData class
Change detectionDetectionChangeSpacept
Infrastructure change detection (Pléiades)DetectionChangePleiadesHyperverge
Infrastructure change detection (SPOT)DetectionChangeSPOTHyperverge
MultiItemJobTemplate class atributes
AttributeDescription
titlestr | required
The title of the output objects: STAC item and STAC collection.
itemslist[pystac.Item] | required
The STAC items retrieved from Asset::stac_items or Storage::pystac_client.

SingleItemJobTemplate class

The SingleItemJobTemplate data class is used in the templates of those processes that require one STAC item as input:

ProcessData class
Aircraft detectionDetectionAircraftOI
Building detectionDetectionBuildingsSpacept
Car detectionDetectionCarsOI
PansharpeningPansharpening
Shadow detectionDetectionShadowsSpacept
Ship detectionDetectionShipsAirbus
Storage tank detectionDetectionStorageTanksAirbus
Tree detectionDetectionTreesSpacept
Tree and tree height detectionDetectionTreesHeightsSpacept
Truck detectionDetectionTrucksOI
Wind turbine detectionDetectionWindTurbinesAirbus
UpsamplingUpsamplingNS
SingleItemJobTemplate class atributes
AttributeDescription
titlestr | required
The title of the output objects: STAC item and STAC collection.
itempystac.Item | required
The STAC item retrieved from Asset::stac_items or Storage::pystac_client.

ValidationError class

The ValidationError data class represents information about validation errors in processing jobs.

ValidationError class attributes
AttributeDescription
messagestr
The message of the validation error.
namestr
The name of the validation error.

View repository