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

NLLoc running #85

Open
rcabdia opened this issue Nov 20, 2018 · 7 comments
Open

NLLoc running #85

rcabdia opened this issue Nov 20, 2018 · 7 comments

Comments

@rcabdia
Copy link

rcabdia commented Nov 20, 2018

From I've read till now is that previously to run FocMec to calculate
the Focal Mechanism, I need to locate the epicenter with NLLoc.

Because I've read that might be there will be problems with Mac I've moved to a Linux machine.
In this email, I write a complete description of the architecture folders that I followed to run Nlloc but unfortunately something wrong happened. I've tried to be the most clear with my issue as possible for not making you waste any time.

Right now I have this installation scheme

/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck

in this folder I've created the subfolder plugins in which I've created

/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/focmec
/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/hyp_2000
/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/nlloc

Inside the ./nlloc there are the typical executable files NLLoc, Grid2Time and so on....

Now, to run my example, I've created in my desktop a folder named obspyck with this architecture
home/Escritorio/obspyck/nlloc

inside the obspyck/nlloc folder there are the waveforms, the file.cfg and I've also created a symbolic link NLLoc ---> NLLoc__Linux__64bit

following the issue #11

For the output
home/Escritorio/obspyck/nlloc/loc1

For the travel times
home/Escritorio/obspyck/nlloc/time
**[layer.P.sta.buf,layer.P.sta.hdr,layer.S.sta.buf,layer.S.sta.buf]

And the run/control file named locate_BY.nlloc in the previous folder

home/Escritorio/obspyck/locate_BY.nlloc
which is attached in this email and the LOCFILES line is

LOCFILES ./nlloc.obs NLLOC_OBS ./time/layer ./loc1
**From the #issue11 I guess that nlloc.obs is created after pick the waveforms and saved in the folder from Ive run obspyck//in my case home/Escritorio/obspyck/nlloc.
**I ve also guessed that obspyck always look for the nlloc control file inside locate_BY.nlloc.

After this configuration, I0ve run successfully obspyck and I picked some waveforms but when I run do_nlloc, obspyck cannot find nlloc. I attached the log error file.

I forget mention you that moreover NLLoc is also in the path of my computer,
I thought that everything is right but I missed in some point and I am stack,

Please could anyone
log2.txt

example_cfg.txt
locate_BY.nlloc.txt

guide me to find a way-out.

@megies
Copy link
Owner

megies commented Nov 20, 2018

Please try to make use of github markdown, it's so hard to read an unformatted issue report, see https://help.github.com/categories/writing-on-github/.

Please run obspyck and post a directory listing of the used temporary directory (directory path should be printed on console).

@rcabdia
Copy link
Author

rcabdia commented Nov 20, 2018

Hello T.Megies, sorry for markdown, I didn't know it.

do you mean.....
When I run ObsPyck

(obspyck_test) sysop@sysop-HP-ProDesk-600-G1-SFF:~/Escritorio/obspyck/nlloc$ obspyck -c example.cfg -t 2016-01-03T06:05:00 -d 240 HHZ

Running ObsPyck version 0.5.1 (location: /home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/obspyck.pyc)
using config file: example.cfg

@megies
Copy link
Owner

megies commented Nov 20, 2018

obspyck show something like this during startup:

Using temporary directory: /tmp/obspyck-bPVgDF

Contents of your plugin directory get copied there, so this has to contain everything needed for NLLOC. Please list the contents of a temp directory in your case.

@rcabdia
Copy link
Author

rcabdia commented Nov 23, 2018

Hello Tobias,

I've been working with obspyck the last days. Finally I was able to run NLLoc without problems. Thank you very much for your tips, I didn't realized that everything is copied to a temp folder in the root directory.
Some issues,

  1. When I write the location file.xml, the coordinates of the location are different from the location of >the file .hyp. (very strange) I can imagine that the problem comes from the config file (it is attached). it >also is shown when I plot the map, the wrong location. it could be because of the transformation >"TRANS SIMPLE" of the control file? may be because it can be read properly the lat long and depth >from the file.hyp.
  1. Something I've noticed is that when obspyck write the observation file "nlloc.obs", it does not >include the polarities U, D (is attached also)
  1. I've checked that apart from the travel times time.buf, it is also saved angle.buf for the P and S wave
  1. Every station has attach the dateless.
  1. After this step I run FocMec.
    **I follow the structure and the control files from the issue FocMec setup #12

it create properly the polarities (I do not understand How because in the nlloc.obs does not appear.)
But the program is stack in an error that I am not able to correct.

Hope you can help with this information. Please do not hesitate if you need something else to solve
ALL of files with the process I followed are attached, Sorry I had to write everything with the extension .txt to be able to attach the files of the process.

directory.txt
example.cfg.txt
focmec.dat.txt
focmec.P_SH_SV.stdin.txt
focmec.P_SH.stdin.txt
focmec.P_SV.stdin.txt
focmec.P.stdin.txt
log.txt
nlloc.hyp.txt
nlloc.obs.txt

rfocmec__Linux__64bit.txt
script.sh.txt

@rcabdia
Copy link
Author

rcabdia commented Nov 23, 2018

Phases for focmec: 8

EVO 33.40 62.60D
OB_2 219.00 63.00U
OB_1 215.70 62.80U
OB_0 225.70 62.70U
OB_4 245.80 62.80U
OB_3 237.50 63.10U
PCVE 53.10 62.80U
PVAQ 65.60 62.80U

Traceback (most recent call last):
File "/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/obspyck.py", line 495, in on_qToolButton_doFocMec_clicked
self.doFocmec()
File "/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/obspyck.py", line 1927, in doFocmec
(msg, err, returncode) = call(prog_dict)
File "/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/util.py", line 910, in tmp
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/subprocess.py", line 390, in init
errread, errwrite)
File "/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/subprocess.py", line 1025, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error

@megies
Copy link
Owner

megies commented Nov 26, 2018

Something I've noticed is that when obspyck write the observation file "nlloc.obs", it does not >include the polarities U, D (is attached also)

Can't say for sure, but I think I never used polarities with NLLoc. Does Nlloc even use polarities?

When I write the location file.xml, the coordinates of the location are different from the location of >the file .hyp. (very strange) I can imagine that the problem comes from the config file (it is attached). it >also is shown when I plot the map, the wrong location. it could be because of the transformation >"TRANS SIMPLE" of the control file? may be because it can be read properly the lat long and depth >from the file.hyp.

There is some coordinate conversion mechanics in util.py, see

  • obspyck/obspyck/util.py

    Lines 981 to 1003 in 74df05a

    def gk2lonlat(x, y, m_to_km=True):
    """
    This function converts X/Y Gauss-Krueger coordinates (zone 4, central
    meridian 12 deg) to Longitude/Latitude in WGS84 reference ellipsoid.
    We do this using pyproj (python bindings for proj4) which can be installed
    using 'easy_install pyproj' from pypi.python.org.
    Input can be single coordinates or coordinate lists/arrays.
    Useful Links:
    http://pyproj.googlecode.com/svn/trunk/README.html
    http://trac.osgeo.org/proj/
    http://www.epsg-registry.org/
    """
    import pyproj
    proj_wgs84 = pyproj.Proj(init="epsg:4326")
    proj_gk4 = pyproj.Proj(init="epsg:31468")
    # convert to meters first
    if m_to_km:
    x = x * 1000.
    y = y * 1000.
    lon, lat = pyproj.transform(proj_gk4, proj_wgs84, x, y)
    return (lon, lat)
  • https://github.com/megies/obspyck/blob/master/obspyck/obspyck.py#L2395

This is also mentioned in one of the other NLLoc issues here, you might have to patch this in your obspyck installation, sorry, never got round to make this changeable via config file, I think.


Not sure what the problem with focmec is, but you should try to run the focmec binary from command line, it should ask for all the input info then, just to see if your binary works..

@rcabdia
Copy link
Author

rcabdia commented Feb 25, 2019

I've go around the rfocmec script step by step and finally I solved partially the problem

grep -v "nan" focmec.out.all | grep "$i.0" > focmec.out && echo "found solution with $i Errors." && exit 0
instead of

grep -v "nan" focmec.out.all | grep " $i.0 " > focmec.out && echo "found solution with $i Errors." && exit 0

Now, it record something in the focmec.out file

But another error arise, now related with obspyck.py

--> focmec finished
1724 suitable solutions found:
Traceback (most recent call last):
File "/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/obspyck.py", line 495, in on_qToolButton_doFocMec_clicked
self.doFocmec()
File "/home/sysop/miniconda2/envs/obspyck_test/lib/python2.7/site-packages/obspyck/obspyck.py", line 1946, in doFocmec
np1.dip = float(line[0])
ValueError: could not convert string to float: Polarities/Errors:

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

No branches or pull requests

2 participants