Seismo-Live: http://seismo-live.org
Introduction:
Basic Tasks:
Advanced Tasks:
Basic lines to set up the notebook and some paths.
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import os
import obspy
plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = (10, 8)
Please also have a look at our webpage - http://www.instaseis.net/ - where everything is documented extensively.
To get going you have to import the package instaseis
.
import instaseis
An Instaseis database must be opened before it can be used. These can be either a local files computed with AxiSEM, or even more easily a remote database hosted by IRIS (http://ds.iris.edu/ds/products/syngine/).
db = instaseis.open_db("syngine://prem_a_10s")
Some basic information about the loaded database can be reviewed by just printing it.
print(db)
From this you can already glance a couple of aspects of the database used for this tutorial:
To avoid delays that become relevant when requesting very many seismograms, IRIS also offers the databases for download.
Instaseis calculates seismograms for any source and receiver pair. A receiver has coordinates and optionally network and station codes. Using a reciprocal database, all receivers are assumed to be at the same depth, i.e. usually at the Earth surface.
rec = instaseis.Receiver(latitude=44.06238, longitude=10.59698,
network="IV", station="BDI")
print(rec)
Sources are naturally a bit more complex and Instaseis offers a variety of ways to define them. A straightforward way for earthquakes is to pass coordinates, moment as well as strike, dip and rake.
src = instaseis.Source.from_strike_dip_rake(
latitude=27.77, longitude=85.37, depth_in_m=12000.0,
M0=1e+21, strike=32., dip=62., rake=90.)
print(src)
Note that origin time was not provided and hence defaults to 1970. A non double-couple source can directly be specified in terms of its moment tensor (note that instaseis uses SI units, i.e. NM, while GCMT uses dyn cm).
src = instaseis.Source(
latitude=27.77, longitude=85.37, depth_in_m=12000.0,
m_rr=8.29e+20, m_tt=-2.33e+20, m_pp=-5.96e+20,
m_rt=2.96e+20, m_rp=4.74e+20, m_tp=-3.73e+20)
print(src)
Sidenote: The moment tensor can be visualized using the Beachball function from obspy.imaging:
from obspy.imaging.beachball import beachball
mt = src.tensor / src.M0 # normalize the tensor to avoid problems in the plotting
beachball(mt, size=200, linewidth=2, facecolor='b');
Now we are ready to extract synthetic seismograms from the database. The return type is an obspy stream object, which can directly be plotted:
st = db.get_seismograms(source=src, receiver=rec, components='ZNERT')
print(st)
st.plot();
Done This is all you need for a basic usage of Instaseis!