Seasonal Water Yield KeyError


I am getting KeyError 331298. Does anyone know what this means?

Thank you.

InVEST-Seasonal-Water-Yield-log-2019-06-16–13_50_33.txt (149.7 KB)

Hi @K_Muhammed -

KeyErrors usually happen when there is a Value in the land use/land cover map that does not appear in the biophysical table. Does the land use map have a value of 331298? If so, then it must have a row in the biophysical table, with Kc and CN values assigned to it.

If the land use map does not have this value, then see if the NoData value is set to 331298. People have reported (mostly on the old forum) that the models sometimes give an error on the NoData value, and if you add that value to the biophysical table, and give Kc values of 0 and CN values of 1 (since I’m not sure it can handle 0 values), the error goes away (and it won’t matter for calculations, since these are NoData pixels.)

One other thing I’d recommend is using the latest InVEST (3.7.0).

~ Stacie

Thank you for the response.

The NoData value for my LULC map is 255 and I added that to the biophysical table with 0s for the Kc values and 1s for the CN values and I got the same KeyError. I also tried adding 331298 to the table and received the same error.

Have you also confirmed that you do not have an LULC class Value of 331298 in your raster?

If that value is not in your LULC raster, and the problem is still happening with InVEST 3.7.0, you can send me your data and I’ll check it out.

~ Stacie

I did not see a value of 331298 in the raster.

I installed 3.7.0 and got the same error.
InVEST-Seasonal-Water-Yield-log-2019-06-17–13_17_05.txt (9.6 KB)

I will email the data to you.

I wasn’t able to email the data or upload it directly here, so here is a link to a Google Drive folder.

Thanks for sending your input data. I think the error is caused by the hydrologic soil group raster (Soil2.tif). The values in this raster need to be only the integers 1-4, which correspond to hydrologic soil groups A-D. But the values in Soil2.tif are the MUKEY values. Please see the User Guide Data Needs section for details on the requirements for the inputs.

Also, the spatial data is in a geographic coordinate system (GCS_WGS_1984), but they all need to be in the same projected coordinate system for the model to produce correct results.

~ Stacie

I’ll make the adjustments to see if it works.

Thank you so much.