3

I'm very new to focal mechanisms (beach balls) and would like to plot these on to a global map using Python.

I already have installed the Anaconda suite, and would like to know if I need to install any further modules to get this working (i.e. is the obspy module included in the Anaconda suite?

I won't be using any specific seismology files as input, but would simply like to create these beach balls by just manually inserting the corresponding parameters. So far I've come across two different examples of code:

from obspy.imaging.beachball import beachball
np1 = [150, 87, 1]
beachball(np1) 

and...

from obspy.imaging.beachball import beachball
mt = [-2.39, 1.04, 1.35, 0.57, -2.94, -0.94]
beachball(mt) 

It is not clear to me what each of these values refer to. I have an example of a site where I'd like to retrieve the relevant information from, then use these values as input for the beach ball:

http://earthquake.usgs.gov/earthquakes/eventpage/us20005ysu#moment-tensor

Thanks in advance.

mtrw
  • 34,200
  • 7
  • 63
  • 71
pymat
  • 1,090
  • 1
  • 23
  • 45
  • I'm a bit unclear on your question, what is it that you are after? Are you just after the definition of those values? – TuanDT Oct 07 '16 at 11:48
  • Yes firstly definition of the values (I havn't so far found the literature on this). Also, do I need a seperate installation of this module even if anacondas is installed? – pymat Oct 07 '16 at 11:53
  • https://docs.obspy.org/packages/autogen/obspy.imaging.beachball.beachball.html#obspy.imaging.beachball.beachball That specifies the meaning of the 3 or 6 item list argument to beachball function. Not sure about how beachball is used in anaconda – TuanDT Oct 07 '16 at 14:53

2 Answers2

2

Our Tutorial has examples of map plots including beachball patches:

http://docs.obspy.org/tutorial/code_snippets/basemap_plot_with_beachballs.html#basemap-plot-of-the-globe

Or check out our more up-to-date master branch Tutorial:

http://docs.obspy.org/master/tutorial/code_snippets/basemap_plot_with_beachballs.html

Pimping those examples you find there a bit you can arrive at this piece of code to plot moment tensors on a basemap (projection can be changed to your liking of course):

import numpy as np
import matplotlib.pyplot as plt 
from mpl_toolkits.basemap import Basemap

from obspy import read_events
from obspy.imaging.beachball import beach


event = read_events(
    'https://earthquake.usgs.gov/archive/product/moment-tensor/'
    'us_20005ysu_mww/us/1470868224040/quakeml.xml', format='QUAKEML')[0]
origin = event.preferred_origin() or event.origins[0]
focmec = event.preferred_focal_mechanism() or event.focal_mechanisms[0]
tensor = focmec.moment_tensor.tensor
moment_list = [tensor.m_rr, tensor.m_tt, tensor.m_pp,
               tensor.m_rt, tensor.m_rp, tensor.m_tp]

m = Basemap(projection='cyl', lon_0=origin.longitude, lat_0=origin.latitude,
            resolution='c')

m.drawcoastlines()
m.fillcontinents()
m.drawparallels(np.arange(-90., 120., 30.))
m.drawmeridians(np.arange(0., 420., 60.))
m.drawmapboundary()

x, y = m(origin.longitude, origin.latitude)

ax = plt.gca()
b = beach(moment_list, xy=(x, y), width=20, linewidth=1, alpha=0.85)
b.set_zorder(10)
ax.add_collection(b)
plt.show()

Basemap plot with beachball

You'll need the basemap package installed for this (conda install basemap).

megies
  • 85
  • 5
1

Here, seismic source is described via moment tensor components

mt = [-2.39, 1.04, 1.35, 0.57, -2.94, -0.94]

Here, focal mechanism is described using nodal planes. There are two nodal planes - principal and auxiliary. In the example below, the principal one is given as input and auxiliary one is computed automatically. Orientation of the nodal plane is given with three angles [Strike, Dip, Rake]

np1 = [150, 87, 1]

According to opensha.org:

Strike: Fault strike is the direction of a line created by the intersection of a fault plane and a horizontal surface, 0° to 360°, relative to North. Strike is always defined such that a fault dips to the right side of the trace when moving along the trace in the strike direction. The hanging-wall block of a fault is therefore always to the right, and the footwall block on the left. This is important because rake (which gives the slip direction) is defined as the movement of the hanging wall relative to the footwall block.

Dip: Fault dip is the angle between the fault and a horizontal plane, 0° to 90°.

Rake: Rake is the direction a hanging wall block moves during rupture, as measured on the plane of the fault. It is measured relative to fault strike, ±180°. For an observer standing on a fault and looking in the strike direction, a rake of 0° means the hanging wall, or the right side of a vertical fault, moved away from the observer in the strike direction (left lateral motion). A rake of ±180° means the hanging wall moved toward the observer (right lateral motion). For any rake>0, the hanging wall moved up, indicating thrust or reverse motion on the fault; for any rake<0° the hanging wall moved down, indicating normal motion on the fault.

I installed Obspy to Anaconda in this way

~/anaconda/bin/pip install obspy

After doing this the code you gave works fine:

from obspy.imaging.beachball import beachball
mt = [-2.39, 1.04, 1.35, 0.57, -2.94, -0.94]
beachball(mt) 

Focal mechanism