terraproof 0.0.0-stage → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +356 -2
- package/bin/terraproof.js +4 -0
- package/dist/router/apply.js +147 -0
- package/dist/router/classify.js +111 -0
- package/dist/router/explain.js +9 -0
- package/dist/router/index.js +272 -0
- package/dist/router/resolve.js +239 -0
- package/dist/router/score.js +60 -0
- package/dist/router/types.js +1 -0
- package/dist/router/validate.js +81 -0
- package/instructions/engineering.md +14 -0
- package/instructions/security.md +14 -0
- package/instructions/simplicity.md +13 -0
- package/package.json +65 -4
- package/routing/DOMAIN_ROUTING.md +161 -0
- package/routing/ROUTER_DESIGN.md +173 -0
- package/routing/SKILL_MANIFEST.md +86 -0
- package/routing/checks.json +121 -0
- package/routing/collections.json +47 -0
- package/routing/registry.json +2211 -0
- package/routing/rules.json +64 -0
- package/skills/accuracy-assessment/SKILL.md +213 -0
- package/skills/accuracy-assessment/UPSTREAM.md +7 -0
- package/skills/accuracy-assessment/references/stratified-estimator.md +127 -0
- package/skills/accuracy-assessment/skill.json +103 -0
- package/skills/brainstorming/SKILL.md +250 -0
- package/skills/brainstorming/UPSTREAM.md +29 -0
- package/skills/brainstorming/scripts/frame-template.html +213 -0
- package/skills/brainstorming/scripts/helper.js +167 -0
- package/skills/brainstorming/scripts/server.cjs +723 -0
- package/skills/brainstorming/scripts/start-server.sh +209 -0
- package/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/skills/brainstorming/skill.json +73 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +299 -0
- package/skills/crs-and-units/SKILL.md +200 -0
- package/skills/crs-and-units/UPSTREAM.md +7 -0
- package/skills/crs-and-units/skill.json +74 -0
- package/skills/design-postgis-tables/SKILL.md +494 -0
- package/skills/design-postgis-tables/UPSTREAM.md +21 -0
- package/skills/design-postgis-tables/skill.json +90 -0
- package/skills/gdal/SKILL.md +125 -0
- package/skills/gdal/UPSTREAM.md +22 -0
- package/skills/gdal/references/gdal-recipes.md +103 -0
- package/skills/gdal/skill.json +66 -0
- package/skills/geomaster/README.md +105 -0
- package/skills/geomaster/SKILL.md +366 -0
- package/skills/geomaster/UPSTREAM.md +21 -0
- package/skills/geomaster/references/advanced-gis.md +376 -0
- package/skills/geomaster/references/big-data.md +363 -0
- package/skills/geomaster/references/code-examples.md +531 -0
- package/skills/geomaster/references/coordinate-systems.md +364 -0
- package/skills/geomaster/references/core-libraries.md +273 -0
- package/skills/geomaster/references/data-sources.md +330 -0
- package/skills/geomaster/references/gis-software.md +369 -0
- package/skills/geomaster/references/industry-applications.md +420 -0
- package/skills/geomaster/references/machine-learning.md +462 -0
- package/skills/geomaster/references/programming-languages.md +456 -0
- package/skills/geomaster/references/remote-sensing.md +370 -0
- package/skills/geomaster/references/scientific-domains.md +416 -0
- package/skills/geomaster/references/specialized-topics.md +428 -0
- package/skills/geomaster/references/troubleshooting.md +439 -0
- package/skills/geomaster/skill.json +157 -0
- package/skills/geopandas/SKILL.md +250 -0
- package/skills/geopandas/UPSTREAM.md +22 -0
- package/skills/geopandas/references/crs-management.md +231 -0
- package/skills/geopandas/references/data-io.md +323 -0
- package/skills/geopandas/references/data-structures.md +207 -0
- package/skills/geopandas/references/geometric-operations.md +262 -0
- package/skills/geopandas/references/spatial-analysis.md +294 -0
- package/skills/geopandas/references/visualization.md +230 -0
- package/skills/geopandas/scripts/_common.py +605 -0
- package/skills/geopandas/scripts/crs_reprojection_plan.py +210 -0
- package/skills/geopandas/scripts/export_plan.py +305 -0
- package/skills/geopandas/scripts/geometry_validity_report.py +227 -0
- package/skills/geopandas/scripts/sensitive_coordinates_checklist.py +230 -0
- package/skills/geopandas/scripts/spatial_join_audit.py +368 -0
- package/skills/geopandas/scripts/vector_inventory.py +140 -0
- package/skills/geopandas/skill.json +116 -0
- package/skills/geoparquet-validation/SKILL.md +125 -0
- package/skills/geoparquet-validation/UPSTREAM.md +24 -0
- package/skills/geoparquet-validation/references/distribution-best-practices.md +118 -0
- package/skills/geoparquet-validation/references/gpio-commands.md +264 -0
- package/skills/geoparquet-validation/references/tool-comparison.md +155 -0
- package/skills/geoparquet-validation/skill.json +71 -0
- package/skills/geospatial-data-discovery/SKILL.md +49 -0
- package/skills/geospatial-data-discovery/UPSTREAM.md +15 -0
- package/skills/geospatial-data-discovery/skill.json +51 -0
- package/skills/geospatial-frontend/SKILL.md +86 -0
- package/skills/geospatial-frontend/UPSTREAM.md +23 -0
- package/skills/geospatial-frontend/references/design-system.md +283 -0
- package/skills/geospatial-frontend/references/user-preferences.md +96 -0
- package/skills/geospatial-frontend/skill.json +87 -0
- package/skills/geozarr/SKILL.md +244 -0
- package/skills/geozarr/UPSTREAM.md +21 -0
- package/skills/geozarr/skill.json +97 -0
- package/skills/networkx/SKILL.md +440 -0
- package/skills/networkx/UPSTREAM.md +22 -0
- package/skills/networkx/references/algorithms.md +384 -0
- package/skills/networkx/references/generators.md +385 -0
- package/skills/networkx/references/graph-basics.md +284 -0
- package/skills/networkx/references/io.md +457 -0
- package/skills/networkx/references/visualization.md +531 -0
- package/skills/networkx/skill.json +93 -0
- package/skills/raster-processing/SKILL.md +222 -0
- package/skills/raster-processing/UPSTREAM.md +7 -0
- package/skills/raster-processing/skill.json +81 -0
- package/skills/sar-basics/SKILL.md +202 -0
- package/skills/sar-basics/UPSTREAM.md +7 -0
- package/skills/sar-basics/references/calibration-lut.md +98 -0
- package/skills/sar-basics/skill.json +97 -0
- package/skills/satellite-preprocessing/SKILL.md +241 -0
- package/skills/satellite-preprocessing/UPSTREAM.md +7 -0
- package/skills/satellite-preprocessing/skill.json +84 -0
- package/skills/scientific-visualization/SKILL.md +285 -0
- package/skills/scientific-visualization/UPSTREAM.md +25 -0
- package/skills/scientific-visualization/assets/color_palettes.py +263 -0
- package/skills/scientific-visualization/assets/nature.mplstyle +68 -0
- package/skills/scientific-visualization/assets/presentation.mplstyle +68 -0
- package/skills/scientific-visualization/assets/publication.mplstyle +77 -0
- package/skills/scientific-visualization/assets/publisher_profiles.json +269 -0
- package/skills/scientific-visualization/references/color_palettes.md +227 -0
- package/skills/scientific-visualization/references/journal_requirements.md +169 -0
- package/skills/scientific-visualization/references/matplotlib_examples.md +336 -0
- package/skills/scientific-visualization/references/publication_guidelines.md +196 -0
- package/skills/scientific-visualization/references/sources.md +76 -0
- package/skills/scientific-visualization/scripts/_common.py +136 -0
- package/skills/scientific-visualization/scripts/export_plan.py +493 -0
- package/skills/scientific-visualization/scripts/figure_export.py +642 -0
- package/skills/scientific-visualization/scripts/image_metadata.py +731 -0
- package/skills/scientific-visualization/scripts/palette_audit.py +327 -0
- package/skills/scientific-visualization/scripts/style_presets.py +501 -0
- package/skills/scientific-visualization/scripts/style_preview.py +232 -0
- package/skills/scientific-visualization/skill.json +95 -0
- package/skills/spectral-indices/SKILL.md +235 -0
- package/skills/spectral-indices/UPSTREAM.md +7 -0
- package/skills/spectral-indices/skill.json +88 -0
- package/skills/stac-and-cloud-access/SKILL.md +209 -0
- package/skills/stac-and-cloud-access/UPSTREAM.md +7 -0
- package/skills/stac-and-cloud-access/references/run-manifest.md +94 -0
- package/skills/stac-and-cloud-access/skill.json +98 -0
- package/skills/statistical-analysis/SKILL.md +446 -0
- package/skills/statistical-analysis/UPSTREAM.md +24 -0
- package/skills/statistical-analysis/references/assumptions_and_diagnostics.md +379 -0
- package/skills/statistical-analysis/references/bayesian_statistics.md +686 -0
- package/skills/statistical-analysis/references/effect_sizes_and_power.md +649 -0
- package/skills/statistical-analysis/references/reporting_standards.md +482 -0
- package/skills/statistical-analysis/references/test_selection_guide.md +129 -0
- package/skills/statistical-analysis/scripts/assumption_checks.py +652 -0
- package/skills/statistical-analysis/skill.json +127 -0
- package/skills/systematic-debugging/SKILL.md +283 -0
- package/skills/systematic-debugging/UPSTREAM.md +28 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +72 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/skill.json +88 -0
- package/skills/time-series-and-change/SKILL.md +217 -0
- package/skills/time-series-and-change/UPSTREAM.md +7 -0
- package/skills/time-series-and-change/references/change-methods.md +42 -0
- package/skills/time-series-and-change/skill.json +116 -0
- package/skills/vector-quality/SKILL.md +204 -0
- package/skills/vector-quality/UPSTREAM.md +7 -0
- package/skills/vector-quality/skill.json +82 -0
- package/skills/verification/SKILL.md +120 -0
- package/skills/verification/UPSTREAM.md +31 -0
- package/skills/verification/skill.json +67 -0
- package/skills/writing-plans/SKILL.md +171 -0
- package/skills/writing-plans/UPSTREAM.md +23 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-plans/skill.json +80 -0
- package/sources/SOURCES.md +374 -0
- package/third_party/isaaccorley-geospatial-skills/LICENSE +176 -0
- package/third_party/isaaccorley-geospatial-skills/NOTICE.md +17 -0
- package/third_party/kdense-scientific-agent-skills/LICENSE +21 -0
- package/third_party/kdense-scientific-agent-skills/NOTICE.md +19 -0
- package/third_party/superpowers/LICENSE +21 -0
- package/third_party/superpowers/NOTICE.md +17 -0
- package/third_party/timescale-pg-aiguide/LICENSE +176 -0
- package/third_party/timescale-pg-aiguide/NOTICE.md +14 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stac-and-cloud-access
|
|
3
|
+
description: Search STAC APIs reproducibly and read cloud-hosted rasters lazily, covering collections/bbox/intersects/datetime/query/filter parameters, item and asset provenance, signed URLs and requester-pays buckets, COG and Zarr windowed reads through HTTP range requests and GDAL /vsicurl/, loader scale/offset behaviour, caching and pinning item ids in a run manifest; use when finding, loading or recording satellite data from STAC catalogs or object storage.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# STAC search and cloud-native access
|
|
8
|
+
|
|
9
|
+
## Search with explicit, reproducible parameters
|
|
10
|
+
|
|
11
|
+
STAC API Item Search (`GET /search` required, `POST` recommended) returns an
|
|
12
|
+
ItemCollection (GeoJSON FeatureCollection of Items). Core parameters [S1]:
|
|
13
|
+
|
|
14
|
+
| Parameter | Meaning and pitfalls |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `collections` | Collection ids; always set it so results are not cross-collection by accident. |
|
|
17
|
+
| `bbox` | `[min lon, min lat, max lon, max lat]` in WGS 84 (CRS84); 2D or 3D. |
|
|
18
|
+
| `intersects` | One GeoJSON geometry. **Only one of `bbox` or `intersects`**; both is a 400 error. |
|
|
19
|
+
| `datetime` | RFC 3339 instant or interval with `/`; `..` for open ends. Item times are UTC [S2]. |
|
|
20
|
+
| `ids` | Exact Item ids — the way to re-fetch a pinned set. |
|
|
21
|
+
| `limit` | Page size suggestion only; servers may return fewer and paginate via `next` links. |
|
|
22
|
+
|
|
23
|
+
Property filtering is an **extension**: the Query extension (`query`, operators
|
|
24
|
+
`eq`, `neq`, `lt`, `lte`, `gt`, `gte`, `startsWith`, `endsWith`, `contains`, `in`)
|
|
25
|
+
[S3] or the recommended Filter extension (`filter`, `filter-lang` = `cql2-text` or
|
|
26
|
+
`cql2-json`) [S4]. Check conformance before relying on either; a server that does
|
|
27
|
+
not implement one may ignore or reject it.
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
import pystac_client
|
|
31
|
+
|
|
32
|
+
client = pystac_client.Client.open("https://earth-search.aws.element84.com/v1")
|
|
33
|
+
if not client.conforms_to("QUERY"):
|
|
34
|
+
raise RuntimeError("server does not advertise the Query extension")
|
|
35
|
+
search = client.search(
|
|
36
|
+
collections=["sentinel-2-l2a"],
|
|
37
|
+
bbox=[13.30, 52.45, 13.50, 52.55],
|
|
38
|
+
datetime="2024-06-01T00:00:00Z/2024-06-30T23:59:59Z",
|
|
39
|
+
query={"eo:cloud_cover": {"lt": 20}},
|
|
40
|
+
max_items=200, # client-side cap across pages
|
|
41
|
+
)
|
|
42
|
+
items = list(search.items())
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`Client.search` defaults to `POST`; `max_items` caps total items, `limit` is the
|
|
46
|
+
per-page hint; `filter` defaults to `cql2-json` for dict input [S5]. When run in
|
|
47
|
+
October 2026 this endpoint advertised Query but not Filter, so a `filter=` search
|
|
48
|
+
only warned. An AOI can return items from several UTM zones/tiles; plan a common
|
|
49
|
+
output CRS. Dataset discovery and licensing are covered by
|
|
50
|
+
[geospatial data discovery](../geospatial-data-discovery/SKILL.md). Shared rules:
|
|
51
|
+
[engineering](../../instructions/engineering.md),
|
|
52
|
+
[simplicity](../../instructions/simplicity.md), [security](../../instructions/security.md).
|
|
53
|
+
|
|
54
|
+
## Record item and asset provenance
|
|
55
|
+
|
|
56
|
+
An Item requires `id`, `geometry`, `bbox` (when geometry is not null),
|
|
57
|
+
`properties.datetime` (or `null` with `start_datetime`/`end_datetime`), `links`
|
|
58
|
+
and `assets`; ids are unique within a Collection, so record **collection + id**
|
|
59
|
+
[S2]. For each input keep:
|
|
60
|
+
|
|
61
|
+
- STAC API root URL, collection id, item id, `datetime`, self link;
|
|
62
|
+
- asset key and **unsigned** `href`, media type and roles;
|
|
63
|
+
- processing version: `processing:version` (e.g. a Sentinel processing
|
|
64
|
+
baseline) [S6], or the deprecated `s2:processing_baseline` still used by some
|
|
65
|
+
catalogs [S7];
|
|
66
|
+
- encoding metadata: raster extension `scale`/`offset`/`nodata` (`raster:bands`
|
|
67
|
+
in v1.x, `raster:scale`/`raster:offset` in v2.0) [S8];
|
|
68
|
+
- the exact search parameters and the date the search ran.
|
|
69
|
+
|
|
70
|
+
Catalogs change (reprocessing, new baselines, removed items). A search re-run
|
|
71
|
+
later can return different items; the pinned ids cannot silently change.
|
|
72
|
+
Re-fetch with `client.search(collections=[...], ids=[...])`. A manifest pattern
|
|
73
|
+
is in [references/run-manifest.md](references/run-manifest.md).
|
|
74
|
+
|
|
75
|
+
## Signed URLs and requester-pays storage
|
|
76
|
+
|
|
77
|
+
- **Signed URLs (SAS):** Microsoft Planetary Computer assets need signing,
|
|
78
|
+
e.g. `Client.open(url, modifier=planetary_computer.sign_inplace)` or
|
|
79
|
+
`planetary_computer.sign(item)`; tokens expire and signed items gain an
|
|
80
|
+
`msft:expiry` property [S9]. Sign at read time; never store signed URLs or
|
|
81
|
+
tokens in manifests, logs or reports ([security](../../instructions/security.md)).
|
|
82
|
+
- **Requester pays:** the reader pays for access and transfer. Example:
|
|
83
|
+
`s3://usgs-landsat/collection02/` is a requester-pays bucket [S10]. GDAL needs
|
|
84
|
+
credentials plus `AWS_REQUEST_PAYER=requester`; `AWS_NO_SIGN_REQUEST=YES`
|
|
85
|
+
disables signing for public buckets [S11]. Estimate transfer before bulk reads.
|
|
86
|
+
|
|
87
|
+
## Read COG windows with HTTP range requests
|
|
88
|
+
|
|
89
|
+
`/vsicurl/` reads remote files piece-wise with HTTP range requests, chunked and
|
|
90
|
+
cached in memory; `/vsicurl_streaming/` does not use range requests; a plain URL
|
|
91
|
+
without `/vsi` uses the HTTP driver, which downloads the whole file [S11]. COGs
|
|
92
|
+
are tiled with overviews and an internal tile index, which is what makes partial
|
|
93
|
+
reads efficient [S11]. Rasterio opens `https://` hrefs through GDAL.
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import rasterio
|
|
97
|
+
from rasterio.warp import transform_bounds
|
|
98
|
+
from rasterio.windows import Window, from_bounds
|
|
99
|
+
|
|
100
|
+
aoi = (13.30, 52.45, 13.50, 52.55) # lon/lat
|
|
101
|
+
href = items[0].assets["red"].href # unsigned public COG here
|
|
102
|
+
with rasterio.Env(GDAL_DISABLE_READDIR_ON_OPEN="EMPTY_DIR",
|
|
103
|
+
CPL_VSIL_CURL_ALLOWED_EXTENSIONS=".tif"):
|
|
104
|
+
with rasterio.open(href) as src:
|
|
105
|
+
bounds = transform_bounds("EPSG:4326", src.crs, *aoi)
|
|
106
|
+
window = from_bounds(*bounds, transform=src.transform)
|
|
107
|
+
window = window.round_offsets().round_lengths()
|
|
108
|
+
window = window.intersection(Window(0, 0, src.width, src.height))
|
|
109
|
+
dn = src.read(1, window=window, masked=True) # stored values
|
|
110
|
+
transform = src.window_transform(window)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR` stops directory listing and side-car
|
|
114
|
+
probing; `CPL_VSIL_CURL_ALLOWED_EXTENSIONS` limits which files GDAL assumes exist
|
|
115
|
+
[S12]. CLI equivalents: `gdalinfo /vsicurl/https://.../B04.tif`, and
|
|
116
|
+
`gdal_translate -projwin_srs EPSG:4326 -projwin ...` for a subset. Retries
|
|
117
|
+
(`GDAL_HTTP_MAX_RETRY`, `GDAL_HTTP_RETRY_DELAY`) and cache sizes are in
|
|
118
|
+
[references/run-manifest.md](references/run-manifest.md#gdal-network-options).
|
|
119
|
+
Windows/blocks and COG creation: [raster processing](../raster-processing/SKILL.md).
|
|
120
|
+
|
|
121
|
+
## Know what your loader decodes
|
|
122
|
+
|
|
123
|
+
In the example above (Earth Search Sentinel-2 L2A, October 2026) the STAC asset
|
|
124
|
+
declared `scale 0.0001, offset -0.1, nodata 0`, while the GeoTIFF reported
|
|
125
|
+
identity scale/offset: `rasterio.read()` returns raw DN [S8]. Loaders differ:
|
|
126
|
+
|
|
127
|
+
- `odc.stac.load(...)` returned raw `uint16` DN with `nodata` 0 in the same test;
|
|
128
|
+
decode afterwards, exactly once.
|
|
129
|
+
- `stackstac.stack(...)` defaults to `rescale=True`, applying `raster:bands`
|
|
130
|
+
scale/offset, with `dtype=float64` and NaN fill [S13]; do not decode again.
|
|
131
|
+
- `xarray.open_zarr(...)` defaults to `mask_and_scale=True` (CF decoding) and
|
|
132
|
+
lazy Dask chunks when Dask is installed [S14].
|
|
133
|
+
|
|
134
|
+
Decoding rules and sensor offsets: [satellite preprocessing](../satellite-preprocessing/SKILL.md).
|
|
135
|
+
|
|
136
|
+
## Load many items as a lazy cube
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
import odc.stac
|
|
140
|
+
|
|
141
|
+
ds = odc.stac.load(
|
|
142
|
+
items, bands=["red", "nir", "scl"],
|
|
143
|
+
crs="EPSG:32633", resolution=20, # explicit output grid
|
|
144
|
+
bbox=[13.30, 52.45, 13.50, 52.55],
|
|
145
|
+
groupby="solar_day", # merge same-pass tiles
|
|
146
|
+
chunks={"x": 2048, "y": 2048}, # Dask-backed, nothing read yet
|
|
147
|
+
)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`groupby="solar_day"` places items from the same solar day in one time slice;
|
|
151
|
+
by default overlapping pixels are filled from the first valid item in a
|
|
152
|
+
deterministic time/id order; `patch_url` can sign hrefs (e.g. `planetary_computer.sign`)
|
|
153
|
+
[S15]. Set `resampling` per band, e.g. nearest for categorical `scl` [S15]. In
|
|
154
|
+
the test above, 4 tile-items became 2 dates. Record `crs`, `resolution`,
|
|
155
|
+
`groupby`, `resampling` and library versions with the outputs.
|
|
156
|
+
|
|
157
|
+
## Cache and pin for reproducibility
|
|
158
|
+
|
|
159
|
+
GDAL's `/vsicurl/` cache is in-process memory only [S11]; it is not a
|
|
160
|
+
reproducibility mechanism. For results that must be re-verified:
|
|
161
|
+
|
|
162
|
+
1. Pin collection + item ids and asset keys; store unsigned hrefs.
|
|
163
|
+
2. Copy the exact bytes you analysed to a local or bucket cache and record
|
|
164
|
+
SHA-256 and size; verify hashes before reuse.
|
|
165
|
+
3. Record processing versions, encoding metadata, loader parameters, library and
|
|
166
|
+
GDAL versions, and the search parameters.
|
|
167
|
+
4. Keep timestamps and machine paths outside the hashed part of a manifest.
|
|
168
|
+
|
|
169
|
+
## Verify with Terraproof
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
python -m terraproof check source-item.json
|
|
173
|
+
python -m terraproof check subset_red.tif --expect reflectance
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`stac.provenance` checks Item time and a projection code, not full lineage,
|
|
177
|
+
licences or calibration. Raster outputs get `crs.defined`, `crs.consistent`,
|
|
178
|
+
`raster.nodata_declared`, `raster.grid_alignment`, `raster.cog_layout`, and
|
|
179
|
+
`rs.reflectance_range` with `--expect reflectance` (only after decoding).
|
|
180
|
+
|
|
181
|
+
Use `--manifest run.json --require-provenance` for `provenance.reproducible`
|
|
182
|
+
(re-hashes manifest inputs/outputs; warns on tool-version drift, fails on content
|
|
183
|
+
drift). Add `--time-range START END` for `rs.temporal_scope` on source Items.
|
|
184
|
+
For `rs.scale_applied_once`, compare a decoded raster with its raw source using
|
|
185
|
+
`--reference-input RAW.tif --encoding s2-l2a` or `landsat-c2-l2`; the sampled
|
|
186
|
+
output is compared with DN × scale + offset under that declared encoding.
|
|
187
|
+
|
|
188
|
+
**Not checked automatically:** whether the search returned the right items,
|
|
189
|
+
whether pinned items still exist upstream, licence compliance and transfer
|
|
190
|
+
costs. Manifest credential guards reject known secret-bearing paths/URLs, but
|
|
191
|
+
do not audit every application log or prevent all signed-URL leakage.
|
|
192
|
+
|
|
193
|
+
## Sources
|
|
194
|
+
|
|
195
|
+
- [S1 — STAC API Item Search](https://github.com/radiantearth/stac-api-spec/blob/main/item-search/README.md): parameters, bbox/intersects exclusivity, datetime syntax, limit and pagination.
|
|
196
|
+
- [S2 — STAC Item specification](https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md): required fields, id uniqueness, UTC datetime.
|
|
197
|
+
- [S3 — STAC API Query extension](https://github.com/stac-api-extensions/query): `query` syntax and operators.
|
|
198
|
+
- [S4 — STAC API Filter extension](https://github.com/stac-api-extensions/filter): `filter`, `filter-lang`, CQL2 text/JSON, queryables.
|
|
199
|
+
- [S5 — pystac-client `Client`](https://github.com/stac-utils/pystac-client/blob/main/pystac_client/client.py): `open(modifier=...)`, `search()` parameters and defaults, `conforms_to`.
|
|
200
|
+
- [S6 — STAC processing extension](https://github.com/stac-extensions/processing): `processing:version` (e.g. Sentinel processing baseline), `processing:software`, lineage links.
|
|
201
|
+
- [S7 — STAC Sentinel-2 extension](https://github.com/stac-extensions/sentinel-2): `s2:processing_baseline` deprecated in favour of `processing:version`.
|
|
202
|
+
- [S8 — STAC raster extension](https://github.com/stac-extensions/raster): scale/offset semantics; Earth Search behaviour observed by a live query and rasterio read (October 2026).
|
|
203
|
+
- [S9 — Planetary Computer SDK](https://github.com/microsoft/planetary-computer-sdk-for-python): `sign`, `sign_inplace`, token expiry and `msft:expiry`.
|
|
204
|
+
- [S10 — Registry of Open Data on AWS, USGS Landsat](https://registry.opendata.aws/usgs-landsat/): `usgs-landsat` bucket `RequesterPays: True`.
|
|
205
|
+
- [S11 — GDAL virtual file systems](https://gdal.org/en/stable/user/virtual_file_systems.html): `/vsicurl/` range requests, chunking/cache, `/vsis3/`, `AWS_REQUEST_PAYER`, `AWS_NO_SIGN_REQUEST`, retries, cloud-friendly TIFF layout.
|
|
206
|
+
- [S12 — GDAL configuration options](https://gdal.org/en/stable/user/configoptions.html): `GDAL_DISABLE_READDIR_ON_OPEN`, `CPL_VSIL_CURL_ALLOWED_EXTENSIONS`.
|
|
207
|
+
- [S13 — stackstac `stack()`](https://github.com/gjoseph92/stackstac/blob/main/stackstac/stack.py): `rescale=True`, `dtype`, `fill_value`, `resampling` defaults.
|
|
208
|
+
- [S14 — xarray `open_zarr`](https://github.com/pydata/xarray/blob/main/xarray/backends/zarr.py): `chunks` and `mask_and_scale` defaults.
|
|
209
|
+
- [S15 — odc-stac `load`](https://odc-stac.readthedocs.io/en/latest/_api/odc.stac.load.html): `groupby`, `chunks`, `crs`, `resolution`, `bbox`, `resampling`, `patch_url`, fuse behaviour.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Attribution
|
|
2
|
+
|
|
3
|
+
Terraproof native — no upstream source.
|
|
4
|
+
|
|
5
|
+
Authored for Terraproof by Geova. License: MIT; see the [project license](../../LICENSE).
|
|
6
|
+
Primary technical references are listed in [SKILL.md](SKILL.md#sources).
|
|
7
|
+
No upstream skill text or code was copied or adapted.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Run records and network options
|
|
2
|
+
|
|
3
|
+
Reference for [STAC and cloud access](../SKILL.md). Terraproof's own manifest
|
|
4
|
+
command and `provenance.reproducible` check are being added in Phase 4; until their
|
|
5
|
+
format is final, keep a run record like the one below and convert it later. It is
|
|
6
|
+
a pattern, not a Terraproof schema.
|
|
7
|
+
|
|
8
|
+
## Minimal run record
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"core": {
|
|
13
|
+
"stac_api": "https://earth-search.aws.element84.com/v1",
|
|
14
|
+
"search": {
|
|
15
|
+
"collections": ["sentinel-2-l2a"],
|
|
16
|
+
"bbox": [13.30, 52.45, 13.50, 52.55],
|
|
17
|
+
"datetime": "2024-06-01T00:00:00Z/2024-06-30T23:59:59Z",
|
|
18
|
+
"query": {"eo:cloud_cover": {"lt": 20}}
|
|
19
|
+
},
|
|
20
|
+
"items": [
|
|
21
|
+
{
|
|
22
|
+
"collection": "sentinel-2-l2a",
|
|
23
|
+
"id": "S2A_32UQD_20240629_0_L2A",
|
|
24
|
+
"datetime": "2024-06-29T10:26:14.251000Z",
|
|
25
|
+
"processing_version": "05.10",
|
|
26
|
+
"assets": {
|
|
27
|
+
"red": {
|
|
28
|
+
"href": "https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/32/U/QD/2024/6/S2A_32UQD_20240629_0_L2A/B04.tif",
|
|
29
|
+
"scale": 0.0001, "offset": -0.1, "nodata": 0,
|
|
30
|
+
"sha256": "<hash of the cached bytes>", "size": 0
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"load": {"crs": "EPSG:32633", "resolution": 20, "groupby": "solar_day",
|
|
36
|
+
"resampling": {"scl": "nearest", "*": "bilinear"}},
|
|
37
|
+
"software": {"python": "3.x", "gdal": "x.y.z", "rasterio": "x.y.z",
|
|
38
|
+
"pystac-client": "x.y.z", "odc-stac": "x.y.z"},
|
|
39
|
+
"outputs": [{"path": "outputs/ndvi_2024-06.tif", "sha256": "...", "size": 0}]
|
|
40
|
+
},
|
|
41
|
+
"context": {"created": "2026-10-21T00:00:00Z", "operator": "...", "root": "."}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The values above came from a real search when this skill was written
|
|
46
|
+
(`processing_version` was read from the deprecated `s2:processing_baseline`
|
|
47
|
+
because the item had no `processing:version`). Rules:
|
|
48
|
+
|
|
49
|
+
- `core` is deterministic: same inputs → same bytes. Timestamps, hostnames and
|
|
50
|
+
absolute paths go in `context`; store paths relative to a declared root.
|
|
51
|
+
- Hrefs are **unsigned**. Strip signing query strings before recording, e.g.
|
|
52
|
+
`href.split("?", 1)[0]` for Planetary Computer SAS URLs, and never store tokens
|
|
53
|
+
or credentials.
|
|
54
|
+
- Hash the bytes actually analysed (a local copy), not the remote object.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import hashlib
|
|
58
|
+
from pathlib import Path
|
|
59
|
+
|
|
60
|
+
def file_digest(path, chunk=1 << 20):
|
|
61
|
+
h = hashlib.sha256()
|
|
62
|
+
p = Path(path)
|
|
63
|
+
with p.open("rb") as f:
|
|
64
|
+
for block in iter(lambda: f.read(chunk), b""):
|
|
65
|
+
h.update(block)
|
|
66
|
+
return {"sha256": h.hexdigest(), "size": p.stat().st_size}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Write JSON with sorted keys (`json.dumps(core, sort_keys=True, indent=2)`) so the
|
|
70
|
+
core serialises identically across runs.
|
|
71
|
+
|
|
72
|
+
## GDAL network options
|
|
73
|
+
|
|
74
|
+
From the GDAL virtual-file-system and configuration documentation [S1, S2]:
|
|
75
|
+
|
|
76
|
+
| Option | Effect |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR` | No directory listing; drivers see only the opened file (no side-car probing). |
|
|
79
|
+
| `CPL_VSIL_CURL_ALLOWED_EXTENSIONS=.tif` | GDAL assumes only files with these extensions exist on the server. |
|
|
80
|
+
| `GDAL_HTTP_MAX_RETRY`, `GDAL_HTTP_RETRY_DELAY` | Retries (count, seconds) on HTTP 429, 502, 503, 504. |
|
|
81
|
+
| `CPL_VSIL_CURL_CHUNK_SIZE` | Range-request chunk size (16 KB default granularity; grows for sequential reads). |
|
|
82
|
+
| `CPL_VSIL_CURL_CACHE_SIZE` | Global in-memory LRU cache shared by `/vsicurl/` downloads (16 MB default). |
|
|
83
|
+
| `VSI_CACHE=TRUE`, `VSI_CACHE_SIZE` | Per-file RAM cache (25 MB default), discarded when the handle closes. |
|
|
84
|
+
| `AWS_REQUEST_PAYER=requester` | Access requester-pays S3 buckets via `/vsis3/` and accept charges. |
|
|
85
|
+
| `AWS_NO_SIGN_REQUEST=YES` | Disable request signing for public buckets. |
|
|
86
|
+
|
|
87
|
+
Set them with `rasterio.Env(...)` in Python or `--config KEY VALUE` / environment
|
|
88
|
+
variables for GDAL CLI tools. Credentials belong in the environment or a GDAL
|
|
89
|
+
configuration file's `[credentials]` section, never in code or manifests [S1].
|
|
90
|
+
|
|
91
|
+
## Sources
|
|
92
|
+
|
|
93
|
+
- [S1 — GDAL virtual file systems](https://gdal.org/en/stable/user/virtual_file_systems.html).
|
|
94
|
+
- [S2 — GDAL configuration options](https://gdal.org/en/stable/user/configoptions.html).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stac-and-cloud-access",
|
|
3
|
+
"layer": "domain",
|
|
4
|
+
"domains": [
|
|
5
|
+
"geospatial"
|
|
6
|
+
],
|
|
7
|
+
"capabilities": [
|
|
8
|
+
"stac-search",
|
|
9
|
+
"cloud-native-raster-access",
|
|
10
|
+
"provenance-recording"
|
|
11
|
+
],
|
|
12
|
+
"triggers": [
|
|
13
|
+
"stac",
|
|
14
|
+
"stac api",
|
|
15
|
+
"pystac-client",
|
|
16
|
+
"planetary computer",
|
|
17
|
+
"signed asset url",
|
|
18
|
+
"requester-pays",
|
|
19
|
+
"/vsicurl/",
|
|
20
|
+
"vsicurl",
|
|
21
|
+
"http range request",
|
|
22
|
+
"windowed read",
|
|
23
|
+
"odc.stac",
|
|
24
|
+
"stackstac",
|
|
25
|
+
"processing:version"
|
|
26
|
+
],
|
|
27
|
+
"recommended": [
|
|
28
|
+
"satellite-preprocessing",
|
|
29
|
+
"geospatial-data-discovery"
|
|
30
|
+
],
|
|
31
|
+
"requires": [],
|
|
32
|
+
"conflicts": [],
|
|
33
|
+
"explanation": "Searches STAC APIs reproducibly (collections/bbox/datetime/query/filter, pinned item ids) and reads cloud-hosted rasters lazily over HTTP range requests (/vsicurl/, signed URLs, requester-pays buckets, windowed reads), recording asset and encoding provenance.",
|
|
34
|
+
"sections": [
|
|
35
|
+
{
|
|
36
|
+
"id": "search-with-explicit-reproducible-parameters",
|
|
37
|
+
"title": "Search with explicit, reproducible parameters",
|
|
38
|
+
"source": "SKILL.md#search-with-explicit-reproducible-parameters"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "record-item-and-asset-provenance",
|
|
42
|
+
"title": "Record item and asset provenance",
|
|
43
|
+
"source": "SKILL.md#record-item-and-asset-provenance"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "signed-urls-and-requester-pays-storage",
|
|
47
|
+
"title": "Signed URLs and requester-pays storage",
|
|
48
|
+
"source": "SKILL.md#signed-urls-and-requester-pays-storage"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "read-cog-windows-with-http-range-requests",
|
|
52
|
+
"title": "Read COG windows with HTTP range requests",
|
|
53
|
+
"source": "SKILL.md#read-cog-windows-with-http-range-requests"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "know-what-your-loader-decodes",
|
|
57
|
+
"title": "Know what your loader decodes",
|
|
58
|
+
"source": "SKILL.md#know-what-your-loader-decodes"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "load-many-items-as-a-lazy-cube",
|
|
62
|
+
"title": "Load many items as a lazy cube",
|
|
63
|
+
"source": "SKILL.md#load-many-items-as-a-lazy-cube"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "cache-and-pin-for-reproducibility",
|
|
67
|
+
"title": "Cache and pin for reproducibility",
|
|
68
|
+
"source": "SKILL.md#cache-and-pin-for-reproducibility"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "verify-with-terraproof",
|
|
72
|
+
"title": "Verify with Terraproof",
|
|
73
|
+
"source": "SKILL.md#verify-with-terraproof"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "sources",
|
|
77
|
+
"title": "Sources",
|
|
78
|
+
"source": "SKILL.md#sources"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "run-manifest",
|
|
82
|
+
"title": "Run manifest",
|
|
83
|
+
"source": "references/run-manifest.md"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"checks": [
|
|
87
|
+
"stac.provenance",
|
|
88
|
+
"provenance.reproducible",
|
|
89
|
+
"rs.temporal_scope",
|
|
90
|
+
"rs.scale_applied_once",
|
|
91
|
+
"raster.cog_layout",
|
|
92
|
+
"raster.grid_alignment",
|
|
93
|
+
"raster.nodata_declared",
|
|
94
|
+
"crs.defined",
|
|
95
|
+
"crs.consistent",
|
|
96
|
+
"rs.reflectance_range"
|
|
97
|
+
]
|
|
98
|
+
}
|