stackstac
stackstac copied to clipboard
RasterioIOError during .compute task
hello, I encouter this problem trying to stack images in a xarray dataframe. The code is running on a local debian server (80 cp - 190 GB memory) . Here is part of the code where the problem occurs (you can recognize part of the geogif example). The items collection contains 10 images.
stack = stackstac.stack(items.item_collection(), bounds_latlon=bbox, epsg = 32620, resolution=30)
scl = stack.sel(band=["SCL"])
invalid = da.isin(scl, [0, 1, 2, 3, 8, 9, 10])
valid = stack.where(~invalid)
rgb = valid.sel(band=["B04", "B03", "B02"])
quarterly = rgb.resample(time="Q").median()
ts_local = quarterly.compute()
And the associated error. I'm not sure that this error is directly related to stack.stac. Should I look for answers with rasterio and Gdal ?
RasterioIOError Traceback (most recent call last)
File ~/miniconda3/envs/earthgif/lib/python3.10/site-packages/stackstac/rio_reader.py:387, in read()
386 try:
--> 387 result = reader.read(
388 window=window,
389 masked=True,
390 # ^ NOTE: we always do a masked array, so we can safely apply scales and offsets
391 # without potentially altering pixels that should have been the ``fill_value``
392 **kwargs,
393 )
394 except Exception as e:
File ~/miniconda3/envs/earthgif/lib/python3.10/site-packages/stackstac/rio_reader.py:227, in read()
226 with self._env.read:
--> 227 return self.dataset.read(1, window=window, **kwargs)
File rasterio/_warp.pyx:1235, in rasterio._warp.WarpedVRTReaderBase.read()
File rasterio/_io.pyx:612, in rasterio._io.DatasetReaderBase.read()
File rasterio/_io.pyx:939, in rasterio._io.DatasetReaderBase._read()
RasterioIOError: Read or write failed. IReadBlock failed at X offset 0, Y offset 4: /vsicurl/https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/21/X/VK/2021/8/S2B_21XVK_20210802_2_L2A/B02.tif, band 1: IReadBlock failed at X offset 0, Y offset 0: TIFFReadEncodedTile() failed.```