Skip to content
Snippets Groups Projects
Commit af72dc0f authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

Force traces in stream to first dtype before merge

A Stream corresponding to a given network, station, location, and
channel can (but probably shouldn't) have more than 1 trace returned
from an ObsPy client.get_waveforms() function. This happens, for
example, when the data type generated by a given station changes.
This change forces the dtype of the data array for all Traces in
the Stream to match the dtype of the data array in the first Trace
of the Stream, thus allowing the Stream.merge() function to work
as intended.
parent a4bc6d95
No related branches found
No related tags found
1 merge request!214Minor factory fixes applied in March 2023
......@@ -361,6 +361,8 @@ class MiniSeedFactory(TimeseriesFactory):
data = self.client.get_waveforms(
sncl.network, sncl.station, sncl.location, sncl.channel, starttime, endtime
)
for trace in data:
trace.data = trace.data.astype(data[0].data.dtype)
data.merge()
if data.count() == 0 and add_empty_channels:
data += self._get_empty_trace(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment