NDR - RuntimeError: In Task: mask runoff proxy raster

Hello @AnaCastro ,

It turns out that GDAL is complaining (and failing the runoff proxy masking step) because there are 3 watersheds that have ring self-intersections, which GDAL considers invalid. Using QGIS’s validity checker (in GEOS mode, which is consistent with how GDAL uses geometries), there are 3 watersheds with self-intersections, plotted as points here:

And a closeup of the eastern-most one:

I fixed this geometry using a python environment and geopandas using the following:

>>> gdf = geopandas.read_file('swat_subbasins.shp')
>>> bgdf = gdf['geometry'].buffer(0)
>>> bgdf.to_file('subbasins_buf0.shp')

And the resulting vector (attached below) works fine.

subbasins_buf0.zip (139.9 KB)

Having said that, this part of the NDR model could be more resilient to minor geometry errors like these, and I will see about updating it.

Hope this helps!
James

1 Like