Skip to content

Commit

Permalink
add stations with unit of m
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuwq0 authored Feb 4, 2024
1 parent 8741f84 commit 111a95a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions phasenet/data_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 111a95a

Please sign in to comment.