Geoskill: RS Index Calc
Calculate 10 spectral indices from GeoTIFF imagery using pure Python without external dependencies, supporting batch, custom formulas, and auto band detection.
ruiduobao
@ruiduobao
What This Skill Does
Calculates 10 spectral indices (NDVI, NDBI, NDWI, EVI, SAVI, MNDWI, AWEI, NBR, BSI, UI) from GeoTIFF imagery using pure Python with no external dependencies. Supports auto band detection, custom formulas, and batch processing.
Replaces reliance on heavy GIS libraries like GDAL or rasterio for spectral index computation by using only Python's standard library.
When to Use It
- Compute NDVI from a multispectral GeoTIFF to assess vegetation health
- Calculate NDBI for urban area extraction from satellite imagery
- Batch process a GeoTIFF to generate all supported spectral indices at once
- Apply a custom band math formula to a GeoTIFF for a unique index
- Extract water bodies using NDWI or MNDWI from a remote sensing image
- Compute burn severity index (NBR) from pre- and post-fire imagery
Install
$ openclaw skills install @ruiduobao/rs-index-calcRemote Sensing Index Calculator
Calculate spectral indices from GeoTIFF imagery using pure Python. No external dependencies required.
Features
- 10 Supported Indices: NDVI, NDBI, NDWI, EVI, SAVI, MNDWI, AWEI, NBR, BSI, UI
- Pure Python: No rasterio, GDAL, numpy, or scipy required
- Auto Band Detection: Automatically detects band mapping from GeoTIFF metadata
- Custom Formulas: Support for arbitrary band math expressions
- Batch Mode: Calculate all indices at once
- Statistics: Automatic min/max/mean/std computation
Installation
pip install -r requirements.txt
# No external dependencies - uses only Python standard library
Usage
Single Index
python rs-index-calc.py input.tif NDVI
python rs-index-calc.py input.tif NDVI --output ndvi_result.tif
All Indices (Batch Mode)
python rs-index-calc.py input.tif --batch
Custom Formula
python rs-index-calc.py input.tif custom --formula "(B4-B3)/(B4+B3)"
Manual Band Order
python rs-index-calc.py input.tif NDVI --bands red nir green blue swir1 swir2
Supported Indices
| Index | Formula | Bands |
|---|---|---|
| NDVI | (NIR - Red) / (NIR + Red) | NIR, Red |
| NDBI | (SWIR - NIR) / (SWIR + NIR) | SWIR, NIR |
| NDWI | (Green - NIR) / (Green + NIR) | Green, NIR |
| EVI | 2.5 * (NIR - Red) / (NIR + 6Red - 7.5Blue + 1) | NIR, Red, Blue |
| SAVI | (NIR - Red) / (NIR + Red + 0.5) * 1.5 | NIR, Red |
| MNDWI | (Green - SWIR) / (Green + SWIR) | Green, SWIR |
| AWEI | 4*(Green-SWIR) - (0.25NIR + 2.75SWIR) | Green, SWIR, NIR |
| NBR | (NIR - SWIR2) / (NIR + SWIR2) | NIR, SWIR2 |
| BSI | ((SWIR+Red)-(NIR+Blue)) / ((SWIR+Red)+(NIR+Blue)) | SWIR, Red, NIR, Blue |
| UI | (SWIR2 - NIR) / (SWIR2 + NIR) | SWIR2, NIR |
Output
- Single-band GeoTIFF with calculated index values
- Statistics printed to stdout (min, max, mean, std, pixel count)
Testing
pytest
License
MIT-0 (No Attribution)
中文说明
从 GeoTIFF 影像计算光谱指数,纯 Python 实现,无需任何外部依赖。
支持的指数(10 种)
| 指数 | 公式 | 波段 |
|---|---|---|
| NDVI | (NIR - Red) / (NIR + Red) | NIR, Red |
| NDBI | (SWIR - NIR) / (SWIR + NIR) | SWIR, NIR |
| NDWI | (Green - NIR) / (Green + NIR) | Green, NIR |
| EVI | 2.5 * (NIR - Red) / (NIR + 6Red - 7.5Blue + 1) | NIR, Red, Blue |
| SAVI | (NIR - Red) / (NIR + Red + 0.5) * 1.5 | NIR, Red |
| MNDWI | (Green - SWIR) / (Green + SWIR) | Green, SWIR |
| AWEI | 4*(Green-SWIR) - (0.25NIR + 2.75SWIR) | Green, SWIR, NIR |
| NBR | (NIR - SWIR2) / (NIR + SWIR2) | NIR, SWIR2 |
| BSI | ((SWIR+Red)-(NIR+Blue)) / ((SWIR+Red)+(NIR+Blue)) | SWIR, Red, NIR, Blue |
| UI | (SWIR2 - NIR) / (SWIR2 + NIR) | SWIR2, NIR |
使用方法
# 计算单个指数
python rs-index-calc.py input.tif NDVI
python rs-index-calc.py input.tif NDVI --output ndvi_result.tif
# 批量计算所有指数
python rs-index-calc.py input.tif --batch
# 自定义公式
python rs-index-calc.py input.tif custom --formula "(B4-B3)/(B4+B3)"
# 手动指定波段顺序
python rs-index-calc.py input.tif NDVI --bands red nir green blue swir1 swir2
输出
- 单波段 GeoTIFF,值为指数计算结果
- 自动输出统计信息(最小值、最大值、均值、标准差、像元数)
Top skills in this category
Humanizer
@biostartechnologyRemove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.
Free Ride - Unlimited free AI
@shaivpidadiManages free AI models from OpenRouter for OpenClaw. Automatically ranks models by quality, configures fallbacks for rate-limit handling, and updates opencla...
Elite Longterm Memory
@nextfrontierbuildsUltimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Playwright (Automation + MCP + Scraper)
@ivangdavilaAutomates, tests, and debugs browsers with Playwright: locators, auto-waiting, traces, CI runs, and MCP browser control. Use when a test is flaky, times out, or fails only in CI or headless; when a locator matches multiple elements or the wrong one (strict mode violation); when clicks need force, waits become sleeps, or networkidle never settles; for storageState and login setup, request mocking and HAR replay, uploads and downloads, iframes and shadow DOM, popups and dialogs, screenshot diffs that change per machine, trace and report artifacts, sharding a slow suite, device and permission emulation, accessibility checks, driving a real browser through Playwright MCP, extracting data from JS-rendered pages, or porting a Cypress, Puppeteer, or Selenium suite to Playwright. Not for maintaining an existing Cypress or Puppeteer suite (cypress, puppeteer) or for work a plain HTTP request answers (http).
Model Usage
@steipeteUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.