使用rasterio打开Sentinel-2 AWS .jp2图像文件(当前由Sinergise托管,可以在此处找到)后,我当前遇到“访问被拒绝”错误。
我的代码如下所示:
import rasterio
access_key = '*****************'
secret_access_key = '***********************'
region_name = 'eu-central-1'
Session = rasterio.env.Env(aws_access_key_id=access_key,
aws_secret_access_key=secret_access_key,
region_name=region_name)
url = 's3://sentinel-pds/tiles/10/S/DG/2015/12/7/0/B01.jp2'
with Session:
with rasterio.open(url) as dataset:
print dataset
响应为:
---------------------------------------------------------------------------
CPLE_AWSAccessDenied Traceback (most recent call last)
<ipython-input-1-4f6da7274649> in <module>()
12
13 with Session:
---> 14 with rasterio.open(url) as dataset:
15 print dataset
/Users/Barney/anaconda/lib/python2.7/site-packages/rasterio/__init__.pyc in open(path, mode, driver, width, height, count, crs, transform, dtype, nodata, **kwargs)
191 raise ValueError(
192 "mode string must be one of 'r', 'r+', or 'w', not %s" % mode)
--> 193 s.start()
194 return s
195
rasterio/_base.pyx in rasterio._base.DatasetReader.start (rasterio/_base.c:2847)()
rasterio/_base.pyx in rasterio._base.DatasetReader.start (rasterio/_base.c:2799)()
rasterio/_err.pyx in rasterio._err.CPLErrors.check (rasterio/_err.c:1773)()
CPLE_AWSAccessDenied: Access Denied
我不确定我是否正确使用了rasterio aws环境,即使提供了密钥和访问密钥,aws会话令牌密钥也需要吗?我还应该补充一点,如果提供Landsat-8网址(即http://landsat-pds.s3.amazonaws.com/L8/139/045/LC81390452014295LGN00/LC81390452014295LGN00_B1.TIF),则此功能可以正常运行
版本(通过Anaconda安装):
光栅-0.36.0
python-2.7
抱歉,以上内容含糊。我的问题是-为什么这适用于Landsat-8而不适用于Sentinel-2?如何使用rasterio打开Sentinel-2 AWS数据?