Compose a processing operation#
Start a processing operation by composing installed public raster functions in
one native owner. The host consumer example
copies caller data through cugeo_raster_layout_copy_host_v1, creates an affine
plan, and calls cugeo_raster_warp_host with a one-column source translation.
Its Rust cdylib links the installed shared core; C++ and Python marshal that
same interface. It needs no extension registration or private core import.
Build and check the host example#
Use an installed native development prefix and a matching Python environment as described in the example README. The prefix includes the mandatory cugeo-proj service.
The generic TIFF is gitignored and absent after cloning. Materialize the pinned
tests/data/sentinel2_bgr_10m_1001x1001.tif using the
fixture acquisition and provenance instructions
and development prerequisites first. That explicit
acquisition is separate from the offline consumer run; the runner never
downloads a missing input.
Run from cugeo-raster/ with its uv dependencies available:
uv run --no-sync env PYTHON=python tools/test-extension-consumer.sh --selection standard --prefix "$CUGEO_RASTER_PREFIX"
uv run --no-sync env PYTHON=python tools/test-extension-consumer.sh --selection standard --prefix "$CUGEO_RASTER_PREFIX" --negative-controls
Use a core-only prefix for the same public consumers:
uv run --no-sync env PYTHON=python tools/test-extension-consumer.sh --selection core-only --prefix "$CUGEO_RASTER_PREFIX"
Each run builds outside the checkout and preserves the supplied installation.
The result file identifies the installed native bytes and actual imports.
C/Rust compiler probes check every mirrored field against the installed
header; Python mirrors are checked against that C result. Dependency/symbol
inspection verifies one shared core and the example’s sole exported function.
For application Python calls, follow the example README’s public loading setup
before imports: select CUGEO_RASTER_LIBRARY, CUGEO_PROJ_LIBRARY,
CUGEO_RASTER_EXAMPLE_LIBRARY and LD_LIBRARY_PATH from the installed prefix.
The runner applies that same setup in fresh processes for both import orders.
Merely installing byte-identical wheel/native files at different paths can
load duplicate cores; explicit selection keeps handles with one native owner.
The analytic input is UInt16 BIP with two rows, three columns and two bands. Caller scratch/output are BSQ views with padding. Every caller compares all source, scratch, destination, status and padding values against integer source indices. The last column fills with zero and receives outside-source status 1. A zero-comparison or missing result is a failure. Negative controls must fail at the intended loader, comparator, artifact or import check, followed by restored positives. Host and packaging validation register these consumers.
Keep one processing and memory owner#
Put admission and composition in Rust once. Bindings describe storage and pass numeric statuses; they do not resample pixels or parse product metadata. The example consumes only the installed public C ABI, including from Rust. It embeds no raster rlib, allocator, decoder or second core instance.
Keep caller storage alive through synchronous host return. Writable samples, all input/output/scratch storage and control records must satisfy their native non-overlap contract. Core owns stride, extent and scalar-type validation; the example owns its nonempty, matching UInt16 domain. A later stage may fail after scratch was written, so callers must not assume rollback.
The example’s interface has no receipt or admission-budget parameter. It returns no persistent handle and releases the core affine plan on every exit. It allocates no image buffers; core plan/status metadata may allocate. The local layout-copy receipt is discarded, rather than presented as an invented combined receipt. Use the existing public resource/admission and receipt APIs when a larger operation exposes budgets or accounting. Preserve their ResourceLimit8/WouldBlock7 distinctions and unknown foreign allocations. The memory-resource contract and execution reference define those owners.
This example executes no CUDA work and qualifies no device route. A CUDA operation must use the existing admission wrapper, compatible SDK/device and matching native artifacts. Retain backing arrays, decoders, prepared resources, streams and pending work through completion and failure draining; preserve fallible-close retry rules. Use explicit streams wherever the native interface requires them, with the existing waits/events and receipts. A host comparison establishes none of those CUDA guarantees.
Integrate maintained first-party processing#
A consumer library is an application artifact outside the cugeo-raster
release. For a first-party processing extension, add its native implementation
under extensions/<identifier>/ and integrate it into the one
libcugeo_raster.so, source archives, API guards, thin bindings and coordinated
release. Follow the extension contract and
ownership inventory.
Generic I/O, grids, sampling, resources and completion stay with core;
terrestrial and vertical transformations stay with cugeo-proj. The optional
physical Sentinel artifact isolates ERFA 2.0.1 and owns astronomical preparation
behind explicit physical preparation. It is not implemented; processing
inclusion supplies no physical execution. Follow the reference’s physical
boundary without adding a generic plugin registry or automatic download.
Choose source builds independently of optional NVIDIA backends:
Selection |
Cargo |
Source-wheel selector |
|---|---|---|
Standard |
Defaults / |
Unset or |
Core-only |
|
|
Explicit Sentinel |
|
|
Only known identifiers form a selected list. Empty, duplicate or unknown names,
and mixing all or none with another selector, fail. Extras add dependencies
only. Including Sentinel does not enable CUDA/nvJPEG2000. CMake installs the
chosen native artifact, and a prebuilt input must match requested extension
and backend booleans. Source archives retain maintained implementation inputs;
compiled artifacts omit excluded implementations and kernels.
Use cugeo.raster.open for ordinary products and generic files. SAFE catalogs,
assets, bands and grouped raw reads belong to core in every selection. Their
canonical Python implementation lives at cugeo.raster.io.sentinel2, with
its existing ordinary and I/O facade exports. Surface-reflectance processing
lives at cugeo.raster.extensions.sentinel2.surface_reflectance. Query
cugeo.raster.diagnostics.capabilities()["extensions"]["sentinel2"]
for processing inclusion only. It does not describe SAFE I/O, physical-module
availability or runtime readiness.
Common C declarations, exports and thin Python/C++ declarations remain installed
in core-only builds. Omitted operations call native typed unsupported code 2;
malformed control records retain code 1 and short storage code 3. Rust extension
APIs compile out when extension-sentinel2 is omitted, with CUDA-only members
also gated by cuda; preserve those conditions in API inventory. A Rust caller of the
installed common C ABI needs neither a gated Rust extension import nor a stub.
Record the processing and reference contract#
An author specifies the facts needed to interpret a result before qualifying it. Use existing metadata, grid and receipt types rather than inventing a universal extension manifest.
Contract |
Record |
|---|---|
Algorithm |
Processing/configuration identity, implementation/reference revision and admitted product/profile |
Inputs |
Ordered physical band identifiers, dtype and units, stored DN versus physical values, scale/offset availability, source identity |
Grid and output |
Shape, transform/CRS or geolocation meaning, pixel registration, ordered bands, units and encoding |
Validity and QA |
Nodata, saturation, mask availability, QA categories/bits and their resampling; distinguish pixel execution statuses |
Auxiliary resources |
Explicit caller paths/bytes, content hashes, provenance/licence, revision, applicability and coverage of LUTs/DEMs/calibration/orbit/Earth-orientation inputs |
Comparison |
Independent reference/build/configuration and resource identities, complete nonempty population, exactness or justified tolerances with units |
The example’s integer-index model is independent of the functions it tests. GDAL 3.8.4 and the applicable pinned Rasterio are oracle infrastructure for raster semantics, never runtime fallbacks or physical sensor-location oracles. Acquire external resources explicitly with their licence and coverage limits; a missing resource authorizes no download or invented all-fill result.
The synthetic catalog checks and host affine case do not qualify authentic SAFE
profiles, a complete Sen2Cor processor, physical Sen2VM, every spacecraft or
absolute accuracy. Missing actual reference/resources remain untested or
SKIP/77. Qualify a scientific implementation only within its independent
reference, frame/terrain/resource envelope and justified numerical acceptance.