04-GDAL读取Sentinel 2数据

Sentinel2 数据在GDAL中读取类似于科学数据集的获取方式,如图:
在这里插入图片描述
如常用的蓝、绿、红、近红外常用波段,就存储于第一个数据集list[0][0],list[0][1]为描述信息。
在这里插入图片描述
GDAL中读取数据示例如下:


from osgeo import gdal
import numpy as np
import os
os.environ['CPL_ZIP_ENCODING'] = 'UTF-8'

filename = "G:\mypython3\gdal\data\S2A_MSIL1C_20170428T030541_N0205_R075_T49SER_20170428T031351.SAFE.zip"

root_ds = gdal.Open(filename)
ds_list = root_ds.GetSubDatasets()

sub = gdal.Open(ds_list[0][0])
sub_arr = sub.ReadAsArray()
dimen = np.array(sub_arr).shape
print(dimen)

print(f'打开数据为:{ds_list[0][1]}')
print(f'投影信息:{sub.GetProjection()}')
print(f'栅格波段数:{sub.RasterCount}')
print(f'栅格列数(宽度):{sub.RasterXSize}')
print(f'栅格行数(高度):{sub.RasterYSize}')
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
以下是一些示例代码,演示如何将 Sentinel-2 和 Sentinel-1 数据进行融合: 1. 利用Pythonsentinelsat库下载Sentinel-2和Sentinel-1数据: ```python from sentinelsat import SentinelAPI, read_geojson, geojson_to_wkt # 登录sentinelsat账号 api = SentinelAPI('username', 'password', 'https://scihub.copernicus.eu/dhus') # 下载Sentinel-2数据 footprint = geojson_to_wkt(read_geojson('path/to/footprint.geojson')) products = api.query(footprint, platformname='Sentinel-2', cloudcoverpercentage=(0, 30), producttype='S2MSI1C') # 下载Sentinel-1数据 products = api.query(footprint, platformname='Sentinel-1', polarisationmode='VV VH', producttype='GRD', orbitdirection='ASCENDING') ``` 2. 使用Pythongdal读取处理Sentinel-1数据: ```python from osgeo import gdal # 读取Sentinel-1数据 s1_vv = gdal.Open('path/to/sentinel1_vv.tif') s1_vh = gdal.Open('path/to/sentinel1_vh.tif') # 将Sentinel-1数据转换为dB单位 s1_vv_db = 10 * np.log10(s1_vv.ReadAsArray()) s1_vh_db = 10 * np.log10(s1_vh.ReadAsArray()) # 对Sentinel-1数据进行滤波和校正 # ... # 将Sentinel-1数据重采样到Sentinel-2的分辨率 # ... # 将Sentinel-1数据Sentinel-2数据进行融合 # ... ``` 3. 使用Python的scikit-image库将Sentinel-2和Sentinel-1数据进行融合: ```python from skimage import exposure # 将Sentinel-2数据进行拉伸和直方图匹配,使其与Sentinel-1数据的动态范围一致 s2_rgb = exposure.rescale_intensity(s2_rgb, in_range=(0, 0.3), out_range=(0, 1)) s2_rgb_matched = exposure.match_histograms(s2_rgb, s1_vv_db) # 将Sentinel-1数据Sentinel-2数据进行加权融合 s1_weight = 0.6 s2_weight = 0.4 fused = (s1_weight * s1_vv_db + (1 - s1_weight) * s1_vh_db) * s2_weight + (1 - s2_weight) * s2_rgb_matched ``` 这只是一些示例代码,具体的融合方法和参数需要根据具体的应用场景进行调整和优化。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

孙同学的一个笔记本

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

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

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

打赏作者

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

抵扣说明:

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

余额充值