0

I have developed a lambda with rasterio 1.3.5 and python 3.9 with serverless. My function requires to read image from sentinel-s2-l2a bucket. But whenever the function tries to read a certain url it throws this error.

Error: '/vsis3/sentinel-s2-l2a/tiles/33/T/UL/2021/7/24/0/R10m/B03.jp2' not recognized as a supported file format.

My code for this specific error is:

url = 's3://sentinel-s2-l2a/tiles/33/T/UL/2021/7/24/0/R10m/B03.jp2'
with rasterio.open(url) as dataset:
         meta = dataset.meta.copy()

In the requirements.txt the libraries are:

requests
numpy==1.24.3
scipy==1.10.1
rasterio==1.3.4
shapely==2.0.1
boto3==1.26.129
pyproj==3.5.0
xmltodict==0.13.0

I have tried by specifying the driver but the error is always same.

url = 's3://sentinel-s2-l2a/tiles/33/T/UL/2021/7/24/0/R10m/B03.jp2'
with rasterio.open(url ,driver='JP2OpenJPEG') as dataset:
         meta = dataset.meta.copy()

Just for the reference, I have added read access from this specific bucket to my lambda function.

0 Answers0