python导入哨兵数据_Python 下载哨兵Sentinel数据(Sentinel-1~3)

哨兵数据目前应用广泛,空间分辨、光谱分辨率都比较高。目前数据下载部分包括官网和Python程序下载。

其中哨兵1和2数据下载网上已经有非常详细的记录,链接如下:Python中使用sentinelsat包自动下载Sentinel系列数据_lidahuilidahui的博客-CSDN博客​blog.csdn.netv2-a4966e65178a16b8c4beeb1e21a370e1_180x120.jpg

我对python代码进行了些微调整,用起来更方便一些。这里面主要还是需要安装库文件sentinelsat

pip install sentinelsat

哨兵1和2数据下载具体代码如下:

def download_sentinel_data(user_name,password,website,foot_print,start_date,end_date,platformname,producttype,max_cloud):

api = SentinelAPI(user_name,password,website)

footprint = geojson_to_wkt(read_geojson(foot_print))

products = api.query(footprint,

date=(start_date, end_date),

platformname=platformname,

producttype =producttype,

cloudcoverpercentage = (0, max_cloud))

print(len(products))

for product in products:

product_info = api.get_product_odata(product)

# print(product_info)

print(product_info['title'])

api.download(product)

这是我随便设定的数据时间,检索的数据结果,这数据还是太大,不过在我这下载速度还挺快的,结果如下:

但是该程序在下载哨兵3会报错,原因是数据文件的详细信息有所不同,导致你在提取文件信息的时候会有偏差,因此,我重新修订了哨兵3数据的下载方式。

库文件都是一样的,同样的还是需要制作足迹文件:以'Changjiang_map.geojson’为例

产品类型本次选择‘OL_2_LRR___’,这个根据需要自行更改。

具体代码如下:

from sentinelsat.sentinel import SentinelAPI, read_geojson, geojson_to_wkt

import logging

import os, sys

def download_sentinel_data(user_name,password,website,foot_print,start_date,end_date,platformname,producttype,max_cloud):

api = SentinelAPI(user_name,password,website)

footprint = geojson_to_wkt(read_geojson(foot_print))

products = api.query(footprint, date=(start_date,end_date),platformname = platformname,cloudcoverpercentage = max_cloud,producttype= producttype)

print("PRODUCT SIZE: "+ str(api.get_products_size(products)))

fp=api.to_geojson(products)

# print(fp)

for entry in fp["features"]:

product_id= entry["properties"]["id"]

print (entry["properties"]["identifier"])

print (entry["properties"]["id"])

print (entry["properties"]["beginposition"])

api.download(product_id)

sys.exit()

if __name__ == '__main__':

user_name = ''

password = ''

website = 'https://scihub.copernicus.eu/apihub/'

foot_print = ''

start_date = '20190122'

end_date = '20200124'

platformname = 'Sentinel-3'

producttype = 'OL_2_LRR___'

max_cloud = 60

download_sentinel_data(user_name,password,website,foot_print,start_date,end_date,platformname,producttype,max_cloud)

数据检索结果如下,本次只是示例,我只下载一个数据文件,不过下载速度嗖嗖的:

本次只是一个示例,证明了Python下载哨兵3数据的可能,我并没有比对过检索数据量的正确与否,感兴趣的可以自行尝试。

欢迎交流,祝好!

2020.11.23 于厦门

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值