class WavebankWrapper(AnxcorDatabase): def __init__(self, directory): super().__init__() self.bank = WaveBank( directory, name_structure='{network}.{station}.{channel}.{time}') self.bank.update_index() def get_waveforms(self, **kwargs): stream = self.bank.get_waveforms(**kwargs) traces = [] for trace in stream: data = trace.data[:-1] header = { 'delta': trace.stats.delta, 'station': trace.stats.station, 'starttime': trace.stats.starttime, 'channel': trace.stats.channel, 'network': trace.stats.network } traces.append(Trace(data, header=header)) return Stream(traces=traces) def get_stations(self): df = self.bank.get_availability_df() uptime = self.bank.get_uptime_df() def create_seed(row): network = row['network'] station = row['station'] return network + '.' + station df['seed'] = df.apply(lambda row: create_seed(row), axis=1) unique_stations = df['seed'].unique().tolist() return unique_stations
class WavebankWrapperWLatLons(AnxcorDatabase): def __init__(self, directory): super().__init__() self.bank = WaveBank(directory) import warnings warnings.filterwarnings("ignore") def get_waveforms(self, **kwargs): stream = self.bank.get_waveforms(**kwargs) traces = [] for trace in stream: data = trace.data[:-1] header = { 'delta': np.floor(trace.stats.delta * 1000) / 1000.0, 'station': trace.stats.station, 'starttime': trace.stats.starttime, 'channel': trace.stats.channel, 'network': trace.stats.network } trace = Trace(data, header=header) trace.stats.coordinates = {'longitude': -117, 'latitude': 35} traces.append(trace) return Stream(traces=traces) def get_stations(self): df = self.bank.get_availability_df() def create_seed(row): network = row['network'] station = row['station'] return network + '.' + station df['seed'] = df.apply(lambda row: create_seed(row), axis=1) unique_stations = df['seed'].unique().tolist() return unique_stations
class WavebankWrapper(AnxcorDatabase): def __init__(self, directory): super().__init__() self.bank = WaveBank( directory, name_structure='{network}.{station}.{channel}.{time}') self.bank.update_index() def get_waveforms(self, **kwargs): stream = self.bank.get_waveforms(**kwargs) traces = [] for trace in stream: data = trace.data[:-1] if isinstance(data, np.ma.MaskedArray): data = np.ma.filled(data, fill_value=np.nan) if 'z' in trace.stats.channel.lower(): channel = 'z' elif 'n' in trace.stats.channel.lower(): channel = 'n' elif 'e' in trace.stats.channel.lower(): channel = 'e' header = { 'delta': trace.stats.delta, 'station': trace.stats.station, 'starttime': trace.stats.starttime, 'channel': channel, 'network': trace.stats.network } trace = Trace(data, header=header) coordinate_dict = {'latitude': 0, 'longitude': 1, 'elevation': 0} if trace.stats.station == '1': coordinate_dict['latitude'] = 50 coordinate_dict['longitude'] = 50 elif trace.stats.station == '2': coordinate_dict['latitude'] = 0 coordinate_dict['longitude'] = 50 else: coordinate_dict['latitude'] = 50 coordinate_dict['longitude'] = 0 trace.stats.coordinates = coordinate_dict traces.append(trace) return Stream(traces=traces) def get_stations(self): df = self.bank.get_availability_df() uptime = self.bank.get_uptime_df() def create_seed(row): network = row['network'] station = row['station'] return network + '.' + station df['seed'] = df.apply(lambda row: create_seed(row), axis=1) unique_stations = df['seed'].unique().tolist() return unique_stations
def __init__(self, directory): super().__init__() self.bank = WaveBank( directory, name_structure='{network}.{station}.{channel}.{time}') self.bank.update_index()
def get_ancor_set(): bank = WaveBank(source_dir) return bank
def __init__(self, directory): super().__init__() self.bank = WaveBank(directory) self.bank.update_index()
def __init__(self, directory): super().__init__() self.bank = WaveBank(directory) import warnings warnings.filterwarnings("ignore")