Skip to content

Python task inputs

Supported Python types for Tilebox workflow task inputs, including geospatial and raster types.

Python tasks are data classes. Annotate each task field with one of the supported types below, and Tilebox reconstructs that type before the task runs.

This page applies to tasks executed by Python runners. For tasks submitted and executed across different languages, use an input schema supported by both SDKs. See Multi-language workflows.

The examples focus on task input declarations and omit the execute method.

These types require no extra packages:

Example usage

from datetime import datetime
from pathlib import Path
from uuid import UUID
from tilebox.workflows import Task
class BuildSentinel2Mosaic(Task):
scene_ids: list[UUID]
bands: tuple[str, ...]
acquired_after: datetime
output_path: Path

protobuf provides generated message classes for strongly typed schemas and is installed with tilebox-workflows.

Tilebox supports Message and its generated subclasses.

Example usage

from google.protobuf.timestamp_pb2 import Timestamp
from tilebox.workflows import Task
class ProcessSceneAcquisition(Task):
scene_id: str
acquired_at: Timestamp

tilebox-datasets provides value types for dataset and job queries and is installed with tilebox-workflows.

TypeUse in a workflow
TimeInterval, IDIntervalPass dataset or job query ranges to a task
SpatialFilterPass a dataset spatial query to a task; its geometry requires Shapely

Example usage

from tilebox.datasets.data.data_access import SpatialFilter
from tilebox.datasets.query import TimeInterval
from tilebox.workflows import Task
class QuerySentinel2Scenes(Task):
collections: list[str]
temporal_extent: TimeInterval
spatial_extent: SpatialFilter

shapely provides geometry types for vector features, footprints, and areas of interest.

Example usage

from shapely import MultiPolygon
from tilebox.workflows import Task
class ComputeSentinel2CloudStatistics(Task):
area_of_interest: MultiPolygon
preceding_hours: int

affine provides two-dimensional affine transformation matrices. pyproj provides coordinate reference systems and coordinate transformations.

TypeUse in a workflow
AffinePreserve the pixel-to-world transform for raster processing
pyproj.CRSPass a coordinate reference system without reducing it to a string

Example usage

from affine import Affine
from pyproj import CRS
from tilebox.workflows import Task
class ReprojectRasterTile(Task):
source_crs: CRS
target_crs: CRS
source_transform: Affine

odc-geo provides projection-aware geometry and raster grid types.

TypeUse in a workflow
CRSPreserve an ODC coordinate reference system
Geometry, BoundingBoxPass projection-aware geometries and bounds
XY, ResolutionDescribe grid coordinates and spatial resolution
Index2d, Shape2dDescribe a grid index or shape
GeoBoxPreserve an aligned, georeferenced raster grid
GeoboxTiles, AnchorEnumPartition and align a GeoBox for tiled processing

Example usage

from odc.geo import GeoBox
from tilebox.workflows import Task
class ReprojectSentinel2Product(Task):
product_location: str
source_grid: GeoBox
target_grid: GeoBox

rasterio provides raster data access and processing. async-geotiff provides asynchronous GeoTIFF and Cloud Optimized GeoTIFF reads. Install either package separately when your workflow uses its window type.

TypeUse in a workflow
rasterio.windows.WindowPass a rectangular pixel region to a task that uses rasterio
async_geotiff.WindowPass a rectangular pixel region to an async GeoTIFF task

Example usage

from rasterio.windows import Window
from tilebox.workflows import Task
class ComputeHyperspectralChunkStatistics(Task):
product_path: str
window: Window
output_key: str

Task inputs are part of the workflow graph and are not intended for large arrays, file contents, pandas DataFrames, clients, or open files. Store large data in object storage or the job cache, then pass a compact reference such as an ID, object prefix, cache key, time interval, geometry, or raster window.