This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyrocko.guts import Object, Float | |
class Location(Object): | |
lat = Float.T() | |
lon = Float.T() | |
class Setup(Object): | |
location = Location.T(default=Location.D(lat=10., lon=20.)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyrocko.guts import Float, Object, ValidationError, List | |
def float_or_none(x): | |
if x is None: | |
return None | |
else: | |
return float(x) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyrocko import topo, gmtpy | |
wesn = (171., 176., -44., -40.) | |
for dem in ('ETOPO1', 'SRTMGL3'): | |
t = topo.get(dem, wesn) | |
gmtpy.savegrd( | |
t.x(), t.y(), t.data, | |
filename='topo_%s_%g_%g_%g_%g.grd' % ((dem, ) + wesn), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib import pyplot as plt | |
from pyrocko import beachball, moment_tensor as pmt, plot | |
fig = plt.figure(figsize=(4., 2.)) | |
fig.subplots_adjust(left=0., right=1., bottom=0., top=1.) | |
axes = fig.add_subplot(1, 1, 1) | |
axes.set_xlim(0., 4.) | |
axes.set_ylim(0., 2.) | |
axes.set_axis_off() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from pyrocko.fdsn import station as fs | |
# Example on how to manipulate StationXML with Pyrocko (pyrocko.fdsn.station) | |
# | |
# Reads StationXML file and replaces sensor orientation and input unit | |
# information | |
sx = fs.load_xml(filename=sys.argv[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gmtpy | |
import subprocess | |
import os | |
wh = 2.0*gmtpy.cm | |
mw = 0.1*gmtpy.cm | |
inch = 2.54*gmtpy.cm | |
beachball_config = dict( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_call, check_output | |
import os | |
import random | |
import shutil | |
import traceback | |
import tempfile | |
from pyrocko import moment_tensor as pmt | |
from obspy.imaging import beachball as opb | |
import gmtpy | |
import mopad |