盐分反演关键:批量计算常用的盐分指数反演变量

盐分反演关键:批量计算常用的盐分指数反演变量

一、引言

盐分指数反演是遥感应用中的一个重要方面,尤其在农业和环境监测中有着广泛的应用。通过遥感影像,研究人员可以高效地获取和分析地表盐分信息,为土地管理和作物生产提供重要支持。本文将介绍如何利用哨兵2号影像批量计算常用的盐分指数反演变量。

二、哨兵2号影像简介

哨兵2号(Sentinel-2)卫星是欧空局(ESA)哨兵计划中的一部分,主要用于地表监测。其多光谱仪(MSI)包含13个波段,覆盖可见光、近红外和短波红外波段,分辨率从10米到60米不等。这些波段为计算各种植被和盐分指数提供了丰富的数据源。

Sentinel-2 BandsCentral Wavelength (µm)Resolution (m)
Band 1 - Coastal aerosol0.44360
Band 2 - Blue0.49010
Band 3 - Green0.56010
Band 4 - Red0.66510
Band 5 - Vegetation Red Edge0.70520
Band 6 - Vegetation Red Edge0.74020
Band 7 - Vegetation Red Edge0.78320
Band 8 - NIR0.84210
Band 8A - Vegetation Red Edge0.86520
Band 9 - Water vapour0.94560
Band 10 - SWIR - Cirrus1.37560
Band 11 - SWIR1.61020
Band 12 - SWIR2.19020

三、常用盐分指数

盐分指数(Salinity Index,SI)是一种通过遥感数据定量描述地表盐分状况的指标。以下是几种常用的盐分指数公式和盐分反演需要用到的植被指数公式:

盐分指数
特征参数变量名称公式及描述
盐分指数 (SI_T)salinity index, SI_T ( R e d − N I R ) × 100 (Red - NIR) \times 100 (RedNIR)×100
盐分指数 (SI1)salinity index, SI1 G r e e n × R e d \sqrt{Green \times Red} Green×Red
盐分指数 (SI2)salinity index, SI2 G r e e n 2 + R e d 2 + N I R 2 \sqrt{Green^2 + Red^2 + NIR^2} Green2+Red2+NIR2
盐分指数 (SI3)salinity index, SI3 G r e e n 2 + R e d 2 \sqrt{Green^2 + Red^2} Green2+Red2
盐分指数 (SI4)salinity index, SI4 B l u e × R e d G r e e n \frac{Blue \times Red}{Green} GreenBlue×Red
盐分指数 (SI5)salinity index, SI5 G r e e n + R e d 2 \frac{Green + Red}{2} 2Green+Red
盐分指数 (S1)salinity index, S1 B l u e R e d \frac{Blue}{Red} RedBlue
盐分指数 (S2)salinity index, S2 B l u e − R e d B l u e + R e d \frac{Blue - Red}{Blue + Red} Blue+RedBlueRed
盐分指数 (S3)salinity index, S3 G r e e n × R e d B l u e \frac{Green \times Red}{Blue} BlueGreen×Red
盐分指数 (SAIO)salinity index, SAIO R e d − N I R G r e e n + N I R \frac{Red - NIR}{Green + NIR} Green+NIRRedNIR
复合盐分指数 (CRSI)composite salinity index, CRSI ( N I R − R e d ) × ( 1 + L ) N I R + R e d + L ; L = 0.5 \frac{(NIR - Red) \times (1 + L)}{NIR + Red + L}; L = 0.5 NIR+Red+L(NIRRed)×(1+L);L=0.5
植被指数
特征参数变量名称公式及描述
土壤调整植被指数 (SAVI)soil-adjusted vegetation index, SAVI ( N I R − R ) × 1.5 N I R + R + 0.5 \frac{(NIR - R) \times 1.5}{NIR + R + 0.5} NIR+R+0.5(NIRR)×1.5
归一化植被指数 (NDVI)normalized vegetation index, NDVI N I R − R N I R + R \frac{NIR - R}{NIR + R} NIR+RNIRR
重整化差异植被指数 (RDVI)renormalize differential vegetation index, RDVI N I R − R N I R + R \frac{\sqrt{NIR - R}}{NIR + R} NIR+RNIRR
绿色归一化差异植被指数 (GNDVI)green normalized differential vegetation index, GNDVI N I R − G N I R + G \frac{NIR - G}{NIR + G} NIR+GNIRG
三角植被指数 (TVI)triangular vegetation index, TVI N I R − R N I R + R + 0.5 \frac{NIR - R}{NIR + R + 0.5} NIR+R+0.5NIRR
差值植被指数 (DVI)differential vegetation index, DVI N I R − R NIR - R NIRR
归一化差异绿色指数 (NDGI)normalized difference green index, NDGI G − R G + R \frac{G - R}{G + R} G+RGR
增强归一化植被指数 (ENDVI)enhanced normalized vegetation index, ENDVI N I R + S W I R 2 − R N I R + S W I R 2 + R \frac{NIR + SWIR_2 - R}{NIR + SWIR_2 + R} NIR+SWIR2+RNIR+SWIR2R

四、GDAL简介

GDAL(Geospatial Data Abstraction Library)是一个用于处理栅格数据和矢量数据的开源库,是地理信息系统(GIS)和遥感领域的重要工具之一。GDAL的详细介绍及其安装可以查看这篇文章:GDAL介绍及安装

五、 批量计算植被指数

1.指数命令

使用 gdal_calc.py 工具可以批量计算上述表格中各盐分指数和植被指数。以下是计算这些植被指数的命令示例:

python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=4 --outfile=savi.tif --calc="((A-B) * 1.5) / (A+B+0.5)"
python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=4 --outfile=ndvi.tif --calc="(A-B) / (A+B)"
python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=4 --outfile=rdvi.tif --calc="sqrt(A-B) / (A+B)"
python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=3 --outfile=gndvi.tif --calc="(A-B) / (A+B)"
python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=4 --outfile=tvi.tif --calc="(A-B) / (A+B+0.5)"
python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=4 --outfile=dvi.tif --calc="A-B"
python gdal_calc.py -A S2.tif --A_band=3 -B S2.tif --B_band=4 --outfile=ndgi.tif --calc="(A-B) / (A+B)"
python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=4 -C S2.tif --C_band=12 --outfile=endvi.tif --calc="(A+C-B)/(A+C+B)"
python gdal_calc.py -A S2.tif --A_band=4 -B S2.tif --B_band=8 --outfile=si_t.tif --calc="(A-B) * 100"
python gdal_calc.py -A S2.tif --A_band=3 -B S2.tif --B_band=4 --outfile=si1.tif --calc="sqrt(A*B)"
python gdal_calc.py -A S2.tif --A_band=3 -B S2.tif --B_band=4 -C S2.tif --C_band=8 --outfile=si2.tif --calc="sqrt(A**2 + B**2 + C**2)"
python gdal_calc.py -A S2.tif --A_band=3 -B S2.tif --B_band=4 --outfile=si3.tif --calc="sqrt(A**2 + B**2)"
python gdal_calc.py -A S2.tif --A_band=2 -B S2.tif --B_band=4 -C S2.tif --C_band=3 --outfile=si4.tif --calc="(A*B)/C"
python gdal_calc.py -A S2.tif --A_band=3 -B S2.tif --B_band=4 --outfile=si5.tif --calc="(A+B)/2"
python gdal_calc.py -A S2.tif --A_band=2 -B S2.tif --B_band=4 --outfile=s1.tif --calc="A/B"
python gdal_calc.py -A S2.tif --A_band=2 -B S2.tif --B_band=4 --outfile=s2.tif --calc="(A-B)/(A+B)"
python gdal_calc.py -A S2.tif --A_band=3 -B S2.tif --B_band=4 -C S2.tif --C_band=2 --outfile=s3.tif --calc="(A*B)/C"
python gdal_calc.py -A S2.tif --A_band=4 -B S2.tif --B_band=8 -C S2.tif --C_band=3 --outfile=saio.tif --calc="(A-B)/(C+B)"
python gdal_calc.py -A S2.tif --A_band=8 -B S2.tif --B_band=4 --outfile=crsi.tif --calc="(A-B)*(1+0.5)/(A+B+0.5)"

这些命令使用 gdal_calc.py 工具来计算表格中的各个植被指数,其中 A_bandB_bandC_band 分别对应 哨兵2号 的不同波段。请根据实际数据文件调整命令中的文件名和波段编号。

2.批处理脚本自动计算

手动运行每条命令会非常麻烦,因此可以将这些命令写入一个批处理文件(.bat),实现自动计算。

3.创建批处理文件

  1. 打开记事本,将上述命令内容复制进去。

  2. 保存文件,将文件名命名为run.bat

  3. 将gdal_calc.py文件和遥感影像文件放入同一文件夹下。

    gdal.py/ run.bat/ run.txt文件已经上传到百度网盘,需要可搜索关注作者微信公众号:Python与遥感 获取
    在这里插入图片描述

4.运行批处理文件

  1. 打开Anaconda Prompt。
  2. 输入以下命令进入相应的驱动器和目录:
    F:
    cd path\to\your\folder
    
  3. 输入并运行批处理文件:
    run.bat
    

运行后,批处理文件将自动依次执行每个命令,计算所有植被指数和盐分指数,并将结果保存到相应的文件中。

注:这里的图示范,采用的是上一篇文章代替的,能看懂就行。

5. 结果展示

每条命令运行后,对应的植被指数会保存在文件夹中,黑窗里的数字到99就代表计算完了一个植被指数。只需等待一小会儿,即可计算完所有的植被指数计算。

六、 总结

盐分指数反演在农业和环境监测中具有重要意义。利用哨兵2号影像和GDAL工具,研究人员可以批量计算常用的盐分指数,获取详细的地表盐分信息。这不仅提高了工作效率,还为科学研究和实际应用提供了强有力的支持。

欢迎关注我的公众号:python与遥感,或许里面有你想要的免费教程。
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

希言自然_happy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值