Hi, I tried to run SDR a few times. For the first few times that failed, I kept receiving: IndexError: index 4 is out of bounds for axis 0 with size 4; then I tried to modify the DEM model in ArcGIS Pro by filling it. The latest attempt lasted a bit longer than the previous ones, and here is the error document. Can you please help me to see what the problem is and what the possible solutions are?
Welcome to the forum and thanks for sharing your log file.
Ensure all of your input rasters (DEM, LULC, erosivity, erodibility) and your watershed vector use the exact same projected coordinate system (e.g., UTM). The units should be in meters, not degrees (WGS84). If your DEM is in degrees, the slope and flow calculations will fail or yield “out of bounds” errors.
If you’re still having trouble after that, check for hidden formatting in your biophysical table input. Open the CSV in a text editor (like Notepad; not Excel). Ensure there are no extra commas at the ends of rows or empty rows at the bottom. The model expects exactly the number of rows corresponding to the lucode values from your LULC raster input.
I’ve done all the thing you mentioned and followed through the DEM user guide. I thought it was because of the watershed that I used was not generated from my input DEM, but after I updated the watershed file and run the SDR model, it still failed. Here’s the log file, could you please have a look at it? It seems it’s still related to the ls factor calculation. Thank you.
I’m sorry that my initial recommendations didn’t seem to change anything. These error messages look like the same ones as before.
I’d need to examine your data to diagnose this properly. Please upload your input data files to a cloud service or someplace where we can access and download them (e.g.: Google Drive, Dropbox, etc.) and then share a link to that location with us. To create a zip file of your inputs to share, from the InVEST workbench with all the inputs populated, click on “Save as…” in the bar on the left side and then select “Parameters and data” and click “Save”, as shown in this screenshot:
Thanks for sharing your datastack. Exploring those data allowed me to diagnose the issue.
The problem is with your DEM. It does not have a NoData value set. As stated in the InVEST User Guide,
Every raster that is used as input to InVEST models must have a numeric data value assigned to the raster’s NoData value. This NoData value must not be considered valid model data. For example, the Land use/land cover raster might have valid land use codes of 1 through 30, so you could choose a NoData value of 9999. The value “nan” IS NOT a valid NoData value, and will produce an error when running models. You can check the NoData value by looking at the raster’s Properties in a GIS.
If you’re using ArcGIS Pro, instructions on how to set a raster’s NoData value is available here under the “Defining NoData” section". I set it to -9999 and ran the model again and it successfully completed in ~11 seconds and the results appear reasonable.
I’ve attached that version of your DEM which I updated: