obspy.io.csv.core._events2array
- _events2array(events, **kw)[source]
Convert ObsPy catalog to numpy array
All kwargs are passed to
load_csv()
, e.g. use only=(‘lat’, ‘lon’, ‘mag’) to get an array with lat, lon, mag parameters.Example
>>> from obspy import read_events >>> from obspy.io.csv import _events2array >>> events = read_events() >>> t = _events2array(events) >>> print(t.dtype.names) ('id', 'time', 'lat', 'lon', 'dep', 'magtype', 'mag') >>> print(t) [ ('20120404_0000041', '2012-04-04...', 41.818, 79.689, 1. , 'mb', 4.4) ('20120404_0000038', '2012-04-04T...', 39.342, 41.044, 14.4, 'ML', 4.3) ('20120404_0000039', '2012-04-04T...', 38.017, 37.736, 7. , 'ML', 3. )] >>> print(t['mag']) [ 4.4 4.3 3. ]