Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change comments in events when re-thresholding #576

Merged
merged 7 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions eqcorrscan/core/match_filter/party.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import numpy as np
from obspy import Catalog, read_events, Stream
from obspy.core.event import Comment

from eqcorrscan.core.match_filter.family import _write_family, _read_family
from eqcorrscan.core.match_filter.matched_filter import MatchFilterError
Expand Down Expand Up @@ -489,6 +490,13 @@
d.threshold = new_thresh
d.threshold_input = new_threshold
d.threshold_type = new_threshold_type
if d.event:
d.event.comments = [
c for c in d.event.comments
if not c.text.lower().startswith("threshold=")]
d.event.comments.append(Comment(

Check warning on line 497 in eqcorrscan/core/match_filter/party.py

View check run for this annotation

Codecov / codecov/patch

eqcorrscan/core/match_filter/party.py#L497

Added line #L497 was not covered by tests
text=f"threshold={new_thresh}"))

rethresh_detections.append(d)
family.detections = rethresh_detections
return self
Expand Down
2 changes: 2 additions & 0 deletions eqcorrscan/utils/pre_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,8 @@
Logger.info(f"Splitting these data in {n_chunks} chunks")
if n_chunks == 0:
Logger.error('Data must be process_length or longer, not computing')
Logger.error(f"Data have {data_len_samps} samples and we require at "

Check warning on line 846 in eqcorrscan/utils/pre_processing.py

View check run for this annotation

Codecov / codecov/patch

eqcorrscan/utils/pre_processing.py#L846

Added line #L846 was not covered by tests
f"least {chunk_len_samps} samples")
return []

for i in range(n_chunks):
Expand Down
Loading