eqcorrscan / EQcorrscan

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

from_sac#IndexError: list index out of range #300

Closed lei2019666 closed 5 years ago

lei2019666 commented 5 years ago

Describe the bug See below

Edited by @calum-chamberlain because the form wasn't filled in

lei2019666 commented 5 years ago

from eqcorrscan.core.template_gen import from_sac import glob sac_files = glob.glob('/Users/leiziguang/Desktop/pythonstudy/testfolder/sac/*') templates = from_sac(sac_files=sac_files, lowcut=2.0, highcut=10.0, samp_rate=25.0, filt_order=4, swin='all', length=2.0, prepick=0.1, all_horiz=True) print(templates[0][0].stats.sampling_rate) print(templates) IndexError
Traceback (most recent call last)

in () ----> 1 print(templates[0][0].stats.sampling_rate) 2 print(templates) IndexError: list index out of range i don't know why
calum-chamberlain commented 5 years ago

It looks like your templates are empty. Did you get any output printed to screen from from_sac? Can you confirm that:

  1. sac_files is a list of sac files;
  2. Your sac files have picks associated with them;
  3. The picks are stored in the headers expected by from_sac (from the docs for sactoevent:

    Picks are taken from header values a, t[0-9]

lei2019666 commented 5 years ago

I am sure that I have write the t0 in the header, but it doesn't work too. Could you send me a example file thank you very much!

calum-chamberlain commented 5 years ago

Can you try reading the SAC files using sactoevent and check that there are picks in the returned event.

The example files used in EQcorrscan's tests are here

lei2019666 commented 5 years ago

The t0 in my file is T0MARKER = 60 so it does not work. However the t0 in example file is T0MARKER = 16.087 (S mu) it can work. So the way I Include picks in position 'a' is invalid, how can I write the (S mu)in the header? Thank you very much!

calum-chamberlain commented 5 years ago

I'm afraid I'm not a SAC user, so I can't help you there. You can change headers in obspy if you need. But if your pick time is stored in a different header then you could make a pull request to add the capability to read pick times from that header location to sactoevent if you wanted.

Get Outlook for Androidhttps://aka.ms/ghei36


From: lei2019666 notifications@github.com Sent: Wednesday, March 20, 2019 6:50:40 PM To: eqcorrscan/EQcorrscan Cc: Calum Chamberlain; Mention Subject: Re: [eqcorrscan/EQcorrscan] from_sac#IndexError: list index out of range (#300)

The t0 in my file is T0MARKER = 60 so it does not work. However the t0 in example file is T0MARKER = 16.087 (S mu) it can work. So how can I write the (S mu)in the header? Thank you very much!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feqcorrscan%2FEQcorrscan%2Fissues%2F300%23issuecomment-474694218&data=02%7C01%7Ccalum.chamberlain%40vuw.ac.nz%7C9c77045fbeb4401c63ba08d6acf7fd64%7Ccfe63e236951427e8683bb84dcf1d20c%7C0%7C0%7C636886578496460810&sdata=Qado51xlqctUrS8HHXrMhw46qAJ2tVvQA1QUE%2Bve5o8%3D&reserved=0, or mute the threadhttps://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKaGc-LNXDqLo72fjESgDH11QFlrA4Wtks5vYcwwgaJpZM4b9TOz&data=02%7C01%7Ccalum.chamberlain%40vuw.ac.nz%7C9c77045fbeb4401c63ba08d6acf7fd64%7Ccfe63e236951427e8683bb84dcf1d20c%7C0%7C0%7C636886578496470819&sdata=sqsc%2FaTbr3XJxVyDKmrHxZj5txq8PSmmd6hLjePx7ZY%3D&reserved=0.

lei2019666 commented 5 years ago

I have solved the problem, it's good. thank you a lot! I used the template creation tutorial last week, it download data from GEONET by the format of quakeml, however when I changed the GEONET to IRIS, it dose not work. so I have to download the sac file from IRIS, but this is not convenient. So do you have the example code of template creation that download the date from IRIS, thank you!

calum-chamberlain commented 5 years ago

AFAIK IRIS doesn't usually serve pick information, so you would need to go to the actual data centre that made the picks, see the disclaimer on the IRIS FDSNWS Event page. So you will either want to use NEIC or ISC as your client.