Riverscapes / pyBRAT

pyBRAT - Beaver Restoration Assessment Tool (Python)
http://brat.riverscapes.xyz
GNU General Public License v3.0
10 stars 10 forks source link

Expanding the capabilities of BRAT to incorporate the Beaver Dam Water Storage(BDWS) #89

Closed MatthewMeier closed 5 years ago

MatthewMeier commented 6 years ago

The concept of using this code that was created by Konrad Hafen(a former graduate student of the ETAL group at USU advised by Joseph Wheaton @joewheaton ) was to construct a model that would use the model outputs from BRAT to predict water storage. Running the tool on the beaver dam counts of ground truthed/google earth censused and BRAT model outputs would provide a valuable optional comparison. This addition to BRAT is useful for water storage concerns in arid and changing climates of managers and land owners. Here are the links to the code and the documentation that Konrad has constructed regarding how to run the BDWS scripts. He also gives an example of the input data for a singular watershed and a batch of watersheds in tutorial 1 and 2. forwarded email from Konrad below...

FYI. This is a python version that does not depend on arcpy. I think this is at a point someone from the lab should be able to run it. Surface storage should be pretty straightforward to run and only requires gdal and numpy. Getting setup to run groundwater storage takes a little more effort, but is still pretty simple (coming from the guy who developed it, so who really knows).

Code is available on github. https://github.com/konradhafen/beaver-dam-water-storage

There is even a documentation website (which probably still has a lot of typos). https://konradhafen.github.io/beaver-dam-water-storage/

Still working on spiffing up the documentation (hoping to get in more images and videos), and I'm sure there are still bugs in the code. But I have a couple of tutorials included with the code that should work.

If any questions, bugs or issues come up let me know and I'll try to help out.


I have also included my own documentation of the possible bottle neck points that I have seen working through his tool, paper, documentation and speaking with Konrad over the phone in that attachment below. Future developement of this tool will be conducted by the ETAL group @banderson1618 @wally-mac @bangen Matthew Meier BDWS update.docx

banderson1618 commented 6 years ago

The link to the Github repository with the code is giving me a 404. I think you assigned a different link to it. Here's a link that works:

https://github.com/konradhafen/beaver-dam-water-storage

banderson1618 commented 6 years ago

@joewheaton, @wally-mac, are we planning to implement this as another part of pyBRAT, or as its own tool?

wally-mac commented 6 years ago

I see it as a option within the pyBRAT tool.

banderson1618 commented 6 years ago

I have some stuff implemented, but I'm running into memory errors a lot. I'm experimenting to see what the limits are of it.

wally-mac commented 6 years ago

Contact Konrad I bet he has insights on this.

MatthewMeier commented 6 years ago

@banderson1618 what is the stage of this? Is it operational or still running into memory errors?

banderson1618 commented 6 years ago

It's operational for the inputs that worked in Konrad's tutorial. I don't think he ever designed it to run for HUC8s, which is where I was having memory errors. I got it to run on a HUC 10, but it's possible that there could be problems there as well.

MatthewMeier commented 6 years ago

Yes that is correct that he didn't intend for it to be ran on a HUC8 all at once but to be broken down into smaller pieces. However you are able to run multiple smaller HUCs at once. See his second tutorial where he runs 2-3 at once. I remember that he did batch process his data and it took a while but worked.

banderson1618 commented 6 years ago

@MatthewMeier the code actually wouldn't work until just now. I had a path to a local file that I forgot to take out until just now. If you download the master branch, it should work fine, though.

MatthewMeier commented 6 years ago

@banderson1618 That is great! I know that there was a hangup with generating some of the inputs. I do not know if this is the next step for you but is there any way to generate the input rasters from gsurgo data for the areas that you are concerned about. This is one of the major hangups with running the script. You are basically taking some of the fields that are in gsurgo data and transforming it into a raster file.

banderson1618 commented 6 years ago

I'm honestly not certain about what sort of editing the inputs need. We should talk some time about what your workflow is, and what steps you think can be automated. You could do a video, if that would be more convenient, too. I'm available 9-5 most days, so just let me know.

MatthewMeier commented 6 years ago

Hey @banderson1618
Here is a video to describe what can be done with some of the https://youtu.be/ot6S4YquFGQ inputs. give me a call if you have questions.

banderson1618 commented 6 years ago

@MatthewMeier

I can automatically clip the inputs to the valley bottom fairly easily. Would that be helpful?

I'm still not certain how to use the MUKEY to create the fc.tif, Ksat.tif, or Kv.tif files. Should I talk to Konrad about this?

I'm also not seeing where things like the water table depth are defined in the script. It seems like they aren't defined in the run.py folder. Do you know where they are defined?

MatthewMeier commented 6 years ago

@banderson1618

I would contact Konrad about this he will have the best idea of how to use the MUKEY (there should be a table that you can reference somewhere and use to create the new rasters using that and the old one. Also he would be good to ask where the water depth is in the code.

wally-mac commented 6 years ago

@banderson1618

have you been in contact with Konrad?

wally-mac commented 6 years ago

@banderson1618, what is the current status of this issue?

banderson1618 commented 6 years ago

I have not been in contact with Konrad. Unless something pressing comes up, I'll focus on this as my priority after I come back from vacation on August 1st.

ssuplick commented 6 years ago

Hello - sorry to bother you all once again. Briefly @banderson1618 @MatthewMeier I was curious about the status of this? The scripts look like they should be ready to go. But I wanted to confirm that a HUC-8 can be processed before I do a run through (waiting on administrator approval for GDAL/OGR install). Or if will I need to break my prepared data up into HUC-12s and batch process these smaller watersheds? Any bugs or output problems I should be aware of before using?

I should be speaking with Konrad on Thursday. If you've been trying to get in touch with him recently about anything that would be appropriate for me to inquire about, feel free to let me know, and I'll ask.

MatthewMeier commented 5 years ago

@ssuplick if your looking through the conversation this is where we are at... @banderson1618 has converted the BDWS script that Konrad has created into our python script and the master tool download. I would break it into huc 12s because when I have spoken with Konrad it just runs a lot faster that way. Also the tool does have an option for batch processing. The main hangup is that we may or may not be working on in the near future. Is an user friendly tool that will convert a soils table to rasters that are used for the inputs for the tool. Konrad created a c++ script for this but we have not gotten to that yet.

ssuplick commented 5 years ago

@MatthewMeier thank you for the helpful update! To clarify a couple things: 1. Future work. You may or may not be working on the BDWS toolbox in the future (because funding, priorities, etc.)? 2. Soil water data. If I've already produced several rasters for the soil water variables for the HUC-8 valley bottom, with modified attribute table values (i.e. changed -9999 or values to average or median of available valley bottom KSAT/KV/frac values), would it be possible to clip this to the HUC-12 boundaries and use them as inputs? Or would you recommend just sticking to whatever the BDWS script tool asks for?