Open vincentsarago opened 1 year ago
😭 This is also true for mosaic
from rio_tiler.tasks import create_tasks, filter_tasks
import rasterio
from rasterio.session import AWSSession
with rasterio.Env(
session=AWSSession(
aws_access_key_id="MyDevseedId",
aws_secret_access_key="MyDevseedKey",
),
):
paths = [
"s3://ds-satellite/cogs/NaturalEarth/world_grey.tif",
"s3://ds-satellite/cogs/NaturalEarth/world_grey_512_256.tif",
]
def reader(path):
with rasterio.open(path) as src:
return src.profile
tasks = filter_tasks(create_tasks(reader, paths, threads=2))
>> RasterioIOError: Access Denied
I always assumed that rasterio was picking the envs from top level but no. It will create a new Env per thread, I guess this is why stackstac does https://github.com/gjoseph92/stackstac/blob/main/stackstac/rio_reader.py
cc @ranchodeluxe @sharkinsspatial
@vincentsarago : given the lack of motion on https://github.com/rasterio/rasterio/issues/2866 is there a fix you're working on here now? Or is this something I can take swing at when I get a chance?
in
MultiBaseReader
(STAC) we initiate a newrasterio.Env
to be able to set the Header size from each file. Sadly when we do this we loose any env options passed in a top level envFirst reported in https://github.com/NASA-IMPACT/veda-backend/issues/192