Help with inconsistent errors using WarpedVRT/rio_tiler


fgassert@...
 

Hello,

I have been running into some puzzling errors with windowed reads of COGs in Mollweide crs.

The read raises a CPLE_AppDefinedError on transforming the window to the dataset crs the first five (5) times it is called, then it succeeds. This implies to me that there might be some behavior that is affected by caching, or with an error suppression logic in rio core. I believe the errors are raised in the first place because the COG bounds become (inf, inf, inf, inf) when transformed from Mollweide to WGS84. However, this does not affect the eventual success of the reads. The error occurs in `rasterio._base()._transform()`.

Here is a simple script to reproduce the errors.
```
import rasterio as rio
from rio_tiler.io import COGReader

arr = None
while arr is None:
    try:
        with COGReader('https://storage.googleapis.com/francis_indicators/backup/HFP/HFP_source/2013_meris_lc.tif') as cog:
            reader = cog.part((10,10,20,20))
            arr = reader.data
    except Exception as e:
        print(e)

print(arr.shape)
```

Output:
```
acos/asin: |arg| >1.+1e-14
acos/asin: |arg| >1.+1e-14
acos/asin: |arg| >1.+1e-14
acos/asin: |arg| >1.+1e-14
Reprojection failed, err = -19, further errors will be suppressed on the transform object.
(1, 1013, 1013)
```

Versions
```
rasterio: 1.2.4
rio_tiler: 2.1.0
gdal: 3.3.0
```

Thanks,
Francis

Join main@rasterio.groups.io to automatically receive all group messages.