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

Install

$ openclaw skills install @ruiduobao/geoskill-rs-index-calc

Remote 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

IndexFormulaBands
NDVI(NIR - Red) / (NIR + Red)NIR, Red
NDBI(SWIR - NIR) / (SWIR + NIR)SWIR, NIR
NDWI(Green - NIR) / (Green + NIR)Green, NIR
EVI2.5 * (NIR - Red) / (NIR + 6Red - 7.5Blue + 1)NIR, Red, Blue
SAVI(NIR - Red) / (NIR + Red + 0.5) * 1.5NIR, Red
MNDWI(Green - SWIR) / (Green + SWIR)Green, SWIR
AWEI4*(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
EVI2.5 * (NIR - Red) / (NIR + 6Red - 7.5Blue + 1)NIR, Red, Blue
SAVI(NIR - Red) / (NIR + Red + 0.5) * 1.5NIR, Red
MNDWI(Green - SWIR) / (Green + SWIR)Green, SWIR
AWEI4*(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

@biostartechnology

Remove 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.

710129k

Free Ride - Unlimited free AI

@shaivpidadi

Manages free AI models from OpenRouter for OpenClaw. Automatically ranks models by quality, configures fallbacks for rate-limit handling, and updates opencla...

48470k

Elite Longterm Memory

@nextfrontierbuilds

Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.

23564k

Playwright (Automation + MCP + Scraper)

@ivangdavila

Automates, 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).

12941k

Model Usage

@steipete

Use 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.

11439k