Using WarpVRT inside a WarpVRT block might not be a normal usage but it is really usefull for speudo file transformation (e.g for Sentinel-1 we use warpVRT to add the transformation matrix, and then a second WarpVRT block to read a tile). The latest rasterio 1.1b changed the behaviour of the code above
This block is working on a CLEAN env (docker) with rasterio==1.0.28
import rasterio
from rasterio.vrt import WarpedVRT
with rasterio.open("my-tif.tif") as dataset:
with WarpedVRT(dataset) as vrt:
with WarpedVRT(vrt) as vrt1:
print(vrt1.meta)
but failling with rasterio==1.1b1
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "rasterio/_warp.pyx", line 813, in rasterio._warp.WarpedVRTReaderBase.__init__
File "rasterio/_shim.pyx", line 66, in rasterio._shim.open_dataset
File "rasterio/_err.pyx", line 205, in rasterio._err.exc_wrap_pointer
rasterio._err.CPLE_OpenFailedError: WarpedVRT(my-tif.tif): No such file or directory
The CPLE_OpenFailedError is quite strange and might be linked to GDAL env. I've also encountered this error with 1.0.28 but on a non-clean env (might have been some GDAL/CPL env sets.
Mac OS X / Linux
1.0.28, 1.1 wheels
ref https://github.com/cogeotiff/rio-cogeo/pull/100
cc @sgillies
I found the culprit: https://github.com/mapbox/rasterio/commit/9e30d22d6d1574057db9f4bbc48258e30a5cb3b1. Instead of re-using the dataset handle, I switched to opening a new dataset handle, which avoided some null pointer problems.
Thanks @sgillies
Do you think this is something that could be resolved ?
To be honest this could be quite useful, mostly to support more dataset for rasterio (e.g Sentinel-1, GOES16....).
@vincentsarago yes, I think I'll find a solution this evening.
Resolved by #1800.
Most helpful comment
Resolved by #1800.