eqcorrscan / EQcorrscan

Earthquake detection and analysis in Python.
https://eqcorrscan.readthedocs.io/en/latest/
Other
163 stars 85 forks source link

Issue writing event data in a tribe #381

Closed lythk closed 4 years ago

lythk commented 4 years ago

Hi, I'm running into an issue when creating tribes -

I'm creating a tribe for 1 day of data using an event catalog which has more events than just for that day, using tribe_construct. It cuts the templates / creates the tribe properly, but the meta data for the templates is wrong i.e. event.origin and event.picks It seems to be because it gets the event info sequentially from the catalog and not for the specific event? This is giving me problems when I want to use the same origin location for the detections as the template. I can work around it but thought I'd report it in case its a problem on my part or it can be sorted.

cheers, Karen

calum-chamberlain commented 4 years ago

Thanks for reporting this. Can you provide a brief example so that I can try and reproduce your issue.

Can you also report the eqcorrscan version that you are running please.

CJ Chamberlain, out of office


From: karen lythgoe notifications@github.com Sent: Friday, April 17, 2020 11:04:44 PM To: eqcorrscan/EQcorrscan EQcorrscan@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [eqcorrscan/EQcorrscan] Issue writing event data in a tribe (#381)

Hi, I'm running into an issue when creating tribes -

I'm creating a tribe for 1 day of data using an event catalog which has more events than just for that day, using tribe_construct. It cuts the templates / creates the tribe properly, but the meta data for the templates is wrong i.e. event.origin and event.picks It seems to be because it gets the event info sequentially from the catalog and not for the specific event? This is giving me problems when I want to use the same origin location for the detections as the template. I can work around it but thought I'd report it in case its a problem on my part or it can be sorted.

cheers, Karen

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feqcorrscan%2FEQcorrscan%2Fissues%2F381&data=02%7C01%7Ccalum.chamberlain%40vuw.ac.nz%7C47c7d5fa5a83437c6e1508d7e2bf23ed%7Ccfe63e236951427e8683bb84dcf1d20c%7C0%7C0%7C637227182914352568&sdata=2zNHdqnjkS17uGMEdtizic%2FEJkBZB7Pb2wx7%2Bx7U%2Fas%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACTIM42WPPZYBYVSFAEW5HLRNAZUZANCNFSM4MKU62PA&data=02%7C01%7Ccalum.chamberlain%40vuw.ac.nz%7C47c7d5fa5a83437c6e1508d7e2bf23ed%7Ccfe63e236951427e8683bb84dcf1d20c%7C0%7C0%7C637227182914352568&sdata=nt517opoOtbCjmdRSDYsL9WlATEg5l1I1wGmSGbLqb4%3D&reserved=0.

calum-chamberlain commented 4 years ago

Found it, that's an annoying bug!

Will patch shortly, thanks for reporting.

calum-chamberlain commented 4 years ago

Simple recreation of this bug:

from obspy import UTCDateTime
from obspy.clients.fdsn import Client

from eqcorrscan import Tribe

client = Client("GEONET")

cat = client.get_events(
    latitude=-41.7, longitude=174.1, maxradius=0.5, minmagnitude=4.0,
    starttime=UTCDateTime(2013, 7, 30),
    endtime=UTCDateTime(2013, 8, 3))

st = client.get_waveforms(
    network="NZ", station="TCW", location="10", channel="EH?",
    starttime=UTCDateTime(2013, 8, 1),
    endtime=UTCDateTime(2013, 8, 2))

tribe = Tribe().construct(
    method="from_meta_file", lowcut=2, highcut=10, samp_rate=50, filt_order=4,
    length=6, prepick=0.5, st=st, meta_file=cat)

for template in tribe:
    for tr in template.st:
        matched_pick = [p for p in template.event.picks
                        if p.waveform_id.get_seed_string() == tr.id]
        if len(matched_pick) == 0:
            continue
        assert abs(matched_pick[0].time - tr.stats.starttime) == template.prepick
calum-chamberlain commented 4 years ago

Fixed in develop by #382 closing.

calum-chamberlain commented 4 years ago

@lythk this should be fixed in the new (0.4.1) release. Thanks for letting me know! If you find any more issues, please raise more issues.

lythk commented 4 years ago

No worries. Thanks for sorting it!