From 111a95ac2b1bcd1cf3086068b8ba3e1962670d87 Mon Sep 17 00:00:00 2001 From: Weiqiang Zhu <75299929+zhuwq0@users.noreply.github.com> Date: Sun, 4 Feb 2024 06:54:37 +0000 Subject: [PATCH] add stations with unit of m --- phasenet/data_reader.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/phasenet/data_reader.py b/phasenet/data_reader.py index 3de2074..20c1c9c 100755 --- a/phasenet/data_reader.py +++ b/phasenet/data_reader.py @@ -506,19 +506,24 @@ def read_mseed_array(self, fname, stations, amplitude=False, remove_resp=True): trace_data[: len(tmp), j] = tmp[:nt] if amplitude: # if stations.iloc[i]["unit"] == "m/s**2": - if stations[sta]["unit"] == "m/s**2": + if stations[sta]["unit"].lower() == "m/s**2": tmp = mseed.select(id=sta + c)[0] tmp = tmp.integrate() tmp = tmp.filter("highpass", freq=1.0) tmp = tmp.data.astype(self.dtype) trace_amp[: len(tmp), j] = tmp[:nt] # elif stations.iloc[i]["unit"] == "m/s": - elif stations[sta]["unit"] == "m/s": + elif stations[sta]["unit"].lower() == "m": + tmp = mseed.select(id=sta + c)[0] + tmp = tmp.differentiate() + tmp = tmp.data.astype(self.dtype) + trace_amp[: len(tmp), j] = tmp[:nt] + elif stations[sta]["unit"].lower() == "m/s": tmp = mseed.select(id=sta + c)[0].data.astype(self.dtype) trace_amp[: len(tmp), j] = tmp[:nt] else: print( - f"Error in {stations.iloc[i]['station']}\n{stations.iloc[i]['unit']} should be m/s**2 or m/s!" + f"Error in {stations[sta]}\n{stations[sta]['unit']} should be m/s**2 or m/s or m!" ) if amplitude and remove_resp: # trace_amp[:, j] /= float(resp[j])