Riverscapes / pyBRAT

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

Error creating BRAT Conservation and Restoration Model #115

Closed kbartelt closed 6 years ago

kbartelt commented 6 years ago

@banderson1618 @bangen I am attempting to complete a provisional run for Tamales-Drake Bays (18050005) for #97 and am getting the following error during step 7. Has anyone come across this error before/ have suggestions for fixing it?

image

My thoughts for potential issues:

The files I am using are here: https://usu.box.com/s/3y0ytuxn9wx2lgd29g78dj6lyyz9va8z

Thanks in advance for the help!

banderson1618 commented 6 years ago

The program is expecting the input to have all of the following fields: "oCC_EX", "oCC_PT", "oPC_Score", "iPC_ModLU", and "iPC_HighLU"

"oCC_EX" and "oCC_PT" are created in Step 5: BRAT Combined Dam Capacity Model. If one of them are missing, I'd advise running that step again.

"oPC_Score" is created during Step 6: BRAT Conflict Potential. If this field is missing, I'd advise running that step again.

"iPC_ModLU" and "iPC_HighLU" are created in Step 2: BRAT Table. If they're missing, my guess is that you ran BRAT Table without giving it a land use raster. It's an optional input, but apparently something later on relies on it, so maybe we should make it required. Something to think about in the future.

@kbartelt, can you let me know which of these is missing, and if so, if running it again fixed it? It's possible that something went wrong somehow in these steps. I haven't seen it happen before, but we've been discovering all sorts of new bugs this last week, so it wouldn't surprise me.

kbartelt commented 6 years ago

thank you @banderson1618. My input file was missing "iPC_ModLU" and "iPC_HighLU". I re-ran Step 2:BRAT Table and made sure to include the LANDFIRE EVT as my land use raster but these 2 fields were still not created.

When I compare my LANDFIRE raster with one for a different watershed, the only column missing is CODE. Is this a field I need to enter manually like with VEG_CODE, LU_CODE, and LUI_Class?

banderson1618 commented 6 years ago

No, the "CODE" field shouldn't matter. Do you have any other iPC attributes in the output? I'm running the dataset you linked to see if I get the same problem, and I'll report back if I figure out what's wrong.

kbartelt commented 6 years ago

Okay sounds good. Yes, there is iPC_RoadX, iPC_RoadAd, iPC_Canal, and iPC_LU.

banderson1618 commented 6 years ago

I think I found the problem. Change the field named "LUI_Class" to "LUI_CLASS", and that should work. Apparently, the if condition is case sensitive. Let me know if it works.

banderson1618 commented 6 years ago

The reverse may actually be the problem (so, change "LUI_CLASS" to "LUI_Class"). I'm working on a fix that will make it no longer case sensitive, but until then, this is a quick fix.

kbartelt commented 6 years ago

Changing the field to Class instead of CLASS worked, thanks!

kbartelt commented 6 years ago

@banderson1618 something to note- the instructions on the BRAT tutorial page use LUI_CLASS instead of LUI_Class which resulted in that error above! This may not matter if you are changing the code but I wanted to let you know. Thanks!

http://brat.riverscapes.xyz/Documentation/Tutorials/StepByStep/2-Preprocessing.html

banderson1618 commented 6 years ago

The documentation for pyBRAT isn't the best, I admit. I appreciate you pointing out places where it needs improvement, even though it shouldn't matter now.