Processing templates in SDK

View processes to run using the SDK.


Overview

Run advanced processing on tasking and catalog data in your storage.

View repository

Class: JobTemplate

A class for job templates that define the process ID and input validation logic.

Attributes

AttributeDescription
process_id

ClassVar[str]

The process ID in a name format.

workspace_id

Union[str, base.WorkspaceId]

The workspace ID.

errors

set[ValidationError]

A list of errors populated if the job isn’t valid.

Properties

is_valid

Checks if the job is valid. Returns bool:

  • True: The job is valid.
  • False: The job isn’t valid.

Python
from up42 import processing_templates
# Select an item
stac_item_id = "68567134-27ad-7bd7-4b65-d61adb11fc78"
# Get the item from the STAC client
stac_client = up42.stac_client()
stac_item = next(stac_client.get_items(stac_item_id))
# Instanitate a DetectionTreesSpacept template
job_template = processing_templates.DetectionTreesSpacept(
title="Detect trees over UK",
item=stac_item,
)
# Assert that the job is valid, print errors if not
if not job_template.is_valid:
for error in job_template.errors:
print(f"{error}\n")

Methods

execute

This action can’t be done with the Viewer role.

Executes the job. Returns Job.

Python
from up42 import processing_templates
# Select an item
11 collapsed lines
stac_item_id = "68567134-27ad-7bd7-4b65-d61adb11fc78"
# Get the item from the STAC client
stac_client = up42.stac_client()
stac_item = next(stac_client.get_items(stac_item_id))
# Instanitate a DetectionTreesSpacept template
job_template = processing_templates.DetectionTreesSpacept(
title="Detect trees over UK",
item=stac_item,
)
# Execute the templated job
job = job_template.execute()
# Define output
print(f"Job details for ID: {job.id}")
print(f"Process ID: {job.process_id}")
print(f"Status: {job.status.value}")
print(f"Price: {job.credits or 'N/A'} credits")
print(f"Created at: {job.created}")

Class: SingleItemJobTemplate

A data class for the process templates that require one STAC item as input. Extends the JobTemplate class.

Attributes

AttributeDescription
title

str

The title of the output objects: STAC item and STAC collection.

item

pystac.Item

The STAC item to process.

Python
from up42 import processing_templates
# Select an item
stac_item_id = "68567134-27ad-7bd7-4b65-d61adb11fc78"
# Get the item from the STAC client
UP42_client = up42.stac_client()
stac_item = next(UP42_client.get_items(stac_item_id))
# Instanitate a DetectionTreesSpacept template
job_template = processing_templates.DetectionTreesSpacept(
title="Detect trees over UK",
item=stac_item,
)

Subclasses

Class nameProcess IDProcess
DetectionAircraftOIdetection-aircraft-oiAircraft detection
DetectionBuildingsSpaceptdetection-buildings-spaceptBuilding detection
DetectionCarsOIdetection-cars-oiCar detection
DetectionShadowsSpaceptdetection-shadows-spaceptShadow detection
DetectionShipsAirbusdetection-ships-airbusShip detection
DetectionStorageTanksAirbusdetection-storage-tanks-airbusStorage tank detection
DetectionTreesSpaceptdetection-trees-spaceptTree detection
DetectionTrucksOIdetection-trucks-oiTruck detection
DetectionWindTurbinesAirbusdetection-wind-turbines-airbusWind turbine detection

Pansharpening

Has more attributes, see its class.

pansharpeningPansharpening
TrueColorConversiontrue-color-conversionTrue color conversion
UpsamplingNSupsampling-nsUpsampling
UpsamplingNSSentinelupsampling-ns-sentinelUpsampling (Sentinel-2)

Class: MultiItemJobTemplate

A data class for the process templates that require multiple STAC items as input. Extends the JobTemplate class.

Atributes

AttributeDescription
title

str

The title of the resulting objects: STAC item and STAC collection.

items

List[pystac.Item]

The STAC items to process.

Class: SimularityJobTemplate

A data class that represents a template for the Simularity processes. Extends the JobTemplate class.

Attributes

AttributeDescription
title

str

The title of the output objects: STAC item and STAC collection.

source_item

pystac.Item

The source STAC item.

reference_item

pystac.Item

The reference STAC item. The positional accuracy of the source image will be improved against this reference.

Python
from up42 import processing_templates
# Select multiple items
source_item_id = "68567134-27ad-7bd7-4b65-d61adb11fc78"
reference_item_id = "c3de9ed8-f6e5-4bb5-a157-f6430ba756da"
# Get the items from the STAC client
UP42_client = up42.UP42_client()
source_item = UP42_client.get_item(source_item_id)
reference_item = UP42_client.get_item(reference_item_id)
# Instantiate a CoregistrationSimularity template
job_template = processing_templates.CoregistrationSimularity(
title="Coregistration for images",
source_item=source_item,
reference_item=reference_item,
)

Subclasses

Class nameProcess IDProcess
CoregistrationSimularitycoregistration-simularityCoregistration

DetectionChangeSimularity

Has more attributes, see its class.

detection-change-simularityChange detection

Class: DetectionChangeSimularity

A data class that represents a template for the Change detection process. Extends the SimularityJobTemplate class.

Attributes

AttributeDescription
sensitivity

int

The setting that adjusts the sensitivity to change. The range of allowed values spans from 0 (lowest sensitivity) to 5 (highest sensitivity). The default value is 2.

Python
from up42 import processing_templates
# Select multiple items
source_item_id = "68567134-27ad-7bd7-4b65-d61adb11fc78"
reference_item_id = "c3de9ed8-f6e5-4bb5-a157-f6430ba756da"
# Get the items from the STAC client
UP42_client = up42.UP42_client()
source_item = UP42_client.get_item(source_item_id)
reference_item = UP42_client.get_item(reference_item_id)
# Instantiate a DetectionChangeSimularity template
job_template = processing_templates.DetectionChangeSimularity(
title="Detecting changes over Berlin",
source_item=source_item,
reference_item=reference_item,
sensitivity=4,
)

Class: Pansharpening

A data class that represents a template for the Pansharpening process. Extends the SingleItemJobTemplate class.

Attributes

AttributeDescription
grey_weights

Optional[List[GreyWeight]]

The weight factors by which spatial details of multispectral bands are scaled.

Python
from up42 import processing_templates
# Select an item
stac_item_id = "68567134-27ad-7bd7-4b65-d61adb11fc78"
# Get the item from the STAC client
UP42_client = up42.stac_client()
stac_item = next(UP42_client.get_items(stac_item_id))
# Instantiate a Pansharpening template with grey weights
job_template = processing_templates.Pansharpening(
title="Pansharpen item",
item=stac_item,
grey_weights=[
processing_templates.GreyWeight(band="red", weight=0.04),
processing_templates.GreyWeight(band="blue", weight=0.9),
processing_templates.GreyWeight(band="green", weight=0.2),
],
)

Class: GreyWeight

A data class that represents the weight factors by which to scale spatial details of multispectral bands.

  • If not specified, the process uses either sensor-optimized weights or optimal generated weights.
  • If you specify the weights yourself, you must define at least 3 bands.

Attributes

AttributeDescription
band

str

The name of the band from the STAC asset with the ["data", "multispectral"] roles.

weight

float

The multiplication value that lets you modulate the influence of multispectral bands on the final image. The range of allowed values spans from -1 to 1.

Python
from up42 import processing_templates
# Select an item
stac_item_id = "68567134-27ad-7bd7-4b65-d61adb11fc78"
# Get the item from the STAC client
UP42_client = up42.stac_client()
stac_item = next(UP42_client.get_items(stac_item_id))
# Instantiate a Pansharpening template with grey weights
job_template = processing_templates.Pansharpening(
title="Pansharpen item",
item=stac_item,
grey_weights=[
processing_templates.GreyWeight(band="red", weight=0.04),
processing_templates.GreyWeight(band="blue", weight=0.9),
processing_templates.GreyWeight(band="green", weight=0.2),
],
)

Learn more

API docs | Processing Console docs | Processing