Seasonal water yield model keyerror 34

Dear Users and Delevopers,

Running the SWYD I encountered the KeyError: 34
Any advice on what this could be and how to solve it would be appreciated.
->Attached the logfile
InVEST-Seasonal-Water-Yield-log-2019-09-30–13_28_26.txt (11.0 KB)

Forgot to mention the version: 3.7

Hi @felipebenra -

Thanks for including your log file. KeyErrors are common, and the first thing I suggest is to search this forum for recommendations on how to troubleshoot it. If none of these suggestions work, let us know and we’ll help further.

~ Stacie

@swolny thanks for your reply! Indeed I have checked for answers regarding this keyerror 34 but I didn’t found anything specific. According to the log file (and what I can understand from it) it should be something related to the generation of the Curve Number (CN) raster. I checked the biophysical table and the CN seems ok (integer with no 0). I hope you can give me some guidance on this issue, otherwise I can upload my data.

Thanks a lot!

Hi @felipebenra -

Ok, so you’ve checked that there is not a value of 34 in your land cover raster that is not included in the biophysical table. Since this is the curve number, which is linked to the hydrologic soil group raster, also check that there is not a value of 34 in your soil group raster. The values of soil group for this model can only be 1,2,3 and 4, but sometimes there are other values assigned to soil groups. If this is what’s happening, you’ll need to reassign the soil group raster values of 34 to one of the allowed classes of 1-4. If this isn’t what’s happening, then please do provide your data and I’ll check it out.

~ Stacie


Indeed it was a problem with the hydrological soil group raster(.tif). To solve the problem you mentioned I just added another value column, with new values (just 1, 2, 3 and 4), but apparently the system just recognizes 1 value column for the raster, and was working with the original value column were I had the old incorrect values ( the value 34 among them).

I just reclassified the raster into the correct values and then the model run perfectly.

Thanks for your help.

Great! Thanks for letting us know.

~ Stacie