# Define the location of the database databaselocation = os.path.join('static_data', 'database_sac') # or "database_hdf5" try: db_base_path = ipynb_path except NameError: try: db_base_path = os.path.dirname(os.path.realpath(__file__)) except NameError: db_base_path = os.getcwd() databaselocation = os.path.join(db_base_path, databaselocation) rfst = read_rf( os.path.join(databaselocation, 'waveforms', 'RF', 'P', 'IU', 'HRV', '*.sac')) # Check traces print("Number of loaded RFs: ", len(rfst)) rfst[0].plot() plt.show(block=False) # %% # Compute Common Conversion Point Stack # +++++++++++++++++++++++++++++++++++++ # # This is similar to the single station stacks. # from pyglimer.ccp import init_ccp
# 2. A set of raw RFs # 3. A move-out corrected RF # 4. A set of move-out corrected RFs # # # Read the IU-HRV receiver functions as a Receiver function stream # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Let's read a receiver function set and see what it's all about! # (i.e. let's look at what data a Receiver function trace contains # and how we can use it!) from pyglimer.rf.create import read_rf path_to_rf = os.path.join(proj_dir, 'waveforms','RF','P','*','*','*.sac') rfstream = read_rf(path_to_rf) print(f"Number of RFs: {len(rfstream)}") # %% # PyGLImER is based on Obspy, but to handle RFs we need some more attributes: from pprint import pprint rftrace = rfstream[0] pprint(rftrace.stats) # %% # First Receiver function plots # -----------------------------
def setUp(self): self.prft = create.read_rf()[0] self.prfz = create.read_rf( os.path.join(finddir(), 'examples', 'PRF_depth.sac'))[0]
def test_example_read_depth(self, pp_mock): create.read_rf(os.path.join(finddir(), 'examples', 'PRF_depth.sac')) pp_mock.assert_called_once()
def test_example_read(self): rf = create.read_rf() self.assertIsInstance(rf, create.RFStream) self.assertIsInstance(rf[0], create.RFTrace)
from pyglimer.plot.plot_utils import set_mpl_params from pyglimer.plot.plot_utils import plot_single_rf from pyglimer.rf.create import read_rf set_mpl_params() # Read all RFs from Station IU/HRV rfst = read_rf("../database/waveforms/RF/P/IU/HRV/*.sac") N = 753 # Plot RF and save its output. plot_single_rf(rfst[N], outputdir="./figures", post_fix="raw", format='svg') # Plot a single RF using the time limits plot_single_rf(rfst[N], tlim=[0, 20], outputdir="./figures", post_fix="timelimit", format='svg') # Plot single RF using time limits and clean plot_single_rf(rfst[N], tlim=[0, 20], clean=True, outputdir="./figures", post_fix="timelimit_clean", format='svg')