UnboundLocalError running PyVelest.py
Closed this issue · 4 comments
python version: 2.7.14
OS system: Ubuntu 14.04
Hello, wonderful code, very useful to run velest. I try to run your code but when I run PyVelest.py with your data set, the following error is generated, I appreciate your help. Kind regards:
+++ Enter Project Name: <Please use the name of velocity model you're using>
initial.mod
+++ Read VELEST input parameters ...
+++ Write VELEST control file ...
+++ Plotting data statistics ...
+++ Make synthetic velocity models ...
+++ Run VELEST ...
--- 50 synthetic model(s) found ...
--- Run for synthetic model: 1
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 2
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 3
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 4
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 5
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 6
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 7
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 8
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 9
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 10
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 11
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 12
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 13
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 14
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 15
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 16
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 17
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 18
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 19
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 20
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 21
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 22
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 23
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 24
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 25
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 26
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 27
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 28
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 29
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 30
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 31
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 32
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 33
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 34
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 35
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 36
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 37
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 38
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 39
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 40
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 41
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 42
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 43
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 44
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 45
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 46
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 47
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 48
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 49
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
--- Run for synthetic model: 50
STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION)
+++ Analyse VELEST outputs ...
Traceback (most recent call last):
File "PyVelest.py", line 3135, in <module>
start.analyse_velest_res()
File "PyVelest.py", line 767, in analyse_velest_res
self.svel['P'][sm].append(p_vel)
UnboundLocalError: local variable 'p_vel' referenced before assignment
python version: 2.7.14
OS system: Ubuntu 14.04Hello, wonderful code, very useful to run velest. I try to run your code but when I run PyVelest.py with your data set, the following error is generated, I appreciate your help. Kind regards:
+++ Enter Project Name: <Please use the name of velocity model you're using> initial.mod +++ Read VELEST input parameters ... +++ Write VELEST control file ... +++ Plotting data statistics ... +++ Make synthetic velocity models ... +++ Run VELEST ... --- 50 synthetic model(s) found ... --- Run for synthetic model: 1 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 2 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 3 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 4 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 5 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 6 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 7 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 8 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 9 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 10 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 11 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 12 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 13 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 14 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 15 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 16 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 17 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 18 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 19 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 20 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 21 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 22 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 23 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 24 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 25 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 26 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 27 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 28 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 29 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 30 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 31 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 32 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 33 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 34 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 35 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 36 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 37 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 38 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 39 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 40 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 41 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 42 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 43 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 44 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 45 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 46 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 47 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 48 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 49 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 50 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) +++ Analyse VELEST outputs ... Traceback (most recent call last): File "PyVelest.py", line 3135, in <module> start.analyse_velest_res() File "PyVelest.py", line 767, in analyse_velest_res self.svel['P'][sm].append(p_vel) UnboundLocalError: local variable 'p_vel' referenced before assignment
python version: 2.7.14
OS system: Ubuntu 14.04Hello, wonderful code, very useful to run velest. I try to run your code but when I run PyVelest.py with your data set, the following error is generated, I appreciate your help. Kind regards:
+++ Enter Project Name: <Please use the name of velocity model you're using> initial.mod +++ Read VELEST input parameters ... +++ Write VELEST control file ... +++ Plotting data statistics ... +++ Make synthetic velocity models ... +++ Run VELEST ... --- 50 synthetic model(s) found ... --- Run for synthetic model: 1 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 2 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 3 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 4 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 5 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 6 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 7 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 8 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 9 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 10 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 11 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 12 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 13 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 14 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 15 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 16 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 17 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 18 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 19 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 20 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 21 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 22 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 23 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 24 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 25 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 26 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 27 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 28 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 29 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 30 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 31 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 32 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 33 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 34 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 35 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 36 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 37 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 38 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 39 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 40 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 41 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 42 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 43 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 44 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 45 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 46 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 47 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 48 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 49 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) --- Run for synthetic model: 50 STOP ...end...(VELEST was running in SINGLE-EVENT-OPTION) +++ Analyse VELEST outputs ... Traceback (most recent call last): File "PyVelest.py", line 3135, in <module> start.analyse_velest_res() File "PyVelest.py", line 767, in analyse_velest_res self.svel['P'][sm].append(p_vel) UnboundLocalError: local variable 'p_vel' referenced before assignment
In the SEISAN manual says that
VELEST skips events without phase readings and therefore the number of events read by VELEST will be different from the number given in the velest.cmn file. If this is the case VELEST stops with the message STOP: ...end...(VELEST was running with the SINGLEEVENT-OPTION). Events without phase readings will not be listed in the invers.out file, and should be deleted from the input file.
When running the program with a dataset of its own, it runs without problems, and when the statistics are plotted, the following error occurs:
...
--- Run for synthetic model: 49
--- Run for synthetic model: 50
+++ Analyse VELEST outputs ...
+++ Plotting data statistics ...
Traceback (most recent call last):
File "PyVelest.py", line 3136, in <module>
start.analyse_velest_res()
File "PyVelest.py", line 1299, in analyse_velest_res
ax6.hist([orms,mrms],color=['r','b'],label=['Initial','Relocated'], histtype='bar',bins=bns, rwidth=0.8, edgecolor='gray')
File "/home/daniel/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1855, in inner
return func(ax, *args, **kwargs)
File "/home/daniel/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 6504, in hist
raise ValueError("color kwarg must have one color per dataset")
ValueError: color kwarg must have one color per dataset
My matplotlib version is: 2.2.3
Dear Daniel,
I am so sorry for my long late, I hope your problem with code resolved, but that was a bug and i solved it now. Thanks for using and reporting :).
Regards
Hii Daniel,
how did you solve this problem:
...
--- Run for synthetic model: 49
--- Run for synthetic model: 50
+++ Analyse VELEST outputs ...
+++ Plotting data statistics ...
Traceback (most recent call last):
File "PyVelest.py", line 3136, in
start.analyse_velest_res()
File "PyVelest.py", line 1299, in analyse_velest_res
ax6.hist([orms,mrms],color=['r','b'],label=['Initial','Relocated'], histtype='bar',bins=bns, rwidth=0.8, edgecolor='gray')
File "/home/daniel/anaconda2/lib/python2.7/site-packages/matplotlib/init.py", line 1855, in inner
return func(ax, *args, **kwargs)
File "/home/daniel/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 6504, in hist
raise ValueError("color kwarg must have one color per dataset")
ValueError: color kwarg must have one color per dataset