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,222 @@
1
+ ---
2
+ name: raster-processing
3
+ description: Read, transform, align, resample, and write rasters with explicit masks, dtypes, grids, and delivery validation; use for rasterio, rioxarray, or GDAL workflows involving nodata, large datasets, reprojection, categorical data, or Cloud Optimized GeoTIFF output.
4
+ ---
5
+
6
+ # Raster processing
7
+
8
+ ## Inspect the storage and analysis contract
9
+
10
+ Identify CRS, affine transform, dimensions, band meanings, dtype, nodata/masks,
11
+ scale/offset, block layout, and overviews before selecting an operation. A file
12
+ extension or band position does not establish scientific meaning.
13
+
14
+ ```python
15
+ import rasterio
16
+
17
+ with rasterio.open("input.tif") as src:
18
+ print(src.crs, src.transform, src.shape, src.count)
19
+ print(src.dtypes, src.nodatavals, src.scales, src.offsets)
20
+ print(src.descriptions, src.block_shapes, src.mask_flag_enums)
21
+ ```
22
+
23
+ Rasterio band indices are one-based [S1]. `read()` returns stored values; do not
24
+ assume it applied scale/offset metadata. Choose raw or physical values explicitly.
25
+ For satellite calibration use [satellite preprocessing](../satellite-preprocessing/SKILL.md).
26
+ For general commands use [GDAL](../gdal/SKILL.md), not another full recipe catalog.
27
+ Shared rules: [engineering](../../instructions/engineering.md),
28
+ [simplicity](../../instructions/simplicity.md), [security](../../instructions/security.md).
29
+
30
+ ## Distinguish nodata values, masks, and valid zero
31
+
32
+ Nodata means missing/invalid, not numerically zero. A valid zero can represent
33
+ no rainfall, sea-level elevation, or an index value. Inspect per-band masks,
34
+ alpha/internal masks, and nodata metadata; a mask can override nodata-derived
35
+ validity. Multi-band calculations normally require the intersection of validity
36
+ across required bands, not the union.
37
+
38
+ GDAL-style masks use zero for invalid and nonzero (usually 255) for valid pixels;
39
+ NumPy masked-array masks use `True` for invalid pixels [S2]. Do not invert twice.
40
+
41
+ ```python
42
+ import numpy as np
43
+ import rasterio
44
+
45
+ with rasterio.open("input.tif") as src:
46
+ band = src.read(1, masked=True).astype("float32")
47
+ values = band.filled(np.nan)
48
+ valid = ~np.ma.getmaskarray(band) & np.isfinite(values)
49
+ ```
50
+
51
+ When writing, use a representable sentinel outside the valid domain, an explicit
52
+ mask, or floating NaN with declared nodata as appropriate for downstream readers.
53
+ Changing the nodata label does not replace existing pixels. Reopen and compare
54
+ valid-pixel counts and the spatial mask, not just the metadata. Never fill missing
55
+ pixels with zero merely to simplify arithmetic.
56
+
57
+ ## Avoid dtype overflow and stale scale metadata
58
+
59
+ Cast integer operands to a sufficient signed/float type **before** subtraction,
60
+ multiplication, division, or calibration. Unsigned subtraction can wrap; integer
61
+ output can truncate continuous results. Check finite extrema before conversion
62
+ with `numpy.iinfo`/`numpy.finfo`; decide rounding and nodata representability.
63
+ Compression is not a substitute for preserving numeric precision.
64
+
65
+ When physical values have been materialized, write identity scale/offset metadata
66
+ rather than retaining the original calibration. If values remain encoded, keep
67
+ and test the encoding on a round trip. Build an output profile intentionally:
68
+ a copied profile can preserve inappropriate dtype, band count, dimensions, nodata,
69
+ photometric settings, or blocks after an operation.
70
+
71
+ ## Match a complete grid, not just resolution
72
+
73
+ A pixelwise calculation requires matching CRS, transform, width and height, and
74
+ compatible pixel interpretation. Equal resolution alone does not rule out a
75
+ half-pixel shift. A grid-lattice match with different extents is not an array-shape
76
+ match; explicitly choose intersection, union, or a reference raster's extent.
77
+
78
+ For north-up rasters, GDAL `-tap` aligns extent boundaries to multiples of `-tr`
79
+ in target CRS units [S3]. It does **not** guarantee alignment to an arbitrary
80
+ reference raster with a different origin. For exact reference matching, use the
81
+ reference CRS, transform and shape rather than independently calculating a new
82
+ grid for every band. This small continuous-data example handles one band:
83
+
84
+ ```python
85
+ import numpy as np
86
+ import rasterio
87
+ from rasterio.enums import Resampling
88
+ from rasterio.warp import reproject
89
+
90
+ with rasterio.open("reference.tif") as ref, rasterio.open("source.tif") as src:
91
+ if ref.crs is None or src.crs is None:
92
+ raise ValueError("Both grids need known CRSs")
93
+ source = src.read(1, masked=True).astype("float32").filled(np.nan)
94
+ target = np.full(ref.shape, np.nan, dtype="float32")
95
+ reproject(
96
+ source=source, destination=target,
97
+ src_transform=src.transform, src_crs=src.crs, src_nodata=np.nan,
98
+ dst_transform=ref.transform, dst_crs=ref.crs, dst_nodata=np.nan,
99
+ resampling=Resampling.bilinear,
100
+ )
101
+ with rasterio.open(
102
+ "aligned.tif", "w", driver="GTiff", count=1, dtype="float32",
103
+ width=ref.width, height=ref.height, transform=ref.transform,
104
+ crs=ref.crs, nodata=np.nan,
105
+ ) as dst:
106
+ dst.write(target, 1)
107
+ ```
108
+
109
+ This uses stored source values and is an in-memory example, not a calibration or
110
+ large-scene recipe. For rotated grids, compare all affine coefficients yourself;
111
+ the current Terraproof alignment check is not a full rotated-grid validator.
112
+
113
+ ## Select resampling from the data meaning
114
+
115
+ | Data | Suitable starting choice | What to verify |
116
+ |---|---|---|
117
+ | Categorical classes, SCL, bit-packed QA | Nearest; mode for majority-class aggregation | Codes stay in the permitted set; mode must not be used to decode/recombine QA bits |
118
+ | Continuous reflectance/elevation | Bilinear or cubic for interpolation | Cubic may overshoot; inspect range and nodata-edge behavior |
119
+ | Continuous data aggregated to coarser cells | Average when a weighted mean is appropriate | A mean is not a conserved sum or a new independent observation |
120
+
121
+ GDAL warp uses `-r near`; Rasterio and Terraproof call it `nearest` [S3, S4].
122
+ Mode selects a modal value; it does not preserve minority classes or class area.
123
+ Use the same semantic choice for overviews as for the main product. Never blend
124
+ land-cover codes with bilinear/cubic/average. QA flags are bit fields, not
125
+ continuous values. Reprojection and aggregation are scientific choices, not
126
+ just file-format changes.
127
+
128
+ ## Process windows or lazy chunks
129
+
130
+ Rasterio reads whole underlying blocks even for small windows [S5]. Iterate
131
+ `src.block_windows(1)` and write each result to the same output window when grids
132
+ match. For a cropped output, update its transform with `src.window_transform()`.
133
+ Ensure the array shape equals the write-window shape to avoid unintended
134
+ resampling/decimation. Neighborhood filters need halos around chunks.
135
+
136
+ For a labelled, chunked array with rioxarray and Dask installed [S6]:
137
+
138
+ ```python
139
+ import rioxarray
140
+
141
+ with rioxarray.open_rasterio(
142
+ "input.tif", chunks="auto", mask_and_scale=True
143
+ ) as data:
144
+ subset = data.isel(band=slice(0, 1))
145
+ subset.rio.to_raster("subset.tif", driver="GTiff", windowed=True)
146
+ ```
147
+
148
+ `mask_and_scale=True` decodes **available raster metadata**, not an arbitrary
149
+ sidecar calibration that the driver did not expose. Do not apply those same
150
+ scale/offset values again. Chunked reads do not guarantee a lazy reprojection or
151
+ bounded-memory write: rioxarray documents that `windowed` has no effect with
152
+ Dask. Test the execution path and memory use; use windowed rasterio/GDAL warping
153
+ when a full-scene operation would otherwise materialize the array.
154
+
155
+ ## Create and validate a COG with overviews
156
+
157
+ Finish analysis first, then create a COG as a delivery step. Choose lossless
158
+ compression for scientific values. Regenerate overviews if existing ones have
159
+ unknown or incorrect resampling [S7]. For a continuous raster:
160
+
161
+ ```bash
162
+ gdal_translate -of COG -co COMPRESS=DEFLATE -co OVERVIEWS=IGNORE_EXISTING -co RESAMPLING=AVERAGE analysis.tif delivery.tif
163
+ gdalinfo delivery.tif
164
+ ```
165
+
166
+ For categorical rasters change `RESAMPLING=AVERAGE` to `RESAMPLING=NEAREST`.
167
+ The COG driver generates appropriate overview levels; very small rasters may not
168
+ need any. Inspect overview presence and values for your delivery contract. For large
169
+ compressed COG output, plan `BIGTIFF` and temporary disk capacity before running:
170
+ set the BIGTIFF option explicitly where the output may exceed classic TIFF limits,
171
+ and confirm free space for both the output and intermediate files.
172
+ Do not add overviews or edit pixels in-place after COG creation; regenerate the
173
+ COG, since updates can break optimized byte ordering.
174
+
175
+ A complete layout validation is separate from `gdalinfo`. With GDAL 3.13 or newer
176
+ and its Python bindings available [S8]:
177
+
178
+ ```bash
179
+ gdal driver cog validate --full-check yes delivery.tif
180
+ ```
181
+
182
+ For earlier environments use the COG validation workflow in
183
+ [GDAL](../gdal/SKILL.md#workflow). Read validator warnings as well as exit status.
184
+ Reopen and compare CRS, transform, mask, dtype and representative pixel values
185
+ against the analysis output; layout validity alone proves no scientific result.
186
+
187
+ ## Verify with Terraproof
188
+
189
+ Use an installed Python core and actual local paths:
190
+
191
+ ```bash
192
+ python -m terraproof check classes.tif --categorical --resampling nearest
193
+ python -m terraproof check reference.tif aligned.tif --format md --lang en --out alignment-report.md
194
+ python -m terraproof check delivery.tif
195
+ ```
196
+
197
+ `raster.nodata_declared` warns when a band lacks a nodata value, including cases
198
+ where a valid mask-only product may be intentional. `raster.resampling` checks
199
+ only the method you declared with `--categorical --resampling`; it does not
200
+ recover the processing history. `raster.grid_alignment` compares CRS, pixel
201
+ sizes and grid origins for multiple positional rasters, **not** equal dimensions,
202
+ extents, full affine rotation, or successful co-registration.
203
+
204
+ `raster.cog_layout` is only a tiling-plus-overviews heuristic on GeoTIFFs, not
205
+ full COG byte-layout validation. It warns on striped layout, and on missing overviews
206
+ only when the raster is larger than one block; a small tiled raster without
207
+ overviews passes.
208
+ `crs.defined` and `crs.consistent` cover CRS metadata. Mask correctness, dtype
209
+ overflow, conservation of quantities, overview resampling history, and peak
210
+ memory use are **not checked automatically yet**. See
211
+ [verification](../verification/SKILL.md).
212
+
213
+ ## Sources
214
+
215
+ - [S1 — Rasterio reading](https://rasterio.readthedocs.io/en/stable/topics/reading.html): one-based band access; [GDAL raster data model](https://gdal.org/en/stable/user/raster_data_model.html): stored values, scale and offset.
216
+ - [S2 — Rasterio masks](https://rasterio.readthedocs.io/en/stable/topics/masks.html): zero/nonzero GDAL mask convention, typical 255 valid value, inverse NumPy masks and mask precedence.
217
+ - [S3 — GDAL gdalwarp](https://gdal.org/en/stable/programs/gdalwarp.html): target-aligned pixels, resolution, resampling and nodata behavior.
218
+ - [S4 — Rasterio resampling](https://rasterio.readthedocs.io/en/stable/topics/resampling.html): continuous-data interpolation and average resampling.
219
+ - [S5 — Rasterio windowed I/O](https://rasterio.readthedocs.io/en/stable/topics/windowed-rw.html): block iteration, window transforms and implicit decimation.
220
+ - [S6 — rioxarray API](https://vylor.github.io/rioxarray/stable/rioxarray.html): chunks, mask_and_scale, rio.to_raster and Dask/windowed limitation.
221
+ - [S7 — GDAL COG driver](https://gdal.org/en/stable/drivers/raster/cog.html): overview generation, resampling options and update/layout limitations.
222
+ - [S8 — GDAL COG validator](https://gdal.org/en/stable/programs/gdal_driver_cog_validate.html): GDAL 3.13 introduction, Python-binding requirement and full-check option.
@@ -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,81 @@
1
+ {
2
+ "name": "raster-processing",
3
+ "layer": "domain",
4
+ "domains": [
5
+ "geospatial"
6
+ ],
7
+ "capabilities": [
8
+ "raster-grid-alignment",
9
+ "nodata-handling",
10
+ "categorical-resampling",
11
+ "raster-delivery"
12
+ ],
13
+ "triggers": [
14
+ "rasterio",
15
+ "rioxarray",
16
+ "nodata",
17
+ "resampling",
18
+ "target aligned pixels",
19
+ "land-cover raster",
20
+ "class values"
21
+ ],
22
+ "recommended": [],
23
+ "requires": [],
24
+ "conflicts": [],
25
+ "explanation": "Reads, aligns, resamples, and writes rasters with explicit nodata, masks, dtypes, and COG delivery checks.",
26
+ "sections": [
27
+ {
28
+ "id": "inspect-the-storage-and-analysis-contract",
29
+ "title": "Inspect the storage and analysis contract",
30
+ "source": "SKILL.md#inspect-the-storage-and-analysis-contract"
31
+ },
32
+ {
33
+ "id": "distinguish-nodata-values-masks-and-valid-zero",
34
+ "title": "Distinguish nodata values, masks, and valid zero",
35
+ "source": "SKILL.md#distinguish-nodata-values-masks-and-valid-zero"
36
+ },
37
+ {
38
+ "id": "avoid-dtype-overflow-and-stale-scale-metadata",
39
+ "title": "Avoid dtype overflow and stale scale metadata",
40
+ "source": "SKILL.md#avoid-dtype-overflow-and-stale-scale-metadata"
41
+ },
42
+ {
43
+ "id": "match-a-complete-grid-not-just-resolution",
44
+ "title": "Match a complete grid, not just resolution",
45
+ "source": "SKILL.md#match-a-complete-grid-not-just-resolution"
46
+ },
47
+ {
48
+ "id": "select-resampling-from-the-data-meaning",
49
+ "title": "Select resampling from the data meaning",
50
+ "source": "SKILL.md#select-resampling-from-the-data-meaning"
51
+ },
52
+ {
53
+ "id": "process-windows-or-lazy-chunks",
54
+ "title": "Process windows or lazy chunks",
55
+ "source": "SKILL.md#process-windows-or-lazy-chunks"
56
+ },
57
+ {
58
+ "id": "create-and-validate-a-cog-with-overviews",
59
+ "title": "Create and validate a COG with overviews",
60
+ "source": "SKILL.md#create-and-validate-a-cog-with-overviews"
61
+ },
62
+ {
63
+ "id": "verify-with-terraproof",
64
+ "title": "Verify with Terraproof",
65
+ "source": "SKILL.md#verify-with-terraproof"
66
+ },
67
+ {
68
+ "id": "sources",
69
+ "title": "Sources",
70
+ "source": "SKILL.md#sources"
71
+ }
72
+ ],
73
+ "checks": [
74
+ "raster.nodata_declared",
75
+ "raster.resampling",
76
+ "raster.grid_alignment",
77
+ "raster.cog_layout",
78
+ "crs.defined",
79
+ "crs.consistent"
80
+ ]
81
+ }
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: sar-basics
3
+ description: Work correctly with Sentinel-1 C-band SAR backscatter, covering GRD versus SLC products, calibration to sigma0/gamma0/beta0 from the product LUTs, linear power versus decibels, speckle and filtering trade-offs, terrain correction and geocoding, VV/VH polarisations and incidence-angle effects; use before SAR water, flood or change mapping or any statistics on Sentinel-1 backscatter.
4
+ license: MIT
5
+ ---
6
+
7
+ # SAR basics (Sentinel-1)
8
+
9
+ ## Identify the product before using pixel values
10
+
11
+ Sentinel-1 is a C-band SAR (centre frequency 5.405 GHz, wavelength ~5.55 cm) with
12
+ four exclusive modes: Stripmap (SM), Interferometric Wide swath (IW), Extra Wide
13
+ swath (EW) and Wave (WV). IW (250 km swath, incidence 29.1°–46.0°, VV+VH over
14
+ land) is the primary mode over land [S1]. Level-1 products are [S2, S3]:
15
+
16
+ | Product | Geometry | Pixel values | Use |
17
+ |---|---|---|---|
18
+ | SLC (Single Look Complex) | slant range, zero-Doppler; IW/EW per sub-swath, bursts separated by black-fill | complex I/Q, phase preserved, single look | interferometry, polarimetry, custom multilooking |
19
+ | GRD (Ground Range Detected) | detected, multi-looked, projected to ground range on the WGS84 ellipsoid | detected amplitude; phase lost | backscatter mapping and change |
20
+
21
+ The GRD ellipsoid projection uses a terrain height that varies in azimuth but is
22
+ constant in range [S3]: a GRD is **not terrain corrected**. IW GRD High resolution
23
+ has ~20 × 22 m resolution, 10 × 10 m pixel spacing and ENL 4.4 [S2]. Product
24
+ names encode mission, mode, type, resolution class, polarisation (`SV`, `SH`,
25
+ `DV` = VV/VH, `DH` = HH/HV), start/stop time, absolute orbit and datatake [S2].
26
+
27
+ Raw GRD/SLC digital numbers are **not backscatter**. Analysis-ready collections
28
+ may already be calibrated, terrain corrected and/or in dB; for example Google Earth
29
+ Engine `COPERNICUS/S1_GRD` is thermal-noise removed, calibrated, terrain corrected
30
+ and converted with `10*log10(x)`, while `COPERNICUS/S1_GRD_FLOAT` keeps power
31
+ values [S4]. Read the provider's processing description before any arithmetic.
32
+ Find and load products with [STAC and cloud access](../stac-and-cloud-access/SKILL.md).
33
+ Shared rules: [engineering](../../instructions/engineering.md),
34
+ [simplicity](../../instructions/simplicity.md), [security](../../instructions/security.md).
35
+
36
+ ## Calibrate to β⁰, σ⁰ or γ⁰ with the product LUTs
37
+
38
+ Every Level-1 product carries calibration LUTs (`betaNought`, `sigmaNought`,
39
+ `gamma`, `dn`) in `annotation/calibration/`. For distributed targets [S5]:
40
+
41
+ ```text
42
+ σ⁰ = DN² / Aσ² β⁰ = DN² / Aβ² γ⁰ = DN² / Aγ²
43
+ DN = GRD amplitude, or sqrt(I² + Q²) for SLC
44
+ ```
45
+
46
+ LUT values are bilinearly interpolated between their sub-sampled pixel/line
47
+ positions [S3]. β⁰ is normalised in slant range, σ⁰ in the ground-range plane,
48
+ γ⁰ in the plane perpendicular to slant range [S5]. On the annotation's ellipsoid
49
+ model, `σ⁰ = β⁰·sin α`, `γ⁰ = β⁰·tan α`, so `γ⁰ = σ⁰ / cos α` [S5]. A noise LUT
50
+ (linear power) can be scaled by the same LUT and subtracted [S3].
51
+
52
+ GDAL ≥ 3.4 applies calibration for the `SIGMA0`, `BETA0` and `GAMMA` calibration
53
+ subdatasets of the SAFE driver; list them with `gdalinfo` on the `.SAFE`
54
+ directory [S6]. Interpolation code, the noise step and ESA's numerical check
55
+ (`<DN²> = 22142.71`, `Aσ = 319.946` → −6.65 dB) are in
56
+ [references/calibration-lut.md](references/calibration-lut.md).
57
+
58
+ ## Keep linear power for arithmetic, dB for display and thresholds
59
+
60
+ The LUTs give natural (linear power) values; decibels are [S5]:
61
+
62
+ ```text
63
+ σ⁰_dB = 10 * log10(σ⁰_lin) σ⁰_lin = 10 ** (σ⁰_dB / 10)
64
+ amplitude = sqrt(power)
65
+ ```
66
+
67
+ **Average in linear power, not in dB.** ESA averages intensity (`DN²`) before
68
+ calibrating an area [S5]; ASF notes power scale is appropriate for statistical
69
+ analysis while dB values are not appropriate for some statistics [S7]. Averaging
70
+ dB values computes a geometric mean: −5 dB and −15 dB average to −10 dB in dB but
71
+ to −7.6 dB when averaged in linear power.
72
+
73
+ ```python
74
+ import numpy as np
75
+
76
+ def to_db(power):
77
+ power = np.asarray(power, dtype="float64")
78
+ out = np.full(power.shape, np.nan)
79
+ np.log10(power, out=out, where=power > 0)
80
+ return 10.0 * out # non-positive power stays NaN
81
+
82
+ def mean_db(db_values, axis=None):
83
+ lin = 10.0 ** (np.asarray(db_values, dtype="float64") / 10.0)
84
+ return to_db(np.nanmean(lin, axis=axis))
85
+ ```
86
+
87
+ Label every raster with its quantity and scale (σ⁰ or γ⁰; linear, amplitude or
88
+ dB) in metadata and filenames. Typical confusions: dB data averaged or resampled
89
+ as if linear; dB thresholds applied to linear data; DN treated as σ⁰. Power values
90
+ are generally close to zero (ASF suggests a 0–0.3 display stretch) [S7], so a
91
+ "σ⁰" raster dominated by negative values is in dB and one with values in the
92
+ hundreds or thousands is likely uncalibrated DN. The noise-equivalent σ⁰ is
93
+ specified at −22 dB or better [S1]: values near that level are noise-dominated.
94
+
95
+ ## Speckle: filtering is a trade-off
96
+
97
+ Speckle arises from interference of returns from many scatterers in a resolution
98
+ cell [S7]. Multi-looking reduces speckle at the cost of resolution: IW SLC has
99
+ ENL 1, IW GRDH ENL 4.4 [S2, S3]. Spatial filters (e.g. the local-statistics Lee
100
+ filter [S8]; ASF's optional Enhanced Lee, 7 × 7) smooth speckle but reduce
101
+ resolution [S7]. Temporal averaging (mean or median over dates) also mitigates
102
+ speckle, in which case a spatial filter may be unnecessary [S7].
103
+
104
+ - Choose and record filter type, window and order (before/after terrain
105
+ correction); compare outputs with and without filtering for the task [S7].
106
+ - Filters that average pixel values should run on linear power for the same
107
+ reason dates are averaged in linear power.
108
+ - Filtering blurs edges and small features; it can hide small floods or narrow
109
+ rivers that a change map must report.
110
+
111
+ ## Terrain correction and geocoding
112
+
113
+ GRD/SLC geolocation is provided as a grid of geolocation points; GDAL's SAFE
114
+ driver exposes them as **GCPs** with an empty coordinate system and no
115
+ geotransform [S6]. Warping on GCPs (`gdalwarp` polynomial or thin-plate-spline
116
+ transformers [S9]) is not DEM-based terrain correction. Two different
117
+ corrections exist:
118
+
119
+ - **Geometric terrain correction** (range-Doppler geocoding with a DEM) places
120
+ pixels at the correct map position despite relief [S7].
121
+ - **Radiometric terrain correction (RTC)** normalises backscatter by the
122
+ DEM-derived illuminated area, yielding terrain-flattened γ⁰ [S10, S7].
123
+
124
+ Side-looking geometry causes foreshortening, layover and shadow; in RTC products
125
+ layover/shadow areas carry no valid data and are flagged in a layover-shadow mask
126
+ [S7]. Record the DEM and its vertical datum, output CRS and pixel spacing (a
127
+ resampled DEM does not have finer information) [S7]. Coregistration to the DEM
128
+ can improve RTC but may introduce inconsistent offsets through time; orbit-based
129
+ geocoding gives more consistent alignment for time series [S7]. Use
130
+ [raster processing](../raster-processing/SKILL.md) for grids and resampling.
131
+
132
+ ## Polarisation, water, flood and change
133
+
134
+ Sentinel-1 transmits H or V and receives both (dual pol HH+HV or VV+VH; single
135
+ HH or VV) [S1]. Rough surfaces and complex structures (forest) scatter more
136
+ energy back; flat surfaces reflect it away and appear dark [S1]. Cross-pol (VH)
137
+ is high for volume scatterers such as vegetation [S7, S1].
138
+
139
+ - **Water:** calm open water has very low backscatter and can often be separated
140
+ with a threshold, frequently in dB; there is **no universal threshold** — derive
141
+ it per scene, e.g. from the valley of a bimodal histogram, then refine [S7].
142
+ Wind-roughened water is brighter (roughness raises backscatter [S1]); radar
143
+ shadow and smooth surfaces such as dry sand are also dark [S7]. Validate.
144
+ - **Change/flood:** the log ratio `log10(date2 / date1)` of calibrated,
145
+ co-registered images shows the direction of change (negative = decrease)
146
+ [S7]. Compute ratios on positive linear power. The dB difference is
147
+ `10 * log10(date2 / date1)`, ten times the plain log ratio; record the units
148
+ used by each change threshold.
149
+ Validate change maps with [accuracy assessment](../accuracy-assessment/SKILL.md);
150
+ temporal design is in [time series and change](../time-series-and-change/SKILL.md).
151
+
152
+ ## Incidence angle and acquisition geometry
153
+
154
+ Backscatter depends on incidence angle; ESA's processor applies range-dependent
155
+ gains partly to compensate for its variation [S3], and IW spans 29.1°–46.0° [S1].
156
+ σ⁰ and γ⁰ differ by `cos α`, so their sensitivity to geometry differs [S5, S7].
157
+
158
+ - Build time series from the **same relative orbit** (and orbit direction) when
159
+ comparing dates, or normalise for incidence angle and document how. Relative
160
+ orbit is in the manifest, not in the product name; ESA gives
161
+ `relative = mod(absolute − 73, 175) + 1` for S1A (175 orbits per 12-day cycle;
162
+ other units have their own offsets) [S2]. STAC fields `sat:relative_orbit` and
163
+ `sat:orbit_state` carry it when present [S11].
164
+ - Revisit depends on the constellation: S1B ended in 2022; S1C (launched December
165
+ 2024) and S1D (November 2025) continue the mission [S1]. Expect irregular
166
+ temporal sampling across these periods.
167
+
168
+ ## Verify with Terraproof
169
+
170
+ Existing checks: `crs.defined` and `raster.grid_alignment` (multi-date stacks on
171
+ one grid), `raster.nodata_declared`, `raster.resampling`, `raster.cog_layout`, and
172
+ `stac.provenance` for source Items. The optical `rs.*` range checks do not apply
173
+ to SAR backscatter.
174
+
175
+ ```bash
176
+ python -m terraproof check s1_vv_20240101_db.tif s1_vv_20240113_db.tif --sar-expect sigma0-db
177
+ python -m terraproof check s1-item.json
178
+ ```
179
+
180
+ `--sar-expect sigma0-db` (or `sigma0-linear`) enables `sar.value_domain`
181
+ (sampled values plausible for the declared scale) and `sar.geocoded`
182
+ (CRS/geotransform rather than GCP-only geometry). Plausible values and a
183
+ geotransform do not prove calibration or terrain correction.
184
+
185
+ **Not checked automatically:** that the right LUT was used, noise removal,
186
+ terrain-correction quality and DEM choice, speckle-filter suitability, orbit
187
+ consistency in a time series, and water/change thresholds. Calibration-chain
188
+ verification against annotation metadata is not in scope.
189
+
190
+ ## Sources
191
+
192
+ - [S1 — ESA SentiWiki, S1 Mission](https://sentiwiki.copernicus.eu/web/s1-mission): frequency, modes, IW swath/incidence 29.1°–46.0°, polarisations, primary IW VV+VH over land, NESZ −22 dB, roughness/dielectric behaviour, polarimetry, launch timeline, 12-day/175-orbit cycle.
193
+ - [S2 — ESA SentiWiki, S1 Products](https://sentiwiki.copernicus.eu/web/s1-products): GRD resolution classes and Table 6 (IW GRDH 20×22 m, 10 m spacing, ENL 4.4; SLC ENL 1), naming convention, relative-orbit formulas.
194
+ - [S3 — ESA SentiWiki, S1 Processing](https://sentiwiki.copernicus.eu/web/s1-processing): SLC/GRD definitions, ellipsoid projection with azimuth-varying terrain height, bilinear LUT interpolation, noise LUT, incidence-angle compensating application LUT.
195
+ - [S4 — Google Earth Engine, COPERNICUS/S1_GRD](https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S1_GRD): preprocessing steps, `10*log10(x)`, S1_GRD_FLOAT.
196
+ - [S5 — ESA-EOPG-CSCOP-TN-0002, Radiometric Calibration of S-1 Level-1 Products (Miranda & Meadows 2015)](https://sentiwiki.copernicus.eu/__attachments/a_362015d79d4b31d2ec7bfc41d6edf57727461ab4812ae4fbc7d634df98d3db58/ESA-EOPG-CSCOP-TN-0002%20-%20Sentienl-1%20Radiometric%20Calibration%20of%20Products%202015%20-%201.0.pdf): LUTs, `DN²/A²`, dB, intensity averaging, sin/tan normalisation, `cos α = Aγ²/Aσ²`.
197
+ - [S6 — GDAL SAFE driver](https://gdal.org/en/stable/drivers/raster/safe.html): geolocation grid as GCPs, calibration subdatasets since GDAL 3.4.
198
+ - [S7 — ASF HyP3 Sentinel-1 RTC Product Guide](https://hyp3-docs.asf.alaska.edu/guides/rtc_product_guide/): σ⁰/γ⁰ normalisation, power/amplitude/dB scales and statistics, speckle and Enhanced Lee filter, DEM matching, layover/shadow, log-difference change, water thresholding.
199
+ - [S8 — Lee, J.-S. (1980). Digital image enhancement and noise filtering by use of local statistics. IEEE TPAMI PAMI-2(2):165–168](https://doi.org/10.1109/TPAMI.1980.4766994).
200
+ - [S9 — GDAL gdalwarp](https://gdal.org/en/stable/programs/gdalwarp.html): GCP polynomial order and thin-plate-spline transformer.
201
+ - [S10 — Small, D. (2011). Flattening Gamma: Radiometric Terrain Correction for SAR Imagery. IEEE TGRS 49(8):3081–3093](https://doi.org/10.1109/TGRS.2011.2120616).
202
+ - [S11 — STAC sat extension](https://github.com/stac-extensions/sat): `sat:orbit_state`, `sat:relative_orbit`, `sat:absolute_orbit`.
@@ -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,98 @@
1
+ # Sentinel-1 Level-1 calibration LUTs in practice
2
+
3
+ Reference for [SAR basics](../SKILL.md). Use a maintained processor (ESA SNAP,
4
+ GDAL ≥ 3.4 `SENTINEL1_CALIB` subdatasets, or a provider's analysis-ready backscatter)
5
+ when available; this page documents what those tools do so their output can be
6
+ checked.
7
+
8
+ ## What the product provides
9
+
10
+ Each Level-1 product has, per measurement (swath × polarisation), a calibration
11
+ annotation file in `annotation/calibration/` with four LUTs [S1]:
12
+
13
+ | LUT | XPath in the calibration XML | Converts to |
14
+ |---|---|---|
15
+ | `Aβ` | `/calibration/calibrationVectorList/calibrationVector/betaNought` | β⁰ (normalised in slant range) |
16
+ | `Aσ` | `/calibration/calibrationVectorList/calibrationVector/sigmaNought` | σ⁰ (normalised in the ground-range plane) |
17
+ | `Aγ` | `/calibration/calibrationVectorList/calibrationVector/gamma` | γ⁰ (normalised in the plane perpendicular to slant range) |
18
+ | `Adn` | `/calibration/calibrationVectorList/calibrationVector/dn` | reverts the final product scaling |
19
+
20
+ Each `calibrationVector` has a `line`, an `azimuthTime`, a space-separated `pixel`
21
+ list and the LUT values at those pixels. LUTs are sub-sampled in range and updated
22
+ in azimuth; values for pixels between LUT points are found by **bilinear
23
+ interpolation**, using the vectors nearest in azimuth [S1, S2].
24
+
25
+ Distributed-target calibration, with `DN` the GRD pixel amplitude or, for SLC,
26
+ `sqrt(I² + Q²)` [S1]:
27
+
28
+ ```text
29
+ σ⁰ = DN² / Aσ² β⁰ = DN² / Aβ² γ⁰ = DN² / Aγ² (linear power)
30
+ σ⁰_dB = 10 * log10(σ⁰)
31
+ ```
32
+
33
+ Thermal noise: a noise LUT (linear power) is provided per measurement; it must be
34
+ scaled by the same calibration LUT as the image and is removed by subtraction [S2].
35
+ Algebraically this is `(DN² − η) / A²` with `η` the interpolated noise LUT value.
36
+ Subtraction can give zero or negative power in very dark areas; decide and record
37
+ how such pixels are handled before taking a logarithm.
38
+
39
+ ## Window-wise σ⁰ from a GRD measurement (tested sketch)
40
+
41
+ ```python
42
+ import numpy as np
43
+ import xml.etree.ElementTree as ET
44
+
45
+ def lut_window(calibration_xml, rows, cols, name="sigmaNought"):
46
+ """Bilinear LUT values for 1-D arrays of image rows and columns."""
47
+ root = ET.parse(calibration_xml).getroot() # <calibration>
48
+ vectors = root.findall("calibrationVectorList/calibrationVector")
49
+ lines = np.array([int(v.findtext("line")) for v in vectors])
50
+ along_range = np.vstack([
51
+ np.interp(cols,
52
+ np.array(v.findtext("pixel").split(), dtype=float),
53
+ np.array(v.findtext(name).split(), dtype=float))
54
+ for v in vectors
55
+ ]) # (n_vectors, len(cols))
56
+ idx = np.clip(np.searchsorted(lines, rows), 1, len(lines) - 1)
57
+ l0, l1 = lines[idx - 1], lines[idx]
58
+ t = np.clip((rows - l0) / (l1 - l0), 0.0, 1.0)[:, None]
59
+ return (1 - t) * along_range[idx - 1] + t * along_range[idx]
60
+
61
+ def sigma0_window(dn, calibration_xml, row_off, col_off):
62
+ rows = np.arange(row_off, row_off + dn.shape[0])
63
+ cols = np.arange(col_off, col_off + dn.shape[1])
64
+ a = lut_window(calibration_xml, rows, cols)
65
+ power = dn.astype("float64") ** 2 / a ** 2
66
+ return np.where(dn == 0, np.nan, power) # 0 = no-data border here
67
+ ```
68
+
69
+ Read `dn` with a rasterio window from the measurement GeoTIFF
70
+ (`src.read(1, window=Window(col_off, row_off, width, height))`). Treating DN 0 as
71
+ no-data is a processing choice for the black-fill border described for Level-1
72
+ products [S2]; document it.
73
+
74
+ Check the implementation against ESA's numerical example: average intensity
75
+ `<DN²> = 22142.71` with `Aσ = 319.946` gives `σ⁰_dB = −6.65 dB` [S1]. Average
76
+ `DN²` (intensity), not `DN`, before calibrating an area [S1].
77
+
78
+ ## Relations between β⁰, σ⁰ and γ⁰
79
+
80
+ The calibration annotation uses an ellipsoid (inflated by an average height) as
81
+ Earth model, so with `α` the incidence angle on that model the LUTs differ only by
82
+ the area-normalisation factor `sin α` (σ⁰) or `tan α` (γ⁰) [S1]:
83
+
84
+ ```text
85
+ σ⁰ = β⁰ * sin α γ⁰ = β⁰ * tan α γ⁰ = σ⁰ / cos α cos α = Aγ² / Aσ²
86
+ ```
87
+
88
+ (The first two follow from the LUT definitions; the last is given in [S1].) This
89
+ ellipsoid γ⁰ is **not** terrain-flattened γ⁰: radiometric terrain correction
90
+ replaces the ellipsoid normalisation area with a DEM-derived illuminated area
91
+ [S3, S4].
92
+
93
+ ## Sources
94
+
95
+ - [S1 — Miranda, N., Meadows, P.J. (2015). Radiometric Calibration of S-1 Level-1 Products Generated by the S-1 IPF, ESA-EOPG-CSCOP-TN-0002](https://sentiwiki.copernicus.eu/__attachments/a_362015d79d4b31d2ec7bfc41d6edf57727461ab4812ae4fbc7d634df98d3db58/ESA-EOPG-CSCOP-TN-0002%20-%20Sentienl-1%20Radiometric%20Calibration%20of%20Products%202015%20-%201.0.pdf): LUT definitions and XPaths, `DN²/A²`, dB conversion, intensity averaging, sin/tan normalisation, numerical example.
96
+ - [S2 — ESA SentiWiki, S1 Processing](https://sentiwiki.copernicus.eu/web/s1-processing): bilinear LUT interpolation, noise LUT scaling and subtraction, black-fill, GRD/SLC definitions.
97
+ - [S3 — Small, D. (2011). Flattening Gamma: Radiometric Terrain Correction for SAR Imagery. IEEE TGRS 49(8):3081–3093](https://doi.org/10.1109/TGRS.2011.2120616).
98
+ - [S4 — ASF HyP3 Sentinel-1 RTC Product Guide](https://hyp3-docs.asf.alaska.edu/guides/rtc_product_guide/): RTC normalisation by DEM-based scattering area.