SDR model Keyerror 0

Dear all,

I got a problem in the processing of SDR application.
I recieved this message error 
File "pygeoprocessing\geoprocessing.pyc", line 949, in aggregate_raster_values_uri
KeyError: 0
Someone can help me?
Thank you

Comments

  • RichRich Administrator, NatCap Staff
    The entire log file would help a lot!  But without more info I'd guess either that there's a landcover type of "0" in your dataset, or it's a bug in the aggregation routine we fixed for byte rasters in a development version.

    Can you first check for lucodes of 0?  And if that doesn't work, install and try this version of rios: http://data.naturalcapitalproject.org/nightly-build/invest-forks/richpsharp/InVEST_richpsharpnull.post418-n3c2afdef7255_x86_Setup.exe

    And if that doesn't work can you send us your entire log file?
  • Kefi_TNKefi_TN Member
    edited September 2015

    Post edited by Kefi_TN on
  • Dear Mr Rich,

    Thank you for your clarification. I have followed your recommandations. 
    1- I dont have lucodes of 0
    2- I used the new version as you suggested and there is the same error. 
    Please have a look on the attached file.
    Thank you for your help
  • RichRich Administrator, NatCap Staff
    Strange, I can't figure out what might be going on there.  Can you dropbox me your sdr datastack to richsharp@stanford.edu so I can recreate it on my end?
  • Dear Mr Rich,
    I have just sent the datastack to your mailbox.
    Thank you for your help.

  • RichRich Administrator, NatCap Staff
    Hi Kefi, for reference I'm also posting here about your error.  

    The datastack you sent had a watersheds shapefile that was missing the "ws_id" field.  Normally InVEST won't even start the model without that field defined.  Rather the user interface with raise a red "X" on that field that reports that the "ws_id field is not defined".  I added that field to your watershed and was able to run the SDR model all the way through.

    Can you add a "ws_id" field and set an ID to 0 or something reasonable and try to re-run?  Otherwise, I'm unable to recreate your "KeyError 0" issue with the data you sent me.

  • Dear Mr Richard,

    Thank you for your help. The model is running correctly and I got interesting results compared to my field data.
    I have just a comment about the output map (sed_retention and sed_export). Some locations in the watershed are without data. What do you think ?
    Thank you,

    Kefi

  • RichRich Administrator, NatCap Staff
    Hi Kefi, can you pass some more information about locations in the watershed are without data?  If it's pixels that are missing, it might be a routing issue on a DEM that has hydrological pits in it.  If that's not your issue, posting a screenshot or more information will be helpful!
  • Dear Richard,

    Please find in attached the output without data.
    What do you think ?
    Thank you for your help.

    All the best,

  • RichRich Administrator, NatCap Staff
    That looks like the kind of output you get when you route with a DEM that has hydrological pits in it.  Did you fill your DEM first?
  • Dear Richard
    You are right. I have to fill the DEM at first. It is working Now.
    By the way, do you know the best approach for checking the accuracy of my results ?
    Thank you,

    Kefi
  • RichRich Administrator, NatCap Staff
    Hi Kefi, accuracy of results can be tricky.  Can you elaborate?  You want to validate against existing data perhaps?
  • Dear Mr. Richard,
    Yes, you are right. I am planning to compare the output of INVEST with the existing data.
    I have reservoir bathymetry data and I would like to check the estimation.
    What do you think ? 
    Thank you,
    Kefi
Sign In or Register to comment.