Traceback (most recent call last): File "C:\Users\Ellen\Documents\ArcGIS\laharz_py_example\laharz_py_example\laharz_py\distal_inundation.py", line 1621, in <module> main(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]) File "C:\Users\Ellen\Documents\ArcGIS\laharz_py_example\laharz_py_example\laharz_py\distal_inundation.py", line 1319, in main planvals,B = CalcCrossSection(sectn,currFlowDir,currRow,currCol,planvals,xsectAreaList,B) File "C:\Users\Ellen\Documents\ArcGIS\laharz_py_example\laharz_py_example\laharz_py\distal_inundation.py", line 771, in CalcCrossSection cellleftelev = A[cellleftx,celllefty] UnboundLocalError: local variable 'cellleftx' referenced before assignment Failed to execute (laharzdistalzones.py). Failed at Mon Oct 05 01:05:08 2015 (Elapsed Time: 1 hours 38 minutes 32 seconds)
I am trying to run the Laharz_py program and keep on receiving this error message when trying to run the models. I know next to nothing about python scripting. Would anyone please be able to explain, (preferably in layman's terms, I really am clueless,) what this means and how I might fix it.
Thanks
Solved! Go to Solution.
Thanks all for the help. Found the solution to it. Basically I was being dim, my digital elevation model didn't extend far enough for the the high volume inputs. That was the missing input value.
Ellen Wildig:
UnboundLocalError: local variable 'cellleftx' referenced before assignment
Hi Ellen,
This error suggests that the tool is trying to use a value from a variable that hasn't been created yet in the script - i.e. it's trying to use a value that it doesn't know about yet.
Without seeing the actual python script it will be difficult to suggest a solution, or what is causing the issue. It may have expected some kind of input when you ran the model, and may be failing if it didn't get the required input values.
Cheers,
Mike.
Ellen, you can following the instructions Posting Code blocks in the new GeoNet or attach the .py file so others can take a look.
As Mike mentioned, it sounds like a variable is not being defined. Since you are not familiar with Python, I'm assuming that you are just trying to run the script, possibly at a command window? Or is it in a toolbox/button? Or model builder (looks like a graphic-flow chart). Depending on how you are running the command could also control how/where the missing variable is created and/or assigned a value.
Tthere are many here willing to help....just more info is needed.
Did you by chance move one of you input model parameters around? Perhaps to reorganize it so it "looked better"? If so, you may have moved one of the parameters out of order. Check your model's parameter order
Ellen, you should contact the developers of the software. I'm sure they will be able to help you out.
Thanks all for the help. Found the solution to it. Basically I was being dim, my digital elevation model didn't extend far enough for the the high volume inputs. That was the missing input value.
Hi Ellen, it's good you were able to resolve your issue. Just for my understanding of your solution, are you saying that your extent for your DEM wasn't large enough, that is, it didn't overlap the extent area if the other inputs fully?
Also, don't forget to mark any of the comments that were helpful to you, and you answer as correct so the question can be closed.
Yes exactly that. Once the volume of the input lahar was high enough the modeled output extended farther than DEM in place and the model would fail