Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Build
Start
Reference code
Tools
API reference
Public services
Agents
Bindings and crosswalks

obsp-eo

REFERENCE Source reference/python/obsp-eo/README.md

On this page
  1. Commands
  2. Worked example
  3. Conventions this tool chose (not text of a draft)
  4. Tests
  5. Limits
FieldValue
StatusReference code written against draft proposals (DRAFT); accepts no proposal; no conformance claim
Packageobsp-eo
Version0.1.0
SourcePython reference tools

An Earth-observation product toolchain for three draft proposals of the Observatory Protocol: OIP-0020 (coverage observations, chunk digests, ARD claims, detections with response history), OIP-0009 (the STAC obsp extension) and OIP-0026 (the C2PA assertion, the PROV-O export). All three are DRAFT; this is reference code written against their patches, not against accepted text, and it makes no conformance claim. No implementation is listed by it and no conformance level is declared for it. Every ARD claim it writes is a self-assessment (or names an assessor’s credential that the caller supplies); it writes no field or value that states an approval by an outside body.

Python 3.10 or later, standard library only (numpy is not needed). Readers for GeoTIFF/COG and Zarr v3 are small and written for the test data: no GDAL, no pixel decoding, no network access.

Commands

python3 -m obsp_eo COMMAND ... (or obsp-eo once installed). Each command prints a JSON report and exits 0 (done), 1 (a check found a problem) or 2 (the input could not be used). --schema-dir DIR on the writing commands also validates the output against the draft schemas in DIR (needs jsonschema; see Tests for how to get such a tree).

Command What it does
manifest Walks a COG file or a Zarr v3 directory, digests every chunk, signs the chunk manifest and writes a coverage observation (coverage-observation.json) and the signed manifest (chunk-manifest.json).
verify Recomputes every digest from the store and compares: reports tampered, missing and unlisted chunks, a manifest whose digest is not that of its list, a signature that does not match, and a grid or band that differs from the file.
stac Writes a STAC 1.1 Item (a product version) and Collection (the product) with the obsp: extension fields.
lineage Builds the product lineage graph, checks it (acyclic; inputs match their digests; origin aggregate not stronger than its weakest input; level not below an input’s), and with --run-time, --bundle-uni and --agent UNI=ROLE writes a provenance bundle and its PROV-O JSON-LD.
ard-claim Writes a self-assessed claim document from a requirement checklist (below).
detection create, notify, respond, show, check: detection records whose notification and response history is append-only.
c2pa Writes the data of the org.obsp.evidence assertion for an image drawn from a product (signing and embedding stay with the operator’s C2PA tool).

Worked example

examples/run.sh OUT_DIR [SCHEMA_DIR] runs the whole flow on synthetic data (a 512x512 tiled GeoTIFF with an overview, written by tests/synth.py; nothing is downloaded). The steps, as commands (eo stands for python3 -m obsp_eo with PYTHONPATH=src):

python3 tests/synth.py out/data                      # sar-nrb.tif (COG layout, 5 tiles) and sr-l2a.zarr

# 1. digest the tiles, sign the manifest, write the coverage observation
eo manifest --store out/data/sar-nrb.tif --meta examples/meta-sar-nrb.json \
    --seed-file examples/test-seed.hex --out-dir out/coverage
#    -> out/coverage/coverage-observation.json, out/coverage/chunk-manifest.json

# 2. recompute from the store: exit 0; flip one byte of a tile and recompute: exit 1 and the tile is named
eo verify --coverage out/coverage/coverage-observation.json --store out/data/sar-nrb.tif \
    --manifest-file out/coverage/chunk-manifest.json --public-key <hex public key from chunk-manifest.json>
#    {"ok": false, "problems": [{"kind": "chunk-tampered", "key": "ifd0/tile/0/0", ...}]}   (on the altered copy)

# 3. products whose lineage pins the coverage by digest (examples/make-products.py), then a claim and the lineage
eo ard-claim --checklist examples/checklist-nrb.json --product out/products/nrb.json \
    --claim-uni uni:ard-claim:sar03-nrb-20260812 --out out/claim.json
eo lineage --product out/products/nrb.json --product out/products/flood.json \
    --coverage out/coverage/coverage-observation.json --out-dir out/lineage \
    --bundle-uni uni:provenance:flood-20260813-bundle --run-time 2026-08-13T06:00:00Z \
    --agent uni:participant:space-segment-operator-01=PROVIDER
#    -> lineage-graph.json, provenance.json, provenance.jsonld

# 4. exchange
eo stac --product out/products/nrb.json --coverage out/coverage/coverage-observation.json \
    --provenance out/lineage/provenance.json --ard-claim out/claim.json \
    --base-url https://data.example.org/obsp/stac --out-dir out/stac
eo c2pa --product out/products/flood.json --provenance out/lineage/provenance.json \
    --rendering-kind QUICKLOOK --out out/c2pa-assertion.json

# 5. a detection: every step writes the next revision (r0001.json, r0002.json, ...); none is rewritten
eo detection create --dir out/detections --spec examples/detection-spec.json
eo detection notify --dir out/detections --uni uni:detection:methane-plume-site-k12-20260816 --role FACILITY_OPERATOR
eo detection respond --dir out/detections --uni uni:detection:methane-plume-site-k12-20260816 \
    --state ACKNOWLEDGED --by-role FACILITY_OPERATOR
eo detection check --dir out/detections --uni uni:detection:methane-plume-site-k12-20260816

The key in examples/test-seed.hex is a public test key and protects nothing.

The meta file of manifest

JSON with the fields a store cannot state: coverageUni, version, observer, procedure, processingLevel, acquisitionTime, origin, operatorUni, storeUri, signing (keyRef, signerRole), bands[] (name, observedProperty, unit, optional scale, offset, centralWavelength, polarisation, nodata), and optionally resultTime, recordedAt, footprint, manifestUri, modelRunRef, calibrationRefs, provenanceRef, domain. The tool reads size, transform, CRS (EPSG code), sample type and nodata from a GeoTIFF and fails when the meta file disagrees. A Zarr v3 store states no georeferencing, so domain (crs, transform) is required for it; a band’s nodata defaults to the array’s numeric fill_value. footprint is derived only for an EPSG:4326 grid. The band property ids are those the drafts use as examples; they were not checked against the observed-property register.

The checklist of ard-claim

JSON: specification (family, identifier, version), assessment (recordRef, assessedAt, assessorRole, assessorUni) and groups[] of {group, label?, evidenceRef?, requirements: [{id, text?, level}]} where a requirement’s level is the highest level it is met at (TARGET, THRESHOLD, NOT_MET). A group’s level is the lowest of its requirements; the claimed level is the lowest group. With any group not met no claim is written (exit 2, the unmet requirements named). --assessor-credential-ref UNI,DIGEST makes the claim not self-assessed. The requirement texts stay in the checklist; the claim carries group levels only.

Conventions this tool chose (not text of a draft)

  • Chunk keys. COG: ifd<N>/tile/<row>/<column> (or ifd<N>/strip/<n>), one entry per tile of every image in the file, so a tile is checked on its own (OIP-0020 open question 5). Zarr: the key of the file relative to the store, such as B04/c/0/1. Chunk digests are SHA-256 of the stored bytes (compressed, as written).
  • Zarr metadata is listed too. Every zarr.json is an entry of chunks, so a changed fill value, codec or chunk shape is caught like a changed chunk. Keep the files manifest writes outside the store, or verify reports them as unlisted.
  • Signature. Ed25519, in pure Python (RFC 8032; checked against the RFC’s vectors). The signed message is the canonical JSON of {chunks: chunkManifest.digest, coverage: digest of the document without chunkManifest}, so the signature covers every field of the coverage document, not only the chunk list. signatureDigest is the digest of the signature bytes; the signature and the public key travel in chunk-manifest.json. A key in that file proves nothing about who holds it: pass --public-key from a trusted source. OIP-0020 leaves the signature shape open (its question 6) and OIP-0008 may replace it.
  • Digests are RFC 8785 canonical JSON, SHA-256, sha256:<hex>, the same form as the repository’s SDK (a test compares them).
  • STAC. An Item’s datetime is null with start_datetime/end_datetime from the manifest’s extent; with no temporal extent it is the generation time in the provenance bundle (the binding’s rule) and a note says so. With no CRS84 box the Item has no geometry and the Collection the whole-world box. obsp:upstream_term and obsp:quality have no source here and are not written. obsp:ard_claim is written only for a self-assessed claim. The Collection’s license is other unless --license says otherwise; no licence is invented. The STAC core schemas are not in this repository, so the tests check the core members this tool writes by hand and the extension by its schema.
  • Provenance from lineage. Each product and input is an entity, each distinct activityRef an activity that used its inputs and generated the product at --run-time; agents are those given with --agent, by UNI and role only. An input without objectKind gets the type segment of its UNI as entityKind (or data-object).

Tests

make eo        # from the repository root; 48 tests, a few seconds

The tests do not use the live schemas alone: tests/draftree.py copies the schemas, bindings and suite code to a scratch directory and applies the patches of OIP-0020 (schemas, invariants), OIP-0009 (STAC binding) and OIP-0026 (C2PA and PROV-O bindings) with git apply. The live tree is untouched. Needs git and jsonschema (in requirements.txt). Set OBSP_EO_DRAFT_TREE to reuse a tree built earlier. Every output of the worked example is validated against those draft schemas and run through the draft’s own invariants (coverage-domain-consistent, coverage-chunks-in-manifest, product-lineage-acyclic, ard-claim-consistent, detection-magnitude-uncertainty, detection-response-append-only).

Limits

  • No pixel decoding, no overview generation, no validation that a file is a COG beyond reading its directories.
  • Classic TIFF and BigTIFF, uint8, uint16, int16, int32, float32 and float64 samples; the regular Zarr chunk grid and the default chunk key encoding with /.
  • Not built: DCAT export (OIP-0026), HXL tables, WIS 2.0, OGC API.
  • All standards named here are cited by name; the mapping rows of the drafts are checked: not checked and so is the use made of them here.