Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use nonlinloc with obspyck? #11

Open
megies opened this issue Oct 13, 2014 · 33 comments
Open

How to use nonlinloc with obspyck? #11

megies opened this issue Oct 13, 2014 · 33 comments
Labels

Comments

@megies
Copy link
Owner

megies commented Oct 13, 2014

Thanks, but now when running with NLloc there's an error message
(below). It may be related to NLloc's control and model files, but
it's not clear how these need to be setup for obspyck. Any
suggestions?


Traceback (most recent call last):
  File "./obspyck.py", line 433, in on_qToolButton_doNlloc_clicked
    self.doNLLoc()
  File "./obspyck.py", line 1910, in doNLLoc
    files = prog_dict['files']
KeyError: 'files'

try the following:

  • in your obspyck folder make a subdirectory "nlloc"
  • put your nonlinloc control file in that folder, naming it
    "locate_BY.nlloc"
  • put your nonlinloc travel time cubes (the *.hdr and *.buf files you
    generated with nonlinloc from your velocity models) in a subfolder
    of "nlloc" folder
  • make sure that in the control file the "LOCFILES" line looks like
    the following:

LOCFILES ./nlloc.obs NLLOC_OBS ./AAA/BBB ./nlloc

  • replace "AAA" with the name of the subfolder with the travel time
    cubes
  • replace "BBB" with the prefix of the travel time cube files
    (e.g. put "VERSION3" for cubes named like e.g.
    "VERSION3.P.UH1.time.buf", for a P travel time cube for station UH1)
  • start obspyck with option --pluginpath='/my/obspyck/folder' pointing
    it to the folder where your obspyck.py is with the "nlloc" subfolder.
Thanks for posting instructions on how to setup Obspyck with NLloc.
But ran into another issue. By default Obspyck seems to be looking
first for Hypo2000. Error message below.

Warning: SeisHub specific features will not work (e.g. 'send Event').
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/fdsn/wadl_parser.py:106:
UserWarning: The 'event' service at
'http://www.seismicportal.eu/fdsnws/event/1/' cannot deal with the following
required parameters: magnitudetype
They will not be available for any requests. Any attempt to use them will result
in an error.
  warnings.warn(msg)
Could not determine possible arrivals using obspy.fdsn/taup.
Problem while fetching events or determining theoretical phases: KeyError:
'coordinates'
Traceback (most recent call last):
  File "./obspyck.py", line 4015, in <module>
    main()
  File "./obspyck.py", line 4009, in main
    obspyck = ObsPyck(clients, streams, options, KEYS)
  File "./obspyck.py", line 200, in __init__
    self.tmp_dir = setup_external_programs(options)
  File "~/test/obspyck/obspyck/util.py", line 664, in setup_external_programs
    shutil.copytree(prog_srcpath, prog_tmpdir, symlinks=True)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
line 171, in copytree
    names = os.listdir(src)

OSError: [Errno 2] No such file or directory: '~/test/obspyck/obspyck/hyp_2000'

Please simply create empty hyp_2000 and focmec directories in your designated obspyck pluginpath directory.

@celsoa
Copy link

celsoa commented Oct 16, 2014

Ok I get as far as making picks with warning messages

Problem while fetching events or determining theoretical phases: KeyError: 'coordinates'
Warning: SeisHub specific features will not work (e.g. 'send Event').
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/obspy/fdsn/wadl_parser.py:106: UserWarning: The 'event' service at 'http://www.seismicportal.eu/fdsnws/event/1/' cannot deal with the following required parameters: magnitudetype
They will not be available for any requests. Any attempt to use them will result in an error.
  warnings.warn(msg)
Could not determine possible arrivals using obspy.fdsn/taup.

then after pressing "do NLloc" I get error below. Not sure if it's a problem with my NLloc setup. Any suggestions?

S-P time: 1.480
S-P time: 1.460
S-P time: 1.670
S-P time: 1.060
S-P time: 1.080
/var/folders/0l/zb190dp16njdsltrsx_1gbrm0000gn/T/obspyck-kXS3jr/nlloc/nlloc*
Phases for NLLoc:
sta1   ?    ?    ? P      ? 20111105 0315  1.1940 GAU  4.00e-01 -1.00e+00 -1.00e+00 -1.00e+00
sta2   ?    ?    ? P      ? 20111105 0315  0.8840 GAU  7.00e-02 -1.00e+00 -1.00e+00 -1.00e+00
sta3   ?    ?    ? P      ? 20111105 0314 57.9740 GAU  2.00e-02 -1.00e+00 -1.00e+00 -1.00e+00
sta1   ?    ?    ? S      ? 20111105 0315  2.6540 GAU  1.40e-01 -1.00e+00 -1.00e+00 -1.00e+00
sta2   ?    ?    ? S      ? 20111105 0315  2.5540 GAU  9.00e-02 -1.00e+00 -1.00e+00 -1.00e+00
sta3   ?    ?    ? S      ? 20111105 0314 59.0540 GAU  6.00e-02 -1.00e+00 -1.00e+00 -1.00e+00

Traceback (most recent call last):
  File "./obspyck.py", line 419, in on_qToolButton_doNlloc_clicked
    self.doNLLoc()
  File "./obspyck.py", line 1883, in doNLLoc
    (msg, err, returncode) = call(prog_dict, controlfilename)
  File "~/test/obspyck/obspyck/util.py", line 710, in tmp 
    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

@megies
Copy link
Owner Author

megies commented Oct 17, 2014

Huh, looks like you're on MAC. I remember there were problems with the checking when the subprocess is finished and the the program should continue. @jwassermann, is it working on MAC for you right now? Can you have a look into your util.py?

EDIT: To be more precise, these lines have sometimes made problems on MAC: https://github.com/megies/obspyck/blob/master/util.py#L711-L714 As I don't use MAC I never was able to perfectly fix that.. all I can say right now is that you could play around with those to change how the waiting for subprocess to finish is handled. Let me know how it goes, I hope @jwassermann is able to help out..

@megies
Copy link
Owner Author

megies commented Oct 17, 2014

@c546824, what you could do in the meantime is to check if the rest that comes after this problem works for you..
When you hit the "do nlloc" button and the above problem pops up you could..

  • try to hit the button a second time (maybe the output from the first click is available then)
  • go to the respective temp directory (don't know exactly where that would be for Mac.. on Linux its just /tmp/obspyck-...) and call NLLoc yourself (./NLLoc_64bit locate_UH.nlloc) and see if it generates output and then click again in the GUI to read the files..

@celsoa
Copy link

celsoa commented Oct 18, 2014

https://github.com/megies/obspyck/blob/master/util.py#L711-L714
as a check I put print statements there but they didn't print. it may not be getting that far?

try to hit the button a second time (maybe the output from the first click is available then)
repeats error message.

call NLLoc yourself
running NLLoc locate_BY.nlloc in mac tmp gives the error below. but then Nlloc says 0 locations completed so maybe it's the NLloc setup that's not working. I may have to check that...

NLLoc (NonLinLoc v6.00.0 18Mar2011) 
WARNING: LOCSEARCH OCT: OctTree max_num_nodes - init_num_cells (9600) < 10000: very few oct-tree subdivisions can be performed.
LOCGAUSS2:  SigmaTfraction: 0.010000  SigmaTmin: 0.050000  SigmaTmax: 2.000000
... Reading observation file ./nlloc.obs
Reading next set of observations (Files open: Tot:3 Buf:0 Hdr:0  Alloc: 0) ...
...end of observation file detected.
No more observation files.  1 events read,  0 events located,  0 locations completed.

@megies
Copy link
Owner Author

megies commented Oct 20, 2014

I may have to check that...

Yes, given that nlloc.obs (written by obspyck from the set picks) contains information on picks, nonlinloc should produce a location (if it finds the corresponding travel time cubes for the picks and if the control file is valid).

@AbeJones
Copy link

Thought i'd move my questions to this forum rather continue in private e-mails (I've been e-mailing you as Abraham Jones, Tobais).

I'm operating on a Linex machine and have been trying to run a provided sample location, but come across the same error as user c546824 once i've made picks and hit 'do NLLoc':

File "./obspyck.py", line 417, in on_qToolButton_doNlloc_clicked
  self.doNLLoc()
File "./obspyck.py", line 1884, in doNLLoc
  (msg, err, returncode) = call(prog_dict, controlfilename)
File "/home/abe/obspyck/util.py", line 711, in tmp
  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/home/abe/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
  errread, errwrite)
File "/home/abe/anaconda/lib/python2.7/subprocess.py", line 1327, in_execute_child
  raise child_exception
OSError: [Errno 2] No such file or directory

I feel that the error lies in calling the locate_RH.nlloc file, as i get the same error message if i try to run NLLoc by calling locate_BY.nlloc or locate_UH.nlloc, despite neither of these files existing in the local dir.

I looked in obspyck.py and commented out controlfilename = "locate_%s.nlloc" % \, replacing it with controlfilename = "locate_RH.nlloc" but this didn't have any effect.

I am however able to produce a location by manually running NLLoc on the locate_RH.nlloc file in the tmp directory, which gives the a successful output:

No more observation files. 1 events read, 1 events located, 1 locations completed.

I'm unsure how to use this location back in the GUI however, as i don't see any change to show that a location has been produced.

@megies
Copy link
Owner Author

megies commented Oct 29, 2014

Can you post a directory listing (e.g. ls -l) for the tmp directory during using ObsPyck, before and after clicking "do NLLoc"? Is the NLLoc executable in there? It should be in there (like in your pluginpath directory, its copied from there) as NLLoc__Linux__64bit.

@AbeJones
Copy link

AbeJones commented Nov 1, 2014

Before clicking:

abe@AGOS1:/tmp/obspyck-zq7447/nlloc$ ls -l

gives (after recursively cleaning up files as you suggested)

total 2812
 -rwxrwxr-x 1 abe abe 196759 Nov  2 18:43 fpfit2hyp    
-rwxrwxr-x 1 abe abe 249225 Nov  2 18:43 Grid2GMT
-rwxrwxr-x 1 abe abe 323513 Nov  2 18:43 Grid2Time
-rwxrwxr-x 1 abe abe 196832 Nov  2 18:43 hypoe2hyp
-rw-rw-r-- 1 abe abe   2114 Sep 21  2011 locate_RH.nlloc
-rwxrwxr-x 1 abe abe 200905 Nov  2 18:43 LocSum
-rwxrwxr-x 1 abe abe 652142 Nov  2 18:43 NLLoc
-rwxrwxr-x 1 abe abe 192667 Nov  2 18:43 oct2grid
-rwxrwxr-x 1 abe abe 393853 Nov  2 18:43 PhsAssoc
drwxrwxr-x 2 abe abe   4096 Nov  1 11:13 RH_5836_32220
-rwxrwxr-x 1 abe abe 210109 Nov  2 18:43 Time2EQ
-rwxrwxr-x 1 abe abe 229061 Nov  2 18:43 Vel2Grid

@AbeJones
Copy link

AbeJones commented Nov 1, 2014

After clicking "do NLLoc"

abe@AGOS1:/tmp/obspyck-9wzGun/nlloc$ ls -l

total 2816
-rwxrwxr-x 1 abe abe 196759 Nov  2 18:43 fpfit2hyp
-rwxrwxr-x 1 abe abe 249225 Nov  2 18:43 Grid2GMT
-rwxrwxr-x 1 abe abe 323513 Nov  2 18:43 Grid2Time
-rwxrwxr-x 1 abe abe 196832 Nov  2 18:43 hypoe2hyp
-rw-rw-r-- 1 abe abe   2114 Sep 21  2011 locate_RH.nlloc
-rwxrwxr-x 1 abe abe 200905 Nov  2 18:43 LocSum
-rwxrwxr-x 1 abe abe 652142 Nov  2 18:43 NLLoc
-rw-rw-r-- 1 abe abe    282 Nov  4 12:45 nlloc.obs
-rwxrwxr-x 1 abe abe 192667 Nov  2 18:43 oct2grid
-rwxrwxr-x 1 abe abe 393853 Nov  2 18:43 PhsAssoc
drwxrwxr-x 2 abe abe   4096 Nov  1 11:13 RH_5836_32220
-rwxrwxr-x 1 abe abe 210109 Nov  2 18:43 Time2EQ
-rwxrwxr-x 1 abe abe 229061 Nov  2 18:43 Vel2Grid

@AbeJones
Copy link

AbeJones commented Nov 1, 2014

The following files no longer seem to be in the tmp directory after clicking "do NLLoc"

-rw-rw-r-- 1 abe abe 282 Oct 27 18:01 nlloc.obs
-rw-r--r-- 1 abe abe 0 Oct 28 17:34 nlloc.sum.grid0.loc.hyp
-rw-r--r-- 1 abe abe 27 Oct 28 17:34 nlloc.sum.grid0.loc.hypo_71
-rw-r--r-- 1 abe abe 0 Oct 28 17:34 nlloc.sum.grid0.loc.hypo_inv
-rw-r--r-- 1 abe abe 1472 Oct 28 17:34 nlloc.sum.grid0.loc.stat
-rw-r--r-- 1 abe abe 0 Oct 28 17:34 nlloc.sum.grid0.loc.stations
-rw-r--r-- 1 abe abe 352 Oct 28 17:34 nlloc.sum.grid0.loc.stat_totcorr

@AbeJones
Copy link

AbeJones commented Nov 1, 2014

Now, I run;

abe@AGOS1:/tmp/obspyck-dgi2EN/nlloc$ ./NLLoc locate_RH.nlloc

...No more observation files. 1 events read, 1 events located, 1 locations completed.

then:

abe@AGOS1:/tmp/obspyck-dgi2EN/nlloc$ ls -l
total 6148
drwxr-xr-x 2 abe abe 4096 Oct 24 13:33 alomax_matrix
-rw-r--r-- 1 abe abe 6449 May 12 2010 calc_crust_corr.c
-rw-r--r-- 1 abe abe 100 Nov 9 2004 calc_crust_corr.h
-rw-rw-r-- 1 abe abe 200488 Oct 24 13:33 calc_crust_corr.o
-rw-r--r-- 1 abe abe 15910 Mar 8 2011 CHANGE_NOTES.txt
-rw-rw-r-- 1 abe abe 18463 Sep 22 21:12 ControlFile.in
-rw-r--r-- 1 abe abe 1433 Nov 9 2004 crust_corr_model.h
-rw-r--r-- 1 abe abe 102308 Nov 8 2004 crust_type.h
-rw-r--r-- 1 abe abe 98740 Nov 8 2004 crust_type_key.h
-rwxrwxr-x 1 abe abe 196759 Oct 24 13:33 fpfit2hyp
-rw-r--r-- 1 abe abe 6112 May 12 2010 fpfit2hyp.c
-rw-rw-r-- 1 abe abe 9120 Oct 24 13:33 fpfit2hyp.o
-rw-r--r-- 1 abe abe 3808 May 1 2010 geo.c
-rwxr-xr-x 1 abe abe 1055 Dec 17 2010 geo.h
drwxr-xr-x 2 abe abe 4096 Mar 19 2011 geometry
-rw-rw-r-- 1 abe abe 8288 Oct 24 13:33 geo.o
-rwxrwxr-x 1 abe abe 249225 Oct 24 13:33 Grid2GMT
-rw-r--r-- 1 abe abe 98834 Jan 26 2011 Grid2GMT.c
-rw-rw-r-- 1 abe abe 100024 Oct 24 13:33 Grid2GMT.o
-rwxrwxr-x 1 abe abe 323513 Oct 24 13:33 Grid2Time
-rw-r--r-- 1 abe abe 42927 Oct 6 2010 Grid2Time1.c
-rw-rw-r-- 1 abe abe 39528 Oct 24 13:33 Grid2Time1.o
-rw-r--r-- 1 abe abe 13196 Feb 16 2011 GridGraphLib.c
-rw-r--r-- 1 abe abe 4908 Jan 26 2011 GridGraphLib.h
-rw-rw-r-- 1 abe abe 8856 Oct 24 13:33 GridGraphLib.o
-rw-r--r-- 1 abe abe 146054 Feb 16 2011 GridLib.c
-rw-r--r-- 1 abe abe 30129 Mar 19 2011 GridLib.h
-rw-rw-r-- 1 abe abe 163152 Oct 24 13:33 GridLib.o
-rw-r--r-- 1 abe abe 8634 Jun 29 2010 GridMemLib.c
-rw-r--r-- 1 abe abe 1450 Jun 14 2010 GridMemLib.h
-rw-rw-r-- 1 abe abe 10168 Oct 24 13:33 GridMemLib.o
-rwxrwxr-x 1 abe abe 196832 Oct 24 13:33 hypoe2hyp
-rw-r--r-- 1 abe abe 9368 May 20 2010 hypoe2hyp.c
-rw-rw-r-- 1 abe abe 12456 Oct 24 13:33 hypoe2hyp.o
-rw-rw-r-- 1 abe abe 109 Nov 1 12:30 last.hdr
-rw-rw-r-- 1 abe abe 2227 Nov 1 12:30 last.hyp
-rw-rw-r-- 1 abe abe 407 Nov 1 12:30 last.hypo_inv
-rw-rw-r-- 1 abe abe 2114 Sep 21 2011 last.in
-rw-rw-r-- 1 abe abe 160016 Nov 1 12:30 last.scat
-rw-r--r-- 1 abe abe 1472 Nov 1 12:30 last.stat
-rw-r--r-- 1 abe abe 114 Nov 1 12:30 last.stations
-rw-r--r-- 1 abe abe 352 Nov 1 12:30 last.stat_totcorr
-rw-rw-r-- 1 abe abe 2114 Sep 21 2011 locate_RH.nlloc
-rw-r--r-- 1 abe abe 9433 Jun 29 2010 loclist.c
-rw-rw-r-- 1 abe abe 7984 Oct 24 13:33 loclist.o
-rwxrwxr-x 1 abe abe 200905 Oct 24 13:33 LocSum
-rw-r--r-- 1 abe abe 15488 Jan 7 2011 LocSum.c
-rw-rw-r-- 1 abe abe 16360 Oct 24 13:33 LocSum.o
-rw-r--r-- 1 abe abe 4568 Mar 19 2011 mag_func_test.c
-rwxr-xr-x 1 abe abe 11271 Mar 19 2011 Makefile
-rw-r--r-- 1 abe abe 8949 Aug 12 2009 map_project.c
-rw-r--r-- 1 abe abe 269 Aug 12 2009 map_project.h
-rw-rw-r-- 1 abe abe 10024 Oct 24 13:33 map_project.o
drwxr-xr-x 2 abe abe 4096 Oct 24 13:33 matrix_statistics
-rwxrwxr-x 1 abe abe 652142 Oct 24 13:33 NLLoc
-rw-r--r-- 1 abe abe 23922 Feb 16 2011 NLLoc1.c
-rw-rw-r-- 1 abe abe 29048 Oct 24 13:33 NLLoc1.o
-rw-rw-r-- 1 abe abe 806 Nov 1 12:30 nlloc.20140526.212828.grid0.loc.h71
-rw-rw-r-- 1 abe abe 109 Nov 1 12:30 nlloc.20140526.212828.grid0.loc.hdr
-rw-rw-r-- 1 abe abe 2227 Nov 1 12:30 nlloc.20140526.212828.grid0.loc.hyp
-rw-rw-r-- 1 abe abe 160016 Nov 1 12:30 nlloc.20140526.212828.grid0.loc.scat
-rw-r--r-- 1 abe abe 10309 Mar 19 2011 NLLoc_func_test.c
-rw-r--r-- 1 abe abe 483345 Feb 17 2011 NLLocLib.c
-rw-r--r-- 1 abe abe 24137 Jan 13 2011 NLLocLib.h
-rw-rw-r-- 1 abe abe 377984 Oct 24 13:33 NLLocLib.o
-rw-rw-r-- 1 abe abe 2114 Sep 21 2011 nlloc_locate_RH.nlloc
-rw-r--r-- 1 abe abe 2891 Feb 16 2011 NLLoc_main.c
-rw-rw-r-- 1 abe abe 10328 Oct 24 13:33 NLLoc_main.o
-rw-rw-r-- 1 abe abe 282 Nov 1 12:29 nlloc.obs
-rw-rw-r-- 1 abe abe 109 Nov 1 12:30 nlloc.sum.grid0.loc.hdr
-rw-rw-r-- 1 abe abe 1416 Nov 1 12:30 nlloc.sum.grid0.loc.hyp
-rw-rw-r-- 1 abe abe 296 Nov 1 12:30 nlloc.sum.grid0.loc.hypo_71
-rw-rw-r-- 1 abe abe 407 Nov 1 12:30 nlloc.sum.grid0.loc.hypo_inv
-rw-rw-r-- 1 abe abe 1472 Nov 1 12:30 nlloc.sum.grid0.loc.stat
-rw-rw-r-- 1 abe abe 114 Nov 1 12:30 nlloc.sum.grid0.loc.stations
-rw-rw-r-- 1 abe abe 352 Nov 1 12:30 nlloc.sum.grid0.loc.stat_totcorr
-rwxrwxr-x 1 abe abe 192667 Oct 24 13:33 oct2grid
-rw-r--r-- 1 abe abe 3536 Jun 29 2010 oct2grid.c
-rw-rw-r-- 1 abe abe 6000 Oct 24 13:33 oct2grid.o
drwxr-xr-x 2 abe abe 4096 Oct 24 13:33 octtree
-rw-r--r-- 1 abe abe 2469 Dec 9 2010 otime_limit.c
-rw-r--r-- 1 abe abe 1024 Dec 9 2010 otime_limit.h
-rw-rw-r-- 1 abe abe 2504 Oct 24 13:33 otime_limit.o
-rw-r--r-- 1 abe abe 14639 Jun 29 2010 phaselist.c
-rw-rw-r-- 1 abe abe 17000 Oct 24 13:33 phaselist.o
-rw-r--r-- 1 abe abe 6177 Jun 29 2010 phaseloclist.h
-rwxrwxr-x 1 abe abe 393853 Oct 24 13:33 PhsAssoc
-rw-r--r-- 1 abe abe 13511 Oct 5 2010 PhsAssoc.c
-rw-rw-r-- 1 abe abe 15184 Oct 24 13:33 PhsAssoc.o
drwxrwxr-x 5 abe abe 4096 Sep 16 16:01 ProjectData
drwxr-xr-x 2 abe abe 4096 Oct 24 13:33 ran1
-rw-r--r-- 1 abe abe 1589 Jul 25 2008 README.txt
drwxrwxr-x 2 abe abe 4096 Nov 1 11:13 RH_5836_32220
-rwxrwxr-x 1 abe abe 210109 Oct 24 13:33 Time2EQ
-rw-r--r-- 1 abe abe 31754 Feb 16 2011 Time2EQ1.c
-rw-rw-r-- 1 abe abe 36064 Oct 24 13:33 Time2EQ1.o
-rw-r--r-- 1 abe abe 130172 Dec 2 2010 Time_3d_NLL.c
-rw-rw-r-- 1 abe abe 152096 Oct 24 13:33 Time_3d_NLL.o
-rw-r--r-- 1 abe abe 4689 Jun 29 2010 ttime_func_test.c
-rw-r--r-- 1 abe abe 3290 Jan 13 2011 util.c
-rw-r--r-- 1 abe abe 2267 Jun 29 2010 util.h
-rw-rw-r-- 1 abe abe 5880 Oct 24 13:33 util.o
drwxr-xr-x 2 abe abe 4096 Oct 24 13:33 vector
-rwxrwxr-x 1 abe abe 229061 Oct 24 13:33 Vel2Grid
-rw-r--r-- 1 abe abe 11169 Oct 27 13:25 Vel2Grid1.c
-rw-r--r-- 1 abe abe 11178 Oct 27 13:23 Vel2Grid1.c~
-rw-rw-r-- 1 abe abe 15216 Oct 24 13:33 Vel2Grid1.o
-rw-r--r-- 1 abe abe 62952 Jan 12 2011 velmod.c
-rw-r--r-- 1 abe abe 16626 Jan 12 2011 velmod.h
-rw-rw-r-- 1 abe abe 56264 Oct 24 13:33 velmod.o

@megies
Copy link
Owner Author

megies commented Nov 1, 2014

First, I'd recommend removing all of NonLinLoc related source/binary files, it's completely confusing with this long list of files. You really only need NLLoc executable of all of NonLinLoc files.

Then, like I wrote before..

Is the NLLoc executable in there? It should be in there (like in your pluginpath directory, its copied from there) as NLLoc__Linux__64bit.

..your binary needs to be renamed or you can also put a symlink in there, for obspyck to find the file..

$ ln -s NLLoc NLLoc__Linux__64bit

The following files no longer seem to be in the tmp directory after clicking "do NLLoc"

That's normal, I'm cleaning out files after location run, so that later there can be no confusion with outdated input files.

@megies
Copy link
Owner Author

megies commented Nov 1, 2014

Then remember that you need to modify the coordinate conversion to fit your needs..

https://github.com/megies/obspyck/blob/master/util.py#L818
https://github.com/megies/obspyck/blob/master/obspyck.py#L1935-L1937

@AbeJones
Copy link

AbeJones commented Nov 3, 2014

We have success! Putting a symlink in the nlloc folder solved all our problems. The program seems to be working fine now. Thanks heaps for your help and patience! Presumably this step of putting in a symlink is also required to call the other build-in packages such as FocMec as well?

@megies
Copy link
Owner Author

megies commented Nov 3, 2014

Yep, for focmec you need some other bash script to handle the program calls as well. Maybe open another issue here about it when you want to try it?

@megies megies added the question label Dec 8, 2014
@AntonBiryukov
Copy link

Hi Tobias,

I am sorry for any inconvenience I might cause, but I 'd like to wonder about one more thing.

Is there an option to pass the existing NonLinLoc solution from a local file to the Obspyck for the corresponding event (similar to passing the event information as --event myevent.xml), so that the takeoff angles, phases and azimuths are somehow parsed to be passed to FocMec ?

Best regards,

Anton.

@megies
Copy link
Owner Author

megies commented Jun 10, 2015

Sorry, that's some really strange use case.. You are using obspyck to pick data, then do nonlinloc externally and then want to load the event into obspyck to run focmec??

I would say either do nonlinloc also from inside obspyck or just do focmec with the output data of obspyck?

Note that obspy can read nonlinloc output into a catalog object. http://docs.obspy.org/packages/obspy.nlloc.html?highlight=nlloc#obspy.nlloc

@AntonBiryukov
Copy link

Hey Tobias,

The use-case is a bit different, as picks were picked by some other in-house software. Using obspy, I have managed to convert the picks from nlloc files into QuakeML. However, nonlinloc omits the information about the channel and location / network codes, so they can't be easily visualized in the obspyck, as ObsPyck does not know which channel assign the picks on.

Eventually, I 'll end up using focmec separately, but it would be good to have the pick visualization in the obspyck from the external nonlinloc file / converted QuakeML.

@megies
Copy link
Owner Author

megies commented Jun 11, 2015

Well, if you parse some nonlinloc output file and write to QuakeML why not insert the correct network/location codes (you should know them I suppose). If you don't know the channel, why not just insert the channels you want to llok at (e.g. Z for P and N for S)?
Anyway, that really hardly sounds like an ObsPyck problem.

@klaaur
Copy link

klaaur commented Oct 17, 2016

I'm having a similar error as AbeJones except that I can't seem to get my 'Missing pick error message' to go away:

/var/folders/z6/2x3y1cqs6xd75sx8ztzsfdnm002t75/T/obspyck-FV1Kt4/nlloc/nlloc*
Warning: Missing pick error. Using a default error of 0.05s for P phase of station BBR. Please set pick errors.
Warning: Missing pick error. Using a default error of 0.05s for P phase of station BBR. Please set pick errors.
Warning: Missing pick error. Using a default error of 0.05s for P phase of station BBR. Please set pick errors.
Phases for NLLoc:
BBR ? ? ? P ? 20110311 0558 36.5195 GAU 5.00e-02 -1.00e+00 -1.00e+00 -1.00e+00
BBR ? ? ? P ? 20110311 0558 36.5195 GAU 5.00e-02 -1.00e+00 -1.00e+00 -1.00e+00
BBR ? ? ? P ? 20110311 0558 45.5695 GAU 5.00e-02 -1.00e+00 -1.00e+00 -1.00e+00

Traceback (most recent call last):
File "obspyck.py", line 443, in on_qToolButton_doNlloc_clicked
self.loadNLLocOutput()
File "obspyck.py", line 2088, in loadNLLocOutput
lines = open(files['summary'], "rt").readlines()
IOError: [Errno 2] No such file or directory: '/var/folders/z6/2x3y1cqs6xd75sx8ztzsfdnm002t75/T/obspyck-oHPNM7/nlloc/nlloc.hyp'

I've set pick errors (e.g., I+1) in the GUI window then press do_NLLoc with the BY option selected. Note I'm on a mac. I have not investigated the subprocess issue yet that you mentioned above. I have my setup as you described at the top of this thread. Note that I'm using the example global config file from nlloc_global_sample (neic_global.in) with the taup/ak135 HDR and buf files and without including the sta_list_neic.in file in the config file. Do you have an example config file that works with the EXAMPLE 1 stations? I figured the default global config file should work with just about any station. I have never used nlloc so there may be obvious things I'm overlooking. Do you know what the issue might be? Thanks!

EDIT: If it helps when I run ./nlloc locate_BY.nlloc in my /tmp directory I get the following output

NLLoc (NonLinLoc v6.00.0 18Mar2011)
LOCGAUSS2: SigmaTfraction: 0.010000 SigmaTmin: 0.050000 SigmaTmax: 2.000000
... Reading observation file ./nlloc.obs
Reading next set of observations (Files open: Tot:2 Buf:0 Hdr:0 Alloc: 0) ...
...end of observation file detected.
No more observation files. 1 events read, 0 events located, 0 locations completed.

@klaaur
Copy link

klaaur commented Oct 18, 2016

Note I was able to make the missing pick error messages go away by adding error bars to the picks with a right click. I'm still having issues with the IOError: [Errno 2] creating the nlloc.hyp file.

@klaaur
Copy link

klaaur commented Oct 18, 2016

Using the verbose mode in the config file I get the following:

./NLLoc__Darwin__64bit locate_BY.nlloc
NLLoc (NonLinLoc v6.00.0 18Mar2011)
GRID: {x, y, z}
Num: {361, 181, 601}
Orig: {-180, -90, 0}
LenSide: {1, 1, 1}
Type: PROB_DENSITY
LOCGAUSS2: SigmaTfraction: 0.010000 SigmaTmin: 0.050000 SigmaTmax: 2.000000
NLLoc LOCQUAL2ERR:
0 -> 0.200000
1 -> 0.500000
2 -> 1.000000
3 -> 2.000000
4 -> 99999.900000
INFO: no phase identifier (LOCPHASEID) values read.
INFO: no station distance weighting (LOCSTAWT) values read.
INFO: no Magnitude Calculation (LOCMAG) params read.
INFO: no Component Descirption (LOCCMP) params read.
INFO: no Alias (LOCALIAS) params read.
INFO: no Exclude (LOCEXCLUDE) params read.
INFO: no Time Delay (LOCDELAY) params read.
INFO: no Topo Surface (LOCTOPO_SURFACE) params read.
INFO: no Time Delay Surface (LOCDELAY_SURFACE) params read.
INFO: no Elevation Correction (LOCELEVCORR) params read.
INFO: no Fixed Origin Time (LOCFIXOTIME) params read.

... Reading observation file ./nlloc.obs

Reading next set of observations (Files open: Tot:2 Buf:0 Hdr:0 Alloc: 0) ...

... 4 observations read, 4 will be used for location (./nlloc.20110311.055446).
LOCGAU param CorrLen is zero, will not be used: 0.000000
Locating... (Files open: Tot:2 Buf:0 Hdr:0 Alloc: 4 3DMem: 0) ...

Applying Octtree search within Grid 0:
Station Density Weight: Ave Station Distance: 9416.598382
Station Density Weight: Mean Root Node Horiz dS: 833.333333
EDT_otime_weight activated, OT_WT exceeds EDT_OT_WT_FLOOR.
OctTree num samples = 50000 / 50000
Octree oct_node_value_max= -3.261204e+01 oct_tree_integral= 5.556205e+05
OCTREE nInitial 27648 nEvaluated 50008 smallestNodeSide 6.510417/6.510417/1.565104 oct_tree_integral 5.556205e+05
EDT_otime_weight: ot_ml_std 0.510669

Station Density Weight: Number Force Divide: 27332 max_num_nodes: 50000
Segmentation fault: 11

I found however that the config file in my /tmp folder is not the one that I use to in my plugin_dir/nlloc directory?

@megies
Copy link
Owner Author

megies commented Oct 19, 2016

Looks like you're getting pretty far with nonlinloc, the segfault probably has to do with the values you used when compiling NonLinLoc..?

I found however that the config file in my /tmp folder is not the one that I use to in my plugin_dir/nlloc directory?

The temporary directory should be a copy of your plugin_dir.. so it seems strange that some files are not the same..?

@klaaur, I'm not sure how to help right now, what is the problem you're stuck with right now? I kind of lost track of your problem..

@klaaur
Copy link

klaaur commented Oct 20, 2016

@megies My current problem is getting nlloc to finish running with my locate_BY.nlloc file. I'm using the default neic_global.in file from the nlloc examples with the sta_list.neic.in file. I've selected a few stations to get picks from that are included in the station list file, I select the P-picks and the error bars, then click on the doNLLoc button and obtain the following error:

Warning: SeisHub specific features will not work (e.g. 'send Event').
/var/folders/z6/2x3y1cqs6xd75sx8ztzsfdnm002t75/T/obspyck-TEJra4/nlloc/nlloc*
Phases for NLLoc:
AAK ? ? ? P ? 20110311 0555 28.1695 GAU 2.65e+02 -1.00e+00 -1.00e+00 -1.00e+00
ARU ? ? ? P ? 20110311 0556 4.1284 GAU 1.30e+02 -1.00e+00 -1.00e+00 -1.00e+00
KURK ? ? ? P ? 20110311 0554 43.2308 GAU 1.48e+02 -1.00e+00 -1.00e+00 -1.00e+00
RPN ? ? ? P ? 20110311 0606 37.6699 GAU 2.34e+02 -1.00e+00 -1.00e+00 -1.00e+00

<subprocess.Popen object at 0x124065610>

--> NLLoc finished
Traceback (most recent call last):
File "obspyck.py", line 442, in on_qToolButton_doNlloc_clicked
self.doNLLoc()
File "obspyck.py", line 2075, in doNLLoc
self.catFile(files['summary'], self.critical)
File "obspyck.py", line 2078, in catFile
lines = open(file, "rt").readlines()
IOError: [Errno 2] No such file or directory: '/var/folders/z6/2x3y1cqs6xd75sx8ztzsfdnm002t75/T/obspyck-TEJra4/nlloc/nlloc.hyp'

I get the first phase output and the NLLoc finished print out but I don't get any of the location information or the focmech solution. Do you have a configuration file that works with the EXAMPLE1 stations in the default ~/.obspyckrc file? Or another NLLOC config file that works with stations and events I could test out my configuration with and pull data from the FDSN server? I'm struggling to find out where my issue is? As I mentioned this is my first time using NLLOC so there could be something simple that I'm overlooking. For example, does the global NLLOC version require that I recalculate the AK135 travel grid? I have the default ak135 HDR and buf files from the global nlloc example. Or would I need to specify that somewhere in obspyck?

EDIT: If it helps I've attached my locate_BY.nlloc file. I made it have a .txt extension for the purposes of attaching it in a supported github attachment.
locate_BY.txt

@klaaur
Copy link

klaaur commented Oct 20, 2016

Update: I have nlloc working now. I went back through the global sample run and retested it with the default files then re-ran in my /tmp directory. Once I got that working I was able to repair my link issue that was causing the wrong input file to be utilized. Now there's a map issue:

--> NLLoc finished
NLLOC "./nlloc.20110311.055456.grid0" "LOCATED" "Location completed."
SIGNATURE "Anthony Lomax (www.alomax.net) NLLoc:v6.00.0 20Oct2016 13h13m04"
COMMENT "NEIC events"
GRID 361 181 601 -180 -90 0 1 1 1 PROB_DENSITY
SEARCH OCTREE nInitial 27648 nEvaluated 50008 smallestNodeSide 208.333333/208.333333/50.083333 oct_tree_integral 6.517140e+14 scatter_volume 6.517140e+14
HYPOCENTER x 72.1875 y 49.6875 z 475.792 OT 37.8976 ix -1 iy -1 iz -1
GEOGRAPHIC OT 2011 03 11 05 53 37.8976 Lat 49.6875 Long 72.1875 Depth 475.792
QUALITY Pmax 8.5938e-07 MFmin 1.87642 MFmax 1.94584 RMS 24.2215 Nphs 4 Gap 138.311 Dist 4.24555 Mamp -9.9 0 Mdur -9.9 0
VPVSRATIO VpVsRatio -1 Npair 0 Diff -2e+30
STATISTICS ExpectX -12.0572 Y 2.39559 Z 304.745 CovXX 1.4045e+08 XY 324123 XZ -368685 YY 2.06086e+07 YZ 2392.82 ZZ 29709.4 EllAz1 93.4352 Dip1 89.8493 Len1 318.521 Az2 359.845 Dip2 0.00943817 Len2 8529.08 Len3 2.226649e+04
STAT_GEOG ExpectLat 2.39559 Long -12.0572 Depth 304.745
TRANSFORM GLOBAL
QML_OriginQuality assocPhCt 4 usedPhCt 4 assocStaCt -1 usedStaCt 4 depthPhCt -1 stdErr 24.2215 azGap 138.311 secAzGap 257.053 gtLevel - minDist 471.728 maxDist 17503.1 medDist 989.697
QML_OriginUncertainty horUnc -1 minHorUnc 6884.6 maxHorUnc 17973.3 azMaxHorUnc 89.845
FOCALMECH Hyp 49.6875 72.1875 475.792 Mech 0 0 0 mf 0 nObs 0
PHASE ID Ins Cmp On Pha FM Date HrMn Sec Err ErrMag Coda Amp Per > TTpred Res Weight StaLoc(X Y Z) SDist SAzim RAz RDip RQual Tcorr
KURK ? ? ? P ? 20110311 0554 56.73 GAU 72 -1 -1 -1 > 78.8333 -0.0000 1.2662 78.6202 50.7154 -0.1840 4.2455 73.53 0.0 0.0 0 0.0000
AAK ? ? ? P ? 20110311 0555 23.67 GAU 76 -1 -1 -1 > 107.7615 -1.9896 1.2544 74.4940 42.6390 -1.6450 7.2318 166.39 0.0 0.0 0 0.0000
ARU ? ? ? P ? 20110311 0556 4.128 GAU 99 -1 -1 -1 > 143.3728 2.8580 1.1648 58.5625 56.4302 -0.2500 10.5828 314.78 0.0 0.0 0 0.0000
RPN ? ? ? P ? 20110311 0607 4.62 GAU 5.8e+02 -1 -1 -1 > 1028.9717 -222.2494 0.3147 -109.3344 -27.1267 -0.1100 157.5276 176.47 0.0 0.0 0 0.0000
END_PHASE
END_NLLOC

no station magnitudes (or all deselected), nothing to do...
Traceback (most recent call last):
File "./obspyck.py", line 477, in on_qToolButton_showMap_toggled
self.drawEventMap()
File "./obspyck.py", line 3045, in drawEventMap
coords = st[0].stats.coordinates
File "//anaconda/lib/python2.7/site-packages/obspy/core/util/attribdict.py", line 125, in getattr
raise AttributeError(e.args[0])
AttributeError: coordinates

@megies
Copy link
Owner Author

megies commented Oct 20, 2016

Are you feeding waveforms via local files? Or via fetching from servers? Looks like metadata is missing..

@klaaur
Copy link

klaaur commented Oct 20, 2016

I'm fetching data from servers

@megies
Copy link
Owner Author

megies commented Oct 21, 2016

FDSN, I guess? Are there any error messages up until obspyck window pops up? Because, coordinates should be attached for FDSN servers correctly, see https://github.com/megies/obspyck/blob/master/util.py#L458-L474

@klaaur
Copy link

klaaur commented Oct 21, 2016

There aren't any errors to suggest the metadata wasn't being obtained. What I didn't realize was that the default obspyckrc has 'no_metadata' set to true. Updating this variable to false fixed the issue. Thanks.

@megies
Copy link
Owner Author

megies commented Oct 21, 2016

default obspyckrc has 'no_metadata' set to true

Really? Are you sure? I think it should have it set to false... https://github.com/megies/obspyck/blob/master/example.cfg#L23

Good to hear you got it working now. I just an't seem to find the time do do a proper polishing of the whole plugin stuff and proper documentation / example use case for nonlinloc..

@klaaur
Copy link

klaaur commented Oct 24, 2016

I must've changed it while doing some other tests, but once I changed it back to false I was able to get the information necessary for the showMap feature. Thanks for your help in this. When you do get around to it it might help to have a working global example and a local example, if possible. Or an example that works with your EXAMPLE1 stations in the .obspyckrc file. I think it would help users immensely get everything up and running. Thanks again. I have a few other issues I'm running into that I'll post into other issue threads.

@klaaur
Copy link

klaaur commented Oct 26, 2016

After nlloc has finished running, the 'show Map' feature is toggled. Could you explain what's being shown in the 3 small graphs in the top right corner? Thanks

@megies
Copy link
Owner Author

megies commented Oct 26, 2016

That's a view of the nonlinloc scatter file: http://alomax.free.fr/nlloc/soft6.00/formats.html#_location_scat_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants