I can’t run the NDR model, this error appears RuntimeError: In Task: mask runoff proxy raster.
I already have the latest Invest version and redownloaded sample data several times.
Here is my logfile InVEST-natcap.invest.ndr.ndr-log-2023-09-13–12_00_21.txt (4.3 KB)
Hello, good afternoon. I imagine it’s an error in the raster files, which contain polygon and multipolygon features, perhaps one is overlapping the other. I suggest you check this again. Also, check the attribute table and the correspondence with the csv file. I hope I’ve helped.
Thanks for posting your log file. It shows these warnings and errors:
2023-09-13 12:00:22,745 (osgeo) utils._log_gdal_errors(97) WARNING [errno 1] Ring Self-intersection at or near point 12344.008690871298 218998.69285557925
2023-09-13 12:00:22,747 (osgeo) utils._log_gdal_errors(97) ERROR [errno 1] Cutline polygon is invalid.
2023-09-13 12:00:22,747 (taskgraph.Task) Task.add_task(706) ERROR Something went wrong when adding task mask runoff proxy raster (2)
If you search this forum, you’ll find several threads related to this, for example this one, which includes several methods for fixing polygon geometries.
Hello,
The thing is that this same map runs with no problem in the other ES (water yield, SDR, CS), so I don’t understand why it doesn’t work in this one specifically…
The failure is happening in this model and not others because of the specific way that the input rasters are being masked to the polygon boundary. This is an unfortunate technical detail of the underlying library we use for interfacing with many spatial file formats.
@AnaCastro could you share your complete set of inputs for this model with us so we can take a closer look? I think this will be easier to debug by looking at the actual data, and this will help us find a more general solution as well.
Hello,
Than you for you help!
Here is my data: Invest_NDR - Google Drive
I am using “swat_subbasins” as “watersheds”, “precipitation.tif” as “Nutrient Runnof Proxy” ,Threshold FLow Accumulation = 1000 and Borselli K parameter=2.
The objective is to map this ecosystem service fot two LULC scenarios (COS2018 and future).
Thank you!
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: