Annual Water Yield: Key encountered: 0

InVEST-Annual-Water-Yield-log-2021-12-03–11_21_59.txt (33.9 KB)

Hello,
i’m trying to run the Annual Water Yield Model at the moment. If I start it, it runs for a while and stops and gives the error: KeyError encountered: 0
I already looked through the forum and tried different strategies, like for example this one:

I also checked the CSV-table for blank lines.
But unfortunately nothing seemed to work so far. Is there anything else I can do?

Hi @Felix,

Thanks for posting to the forums and welcome! Thanks for including the log file and doing some searching for possible solutions. This KeyError is a bit different than most we see and I have a hunch of what is causing it. Would you be willing to share your input data for the model with me via Google Drive, email ( ddenu @ stanford . edu ) or another cloud sharing option? It would help in debugging the issue.

Cheers,

Doug

Hi Doug, thanks for the quick response! I shared the data with you on google drive.
Best regards
Felix

Hi @Felix , I know Doug may be offline for a couple days so I took a look at your log and I think this may be a bug in the model. I’m able to reproduce this error whenever I use a geopackage instead of a shapefile for the watersheds layer. This is because shapefile FIDs are indexed starting from 0 and gpkg FIDs start from 1. And the model is trying to join stats indexed by the gpkg FIDs to an output layer shapefile.

Anyway, we’ll work on fixing this bug and in the meantime if you convert your watershed gpkg to a shapefile, the model should complete.

Best,

4 Likes

Hi Dave,
i will try that, thank you very much for your help!
Best regards
Felix

Edit: I tried to convert the watershed from a gpkg to a shape-file and was able to complete the model, thanks a lot for your help again!

3 Likes

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