首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用亚马逊S3下载陆地卫星8号图像

如何使用亚马逊S3下载陆地卫星8号图像
EN

Stack Overflow用户
提问于 2019-05-09 14:44:45
回答 1查看 498关注 0票数 2

我实现了Automated Bulk Downloads of Landsat-8 Data Products in Python | Geology and Python教程中的python代码。

它工作得很好,但我想在日期的基础上检索数据。我甚至修改了一些代码,并尝试了,但没有成功。

代码语言:javascript
复制
bulk_list = []

# Iterate through paths and rows
for path, row in zip(paths, rows):

print('Path:',path, 'Row:', row)

# Filter the Landsat Amazon S3 table for images matching path, row, cloudcover and processing state.
scenes = s3_scenes[(s3_scenes.path == path) & (s3_scenes.row == row) & 
                   (s3_scenes.cloudCover <= 15) & 
                   (s3_scenes.acquisitionDate='2019-04-22')
                   (~s3_scenes.productId.str.contains('_T2')) &
                   (~s3_scenes.productId.str.contains('_RT'))]
print(' Found {} images\n'.format(len(scenes)))

# If any scenes exists, select the one that have the minimum cloudCover.
if len(scenes):
    scene = scenes.sort_values('acquisitionDate').iloc[0]

# Add the selected scene to the bulk download list.
bulk_list.append(scene)

但是它抛出了一个错误:

代码语言:javascript
复制
File "<ipython-input-37-ec27c752ae7e>", line 11
(s3_scenes.acquisitionDate='2019-04-22')
                              ^
SyntaxError: invalid syntax

我知道日期格式有问题,但无法解决。

也请向我推荐一些好的教程,以便在Landsat8图像上使用AWS。

当我打印批量列表bulk_list [productId LC08_L1TP_152042_20190422_20190507_01_T1 entityId LC81520422019112LGN00 acquisitionDate 2019-04-22 05:56:08.442691 cloudCover 0 processingLevel L1TP path 152 row 42 min_lat 24.9171 min_lon 66.742 max_lat 27.0339 max_lon 69.0604 download_url https://s3-us-west-2.amazonaws.com/landsat-pds... Name: 1520154, dtype: object]

即使在我使用(s3_scenes.acquisitionDate='2019-04-22 05:56:08.442691')之后,结果仍然是一样的

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-09 15:07:02

我认为日期格式应该是YYYYMMDD

有关更多信息,请参阅amazon

或者简单地使用s3_scenes.productId.str.contains('20190422')

并且在语句的末尾忘记了&

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56053622

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档