Fix. Merge traces from the same station after loading waveforms, use real channel names (i.e. not only EHZ, EHN, EHE) and stop trying to use zero length streams.
This commit is contained in:
parent
94054bc391
commit
5c3ce04868
@ -132,9 +132,10 @@ def get_three_channels_trace_paths(input_path, trace_params):
|
|||||||
day_of_year = pd.Timestamp(str(trace_params["time"])).day_of_year
|
day_of_year = pd.Timestamp(str(trace_params["time"])).day_of_year
|
||||||
net = trace_params["station_network_code"]
|
net = trace_params["station_network_code"]
|
||||||
station = trace_params["station_code"]
|
station = trace_params["station_code"]
|
||||||
|
channel_base = trace_params["trace_channel"]
|
||||||
paths = []
|
paths = []
|
||||||
for channel in ["EHE", "EHN", "EHZ"]:
|
for ch in ["E", "N", "Z"]:
|
||||||
|
channel = channel_base[:-1] + ch
|
||||||
paths.append(
|
paths.append(
|
||||||
f"{input_path}/{year}/{net}/{station}/{channel}.D/{net}.{station}..{channel}.D.{year}.{day_of_year:03}")
|
f"{input_path}/{year}/{net}/{station}/{channel}.D/{net}.{station}..{channel}.D.{year}.{day_of_year:03}")
|
||||||
return paths
|
return paths
|
||||||
@ -178,6 +179,7 @@ def load_stream(input_path, trace_params, time_before=60, time_after=60):
|
|||||||
print(f"no data in: {trace_path}")
|
print(f"no data in: {trace_path}")
|
||||||
else:
|
else:
|
||||||
sampling_rate = stream.traces[0].stats.sampling_rate
|
sampling_rate = stream.traces[0].stats.sampling_rate
|
||||||
|
stream.merge()
|
||||||
|
|
||||||
return sampling_rate, stream
|
return sampling_rate, stream
|
||||||
|
|
||||||
@ -224,7 +226,7 @@ def convert_mseed_to_seisbench_format(input_path, catalog_path, output_path):
|
|||||||
|
|
||||||
trace_params = get_trace_params(picks[0])
|
trace_params = get_trace_params(picks[0])
|
||||||
sampling_rate, stream = load_stream(input_path, trace_params)
|
sampling_rate, stream = load_stream(input_path, trace_params)
|
||||||
if stream is None:
|
if stream is None or len(stream.traces) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
actual_t_start, data, _ = sbu.stream_to_array(
|
actual_t_start, data, _ = sbu.stream_to_array(
|
||||||
|
Loading…
Reference in New Issue
Block a user