SDR TypeError: 'isfinite'

Hello,

First time using InVEST. I am trying to run an SDR model, but keep getting the same error code: TypeError: unfunc ‘isfnite’ not supported fir tge unput types, and the inputs could not be safely coerced to any supported types according to the casting rule “safe”

I have the latest version of InVEST and I am not sure what part the error is relating to. Below is the text file produced from the log. Any help is welcome!

InVEST-Sediment-Delivery-Ratio-log-2022-02-11–13_54_19.txt (92.2 KB)

Hi @CTXBrabbs,

Thanks for trying InVEST and welcome to the forums. This looks like an issue related to one of the input rasters having an undefined nodata value. We thought we handled this bug awhile back but apparently something is slipping through.

Would you mind opening your input rasters in GIS and sharing what the nodata values are for each?

I think a quick fix would be defining the nodata values on the raster, that should get the model running.

Cheers,

Doug

Hi @dcdenu4,

Thank you for the advice. I have looked through all the raster data used for the model and I had one value in my watershed and one in the soil erodibility raster which were blank. However, even after providing the relevant values, I still get the same error.

Are the input rasters supposed to be integer values or do floating points work too?
How important is it that the input datasets overlap correctly? Although I am not getting any boundary errors, some of the datasets expand over a larger spatial scale than others. Would this be an issue?

InVEST-Sediment-Delivery-Ratio-log-2022-02-14–09_50_32.txt (92.6 KB)

Best,
Charlie

Update: I tried with integer rasters and an equal spatial scale and have made sure that here are no empty values in the important attributes. Now I get Error: encountered ‘0’ , there are 0 values but they are intended to be 0. I have checked other posts concerning this error, but the solutions are not applicable.

If it would help I can also share my files that I have been using.

InVEST-Sediment-Delivery-Ratio-log-2022-02-14–12_48_00.txt (120.1 KB)

Yes, I think this will be necessary. It’s not obvious how that latest KeyError could have happened or how to avoid it.

The model should work with either. But certainly for a categorical raster like an LULC, integer makes a lot more sense. For soil erodibility, float makes sense.

The first thing the model does is align the extents and cell sizes of all the raster inputs, using the DEM as the basis for alignment. So they need not be perfect beforehand, but it never hurts to do the alignment yourself if you’re inclined.

I think Doug is offline, I’m happy to take a look at your input data if you can share a google drive link, or similar. If you like, you can use the File > Save as > Datastack Type: Data Archive to compress all the input data.

Thanks,

Hello @dave,

Thanks for the feedback! I have attached all the input files used for the latest run of the model. Some of the rasters have other datasets in their attribute tables, so it isn’t just the InVEST relevant points.

I am away this week and will be back next Monday. You can get in touch with me here if you may need more or have a new solution.

Best,
Charlie

https://drive.google.com/drive/folders/1r5DwBLGaUPhukgLLd_on2yR4jhVYCcsr?usp=sharing

@CTXBrabbs , thanks for the data. This is probably enough to debug the issue, but if you’re still online, please update the Watersheds layer that you shared. It only includes a shp file, and a complete shapefile will have at least 3 or 4 separate files with different extensions and the same basename. All are needed for a functional shapefile. Thanks,

Hi @CTXBrabbs , it looks like there’s a small error in the biophysical table input. In the header row, lucode and Description should be switched so that the lucode column contains the simple integer codes. Your table looks like this:

Description;lucode;usle_c;usle_p
0;Class1_Prosopis;0.35;0
1;Class2_Acacia_Tort;0.38;0
...

Let us know if that solves the problem!

1 Like

Hello @dave,

Thank you for the help, switching the lucode and Descriptions around in the biophysical table has solved the the issue!

Thanks again,
Charlie

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.