Skip to content

Commit 0f2ca76

Browse files
Refactor examples to new workflow structure (#15)
* Remove outdated workflows * Remove outdated workflows * Update to geospatial task inputs
1 parent 3e23e82 commit 0f2ca76

63 files changed

Lines changed: 5659 additions & 12154 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ List of examples:
2323
- [Workflows Hello World, Python](/workflows-hello-world-py/)
2424
A simple example that demonstrates how to use the Tilebox SDKs to submit a job and run a worker.
2525
- [Workflows Cron Automation, Python](/workflows-cron-automation-py/)
26-
A simple example that demonstrates how to use the Tilebox SDKs to create a Workflows Cron Automation, a workflow that runs on a schedule, and showcases how to filter timeseries Datasets based on spatial and temporal criteria.
26+
A release-based async Cron Automation that queries Sentinel-2 statistics for native Shapely areas.
2727
- [Multi-Language Workflows, Python and Go](/workflows-multilang/)
28-
An example that demonstrates how to use the Tilebox SDKs to create a Workflows that uses tasks implemented in different languages, Python and Go. Go is used to submit the job, while Python is used to execute it.
28+
An example that submits native ODC Geo task inputs from Go for execution by an async Python task.
2929

3030
**Mixed**
3131

3232
- [Download S2 Data for Points of Interest, Python](/workflows-download-s2-for-aois/)
3333
A more complex example that demonstrates how to use the Tilebox SDKs to create a Workflows to find Sentinel-2 data for a set of points of interest (POIs), filter the data to be as cloud-free as possible and finally download the data.
3434
- [Sentinel-2 Cloud-free Mosaic](/s2-cloudfree-mosaic/)
35-
This workflow reads Sentinel-2 data from the Copernicus archive, and writes a cloudfree mosaic to a Zarr datacube.
35+
This workflow window-reads Sentinel-2 COGs from AWS Earth Search and writes a cloud-free mosaic to Zarr.
36+
- [Sentinel-2 Clay Change Detection](/s2-clay/)
37+
This workflow composites two Sentinel-2 periods, runs tiled Clay inference, and writes embedding change distances.
38+
- [Wyvern Hyperspectral PCA](/wyvern-hyperspectral-pca/)
39+
This workflow computes distributed PCA with ODC geospatial tiling and a bounded statistics reduction tree.

‎s2-clay/.env.example‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
RUNNER_NAME=lukas-notebook
2-
AXIOM_API_KEY=
31
TILEBOX_API_KEY=
42
AXIOM_TRACES_DATASET=workflow-traces
5-
AXIOM_LOGS_DATASET=workflow-logs
63
OTC_ACCESS_KEY_ID=
74
OTC_SECRET_ACCESS_KEY=
8-
COPERNICUS_ACCESS_KEY_ID=
9-
COPERNICUS_SECRET_ACCESS_KEY=
10-

‎s2-clay/README.md‎

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# Sentinel-2 Change Detection
1+
# Sentinel-2 Clay Change Detection
22

3+
This workflow compares two Sentinel-2 time periods with the
4+
[Clay](https://github.com/Clay-foundation/model) foundation model and writes a patch-level change map to Zarr.
5+
6+
## Design
7+
8+
`DetectChanges` accepts native ODC `Geometry`, `CRS`, and `Resolution` values plus two Tilebox `TimeInterval` values.
9+
It queries credentials-free Sentinel-2 L2A COGs from AWS Earth Search and divides the exact output `GeoBox` into
10+
256 × 256 pixel model tiles.
11+
12+
For every tile and period, `ComputeClayTile` reads only the required COG windows, masks clouds with the scene
13+
classification layer, creates a 25th-percentile composite in memory, and runs Clay. `ComputeChangeTile` then computes
14+
the cosine distance between corresponding embeddings. No full products, time-series cubes, pickled grids, or
15+
intermediate mosaics are written.
16+
17+
The Zarr group is written to `change-detection/<job-id>` in the configured `s2-clay` bucket and contains `before` and
18+
`after` Clay embeddings and the resulting `change` distance array.
19+
20+
## Run the workflow
21+
22+
1. Copy `.env.example` to `.env` and configure the Tilebox and Open Telekom Cloud credentials.
23+
2. Validate and publish the release:
24+
25+
```bash
26+
tilebox workflow build-release --debug --json
27+
tilebox workflow publish-release --json
28+
tilebox workflow deploy-release --latest --cluster <cluster-slug> --json
29+
tilebox runner start --cluster <cluster-slug>
30+
```
31+
32+
The Clay v1.5 checkpoint is downloaded and cached by `huggingface_hub` on each runner when first needed.
33+
34+
## Submit a job
35+
36+
```python
37+
from datetime import UTC, datetime
38+
39+
from odc.geo import CRS, Geometry, Resolution
40+
from shapely import box
41+
from tilebox.datasets.query import TimeInterval
42+
from tilebox.workflows import Client
43+
44+
from s2_clay import DetectChanges
45+
46+
client = Client()
47+
client.jobs().submit(
48+
"vienna-change-detection",
49+
DetectChanges(
50+
area=Geometry(box(16.2, 48.1, 16.5, 48.3), "EPSG:4326"),
51+
before=TimeInterval(datetime(2024, 6, 1, tzinfo=UTC), datetime(2024, 7, 1, tzinfo=UTC)),
52+
after=TimeInterval(datetime(2025, 6, 1, tzinfo=UTC), datetime(2025, 7, 1, tzinfo=UTC)),
53+
output_crs=CRS("EPSG:32633"),
54+
resolution=Resolution(x=10, y=-10),
55+
max_cloud_cover=20,
56+
),
57+
)
58+
```

0 commit comments

Comments
 (0)