搜索和下载哥白尼哨兵卫星图像的实用程序

sentinelsat的Python项目详细描述


哨兵

PyPI packageTravis-CIcodecov.io code coverageDocumentationgitter.im chatZenodo DOI

sentinelsat搜索、下载和检索Sentinel的元数据 卫星图像来自 Copernicus Open Access Hub简单。

它提供了一个易于使用的命令行界面

sentinelsat -u <user> -p <password> -g <search_polygon.geojson> --sentinel 2 --cloud 30

以及强大的python api。

fromsentinelsatimportSentinelAPI,read_geojson,geojson_to_wktapi=SentinelAPI('user','password')footprint=geojson_to_wkt(read_geojson('search_polygon.geojson'))products=api.query(footprint,producttype='SLC',orbitdirection='ASCENDING')api.download_all(products)

文档发布在http://sentinelsat.readthedocs.io/

安装

通过pip安装sentinelsat

pip install sentinelsat

用法

sentinelsat提供了一个python api和一个用于搜索的命令行界面, 下载并检索Sentinel产品的元数据。

python库

fromsentinelsat.sentinelimportSentinelAPI,read_geojson,geojson_to_wktfromdatetimeimportdate# connect to the APIapi=SentinelAPI('user','password','https://scihub.copernicus.eu/dhus')# download single scene by known product idapi.download(<product_id>)# search by polygon, time, and Hub query keywordsfootprint=geojson_to_wkt(read_geojson('map.geojson'))products=api.query(footprint,date=('20151219',date(2015,12,29)),platformname='Sentinel-2',cloudcoverpercentage=(0,30))# download all results from the searchapi.download_all(products)# GeoJSON FeatureCollection containing footprints and metadata of the scenesapi.to_geojson(products)# GeoPandas GeoDataFrame with the metadata of the scenes and the footprints as geometriesapi.to_geodataframe(products)# Get basic information about the product: its title, file size, MD5 sum, date, footprint and# its download urlapi.get_product_odata(<product_id>)# Get the product's full metadata available on the serverapi.get_product_odata(<product_id>,full=True)

可以在Copernicus Open Access Hub documentation中找到有效的搜索查询关键字。

命令行界面

基本搜索查询包括搜索区域几何图形以及用户名和 访问哥白尼开放访问中心的密码。

sentinelsat -u <user> -p <password> -g <geojson>

搜索区域作为geojson文件提供,可以使用 QGISgeojson.io。 如果不指定开始日期和结束日期,则只指定上次发布的产品 24小时查询。

示例

按降序搜索并下载SLC类型的所有Sentinel-1场景 轨道,2015年。

sentinelsat -u <user> -p <password> -g <search_polygon.geojson> -s 20150101 -e 20151231 -d \
--producttype SLC -q "orbitdirection=Descending"\
--url "https://scihub.copernicus.eu/dhus"

也可以通过环境变量设置用户名、密码和dhus url,以方便使用。

# same result as query above
exportDHUS_USER="<user>"exportDHUS_PASSWORD="<password>"exportDHUS_URL="https://scihub.copernicus.eu/dhus"

sentinelsat -g <search_polygon.geojson> -s 20150101 -e 20151231 -d \
--producttype SLC -q "orbitdirection=Descending"

选项

-u–userTEXTUsername [required] (or environment variable DHUS_USER)
-p–passwordTEXTPassword [required] (or environment variable DHUS_PASSWORD)
–urlTEXTDefine another API URL. Default URL is ‘https://scihub.copernicus.eu/apihub/’.
-s–startTEXTStart date of the query in the format YYYYMMDD.
-e–endTEXTEnd date of the query in the format YYYYMMDD.
-g–geometryPATHSearch area geometry as GeoJSON file.
–uuidTEXTSelect a specific product UUID instead of a query. Multiple UUIDs can separated by commas.
–nameTEXTSelect specific product(s) by filename. Supports wildcards.
–sentinelINTLimit search to a Sentinel satellite (constellation).
–instrumentTEXTLimit search to a specific instrument on a Sentinel satellite.
–producttypeTEXTLimit search to a Sentinel product type.
-c–cloudINTMaximum cloud cover in percent. (requires –sentinel to be 2 or 3)
-o–order-byTEXTComma-separated list of keywords to order the result by. Prefix ‘-‘ for descending order.
-l–limitINTMaximum number of results to return. Defaults to no limit.
-d–downloadDownload all results of the query.
–pathPATHSet the path where the files will be saved.
-q–queryTEXTExtra search keywords you want to use in the query. Separate keywords with comma. Example: ‘producttype=GRD,polarisationmode=HH’.
-f–footprintsCreate geojson file search_footprints.geojson with footprints of the query result.
–versionShow version number and exit.
-h–helpShow help message and exit.

测试

sentinelsat

上运行测试
git clone https://github.com/sentinelsat/sentinelsat.git
cd sentinelsat
pip install -e .[dev]
py.test -v

默认情况下,对哥白尼开放访问中心查询的预先记录的响应不受其停机时间的影响。 要允许测试对哥白尼开放访问中心运行实际查询,请设置环境变量

exportDHUS_USER=<username>
exportDHUS_PASSWORD=<password>

并将--vcr disable添加到py.test参数中。 要更新录制,请使用--vcr record_new--vcr reset

文档

构建文档:

git clone https://github.com/sentinelsat/sentinelsat.git
cd sentinelsat
pip install -e .[dev]cd docs
make html

完整的文档也发布在http://sentinelsat.readthedocs.io/

更改日志

CHANGELOG。您还可以使用github的compare视图查看changes in the master branch since last release

贡献者

我们邀请任何人通过参与代码、报告错误、修复错误、编写文档和教程以及讨论这个项目的未来来参与。请检查CONTRIBUTE.rst

有关维护者和贡献者的列表,请参见AUTHORS.rstcontributor graph

许可证

gplv3+

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
主类中的java访问方法   Javalog4j不读取它的log4j。属性文件   雅加达ee通过Java(web应用程序)使用iText/任何其他使用现成数据的库生成PDF报告   lua使用java阅读TeamSpeak 3消息   将日期转换为BST java   java Spring引用ProxyFactoryBean中带有ref的protoyype bean   如何使java只打印一条带有if语句的消息   java如何通过JavaMail从雅虎服务器发送电子邮件?   使用百分比和BigDecimal的java测试   java如何对字符串数组排序   java验证器+MVC+REST::更新问题   java如何阻止eclipse如此频繁地挂起?   java从AsyncTask(片段内)访问TextView   IDEJava:制作可调整大小和拖动的组件