You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
the Raster.reproject() function raise an error when the reference Raster have less band than the source one.
To Reproduce
import geoutils as gu
raster_3b = gu.Raster(gu.examples.get_path("everest_landsat_rgb")) # 3 bands Raster
raster_1b = gu.Raster(gu.examples.get_path("everest_landsat_b4_cropped")) # 1 band Raster
raster_1b.reproject(raster_3b) # works perfectly
raster_3b.reproject(raster_1b) # Raise an error
Expected behavior
I want the 3 bands of the raster_3b to be reprojected over the raster_1b
System (please complete the following information):
macOS
Conda (I'm not sure of what is expected here)
Additional context
Can be solved by import separately the bands using Raster.reproject parameters : bands and load_data=True. But it's creating n-bands Raster objects instead of one.
The text was updated successfully, but these errors were encountered:
Hi Gabin,
Thanks for raising the issue!
Indeed, a quick workaround is to run:
raster_3b = gu.Raster(gu.examples.get_path("everest_landsat_rgb"), load_data=True) # make sure data is loaded
raster_1b = gu.Raster(gu.examples.get_path("everest_landsat_b4_cropped"))
raster_3b.reproject(raster_1b)
The issue occurs only when the data is not loaded, at this line.
What happens is that we load only 1 band at a time, but in the reproj_kwargs, the output shape is set to same as input. For a 3-band raster, we are creating 3 3-band rasters, so the number of bands end up being 9... I think this can be easily fixed by removing the loop over bands.
We'll fix this when we find time!
Describe the bug
the Raster.reproject() function raise an error when the reference Raster have less band than the source one.
To Reproduce
Expected behavior
I want the 3 bands of the raster_3b to be reprojected over the raster_1b
System (please complete the following information):
Additional context
Can be solved by import separately the bands using Raster.reproject parameters : bands and load_data=True. But it's creating n-bands Raster objects instead of one.
The text was updated successfully, but these errors were encountered: