The original input file can be found in the sw4-v1.1/examples/rfile
directory, also on SW4's GitHub repository.
However to generate the output used in this notebook run the simulation again with
this input file: https://github.com/shaharkadmiel/pySW4/blob/master/tutorials/berkeley.sw4
In [2]:
import os
import sys
import pySW4 as sw4
import matplotlib.pyplot as plt
import numpy as np
Using the rfileIO library to read in the model.
In [3]:
f = '../sw4-v1.1/examples/rfile/berkeley.rfile'
model = sw4.prep.rfileIO.read(f, block_number='all', verbose=True)
In [4]:
model.plot_topography(cmap='terrain')
Out[4]:
In [5]:
cs = model.get_cross_section(0, 12, 0, 12)
cs.plot()
Out[5]:
In [6]:
z, properties = model.get_z_profile(4, 4)
labels = ('rho, kg/m^3', 'vp, m/s', 'vs, m/s', 'qp', 'qs')
fig, ax = plt.subplots()
for p, label in zip(properties.T, labels):
p = np.ma.masked_equal(p, -999)
ax.plot(p, z, label=label)
ax.invert_yaxis()
ax.xaxis.tick_top()
ax.set_xlabel('Material properties')
ax.xaxis.set_label_position('top')
ax.set_ylabel('Z, km')
ax.legend(loc=0)
Out[6]:
In [7]:
f = '../sw4-v1.1/examples/rfile/results/berkeley.cycle=00000.z=0.topo.sw4img'
topo = sw4.read_image(f)
topo.plot(cmap='terrain')
Out[7]: