Bran new installation, brand new user, no obspy experience and stuck

Good morning,
I just got back from the Earthscope meeting, all excited to give Obspy a go. I’ve followed the instructions on the website, and gone through the installation of the 64-bit Obspy onto my windows 8 computer. All looks good, and I can open various windows into a python 2.7 interpreter. I’m ready to go! However…

Where to go next?
I have a directory full of SAC files for an earthquake I wish to examine; I have my Python installed. Presumably the Obspy modules are somewhere.
However, Window #1 of the tutorial called ‘getting started’ assumed I’ve already started. When I attempt to follow along, the python shell fails to recognize that obspy.core exists and thus I cannot generate anything, much less an initial plot.

My guess is that I need to somehow put the obspy package into the search path, but the installer didn’t do it automatically.

Is there a precursor tutorial to ‘getting started’ that helps me configure the python interpreter such that it integrates the Obspy package? It is my assumption that the installer was supposed to configure the package for preparation. I could probably use a bit of documentation that takes me from installation through waveform plot, then shows me how to plot multiple stations for a given event, align, and locate hypocenter and epicenter. Moment tensor would be nice, too. Synthetics would be icing on the cake.

Anyone want to help? I’m a willing pupil!

Hi Tycho,

seems like the installer is a bit broken for Windows 8 - I just tested
it and it actually did install all dependencies but not the ObsPy
package itself :confused:

To fix this for now just run "ObsPy Shell" from the start tile thingy
(or from your start menu if you have) and run "easy_install obspy".
After that test if it works calling obspy-runtests.

Cheers,
Robert

Good morning, I just got back from the Earthscope meeting, all
excited to give Obspy a go. I've followed the instructions on the
website, and gone through the installation of the 64-bit Obspy onto
my windows 8 computer. All looks good, and I can open various
windows into a python 2.7 interpreter. I'm ready to go! However...

Where to go next? I have a directory full of SAC files for an
earthquake I wish to examine; I have my Python installed.
Presumably the Obspy modules are somewhere. However, Window #1 of
the tutorial called 'getting started' assumed I've already started.
When I attempt to follow along, the python shell fails to recognize
that obspy.core exists and thus I cannot generate anything, much
less an initial plot.

My guess is that I need to somehow put the obspy package into the
search path, but the installer didn't do it automatically.

Is there a precursor tutorial to 'getting started' that helps me
configure the python interpreter such that it integrates the Obspy
package? It is my assumption that the installer was supposed to
configure the package for preparation. I could probably use a bit
of documentation that takes me from installation through waveform
plot, then shows me how to plot multiple stations for a given
event, align, and locate hypocenter and epicenter. Moment tensor
would be nice, too. Synthetics would be icing on the cake.

Anyone want to help? I'm a willing pupil!

_______________________________________________ obspy-users mailing
list obspy-users@lists.swapbytes.de
http://lists.swapbytes.de/mailman/listinfo/obspy-users

- --
Dr. Robert Barsch

EGU Office Munich
Luisenstr. 37
80333 Munich
Germany

Phone: +49-89-21806549
Fax: +49-89-218017855
eMail: barsch@egu.eu

Thank you Robert for your help.

I have opened the ObsPy shell, typed in the “easy_install ObsPy” and seen the dependencies process and install to c:\Users\Daniel\ObsPy\Scripts.
This package has installed a shell called “PythonWin”, and I have edited the path to point to c:/Users/Daniel/Scripts and I can now see within the library these files, and listed under the Obspy/Scripts path:

Activate_this.py
Easy_install-2.7-script.py
.
.
.
obspy-dataless2resp-script.py
.
.
.
obspy-xseed2dataless-script.py
.
.
etcetera

I then open Python, type in the following from the tutorial, and receive back the following error.

import glob
from obspy.core import read
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named obspy.core

I cannot figure out how to launch the obspy-runtests script quite yet.

I can, however, add 1 + 2 and get three, and create a do-while loop that counts from three to zero. I can also print variables that contain the text string “Hello World”. However what I really want to do is create waveform graphs, convert data file formats, pick Pg, Pn, Sg,Sn arrival times at each station, compute hypocenters, examine residuals, ascertain focal mechanisms, moment tensors, generate synthetics, figure out the weird crustal phases, then autocorrelate the hundreds of aftershocks that fill my dataset from the several local stations of the temporary deployment.

Cheers, and thank you ahead of time for releasing this processing tool - I hope I can move from beginner to helpful contributor over the course of this next few months.

Daniel Burk
Michigan State University

Tycho,

don't use PythonWin (unfortunately this comes with one of the
dependencies) you should work with "ObsPy Shell".

PythonWin uses the system python interpreter but the installer creates
a virtual Python environment which separates the system Python from a
ObsPy installation. Python programmer use this concept to have
multiple separated Python environments which do not interfere with
each other.

In order to use the correct python executable use the one in your
installation directory - in your case it seems to be
c:\Users\Daniel\ObsPy\Scripts\python.exe

If so, the following will work (no output):

c:\Users\Daniel\ObsPy\Scripts\python.exe -c 'import obspy'

than you can start writing scripts such as

from obspy.core import read
st = read()
st.plot()

save it as testscript.py and call it on command line

c:\Users\Daniel\ObsPy\Scripts\python.exe /path/to/your/testscript.py

if you choose to use an IDE you have to use the correct Python executable.

Hope it helps,
Robert

Thank you Robert for your help.

I have opened the ObsPy shell, typed in the "easy_install ObsPy"
and seen the dependencies process and install to
c:\Users\Daniel\ObsPy\Scripts. This package has installed a shell
called "PythonWin", and I have edited the path to point to
c:/Users/Daniel/Scripts and I can now see within the library these
files, and listed under the Obspy/Scripts path:

Activate_this.py Easy_install-2.7-script.py
<http://Easy_install-2.7-script.py> . . .
obspy-dataless2resp-script.py . . . obspy-xseed2dataless-script.py
. . etcetera

I then open Python, type in the following from the tutorial, and
receive back the following error.

import glob from obspy.core import read

Traceback (most recent call last): File "<interactive input>", line
1, in <module> ImportError: No module named obspy.core

I cannot figure out how to launch the obspy-runtests script quite
yet.

I can, however, add 1 + 2 and get three, and create a do-while loop
that counts from three to zero. I can also print variables that
contain the text string "Hello World". However what I really want
to do is create waveform graphs, convert data file formats, pick
Pg, Pn, Sg,Sn arrival times at each station, compute hypocenters,
examine residuals, ascertain focal mechanisms, moment tensors,
generate synthetics, figure out the weird crustal phases, then
autocorrelate the hundreds of aftershocks that fill my dataset from
the several local stations of the temporary deployment.

Cheers, and thank you ahead of time for releasing this processing
tool - I hope I can move from beginner to helpful contributor over
the course of this next few months.

Daniel Burk Michigan State University

Hi Tycho,

seems like the installer is a bit broken for Windows 8 - I just
tested it and it actually did install all dependencies but not the
ObsPy package itself :confused:

To fix this for now just run "ObsPy Shell" from the start tile
thingy (or from your start menu if you have) and run "easy_install
obspy". After that test if it works calling obspy-runtests.

Cheers, Robert

Good morning, I just got back from the Earthscope meeting, all
excited to give Obspy a go. I've followed the instructions on
the website, and gone through the installation of the 64-bit
Obspy onto my windows 8 computer. All looks good, and I can open
various windows into a python 2.7 interpreter. I'm ready to go!
However...

Where to go next? I have a directory full of SAC files for an
earthquake I wish to examine; I have my Python installed.
Presumably the Obspy modules are somewhere. However, Window #1
of the tutorial called 'getting started' assumed I've already
started. When I attempt to follow along, the python shell fails
to recognize that obspy.core exists and thus I cannot generate
anything, much less an initial plot.

My guess is that I need to somehow put the obspy package into
the search path, but the installer didn't do it automatically.

Is there a precursor tutorial to 'getting started' that helps me
configure the python interpreter such that it integrates the
Obspy package? It is my assumption that the installer was
supposed to configure the package for preparation. I could
probably use a bit of documentation that takes me from
installation through waveform plot, then shows me how to plot
multiple stations for a given event, align, and locate hypocenter
and epicenter. Moment tensor would be nice, too. Synthetics would
be icing on the cake.

Anyone want to help? I'm a willing pupil!

_______________________________________________ obspy-users
mailing list obspy-users@lists.swapbytes.de

<mailto:obspy-users@lists.swapbytes.de>

http://lists.swapbytes.de/mailman/listinfo/obspy-users

_______________________________________________ obspy-users mailing
list obspy-users@lists.swapbytes.de
<mailto:obspy-users@lists.swapbytes.de>
http://lists.swapbytes.de/mailman/listinfo/obspy-users

_______________________________________________ obspy-users mailing
list obspy-users@lists.swapbytes.de
http://lists.swapbytes.de/mailman/listinfo/obspy-users

- --
Dr. Robert Barsch

EGU Office Munich
Luisenstr. 37
80333 Munich
Germany

Phone: +49-89-21806549
Fax: +49-89-218017855
eMail: barsch@egu.eu

Thank you Robert,
I now have a plot of some sample data on my computer screen!
I will continue and try to bring up a few of my SAC files, probably tomorrow. It is 1:40 PM, and it is my son’s birthday. I should probably prepare as I’ve been gone since Sunday, and alas, ObsPy and seismics are not as important as his 17th birthday party :slight_smile:

Thank you for the quick help. I look forward to the process of discovery.

-Daniuel Burk
Michigan State

perfect - with ObsPy running I guess you can now actually enjoy the
birthday party :wink:

Cheers,
Robert

Thank you Robert, I now have a plot of some sample data on my
computer screen! I will continue and try to bring up a few of my
SAC files, probably tomorrow. It is 1:40 PM, and it is my son's
birthday. I should probably prepare as I've been gone since Sunday,
and alas, ObsPy and seismics are not as important as his 17th
birthday party :slight_smile:

Thank you for the quick help. I look forward to the process of
discovery.

-Daniuel Burk Michigan State

- --
Dr. Robert Barsch

EGU Office Munich
Luisenstr. 37
80333 Munich
Germany

Phone: +49-89-21806549
Fax: +49-89-218017855
eMail: barsch@egu.eu

Back to the drawing board here.

I have been unsuccessful at opening any of my files. Here is my first bit of code:

from obspy.core import read
st = read(‘C:\Seismic\Myatis_thrust\2013.045.13.13.17.9195.IU.MA2.00.BHZ.R.SAC’)

The error code returned is as follows, as best as I can type it.

Traceback (most recent call last):

File “”, line 1, in

File “C:\Users\burkdani\ObsPy\lib\site-packages\obspy-0.8.3-py2.7-win-amd64.egg\obspy\core\stream.py”, line 253, in read

raise IOError(2,“No such file or directory”,pathname)

IOError: [Errno 2] No such file or firectory: "C:\Seismic\Myastis_thrust\x813.045.13.13.17.9195.IU.MA2.00.BHZ.R.SAC’

Hi Tycho,

windows paths must be escaped (see
How should I write a Windows path in a Python string literal? - Stack Overflow) -
therefore try

read('C:\\Seismic\\Myatis_thrust\\2013.045.13.13.17.9195.IU.MA2.00.BHZ.R.SAC')

It seems ObsPy only runs in a basic DOS shell with no cut & paste
ability so I have to hand type all of the above. Is there no way to
run ObsPy with pre-existing scripts, or must I type it all in line
by line each time?

write your scripts in whatever editor you want and run it by calling
the python.exe within your obspy installation, e.g.

c:\Users\burkdani\Obspy\scripty\python.exe path\to\your\script

good python developing environments allow to run/debug python within
the environment - usually you have to provide only the path to the
python.exe

Lastly, What is the reasoning and logic as to where what components
are being placed within the directory structure?

I have Python2.7 installed in the directory called c:\Program
Files\Python27\.

- -> system python

I have components on my start menu that point to links unto
themselves; in the directory
"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ObsPy\"

- -> start menu entries

I have the Obspy code itself stuck in the boondocks of the drive
under the following path: c:\Users\burkdani\Obspy\

- -> actual ObsPy installation

reasoning is clean separation of system python and ObsPy installation
- - once you have multiple python projects running you see the big
advantage of this setup - if you dont plan to use any other python for
now just set the the ObsPy python.exe in your PATH environment
variable and it should always use this

Should this all be pointing at a single directory in the Program
Files, and furthermore, should there not be some sort of working
directory to where I import my data files, and work with them? I
have plenty of SAC files I want to analyze and compare. What is the
appropriate strategy for workflow that doesn't involve hand-typing
each line into a black & white command shell? I'd also like to
resize the shell window so that I don't have to use reading glasses
to see the text.

nope you can read from wherever you want - just escape the paths properly

you can change the font properties of your command shell - just click
on the left upper icon of the window

Man, I hope this doesn't sound too pedantic, but really, I need an
ObsPy tutorial on setting up the environment, a method for creating
scripts, opening some waveforms, correlating them, picking phases
and manipulating in order to get a location, moment tensor, and
focal mechanism. I would like to install the software, start with a
single event, extract data from the archive, add my own locally
deployed stations and build up from there. Are there any documents
that describe this process?

you wont find to much information how to setup your own working
environment as it completely depends on the user - I for instance use
the Eclipse IDE as my standard development environment - but other
users would be lost by the amount of features/bloatedness of such IDE
- - other prefer to work on command line with there beloved emacs or vi
editors ... so its bit out of scope for a general tutorial to
introduce the user to an programming environment - we try to focus on
more seismological stuff :wink:

But feel free to ask further questions - here are enough users which
may help you!

Cheers,
Robert

- --
Dr. Robert Barsch

EGU Office Munich
Luisenstr. 37
80333 Munich
Germany

Phone: +49-89-21806549
Fax: +49-89-218017855
eMail: barsch@egu.eu