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.
Files changed (182) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +356 -2
  3. package/bin/terraproof.js +4 -0
  4. package/dist/router/apply.js +147 -0
  5. package/dist/router/classify.js +111 -0
  6. package/dist/router/explain.js +9 -0
  7. package/dist/router/index.js +272 -0
  8. package/dist/router/resolve.js +239 -0
  9. package/dist/router/score.js +60 -0
  10. package/dist/router/types.js +1 -0
  11. package/dist/router/validate.js +81 -0
  12. package/instructions/engineering.md +14 -0
  13. package/instructions/security.md +14 -0
  14. package/instructions/simplicity.md +13 -0
  15. package/package.json +65 -4
  16. package/routing/DOMAIN_ROUTING.md +161 -0
  17. package/routing/ROUTER_DESIGN.md +173 -0
  18. package/routing/SKILL_MANIFEST.md +86 -0
  19. package/routing/checks.json +121 -0
  20. package/routing/collections.json +47 -0
  21. package/routing/registry.json +2211 -0
  22. package/routing/rules.json +64 -0
  23. package/skills/accuracy-assessment/SKILL.md +213 -0
  24. package/skills/accuracy-assessment/UPSTREAM.md +7 -0
  25. package/skills/accuracy-assessment/references/stratified-estimator.md +127 -0
  26. package/skills/accuracy-assessment/skill.json +103 -0
  27. package/skills/brainstorming/SKILL.md +250 -0
  28. package/skills/brainstorming/UPSTREAM.md +29 -0
  29. package/skills/brainstorming/scripts/frame-template.html +213 -0
  30. package/skills/brainstorming/scripts/helper.js +167 -0
  31. package/skills/brainstorming/scripts/server.cjs +723 -0
  32. package/skills/brainstorming/scripts/start-server.sh +209 -0
  33. package/skills/brainstorming/scripts/stop-server.sh +120 -0
  34. package/skills/brainstorming/skill.json +73 -0
  35. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  36. package/skills/brainstorming/visual-companion.md +299 -0
  37. package/skills/crs-and-units/SKILL.md +200 -0
  38. package/skills/crs-and-units/UPSTREAM.md +7 -0
  39. package/skills/crs-and-units/skill.json +74 -0
  40. package/skills/design-postgis-tables/SKILL.md +494 -0
  41. package/skills/design-postgis-tables/UPSTREAM.md +21 -0
  42. package/skills/design-postgis-tables/skill.json +90 -0
  43. package/skills/gdal/SKILL.md +125 -0
  44. package/skills/gdal/UPSTREAM.md +22 -0
  45. package/skills/gdal/references/gdal-recipes.md +103 -0
  46. package/skills/gdal/skill.json +66 -0
  47. package/skills/geomaster/README.md +105 -0
  48. package/skills/geomaster/SKILL.md +366 -0
  49. package/skills/geomaster/UPSTREAM.md +21 -0
  50. package/skills/geomaster/references/advanced-gis.md +376 -0
  51. package/skills/geomaster/references/big-data.md +363 -0
  52. package/skills/geomaster/references/code-examples.md +531 -0
  53. package/skills/geomaster/references/coordinate-systems.md +364 -0
  54. package/skills/geomaster/references/core-libraries.md +273 -0
  55. package/skills/geomaster/references/data-sources.md +330 -0
  56. package/skills/geomaster/references/gis-software.md +369 -0
  57. package/skills/geomaster/references/industry-applications.md +420 -0
  58. package/skills/geomaster/references/machine-learning.md +462 -0
  59. package/skills/geomaster/references/programming-languages.md +456 -0
  60. package/skills/geomaster/references/remote-sensing.md +370 -0
  61. package/skills/geomaster/references/scientific-domains.md +416 -0
  62. package/skills/geomaster/references/specialized-topics.md +428 -0
  63. package/skills/geomaster/references/troubleshooting.md +439 -0
  64. package/skills/geomaster/skill.json +157 -0
  65. package/skills/geopandas/SKILL.md +250 -0
  66. package/skills/geopandas/UPSTREAM.md +22 -0
  67. package/skills/geopandas/references/crs-management.md +231 -0
  68. package/skills/geopandas/references/data-io.md +323 -0
  69. package/skills/geopandas/references/data-structures.md +207 -0
  70. package/skills/geopandas/references/geometric-operations.md +262 -0
  71. package/skills/geopandas/references/spatial-analysis.md +294 -0
  72. package/skills/geopandas/references/visualization.md +230 -0
  73. package/skills/geopandas/scripts/_common.py +605 -0
  74. package/skills/geopandas/scripts/crs_reprojection_plan.py +210 -0
  75. package/skills/geopandas/scripts/export_plan.py +305 -0
  76. package/skills/geopandas/scripts/geometry_validity_report.py +227 -0
  77. package/skills/geopandas/scripts/sensitive_coordinates_checklist.py +230 -0
  78. package/skills/geopandas/scripts/spatial_join_audit.py +368 -0
  79. package/skills/geopandas/scripts/vector_inventory.py +140 -0
  80. package/skills/geopandas/skill.json +116 -0
  81. package/skills/geoparquet-validation/SKILL.md +125 -0
  82. package/skills/geoparquet-validation/UPSTREAM.md +24 -0
  83. package/skills/geoparquet-validation/references/distribution-best-practices.md +118 -0
  84. package/skills/geoparquet-validation/references/gpio-commands.md +264 -0
  85. package/skills/geoparquet-validation/references/tool-comparison.md +155 -0
  86. package/skills/geoparquet-validation/skill.json +71 -0
  87. package/skills/geospatial-data-discovery/SKILL.md +49 -0
  88. package/skills/geospatial-data-discovery/UPSTREAM.md +15 -0
  89. package/skills/geospatial-data-discovery/skill.json +51 -0
  90. package/skills/geospatial-frontend/SKILL.md +86 -0
  91. package/skills/geospatial-frontend/UPSTREAM.md +23 -0
  92. package/skills/geospatial-frontend/references/design-system.md +283 -0
  93. package/skills/geospatial-frontend/references/user-preferences.md +96 -0
  94. package/skills/geospatial-frontend/skill.json +87 -0
  95. package/skills/geozarr/SKILL.md +244 -0
  96. package/skills/geozarr/UPSTREAM.md +21 -0
  97. package/skills/geozarr/skill.json +97 -0
  98. package/skills/networkx/SKILL.md +440 -0
  99. package/skills/networkx/UPSTREAM.md +22 -0
  100. package/skills/networkx/references/algorithms.md +384 -0
  101. package/skills/networkx/references/generators.md +385 -0
  102. package/skills/networkx/references/graph-basics.md +284 -0
  103. package/skills/networkx/references/io.md +457 -0
  104. package/skills/networkx/references/visualization.md +531 -0
  105. package/skills/networkx/skill.json +93 -0
  106. package/skills/raster-processing/SKILL.md +222 -0
  107. package/skills/raster-processing/UPSTREAM.md +7 -0
  108. package/skills/raster-processing/skill.json +81 -0
  109. package/skills/sar-basics/SKILL.md +202 -0
  110. package/skills/sar-basics/UPSTREAM.md +7 -0
  111. package/skills/sar-basics/references/calibration-lut.md +98 -0
  112. package/skills/sar-basics/skill.json +97 -0
  113. package/skills/satellite-preprocessing/SKILL.md +241 -0
  114. package/skills/satellite-preprocessing/UPSTREAM.md +7 -0
  115. package/skills/satellite-preprocessing/skill.json +84 -0
  116. package/skills/scientific-visualization/SKILL.md +285 -0
  117. package/skills/scientific-visualization/UPSTREAM.md +25 -0
  118. package/skills/scientific-visualization/assets/color_palettes.py +263 -0
  119. package/skills/scientific-visualization/assets/nature.mplstyle +68 -0
  120. package/skills/scientific-visualization/assets/presentation.mplstyle +68 -0
  121. package/skills/scientific-visualization/assets/publication.mplstyle +77 -0
  122. package/skills/scientific-visualization/assets/publisher_profiles.json +269 -0
  123. package/skills/scientific-visualization/references/color_palettes.md +227 -0
  124. package/skills/scientific-visualization/references/journal_requirements.md +169 -0
  125. package/skills/scientific-visualization/references/matplotlib_examples.md +336 -0
  126. package/skills/scientific-visualization/references/publication_guidelines.md +196 -0
  127. package/skills/scientific-visualization/references/sources.md +76 -0
  128. package/skills/scientific-visualization/scripts/_common.py +136 -0
  129. package/skills/scientific-visualization/scripts/export_plan.py +493 -0
  130. package/skills/scientific-visualization/scripts/figure_export.py +642 -0
  131. package/skills/scientific-visualization/scripts/image_metadata.py +731 -0
  132. package/skills/scientific-visualization/scripts/palette_audit.py +327 -0
  133. package/skills/scientific-visualization/scripts/style_presets.py +501 -0
  134. package/skills/scientific-visualization/scripts/style_preview.py +232 -0
  135. package/skills/scientific-visualization/skill.json +95 -0
  136. package/skills/spectral-indices/SKILL.md +235 -0
  137. package/skills/spectral-indices/UPSTREAM.md +7 -0
  138. package/skills/spectral-indices/skill.json +88 -0
  139. package/skills/stac-and-cloud-access/SKILL.md +209 -0
  140. package/skills/stac-and-cloud-access/UPSTREAM.md +7 -0
  141. package/skills/stac-and-cloud-access/references/run-manifest.md +94 -0
  142. package/skills/stac-and-cloud-access/skill.json +98 -0
  143. package/skills/statistical-analysis/SKILL.md +446 -0
  144. package/skills/statistical-analysis/UPSTREAM.md +24 -0
  145. package/skills/statistical-analysis/references/assumptions_and_diagnostics.md +379 -0
  146. package/skills/statistical-analysis/references/bayesian_statistics.md +686 -0
  147. package/skills/statistical-analysis/references/effect_sizes_and_power.md +649 -0
  148. package/skills/statistical-analysis/references/reporting_standards.md +482 -0
  149. package/skills/statistical-analysis/references/test_selection_guide.md +129 -0
  150. package/skills/statistical-analysis/scripts/assumption_checks.py +652 -0
  151. package/skills/statistical-analysis/skill.json +127 -0
  152. package/skills/systematic-debugging/SKILL.md +283 -0
  153. package/skills/systematic-debugging/UPSTREAM.md +28 -0
  154. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  155. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  156. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  157. package/skills/systematic-debugging/find-polluter.sh +72 -0
  158. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  159. package/skills/systematic-debugging/skill.json +88 -0
  160. package/skills/time-series-and-change/SKILL.md +217 -0
  161. package/skills/time-series-and-change/UPSTREAM.md +7 -0
  162. package/skills/time-series-and-change/references/change-methods.md +42 -0
  163. package/skills/time-series-and-change/skill.json +116 -0
  164. package/skills/vector-quality/SKILL.md +204 -0
  165. package/skills/vector-quality/UPSTREAM.md +7 -0
  166. package/skills/vector-quality/skill.json +82 -0
  167. package/skills/verification/SKILL.md +120 -0
  168. package/skills/verification/UPSTREAM.md +31 -0
  169. package/skills/verification/skill.json +67 -0
  170. package/skills/writing-plans/SKILL.md +171 -0
  171. package/skills/writing-plans/UPSTREAM.md +23 -0
  172. package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  173. package/skills/writing-plans/skill.json +80 -0
  174. package/sources/SOURCES.md +374 -0
  175. package/third_party/isaaccorley-geospatial-skills/LICENSE +176 -0
  176. package/third_party/isaaccorley-geospatial-skills/NOTICE.md +17 -0
  177. package/third_party/kdense-scientific-agent-skills/LICENSE +21 -0
  178. package/third_party/kdense-scientific-agent-skills/NOTICE.md +19 -0
  179. package/third_party/superpowers/LICENSE +21 -0
  180. package/third_party/superpowers/NOTICE.md +17 -0
  181. package/third_party/timescale-pg-aiguide/LICENSE +176 -0
  182. package/third_party/timescale-pg-aiguide/NOTICE.md +14 -0
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "geospatial-frontend",
3
+ "layer": "implementation",
4
+ "domains": [
5
+ "frontend",
6
+ "geospatial"
7
+ ],
8
+ "capabilities": [
9
+ "web-map",
10
+ "maplibre",
11
+ "duckdb-wasm",
12
+ "deckgl",
13
+ "spatial-ui"
14
+ ],
15
+ "triggers": [
16
+ "map",
17
+ "web map",
18
+ "maplibre",
19
+ "deck.gl",
20
+ "interactive map",
21
+ "map dashboard",
22
+ "spatial ui",
23
+ "cartography web"
24
+ ],
25
+ "recommended": [],
26
+ "requires": [],
27
+ "conflicts": [],
28
+ "explanation": "Configures MapLibre GL, interactive layers, and map dashboard interfaces.",
29
+ "sections": [
30
+ {
31
+ "id": "architecture",
32
+ "title": "Architecture",
33
+ "source": "SKILL.md#architecture"
34
+ },
35
+ {
36
+ "id": "design-system",
37
+ "title": "Design System",
38
+ "source": "SKILL.md#design-system"
39
+ },
40
+ {
41
+ "id": "ui-rules",
42
+ "title": "UI Rules",
43
+ "source": "SKILL.md#ui-rules"
44
+ },
45
+ {
46
+ "id": "layout",
47
+ "title": "Layout",
48
+ "source": "SKILL.md#layout"
49
+ },
50
+ {
51
+ "id": "map-integration",
52
+ "title": "Map Integration",
53
+ "source": "SKILL.md#map-integration"
54
+ },
55
+ {
56
+ "id": "data-pipeline-pattern",
57
+ "title": "Data Pipeline Pattern",
58
+ "source": "SKILL.md#data-pipeline-pattern"
59
+ },
60
+ {
61
+ "id": "tutorial-system",
62
+ "title": "Tutorial System",
63
+ "source": "SKILL.md#tutorial-system"
64
+ },
65
+ {
66
+ "id": "responsive",
67
+ "title": "Responsive",
68
+ "source": "SKILL.md#responsive"
69
+ },
70
+ {
71
+ "id": "file-organization",
72
+ "title": "File Organization",
73
+ "source": "SKILL.md#file-organization"
74
+ },
75
+ {
76
+ "id": "design-system-reference",
77
+ "title": "Design System Tokens",
78
+ "source": "references/design-system.md"
79
+ },
80
+ {
81
+ "id": "user-preferences",
82
+ "title": "UI Preferences & Design Rules",
83
+ "source": "references/user-preferences.md"
84
+ }
85
+ ],
86
+ "checks": []
87
+ }
@@ -0,0 +1,244 @@
1
+ ---
2
+ name: geozarr
3
+ description: GeoZarr conventions for geospatial Zarr stores: CF grid_mapping, coordinate arrays, Zarr v2/v3 dimension declarations, multiscales, proj:/spatial: namespaces, and xarray/rioxarray/GDAL interop. Use when authoring, patching, validating, or ingesting Zarr stores intended to round-trip as georeferenced rasters.
4
+ ---
5
+
6
+ # GeoZarr
7
+
8
+ GeoZarr is a set of modular Zarr conventions for multidimensional georeferenced grids. It bridges the Zarr format with the Climate-and-Forecast (CF) data model, GDAL, and STAC so common tools such as xarray, rioxarray, GDAL, and QGIS can open a Zarr store as a properly georeferenced raster without per-tool metadata patches.
9
+
10
+ This skill covers what a compliant store looks like, how to author one from scratch, and how to patch existing non-compliant stores in place.
11
+
12
+ ## How to use this skill
13
+
14
+ Work from the user's actual files, environment, and target reader. Do not assume local paths, private buckets, one cloud provider, or one Python package manager. Prefer examples with placeholders such as `store.zarr`, `data_var`, `s3://bucket/path/`, or `https://example.com/store.zarr`; replace them only when the user provides concrete values.
15
+
16
+ When advice depends on a moving draft spec or a specific reader version, say so explicitly and verify the installed tool when possible:
17
+
18
+ ```bash
19
+ python -c "import zarr, xarray; print('zarr', zarr.__version__, 'xarray', xarray.__version__)"
20
+ gdalinfo --version
21
+ ```
22
+
23
+ ## Status and version guidance
24
+
25
+ - The OGC GeoZarr Standards Working Group draft lives at [zarr-developers/geozarr-spec](https://github.com/zarr-developers/geozarr-spec); rendered draft at [zarr.dev/geozarr-spec](https://zarr.dev/geozarr-spec/documents/standard/template/geozarr-spec.html).
26
+ - The draft is **modular**. You can adopt CF + grid_mapping alone, or layer on `proj:` / `spatial:` / multiscales conventions independently. Treat these layers as compatibility choices, not a single mandatory profile.
27
+ - Zarr v2 and v3 are both relevant in real systems. In v2, dimension names live in `_ARRAY_DIMENSIONS`; in v3, they live in `dimension_names`.
28
+ - GDAL support varies by version and convention. GDAL 3.11 added Kerchunk reference support; GDAL 3.12 added remote stores without reliable directory listing; GDAL 3.13 added Zarr v3 sharding, multiscales reading, and `SPATIAL_PROJ` georeferencing read/write support.
29
+
30
+ ## When to use this skill
31
+
32
+ - Writing a new Zarr from xarray/rioxarray and want it to be readable by GDAL/QGIS as a raster.
33
+ - Auditing an existing Zarr that "opens but has no CRS" or where `rio.crs` is `None`.
34
+ - Patching a published store in place to add CF + grid_mapping without rewriting chunks.
35
+ - Building virtual references (kerchunk / virtualizarr / icechunk) and need the resulting store to be GeoZarr-compliant.
36
+ - Adding multiscale overviews (pyramids) for tile-server / web-map consumption.
37
+
38
+ ## The compliance checklist
39
+
40
+ A minimum-viable georeferenced Zarr store has:
41
+
42
+ 1. **Root group attrs**
43
+ - `Conventions: "CF-1.8"` (or later)
44
+ - Optional but recommended: `title`, `institution`, `history`, `source`, `references`.
45
+ 2. **A spatial_ref / crs scalar variable** (CF "grid mapping variable"). Common names: `spatial_ref`, `crs`. Attrs:
46
+ - `grid_mapping_name` (e.g. `latitude_longitude`, `transverse_mercator`)
47
+ - `crs_wkt` (WKT2 string — what GDAL/rioxarray actually reads)
48
+ - `spatial_ref` (legacy GDAL key, same WKT) — optional but improves compat
49
+ - `GeoTransform: "x0 dx 0 y0 0 dy"` — six-number affine, pixel-edge origin
50
+ - For lat/lon: `semi_major_axis`, `inverse_flattening`, `longitude_of_prime_meridian`
51
+ 3. **Each data array** carries:
52
+ - `grid_mapping: "spatial_ref"` (the name of the grid mapping variable)
53
+ - `_FillValue` (or `missing_value`) if applicable
54
+ - `units`, `standard_name`, `long_name` when meaningful
55
+ 4. **1D coordinate arrays** along the spatial axes (`x`/`y` or `lon`/`lat`) when the grid is rectilinear:
56
+ - dtype `float64`, monotonic, **cell-center** values (`x0 + (i + 0.5) * dx`)
57
+ - `dimension_names: ["x"]` (Zarr v3) or `_ARRAY_DIMENSIONS: ["x"]` (v2)
58
+ - For projected: `standard_name: "projection_x_coordinate"`, `units: "m"`, `axis: "X"`
59
+ - For geographic: `standard_name: "longitude"`, `units: "degrees_east"`, `axis: "X"` (analogous for `y`/latitude)
60
+ 5. **Dimension names declared on every array** (not just coord arrays) so readers know which axis is which.
61
+ 6. **Consolidated metadata** at the root for fast remote opens when supported by the chosen Zarr format and library.
62
+
63
+ That's enough for `xarray.open_zarr(...)` + `rioxarray` to recover the CRS and transform in common Python workflows, and for GDAL to expose a populated coordinate system when the installed GDAL version supports the chosen convention.
64
+
65
+ ## Cell-center vs pixel-edge
66
+
67
+ CF coordinate variables are **cell centers**. The GeoTransform string is **pixel edge** (matches GDAL). Don't mix them up.
68
+
69
+ ```python
70
+ # Coordinate arrays — cell centers
71
+ x = x0 + (np.arange(NX) + 0.5) * dx
72
+ y = y0 + (np.arange(NY) + 0.5) * dy # dy is negative for north-up
73
+
74
+ # GeoTransform attribute on spatial_ref — pixel edge
75
+ "GeoTransform": f"{x0} {dx} 0 {y0} 0 {dy}"
76
+
77
+ # bbox (pixel edge): [x0, y0 + NY*dy, x0 + NX*dx, y0] # for north-up dy<0
78
+ ```
79
+
80
+ If your coords are off by half a pixel after a round-trip, this is almost always the bug.
81
+
82
+ ## Zarr v2 vs v3 dimension declaration
83
+
84
+ | What | v2 | v3 |
85
+ |---|---|---|
86
+ | Dimension names | `_ARRAY_DIMENSIONS` in `.zattrs` | `dimension_names` field in `zarr.json` |
87
+ | Consolidated metadata | `.zmetadata` | `zarr.json` blocks merged into root |
88
+ | Sharding | n/a | first-class |
89
+
90
+ Recent xarray handles both. Check the installed GDAL version before promising a specific v3, Kerchunk, multiscale, or `SPATIAL_PROJ` behavior.
91
+
92
+ ## Optional layered conventions
93
+
94
+ These are independent. Adopt only the layers needed by the target readers. They may be identified in root attrs by a `zarr_conventions` array of `{uuid, name, spec_url, schema_url}` entries.
95
+
96
+ ### `proj:` (geo-proj v1)
97
+
98
+ CRS info as root attrs alongside CF grid_mapping:
99
+
100
+ ```json
101
+ {
102
+ "proj:code": "EPSG:4326",
103
+ "proj:wkt2": "...",
104
+ "proj:projjson": { ... }
105
+ }
106
+ ```
107
+
108
+ ### `spatial:` (zarr-conventions/spatial v1)
109
+
110
+ Compact affine + bbox at the root, redundant with grid_mapping but easier to read:
111
+
112
+ ```json
113
+ {
114
+ "spatial:dimensions": ["y", "x"],
115
+ "spatial:transform": [dx, 0, x0, 0, dy, y0],
116
+ "spatial:transform_type": "affine",
117
+ "spatial:bbox": [xmin, ymin, xmax, ymax],
118
+ "spatial:shape": [NY, NX],
119
+ "spatial:registration": "pixel"
120
+ }
121
+ ```
122
+
123
+ ### Multiscales / pyramids
124
+
125
+ For multi-resolution overviews, a parent group holds child groups (`0`, `1`, `2`, …) at successive halvings. Root attrs:
126
+
127
+ ```json
128
+ {
129
+ "multiscales": [{
130
+ "tile_matrix_set": "WebMercatorQuad",
131
+ "resampling_method": "average",
132
+ "datasets": [
133
+ {"path": "0"},
134
+ {"path": "1"},
135
+ {"path": "2"}
136
+ ]
137
+ }]
138
+ }
139
+ ```
140
+
141
+ `tile_matrix_set` may be an OGC TMS identifier, a URI, or inline JSON. Resampling: `nearest`, `average`, `bilinear`, `cubic`, `lanczos`, `mode`.
142
+
143
+ ## Authoring from xarray/rioxarray
144
+
145
+ ```python
146
+ import rioxarray # noqa: F401 — registers .rio
147
+ import xarray as xr
148
+
149
+ da = xr.open_dataset("input.tif").band_data # already has CRS via rio
150
+ ds = da.to_dataset(name="reflectance")
151
+ ds.attrs["Conventions"] = "CF-1.8"
152
+ ds.rio.write_crs("EPSG:4326", inplace=True) # writes spatial_ref
153
+ ds.rio.write_coordinate_system(inplace=True) # writes axis/standard_name
154
+ ds.rio.write_transform(inplace=True) # writes GeoTransform on spatial_ref
155
+ ds.to_zarr("out.zarr", mode="w", zarr_format=3, consolidated=True)
156
+ ```
157
+
158
+ Verify: `xr.open_zarr("out.zarr").reflectance.rio.crs` should be non-None.
159
+
160
+ ## Patching an existing store in place
161
+
162
+ When you cannot or should not rewrite chunks, patch metadata only. The pattern:
163
+
164
+ 1. Open the root group `r+`.
165
+ 2. Create 1D `x`/`y` coord arrays sized `(NX,)` / `(NY,)`, single-chunk, float64. Fill from the GeoTransform with the cell-center +0.5 offset. Set `standard_name` / `units` / `axis` on each.
166
+ 3. On data arrays, set `grid_mapping = "spatial_ref"` and `coordinates = "spatial_ref"` (so plain `xr.open_zarr` without `decode_coords="all"` promotes it to a scalar coord). If GDAL is a target reader, also set the array-level `_CRS` attr (see gotchas below).
167
+ 4. Ensure every array declares its dimensions. **Zarr v3: zarr-python has no API to set `dimension_names` on an existing array** — edit each array's `zarr.json` document directly:
168
+
169
+ ```python
170
+ for name, dims in {"data_var": ["y", "x"], "x": ["x"], "y": ["y"]}.items():
171
+ doc = store_path / name / "zarr.json"
172
+ meta = json.loads(doc.read_text())
173
+ meta["dimension_names"] = dims
174
+ doc.write_text(json.dumps(meta))
175
+ ```
176
+
177
+ (Zarr v2: just set `_ARRAY_DIMENSIONS` in `.zattrs` via `arr.attrs`.)
178
+ 5. On root, set `Conventions = "CF-1.8"`.
179
+ 6. Re-run `zarr.consolidate_metadata(store_path)` **as the last step, after any direct `zarr.json` edits** — consolidated metadata shadows per-array documents on read, so stale consolidation silently undoes the patch. On Zarr v3 this emits `ZarrUserWarning: Consolidated metadata is currently not part in the Zarr format 3 specification` — expected, not an error.
180
+
181
+ Total bytes written are usually small compared with the data chunks; the coordinate arrays dominate. Dry-run/apply separation matters for published or shared stores; for a scratch copy, an assert-guarded single-pass patch script is fine.
182
+
183
+ A re-runnable additive patch is safe; the predicate to skip is "child arrays already exist with the right shape and attrs."
184
+
185
+ ## Common gotchas
186
+
187
+ - **`rio.crs` is None on read.** Almost always one of: missing `grid_mapping` on the data var, missing `crs_wkt` on `spatial_ref`, or `dimension_names` not set so xarray can't find the spatial axes.
188
+ - **Coords half a pixel off.** Cell-center vs pixel-edge confusion. See above.
189
+ - **GDAL sees the array but no CRS.** The classic GDAL Zarr driver does **not** read CF `grid_mapping` — it reads a `_CRS` attribute on the data array itself: `"_CRS": {"wkt": "<WKT2>", "projjson": {...}}`. Add it alongside `grid_mapping` whenever GDAL must open the store (GDAL ≥ 3.13 can alternatively read root `spatial:`/`proj:` attrs). rioxarray reads CF `grid_mapping`/`crs_wkt`. Patch all readers you target; know which key serves which reader.
190
+ - **GDAL reports NoData you never set.** The Zarr array's codec-level `fill_value` (in `zarr.json`/`.zarray`) surfaces as GDAL's NoData. If 0.0 is a valid data value, author with a distinct fill (e.g. NaN for float) — this is baked in at creation and is not a metadata-only fix.
191
+ - **xarray promotes `spatial_ref` to a data var instead of a scalar coord.** Add `coordinates: "spatial_ref"` to the data var's attrs, OR set `decode_coords="all"` on open. Pick one — both is fine in CF but doubly-listing can confuse readers.
192
+ - **virtualizarr-built reference store has no `Conventions`.** virtualizarr emits geometry but not CF metadata. You must add it post-hoc.
193
+ - **Negative `dy` flipped to positive.** North-up data has `dy < 0`. If you sort coords ascending you reverse the array. Keep `y` descending for north-up.
194
+ - **Cloud/object-store paths differ by library.** S3, GCS, Azure, HTTPS, fsspec, obstore, and GDAL VSI paths use different URL forms. Verify the reader's expected path syntax instead of rewriting paths blindly.
195
+
196
+ ## Validation
197
+
198
+ Which reader needs which keys — patch only the rows for your target readers:
199
+
200
+ | Target reader | Reads |
201
+ |---|---|
202
+ | rioxarray / xarray | `grid_mapping` + `crs_wkt` on `spatial_ref`, `dimension_names`/`_ARRAY_DIMENSIONS`, `coordinates` attr or `decode_coords="all"` |
203
+ | GDAL Zarr driver (classic, all versions) | array-level `_CRS` attr; geotransform inferred from regular 1D dim arrays (requires `dimension_names`) |
204
+ | GDAL ≥ 3.13 spatial layer | root `spatial:` / `proj:` attrs |
205
+
206
+ When the Python env is spun up per-invocation (uv/pipx/conda run), heavy geo imports dominate wall time — fold patch and verification into **one** script: patch, then in the same process `xr.open_zarr(...)`, assert `da.rio.crs` is not None, and print crs/transform/bounds; follow with `gdalinfo` (no Python needed) as the second, independent check. Pre-checks (e.g. the cell-center assertion) belong inside the same patch script as a guard, not a separate run.
207
+
208
+ ```bash
209
+ # Round-trip CRS through rioxarray
210
+ python -c "import xarray as xr, rioxarray; print(xr.open_zarr('store.zarr').data_var.rio.crs)"
211
+
212
+ # GDAL view
213
+ gdalinfo 'ZARR:"store.zarr":/data_var'
214
+
215
+ # Inspect a remote or local Zarr root
216
+ python -c "
217
+ import zarr
218
+ g = zarr.open_group('store.zarr', mode='r')
219
+ print(dict(g.attrs)); print(list(g))
220
+ "
221
+ ```
222
+
223
+ A draft validator is tracked under [zarr-developers/geozarr-spec issues](https://github.com/zarr-developers/geozarr-spec/issues). Until it lands, the GDAL + rioxarray round-trip is the de facto conformance check.
224
+
225
+ ## Tooling matrix
226
+
227
+ | Need | Tool |
228
+ |---|---|
229
+ | Author from raster | `rioxarray` + `xr.to_zarr` |
230
+ | Virtual reference store over COGs/NetCDFs | `virtualizarr` ≥ 2.5, `icechunk` |
231
+ | Remote object IO | `obstore`, `obspec-utils` |
232
+ | Read GeoZarr as raster | `rioxarray`, QGIS via GDAL, and GDAL versions that support the chosen Zarr/convention layer |
233
+ | Tile / pyramid generation | `ndpyramid`, `xarray-multiscale` |
234
+ | Visual inspect | [Earthmover Arraylake](https://earthmover.io), `xarray` repr in Jupyter |
235
+
236
+ ## References
237
+
238
+ - [GeoZarr spec repo](https://github.com/zarr-developers/geozarr-spec)
239
+ - [GeoZarr.org](https://geozarr.org)
240
+ - [OGC GeoZarr SWG announcement](https://www.ogc.org/announcement/ogc-forms-new-geozarr-standards-working-group-to-establish-a-zarr-encoding-for-geospatial-data/)
241
+ - [zarr-conventions framework](https://github.com/zarr-conventions)
242
+ - [zarr-experimental/geo-proj](https://github.com/zarr-experimental/geo-proj)
243
+ - [CF-1.8 conventions](https://cfconventions.org/cf-conventions/cf-conventions.html)
244
+ - [EOPF Sentinel Zarr Explorer](https://explorer.eopf.copernicus.eu/software-services/datamodel/) — large-scale GeoZarr deployment example
@@ -0,0 +1,21 @@
1
+ # Upstream Attribution
2
+
3
+ This skill is derived from the `geozarr` skill in `isaaccorley/geospatial-skills`.
4
+
5
+ - **Upstream repository:** https://github.com/isaaccorley/geospatial-skills
6
+ - **Upstream path:** `skills/geozarr/`
7
+ - **License:** Apache-2.0 (see [third_party/isaaccorley-geospatial-skills/LICENSE](../../third_party/isaaccorley-geospatial-skills/LICENSE))
8
+ - **Imported commit:** `a203446cb997cd1dbf054918b1021a6040b69824`
9
+ - **Import date:** 2026-08-25
10
+ - **Local path:** `skills/geozarr/`
11
+
12
+ ## Imported Files
13
+
14
+ - `SKILL.md`
15
+
16
+ ## Local modifications
17
+
18
+ Initial import:
19
+ - Local behavioral modifications: none (faithful vendoring, byte-for-byte identical to upstream).
20
+
21
+ Any future AgentLayer modifications must be documented here.
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "geozarr",
3
+ "layer": "domain",
4
+ "domains": [
5
+ "geospatial",
6
+ "data"
7
+ ],
8
+ "capabilities": [
9
+ "geozarr",
10
+ "zarr-multidim",
11
+ "cloud-native-raster"
12
+ ],
13
+ "triggers": [
14
+ "geozarr",
15
+ "zarr",
16
+ "multidimensional raster",
17
+ "climate grid",
18
+ "xarray zarr"
19
+ ],
20
+ "recommended": [
21
+ "verification"
22
+ ],
23
+ "requires": [],
24
+ "conflicts": [],
25
+ "explanation": "Handles multidimensional geospatial raster arrays and GeoZarr conventions.",
26
+ "sections": [
27
+ {
28
+ "id": "how-to-use-this-skill",
29
+ "title": "How to use this skill",
30
+ "source": "SKILL.md#how-to-use-this-skill"
31
+ },
32
+ {
33
+ "id": "status-and-version-guidance",
34
+ "title": "Status and version guidance",
35
+ "source": "SKILL.md#status-and-version-guidance"
36
+ },
37
+ {
38
+ "id": "when-to-use-this-skill",
39
+ "title": "When to use this skill",
40
+ "source": "SKILL.md#when-to-use-this-skill"
41
+ },
42
+ {
43
+ "id": "the-compliance-checklist",
44
+ "title": "The compliance checklist",
45
+ "source": "SKILL.md#the-compliance-checklist"
46
+ },
47
+ {
48
+ "id": "cell-center-vs-pixel-edge",
49
+ "title": "Cell-center vs pixel-edge",
50
+ "source": "SKILL.md#cell-center-vs-pixel-edge"
51
+ },
52
+ {
53
+ "id": "zarr-v2-vs-v3-dimension-declaration",
54
+ "title": "Zarr v2 vs v3 dimension declaration",
55
+ "source": "SKILL.md#zarr-v2-vs-v3-dimension-declaration"
56
+ },
57
+ {
58
+ "id": "optional-layered-conventions",
59
+ "title": "Optional layered conventions",
60
+ "source": "SKILL.md#optional-layered-conventions"
61
+ },
62
+ {
63
+ "id": "authoring-from-xarrayrioxarray",
64
+ "title": "Authoring from xarray/rioxarray",
65
+ "source": "SKILL.md#authoring-from-xarrayrioxarray"
66
+ },
67
+ {
68
+ "id": "patching-an-existing-store-in-place",
69
+ "title": "Patching an existing store in place",
70
+ "source": "SKILL.md#patching-an-existing-store-in-place"
71
+ },
72
+ {
73
+ "id": "common-gotchas",
74
+ "title": "Common gotchas",
75
+ "source": "SKILL.md#common-gotchas"
76
+ },
77
+ {
78
+ "id": "validation",
79
+ "title": "Validation",
80
+ "source": "SKILL.md#validation"
81
+ },
82
+ {
83
+ "id": "tooling-matrix",
84
+ "title": "Tooling matrix",
85
+ "source": "SKILL.md#tooling-matrix"
86
+ },
87
+ {
88
+ "id": "references",
89
+ "title": "References",
90
+ "source": "SKILL.md#references"
91
+ }
92
+ ],
93
+ "checks": [
94
+ "crs.defined",
95
+ "raster.nodata_declared"
96
+ ]
97
+ }