这次主要介绍sentinelsat包,包括查询条件和相关的API等。
主要记录自己学习过程~~
- 首先我们需要知道欧空局ESA的数据,因为考虑数据存储等问题,会将sentinel数据从在线存档中删除。
- 对于长期存档的数据,会出现offline情况,在下载的时候,需要先激活然后再下载(这也就是在官网手动下载数据时,对于offline的数据,需要等一段时间才能下载的原因)
- 因此,如果需要下载很多offline,也就是历史数据,需要利用sentinelsat包,sentinelsat可以检索和下载sentinel系列数据,对于offline数据,download函数会先激活数据,然后再进行下载。
- 但是sentinelsat数据下载,很容易出现突然就不下载的问题,然后重新启动程序,又会重新下载。所以也有大佬利用sentinelsat结合IDM来下载,可参考:https://blog.csdn.net/mrzhy1/article/details/107044828
1.根据条件筛选数据api.query()
在官网我们可以手动设定条件,然后下载数据。利用sentinelsat下载数据的时候,只需设置api.query()
中的内容即可。
这里举例:比如我想下载下面的数据
(1) 通配符的使用
(2)footprint
The maximum footprint extent possible is defined by the Mercator projection used on DHuS, i.e. LAT [-180, + 180] and LONG [-85.05, +85.05].
使用方法:footprint:"Intersects(POLYGON((-4.53 29.85, 26.75 29.85, 26.75 46.80,-4.53 46.80,-4.53 29.85)))"
(3)producttype
Sentinel-3: SR_1_SRA___, SR_1_SRA_A, SR_1_SRA_BS, SR_2_LAN___, OL_1_EFR___, OL_1_ERR___, OL_2_LFR___, OL_2_LRR___, SL_1_RBT___, SL_2_LST___, SY_2_SYN___, SY_2_V10___, SY_2_VG1___, SY_2_VGP___, SY_2_AOD__, SL_2_FRP__.
可以参考:https://scihub.copernicus.eu/twiki/do/view/SciHubUserGuide/FullTextSearch?redirectedfrom=SciHubUserGuide.3FullTextSearch
根据自己要求设置:
下载sentinel-3代码:
from sentinelsat import SentinelAPI, read_geojson, geojson_to_wkt
api = SentinelAPI('user', 'code')
footprint = geojson_to_wkt(read_geojson('map.geojson'))
products = api.query(footprint,
platformname = 'Sentinel-3',
# filename = 'S3A_SR_2_LAN____*',
producttype='SR_2_LAN___',
# timeliness = 'NTC',
# orbitdirection='ASCENDING',
# limit=10
)
for product in products:
product_info = api.get_product_odata(product)
print(product_info['title'])
api.download(product)