obspy.io.gse2.bulletin._read_gse2

_read_gse2(filename, inventory=None, default_network_code='XX', default_location_code=None, default_channel_code=None, res_id_prefix='smi:local', fields=None, event_point_separator=False, agency=None)[source]

Read a GSE2.0 bulletin file and returns an ObsPy Catalog object.

Warning

This function should NOT be called directly, it registers via the ObsPy read_events() function, call this instead.

Parameters:
  • filename (str) File or file-like object in text mode.
  • inventory (Inventory) Inventory used to retrieve network code, location code and channel code of stations.
  • default_network_code (str) Default network code used if stations are not found in the inventory.
  • default_location_code (str) Location code used if stations are not found in the inventory.
  • default_channel_code (str) Default channel code used if stations are not found in the inventory.
  • res_id_prefix (str) Prefix used in ResourceIdentifier attributes.
  • fields (dict) dictionary of positions of input fields, used if input file is non-standard
  • event_point_separator (bool) True if events are separated by point rather than 2 empty lines.
  • agency (str) Agency that generated the file.
Return type:

Catalog

Returns:

An ObsPy Catalog object.

Example

>>> from obspy import read_events
>>> default_fields = {
...     'line_1': {
...         'time': slice(0, 21),
...         'time_fixf': slice(22, 23),
...         'lat': slice(25, 33),
...         'lon': slice(34, 43),
...         'epicenter_fixf': slice(44, 45),
...         'depth': slice(47, 52),
...         'depth_fixf': slice(53, 54),
...         'n_def': slice(56, 60),
...         'n_sta': slice(61, 65),
...         'gap': slice(66, 69),
...         'mag_type_1': slice(71, 73),
...         'mag_1': slice(73, 77),
...         'mag_n_sta_1': slice(78, 80),
...         'mag_type_2': slice(82, 84),
...         'mag_2': slice(84, 88),
...         'mag_n_sta_2': slice(89, 91),
...         'mag_type_3': slice(93, 95),
...         'mag_3': slice(95, 99),
...         'mag_n_sta_3': slice(100, 102),
...         'author': slice(104, 112),
...         'id': slice(114, 122),
...     },
...     'line_2': {
...         'rms': slice(5, 10),
...         'ot_error': slice(15, 21),
...         's_major': slice(25, 31),
...         's_minor': slice(32, 38),
...         'az': slice(40, 43),
...         'depth_err': slice(49, 54),
...         'min_dist': slice(56, 62),
...         'max_dist': slice(63, 69),
...         'mag_err_1': slice(74, 77),
...         'mag_err_2': slice(85, 88),
...         'mag_err_3': slice(96, 99),
...         'antype': slice(104, 105),
...         'loctype': slice(106, 107),
...         'evtype': slice(108, 110),
...     },
...     'arrival': {
...         'sta': slice(0, 5),
...         'dist': slice(6, 12),
...         'ev_az': slice(13, 18),
...         'picktype': slice(19, 20),
...         'direction': slice(20, 21),
...         'detchar': slice(21, 22),
...         'phase': slice(23, 30),
...         'time': slice(31, 52),
...         't_res': slice(53, 58),
...         'azim': slice(59, 64),
...         'az_res': slice(65, 71),
...         'slow': slice(72, 77),
...         's_res': slice(78, 83),
...         't_def': slice(84, 85),
...         'a_def': slice(85, 86),
...         's_def': slice(86, 87),
...         'snr': slice(88, 93),
...         'amp': slice(94, 103),
...         'per': slice(104, 109),
...         'mag_type_1': slice(110, 112),
...         'mag_1': slice(112, 116),
...         'mag_type_2': slice(117, 119),
...         'mag_2': slice(119, 123),
...         'id': slice(124, 132),
...     },
... }
>>> # Only non-standard field indexes are required
>>> fields = {
...     'line_1': {
...         'author': slice(105, 113),
...         'id': slice(114, 123),
...     },
...     'line_2': {
...         'az': slice(40, 46),
...         'antype': slice(105, 106),
...         'loctype': slice(107, 108),
...         'evtype': slice(109, 111),
...     },
...     'arrival': {
...         'amp': slice(94, 104),
...     },
... }
>>> catalog = read_events('/path/to/bulletin/gse_2.0_non_standard.txt',
... default_network_code='FR', res_id_prefix='quakeml:abc',
... fields=fields, event_point_separator=True)
>>> print(catalog)
2 Event(s) in Catalog:
1995-01-16T07:26:52.400000Z | +39.450,  +20.440 | 3.6 mb | manual
1995-01-16T07:27:07.300000Z | +50.772, -129.760 | 1.2 Ml | manual