This forum is shutting down! Please post new discussions at community.naturalcapitalproject.org

How to get threshold flow accumulation to input to run sdr model ?

I want to run sdr model to my study area (a country with an area 881,913 km2). How I can get/find threshold flow accumulation? please help 

Comments

  • swolnyswolny Member, NatCap Staff

    To find the right threshold flow accumulation(TFA)  for your area, compare the "stream.tif" output from the model with a real-world stream map. Larger values of TFA will create streams with fewer tributaries, smaller values of TFA will create more tributaries. Adjust the TFA until the stream output by the model come as close as possible to the real-world stream map. Usually they are not an exact match, but come as close as you can. You can also use the InVEST tool RouteDEM to create streams, which might make the process of finding TFA a bit faster since you're not running the whole SDR model, just processing the DEM.

    ~ Stacie
  • Hi @swolny

    Thank you for the response. The RouteDEM requires Threshold flow accumulation limit (input), how to adjust it?




    Regards,  


  • Hi @swolny

    My second question is, the Dem for this RouteDEM be a filled dem or unfilled ?
  • Hi @swolny

    I run the SDR model but encountered an error. I am sending the Log file please check.


    Regards, 
  • swolnyswolny Member, NatCap Staff
    Hi @Shedayi -

    A few other people have gotten this same error - if you search the forum you will find their posts. One them was caused by there being negative numbers in the erodibility (K) input raster, so check yours to make sure there are no negative values. If there aren't, you could send me your input data and I'll see if I can replicate the problem. A good way to do this is through the SDR user interface window: 
    File -> Save As -> Datastack type = Data archive

    ~ Stacie
  • Hi @swolny

    I am sending the input data to you. Please check. In the initial run, some output files were missing and some were found but without statistical calculation and having minimum value as -1.#INF



  • ShedayiShedayi Member
    edited January 8
    and the output raster is not showing erosion/sedimentation values for all the pixels rather showing all values concentarted to one region/point.......
    Post edited by Shedayi on
  • The model run finished without all the final output files/results........


  • Hi @swolny

    Did you receive the input file folder, I sent to you via email as per your direction. 




     
  • swolnyswolny Member, NatCap Staff
    Hi @Shedayi -

    Sorry, we have been out on Stanford's holiday break, and are just catching up now. I do not see an email with the input, so please resend to swolny at stanford.edu. Thanks.

    ~ Stacie
  • swolnyswolny Member, NatCap Staff
    Thank you for sending your data. The first time I tested it with InVEST 3.5.0 I had the same error "RuntimeError: stats_worker_thread.join() timed out". So I searched the forum and found this post, where someone had the same error, and I tried running the model with the development version of InVEST that Rich mentioned in this post. This time the error did not happen, but a different one did (KeyError 0 - see the attached log file.) Since this happened at the end of "processing polygon sets" (see the log file), I looked more closely at your watershed shapefile, since it is the only polygon layer used by the model. This shapefile has over 29,000 small polygons, most of which are not shaped like hydrological units (or sub-watersheds.) So I did the experiment of creating just one watershed that covers the whole area of interest, re-ran the model with the development version of InVEST, and it completed successfully, with reasonable values for USLE, sed_export and the watershed shapefile results.

    It would be good to re-think your watershed shapefile, and enter either one large watershed, if you are evaluating a dam or something at the outlet of the area of interest, or generate smaller sub-watersheds using the tool DelineateIt or a GIS watershed generation tool, so there are fewer of them and they are based on the DEM. Also, the area of interest does not look like a complete watershed or set of watersheds, it is cut off linearly in several places. This also indicates that this area is not hydrologically complete, so you will not be capturing all of the sediment production and retention correctly, since some of the sub-basin area is missing.

    ~ Stacie
  • Hi @swolny

    Thank you so much for identifying the error. I developed a new watershed file using the hydrology tool. This time I made three watersheds. Run the sdr gain but again gave an error showing; ValueError encountered: invalid literal float0: 1000,000. 
    Please check the log file and further guide me to fix the error. 

    Thank you and
    Regards,   
  • swolnyswolny Member, NatCap Staff
    That error is because you provided a Threshold Flow Accumulation value of "1000,000" but the model requires an integer value with no commas or periods such as "1000".

    ~ Stacie
  • Hi @swolny

    That error was fixed and run again it gave another error almost at the last stage. Signalling stats worker to terminate. Running timeout. 

     WARNING  C:\INVEST~1.0_X\INVEST~1\natcap\invest\sdr.py:460: RuntimeWarning: invalid value encountered in multiply.

    Log file attached...

    Regards, 

  • swolnyswolny Member, NatCap Staff
    That's the same error that I mentioned in my previous response, where I searched the forum and found a post with the same problem that was fixed by using a development version. Please see my previous response for a link to that post and give it a try.

    ~ Stacie

  • Hi @swolny

    Okay, which development version would be better to use in window 10 to get these results ?




    Regards, 


  • Hi @swolny

    I installed the development version 3.5.0.post762+hfcd354264ad3 and run the sdr model again it gave the same error as it gave previously. Now, re delineate watershed and will develop one watershed (one polygon) and check again. Let's see. 

    The log file is attached... 
  • Hi @swolny

    I run the sdr model again with one polygon watershed in the development version 3.5.0.post762+hfcd354264ad3 , this time again gave an error encountered such as 
    RuntimeError encountered: Stats_Worker_Thread.join0 time out 

    Attached is the log file  
  • swolnyswolny Member, NatCap Staff
    Hm. The development version I used that did not give that error is 
    InVEST 3.5.0.post709+hbc41e54bcc6c

    That's the problem with development versions, I guess! Try that one, linked in the forum post above and see what happens. If it still gives that error, I'll have to punt to the software team.

    ~ Stacie
  • Hi @swolny,

    I used the developmental version 3.5.0.post762+hfcd354264ad3  and it run successfully. Thank you for being a great help. One another question, I was searching for any sample data for sdr. Would you please guide me to find it and to use it to test the model. 

    Thank you and regards,  
  • swolnyswolny Member, NatCap Staff
    Hi @Shedayi -

    When you install InVEST, there is an option to install sample data. You can select the Freshwater Datasets. The sample data is still a bit confusing, but if you look in Base_data/Freshwater you'll find inputs for SDR.


    ~ Stacie
  • @swolny

    Thank you and will check 

    Regards
  • Hi, @swolny

    I saw the sample folder containing the input files. The input files for sdr are fine, but there is not any information about the other parameters like (1) threshold flow accumulation (2) k, (3) ICo, and (4) max sdr value. 

    The defaults values for k (2), ICo (0.5), max sdr (0.8) can be used (if no specific values available), but there is no information about the threshold flow accumulation. Would you please let me know the exact value for threshold flow accumulation (the number of upstream cells that flow into a cell before entering a stream. 

    Thank you and best regards, 

    Arshad 


  • swolnyswolny Member, NatCap Staff
    Hi Arshad -

    At the beginning of this thread, we started talking about how to determine the threshold flow accumulation, so you can use this method for your own work. There is no exact recommendation for this value, but you can start with a value of 1000 and adjust it from there, based on the stream network that comes out of the model. 1000 should be fine for the sample data too.

    ~ Stacie

Sign In or Register to comment.