Install
openclaw skills install @ruiduobao/rs-index-calcCalculate spectral indices from GeoTIFF imagery using pure Python. No external dependencies required. Supports 10 indices including NDVI, NDBI, NDWI, EVI, SAVI, MNDWI, AWEI, NBR, BSI, UI.
openclaw skills install @ruiduobao/rs-index-calcCalculate spectral indices from GeoTIFF imagery using pure Python. No external dependencies required.
pip install -r requirements.txt
# No external dependencies - uses only Python standard library
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
| 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 |
pytest
MIT-0 (No Attribution)
从 GeoTIFF 影像计算光谱指数,纯 Python 实现,无需任何外部依赖。
| 指数 | 公式 | 波段 |
|---|---|---|
| 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