Skip to content

Commit

Permalink
scattering: allow data_load to accept local path
Browse files Browse the repository at this point in the history
  • Loading branch information
zerafachris committed Jun 4, 2024
1 parent ec45115 commit 7e14c0a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions scatcluster/processing/scattering.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import pickle

import obspy

import cupy as cp
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -108,13 +110,20 @@ def load_data(self, starttime: UTCDateTime, endtime: UTCDateTime, channel: str)
Stream: Processed obspy stream
"""
try:
client = Client(self.data_client_path)
stream = client.get_waveforms(network=self.data_network,
station=self.data_station,
location=self.data_location,
channel=channel,
starttime=starttime,
endtime=endtime)
if 'local:' in self.data_client_path:
stream = obspy.read( self.data_client_path.replace('local:',''))
stream.trim(starttime, endtime)

elif 'sds.chris' in self.data_client_path:
client = Client(self.data_client_path)
stream = client.get_waveforms(network=self.data_network,
station=self.data_station,
location=self.data_location,
channel=channel,
starttime=starttime,
endtime=endtime)
else:
raise ValueError('Unknown data client path')

stream = self.stream_process(stream)
stream.merge(method=1, fill_value=0)
Expand Down

0 comments on commit 7e14c0a

Please sign in to comment.