I would like to get event information separately.
from obspy.iris import Client
from obspy import UTCDateTime
client = Client()
starttime = UTCDateTime("2011-04-11")
endtime = UTCDateTime("2011-04-12")
EVTs = client.getEvents(starttime=starttime, endtime=endtime, minmag=6.7)
In : print(EVTs)
1 Event(s) in Catalog:
2011-04-11T08:16:12.730000Z | +37.001, +140.401 | 6.7 MW
I try to get time / lat/ lon/ depth/ ma as its attribute.
I cannot find it.
In : EVTs.
EVTs.append EVTs.copy EVTs.description EVTs.filter EVTs.write
EVTs.clear EVTs.count EVTs.events EVTs.plot
EVTs.comments EVTs.creation_info EVTs.extend EVTs.resource_id
any one knows how to call those parameters separately?
Thank you so much.
I have not worked with Event objects very much, but it looks like you can access the attributes you want in this way:
Your EVTs object is a list of events (in this case, there is only one in the list).
To create an object with just this event in it, and see its attributes, I did this:
In : myevent=EVTs
(try myevent. to see all of the attributes now…)
In : myevent.origins
time: UTCDateTime(2011, 4, 11, 8, 16, 12, 730000)
In : myevent.origins[‘latitude’]
So it looks like each Event can have a list of different origins associated with it (though again, there is only one for this event). You could do a similar thing to get the longitude, time, and depth. The “magnitudes” attribute also seems to be structured in a similar way:
In : myevent.magnitudes
In : myevent.magnitudes[‘mag’]
Hope that helps! If there is a better way of explaining or accessing Event attributes, please let me know…
thank you so much… This is what I am looking for.
It’s not so straightforward.
did try EVTs.… but didn’t see the related attributes
If you are puzzled by the setup of all the event related objects, I can
recommend a look at the QuakeML standard. It is quite complex,
admittedly, but it makes sense and the ObsPy Event structure is modeled
pretty closely around it (as QuakeML is the standard Event/Catalog
exchange format right now).