This forum is shutting down! Please post new discussions at

Wate yield - error encounteed:'Kc'

Hi again,

I exported all of my files into tiffs and the model ran until it ran into the KeyError encountered:'Kc'.

I went back and changed values I had questions about and still ran into this error message. Please find my run log and Biophysical table attached. Can you take a look at it and help me figure out what's wrong ?

Thanks !



  • Looks like only my log file showed up in the previous post here is my biophysical table
  • swolnyswolny Member, NatCap Staff
    Hi Hildegaard -

    The logfile shows that you're giving this as the input to your biophysical table: LAwsBioFizztable.txt.xml. But the model requires a CSV file as input. Try exporting your LAwsBioFizztable.txt to .csv and try again.

    Since this has come up twice now, it might be useful for you to change your Windows settings so that it shows file extensions in your file explorer. Otherwise, Explorer makes it look like you're entering LAwsBioFizztable.txt, but you're actually entering LAwsBioFizztable.txt.xml, because it's not showing you the .xml part of the filename. Same with the .tiff issue previously. I'm not sure which version of Windows you're using, but here's an article about how to do it in Win 7 and earlier, and this article for Win 10.

    ~ Stacie

  • Thanks Stacie, here's my next question.

    Watershed Shape files I downloaded some nice watershed and sub watershed shape files that I planned on using. Are the DelineateIT watershed shape files the only ones that work with the Water yield model ?

    The model doesn't recognize the downloaded watershed shapes and the projected shape files have a very large area field that the model doesn't like

    thanks for everything ! 

  • swolnyswolny Member, NatCap Staff
    You can use watershed shapefiles from anywhere, as long as they are polygons and have the ws_id field, and align properly with the hydrology produced by your DEM (or you'll get incorrect results when the model aggregates within the watersheds.) 

    From your logfile, I see this error:

    not recognised as a supported file format.'

    One thing that could be a problem is the folder name "Q2modeling,data,maps", the commas are often a problem. Try renaming it to, say, "Q2_modeling_data_maps" and see if that helps.

    If it doesn't help, then there's something funky about the shapefile itself, and I can take a look at it if needed.

    ~ Stacie


  • Great thanks Stacie this is rally helpful.
    I'll rename the folder 
    Can I just add a field    ws_id  and assign numbers 1 thru 200 or so ?
    I was thinking of adding a a ws_id field and letting the HUC numbers be the ws_id

  • also what properties should the ws_is field have ?
  • swolnyswolny Member, NatCap Staff
    The numbers can be assigned however you like, but ws_id must be an integer field with unique values for each watershed. 

    For future reference, the User Guide Data Needs section lists all of the inputs to the models, including what properties are required.

    ~ Stacie

  • Hi Stacie,

    I modified my shape files to include only a few fields plus an ws_id field and I am still getting the null value shape file not a valid format error message. Please find attached my 2 shape files and the data stack from the run

  • here is my watershed shape file
  • My subwatershed shape file is too large to post even in compressed form
  • swolnyswolny Member, NatCap Staff
    You can try emailing it to me: swolny at Or post the zipfile on Google Drive, DropBox or someplace accessible like that and send me the link.

    ~ Stacie
  • anzejanzej Member
    edited March 2018
    Dear hildegaardl or swolny,

    I was wondering how you solved your 'Kc' problem. I am experiencing the same issue, however I cannot establish the issue - I made sure it was an .csv fine, but it still keeps sending me the error message.

    I hope someone can help me!

    Thank you.
    Post edited by anzej on
  • jdouglassjdouglass Administrator, NatCap Staff
    Hi @anzej, it looks like the table attached to your comment is tab-separated.  InVEST will only recognize CSVs that are comma-delimited.  Could you try re-exporting your table using commas as the column delimiter and see if that fixes the issue?
  • anzejanzej Member
    Hi, jdouglass, this is a .txt. export. I tried to upload the .csv file but the blog does not allow it. Is there any other way I can share my original file with you.

    Thank you for replying!
  • jdouglassjdouglass Administrator, NatCap Staff
    Sure, if you could email your table to jdouglass@stanford edu, I'll take a look.
  • anzejanzej Member
    It seems I resolved the issue. A colleague suggested to open it directly in the notepad and I found it was semi-colon sep. and not comma-sep. I used search-replace, open it in the Excel again and save it as .csv again. It worked out. It seems that saving it as .csv in Excel does not necessarily preclude it will be comma-sep. (it can also be semi-colon). I guess this could be related to Office settings?

    Well, your suggestion was actually the same :)

    Thank you for your reply!
  • swolnyswolny Member, NatCap Staff
    Hi @anzej -

    The version of Excel that I use (2010) has a specific option for Save As "CSV (comma delimited)" - that's the one I use for saving our biophysical tables.

    ~ Stacie
  • anzejanzej Member
    Thank you Stacie!
Sign In or Register to comment.