Closed PierreRCM closed 2 years ago
Hi Pierre,
Sounds like rasterio may have updated their API and the change may have broken this function.
I will need to update the library. In the meantime, you can try downgrading rasterio.
The version I am currently using is 1.0.4.
Thanks, MDB
Thanks for the answer,
I can't find 1.0.4 in all version proposed
There are :
1.0.22 1.0.21 1.0.13 0.36.0 0.25.0 0.24.0
which one would match with pysheds ?
Thanks
I think it should work with one of the 1.0.x versions.
What version do you currently have?
The last one 1.0.22
Ah, I just looked at the rasterio docs. It looks like read_band
was replaced with read
in v1.0. I guess I just never had any test cases with multiple bands.
The line:
data = np.ma.filled(f.read_band(band))
Would need to be changed to:
data = np.ma.filled(f.read(band))
Oh nice ! At least i didn't bother you for no reason :D
Thanks
Please reopen if this issue persists.
the error is fixed by replacing read_band()
by read(band)
... but this patch does not appear in the current pysheds version (0.3.2) which is problematic for projects depending on pysheds :/
Thanks for letting me know. I didn't realize this was never fixed. Unit tests never raised this error because only single-band rasters were used. I will fix as soon as possible.
Hi,
I could not find the read_band method which is from rasterio? This error appears in read_raster Maybe a problem of version ?
if window is None: shape = f.shape if len(f.indexes) > 1: data = np.ma.filled(f.read_band(band)) else: data = np.ma.filled(f.read()) affine = f.transform data = data.reshape(shape)
Any ideas ? :D