I would like to process a geotif raster using scipy.ndimage.label into regions defined by adjacing equal raster values. The original file looks as below.
When plotting using show_hist the histogram looks as follows.
Currently the raster is being processed as follows.
import io
import rasterio
import scipy
with rasterio.open('https://github.com/AaltoUrbanWater/GisToSWMM5/blob/master/demo_catchment/GIS/raster_landuse.tif?raw=true', nodata=0) as ds:
print(ds.read(1).astype(int))
labeled_array, num_features = scipy.ndimage.label(ds.read(1).astype(int)>0)
print(num_features)
In result num_features carries one value only. I would expect at least five from the histogram.