It is known that GeoRaster2 class is not designed to support non-geographic rasters.
Right now if you try to copy a raster without CRS it raises a RecursionError because it tries to read over and over a None attribute. This can be triggered with the next lines:
To avoid this exception which is not really informative, I propose to differentiate between a crs not yet read (None) and one already read from file but non-existing or void which can be a rasterio.crs.CRS() instance without init arguments. This empty crs allows upper lines to work.
In the future, if a proper exception wants to be raised with the message that some method is not supported for this kind of rasters, the rasterio.crs.CRS property is_valid can be checked, which for an empty instance returns False.
I can create the PR with the proposal if maintainers think the idea is worth it.
It is known that
GeoRaster2
class is not designed to support non-geographic rasters.Right now if you try to copy a raster without CRS it raises a
RecursionError
because it tries to read over and over aNone
attribute. This can be triggered with the next lines:To avoid this exception which is not really informative, I propose to differentiate between a crs not yet read (
None
) and one already read from file but non-existing or void which can be arasterio.crs.CRS()
instance without init arguments. This empty crs allows upper lines to work.In the future, if a proper exception wants to be raised with the message that some method is not supported for this kind of rasters, the
rasterio.crs.CRS
propertyis_valid
can be checked, which for an empty instance returnsFalse
.I can create the PR with the proposal if maintainers think the idea is worth it.