obspyload with my own events

Hi everyone,

I have looked a bit at obspyload.py, and it looks very useful. I'm curious, though, is it possible to download data using my own event list? I see a few ways to hack this, but it seems like that functionality could potentially be inside obspyload already. If it is not, perhaps someone could suggest the best entry point for adding it?

Thanks for your help.

Best,
Jonathan

Hi Jonathan,

thanks for your interest in the script.
What's the format of the event list you want to use - did you get it
with the obspy.neries.client with sth. like

mylist = client.getEvents() ?

If so, a specific functionality to use that list is not in obspyload,
but it won't be a large effort to add it.
Just tell me how you retrieved those event lists. Do you save them to
disk with the pickle module?

(if you want to look into it, the code following lines 1467 reads a
pickle saved file - we could add a flag or you just put your own
pickle file in a directory, call it 'events.pickle' and let obspyload
run on that directory.

Best,
Chris

Hello Chris,

Thanks for your response. I download events using several different methods (SOD, IRIS Jweed, lists emailed from collaborators), so my question is a bit more general. It looks like the neries "getEvents" returns a list of dictionaries; perhaps I can just supply obspyload with a custom "get_events" function that returns a list a dictionaries with keys that look like those returned by "getEvents"?

Best,
Jonathan

Hi Jonathan,

that's right, a list of dictionaries of the following form is
returned:

[{'origin_id': 787423, 'event_id': u'20120417_0000016', 'author':
u'CSEM', 'longitude': -71.474999999999994, 'datetime':
UTCDateTime(2012, 4, 17, 3, 50, 15), 'depth': -30.0, 'magnitude':
6.7000000000000002, 'magnitude_type': u'mw', 'latitude':
-32.610999999999997, 'flynn_region': u'OFFSHORE VALPARAISO, CHILE'},
{...}, ... ]

The event loop following lines 943 in the current code reads these
keys:

        eventid = eventdict['event_id']
        eventtime = eventdict['datetime']
        eventlat = float(eventdict['latitude'])
        eventlon = float(eventdict['longitude'])
        eventdepth = float(eventdict['depth'])
and a bit further these keys
'origin_id', 'author', 'flynn_region', 'magnitude', 'magnitude_type'

So you would need to add a function or modify the get_events() s.t. it
returns a list of dictionaries that has these keys.
You can provide placeholders for some values, but for the plot to work
you need 'latitude' and 'longitude', of course.

Hope this helps. Let me know if I can help further.

all the best,
Chris

Hi again,

So you would need to add a function or modify the get_events() s.t. it
returns a list of dictionaries that has these keys.
You can provide placeholders for some values, but for the plot to work
you need 'latitude' and 'longitude', of course.

Alternatively, you could write a script that creates these dictionaries
and saves them with the pickle module:

fh = open('path/to/some/events.pickle', 'wb')
pickle.dump(myListOfDicts, fh)

So the file needs to be called events.pickle. Then let obspyload run
on that directory with obspyload.py -P /path/to/some/

greets
Chris