esmailhussien/terraproof/spectral-indices
Claude Code and agent skill by esmailhussien/terraproof
- community
Checking that the SKILL.md file is still in the repository.
Compute and interpret vegetation, water, and burn indices with explicit formulas, sensor band mappings, calibrated reflectance, masks, and numeric safeguards; use for NDVI, McFeeters NDWI, MNDWI, NBR or dNBR, EVI, and SAVI from Sentinel-2 or Landsat 8/9 imagery.
Install
npx vskill@latest install esmailhussien/terraproof/spectral-indicesSKILL.md
The same SKILL.md was published earlier as esmailhussien/terraproof/spectral-indices.
Spectral indices
Require calibrated, aligned inputs
For this skill's quantitative comparison workflows, use cloud/shadow-screened, physical surface reflectance, not raw DN, RGB display values, QA codes, or a mixture of TOA and surface reflectance. Decode scale and additive offset exactly once using satellite preprocessing. A common multiplicative scale cancels in a normalized difference, but an additive offset does not. EVI/SAVI constants also require physical reflectance units.
Verify CRS, complete affine transform, dimensions, extent and validity masks before pairing pixels. Use the intersection of masks for all bands in the formula. Resampling a coarse SWIR band to a finer grid does not create finer information; document the chosen analysis grid and resampling. Resampling reflectance before a nonlinear index is generally not equivalent to resampling the computed index. Use raster processing for I/O, masks and alignment, GDAL for CLI workflows, and geomaster for broader interpretation context. Shared rules: engineering, simplicity, security.
Map spectral roles to the sensor
Use product band identifiers, not positions in an arbitrary raster stack. The following mapping is for Sentinel-2 MSI and Landsat 8/9 OLI, not older Landsat sensors [S1, S2]:
| Spectral role | Sentinel-2 | Landsat 8/9 surface reflectance | |
|---|---|---|---|
Blue (B) | B02 | SR_B2 | |
Green (G) | B03 | SR_B3 | |
Red (R) | B04 | SR_B4 | |
Broad NIR (N) | B08 | SR_B5 (OLI NIR) | |
| Narrow NIR alternative | B8A | No interchangeable extra NIR band | |
SWIR1 (S1) | B11 | SR_B6 | |
SWIR2 (S2) | B12 | SR_B7 |
Sentinel-2 B02/B03/B04/B08 have native 10 m resolution; B8A/B11/B12 have native 20 m resolution [S1]. B08 and B8A have different spectral responses. For Sentinel-2 formulas below, N defaults to B08; if using B8A to match a coarser grid or a harmonized workflow, name that choice and do not mix it across dates as if unchanged. Landsat 8/9 reflective bands here have 30 m resolution [S2]. Do not read src.read(8) to obtain B08 from a single-band B08 file: Rasterio indices address file bands, not sensor band names.
NDVI: vegetation contrast
Use physical, masked red and NIR reflectance on the same grid [S3]:
For nonnegative inputs with nonzero sum, NDVI lies in [-1, 1]. High values indicate stronger NIR/red contrast, not a universal biomass or plant-health measurement. NDVI can saturate in dense vegetation and responds to soil, phenology, water, shadow and atmosphere. Do not apply universal vegetation-class thresholds without local calibration. Negative corrected reflectances can yield ratios outside the nominal interval; investigate rather than silently clipping.
NDWI (McFeeters) versus MNDWI: specify the water index
For open-water contrast, use one named definition and physical reflectance [S4]:
McFeeters NDWI uses Sentinel-2 B03/B08 or Landsat 8/9 SR_B3/SR_B5. MNDWI uses Sentinel-2 B03/B11 or Landsat 8/9 SR_B3/SR_B6. These are not the NIR/SWIR vegetation-moisture index also called NDWI (Gao). ESA SNAP names the McFeeters operator NDWI2; always state the formula rather than trusting an operator name.
Both normalized differences lie in [-1, 1] for nonnegative inputs and nonzero sum. MNDWI substitutes SWIR1 to reduce some built-up-land confusion, not to create an infallible water mask. Turbid/shallow water, shadows, snow, mixed shore pixels and urban surfaces still require validation. Select a local threshold using reference data; do not present either continuous index as measured water depth.
NBR and dNBR: burn-sensitive contrast and change
Use masked, aligned NIR and SWIR2, not SWIR1 [S5]:
For nonnegative reflectances with nonzero sum, NBR lies in [-1, 1]. The unscaled dNBR difference can consequently span [-2, 2] (derived from the two NBR bounds), so it must not be tested as though it were a single normalized index. Record whether a delivered product is scaled; do not compare encoded integer thresholds with unscaled floats.
Positive dNBR commonly indicates decreased NBR after fire, but seasonality, moisture, harvest, land-cover change and cloud remnants also alter NBR. Match prefire/postfire season and processing, retain both-date validity, and validate burn severity with suitable reference observations [S6]. Do not invent universal severity class breaks or treat an index change as causal proof of fire.
EVI and SAVI: additive constants require physical reflectance
Use blue/red/NIR surface reflectance for EVI; use red/NIR for SAVI. The standard USGS coefficients and the USGS SAVI soil adjustment choice are [S7, S8]:
Map B, R, N using the sensor table. Do not put raw DN or reflectance scaled to integer storage into these formulas: the additive constants would be in the wrong units. EVI mitigates some canopy-background/atmospheric effects but is not a substitute for atmospheric correction and QA. Its blue term is sensitive to residual atmospheric problems; USGS warns that Landsat 8/9 SR blue-band retrieval can be unreliable for analysis [S9]. Make that caveat visible when using EVI.
EVI has no universal algebraic [-1, 1] bound: even nonnegative inputs can produce a near-zero denominator and extreme values. USGS delivered EVI products have a specified valid range, but that product contract is not a theorem about every raw formula result [S7]. SAVI with L = 0.5 is bounded by [-1, 1] when both input reflectances are within [0, 1] (derived from its formula); negative or above-unity corrected values invalidate that assumption. Keep exceptions visible. Do not clip EVI/SAVI simply to pass an index-range checker.
Divide safely and write explicit nodata
Cast before arithmetic. A zero denominator is invalid, not index zero. Mask nonfinite inputs and outputs. If near-zero denominators are excluded, select a tolerance from measurement/precision requirements and report it; a universal machine epsilon is not a scientific quality threshold.
Standalone NDVI read/write example for already decoded single-band reflectance files with identity scale/offset (small rasters; use windows for large scenes). The helper above can be used for other formulas:
Metadata identity alone cannot prove physical encoding; that is a prerequisite from the preprocessing record. Preserve valid zero indices and keep masked pixels nodata. Independently check known input pixels and formula values.
Verify with Terraproof
Use an installed Python core and real local data:
rs.reflectance_range is sampled plausibility, not proof of decoded SR. rs.index_range tests a nominal normalized-index interval; it is useful for NDVI/NDWI/MNDWI/NBR under the stated assumptions, not a general validator for dNBR or EVI. The last command intentionally omits --expect index for dNBR. Inspect out-of-range results rather than altering data to satisfy a checker.
raster.nodata_declared, raster.grid_alignment, crs.defined and crs.consistent provide metadata checks. Grid alignment does not establish identical shape/extent or actual co-registration. GeoTIFF inputs may also receive the heuristic raster.cog_layout check.
Formula choice, correct band roles, exact-once calibration, cloud masking, denominator policy, scientific interpretation, and burn/water/vegetation threshold validity are not checked automatically yet. A plausible wrong-band index can pass. See verification.
Sources
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/spectral-indices/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/esmailhussien/terraproof/spectral-indices)