Skip to content

Commit

Permalink
Merge pull request #581 from eqcorrscan/length-sanitation
Browse files Browse the repository at this point in the history
Drop last sample, not first
  • Loading branch information
calum-chamberlain authored Jul 25, 2024
2 parents 3aab7e8 + 79765b1 commit 3d51092
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions eqcorrscan/utils/pre_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ def _sanitize_length(st, starttime=None, endtime=None):
tr.trim(starttime, endtime)
if len(tr.data) == ((endtime - starttime) *
tr.stats.sampling_rate) + 1:
Logger.info(f"{tr.id} is overlength dropping first sample")
tr.data = tr.data[1:len(tr.data)]
# TODO: this should adjust the start-time
# tr.stats.starttime += tr.stats.delta
Logger.info(f"{tr.id} between {tr.stats.starttime} and "
f"{tr.stats.endtime} with {tr.stats.npts} samples "
f"is overlength by one sample. Dropping last "
f"sample.")
tr.data = tr.data[0:-1]
length = endtime - starttime
clip = True
elif starttime:
Expand Down

0 comments on commit 3d51092

Please sign in to comment.