下载esa卫星数据的python模块
esahub的Python项目详细描述
esahub:从esa scihub下载数据
esahub
为从欧洲哨兵任务下载卫星数据提供了一个简单的接口。
它允许从多个数据服务器并行执行多个下载。 支持各种哥白尼数据服务器,包括:
https://scihub.copernicus.eu/dhus
https://scihub.copernicus.eu/apihub
https://scihub.copernicus.eu/s3
(来宾访问)https://s5phub.copernicus.eu/dhus
(来宾访问)https://tmphub.copernicus.eu/dhus
https://colhub.copernicus.eu/dhus
https://colhub2.copernicus.eu/dhus
设置
安装esahub
:
$ pip install esahub
<>这也将通过复制{{CD11}}在^ {CD10>}中创建YAML配置文件(除非该文件存在)。~/.esahub.conf
中的配置设置优先于config.yaml
中的设置。您应该覆盖~/.esahub.conf
中所需的设置,特别是:
GENERAL.DATA_DIR
对于大多数数据服务器,您需要在SERVERS
中提供自己的身份验证详细信息。
测试安装
运行测试的建议方法是:
$ python setup.py test
注意:运行测试可能需要一段时间,因为它包括从scihub实时下载的测试(尽管使用的文件非常小)。
命令行用法
$ esahub [cmd] [args] ...
可用命令:
$ esahub [cmd] [args] ...
Command | Description |
---|---|
^{ | Queries SciHub for archives matching the specified query parameters. Prints the total number of files and data size. |
^{ | Queries SciHub like ^{ |
^{ | Checks local satellite products for consistency, either by validating the zip/NetCDF format or by comparing to the MD5 checksum from SciHub. Allows to either delete or repair broken files. |
选项
Option | Argument | Available for | Description |
---|---|---|---|
^{ | all | Satellite to query, e.g. S1A, S1B, S2A, S2B, S3A | |
^{ | ^{ | all | raw data directory (defaults to config ^{ |
^{ | ^{ | ^{ | write files to JSON |
^{ | ^{ | ^{ | read files from JSON |
^{ | ^{ | ^{ | e.g. ^{ |
^{ | ^{ | ^{ | geospatial location in WKT format |
^{ | ^{ | ^{ | location as defined in config ^{ |
^{ | ^{ | ^{ | Supports a variety of datetime string formats. |
^{ | ^{ | ^{ | e.g. ^{ |
^{ | ^{ | ^{ | ^{ |
^{ | ^{ | ^{ | product identifier, may include wildcards (^{ |
^{ | ^{ | ^{ | custom query for SciHub, e.g. for single archive: ^{ |
^{ | ^{ | Force restart incomplete downloads | |
^{ | all | write log file | |
^{ | all | Suppress terminal output | |
^{ | ^{ | ^{ | ^{ |
^{ | ^{ | delete corrupt files | |
^{ | ^{ | redownload corrupt files | |
^{ | all | send email report |
日期时间分析
以下是将自动分析为日期或日期范围的日期时间格式示例:
下列单一日期将显式转换为涵盖给定年份、月份或日期的日期范围:
--time 2016
--time 06/2018
--time 2018/06
--time "Sep 1, 2018"
日期范围也可以明确指定:
--time "2016 to 2017"
--time "Jan 2016 - Feb 2016"
--time "01/01/2016, 14/01/2016"
也可以使用单面日期范围:
--time "to 2017"
--time "01/2017-"
--time "01/12/2017,"
示例
ex 1.检索在过去午夜到午夜与爱尔兰相交期间上载到scihub的sentinel-3存档的数量和总文件大小(仅当配置项中定义了Ireland
时才有效)
$ esahub ls -t yesterday --location=Ireland
ex 2.下载昨天上传的四个位置的存档。
$ esahub get -t yesterday --location=Ireland_Mace_Head --location=Namibia_Gobabeb --location=Italy_Rome_Tor_Vergata --location=France_La_Crau
ex 3.查询scihub以获取爱尔兰的所有可用sentinel-2数据,并将结果写入json文件。然后通过get
命令读取该json文件,从而下载指定的文件。{EM1}$Note:
$ esahub ls --location=Ireland --mission=Sentinel-2 --out=Sen2_IE.json
$ esahub get --in=Sen2_IE.json --log
ex 4.检查自定义目录中的所有zip存档文件是否一致,并生成日志文件。
$ esahub doctor --dir=/path/to/dir/ --mode=md5 --log
python api
fromesahubimportscihubquery={'mission':'Sentinel-1','geo':'POINT(-9.0 53.0)','time':'today'}files=scihub.search(query)scihub.download(files)
依赖关系
必需
pyyaml
numpy
lxml
shapely
python-dateutil
pytz
tqdm
可选
pyproj
netCDF4
库
libgeos_c