1""" 2obspy.io.nied.fnetmt - F-net's moment tensors TEXT format support for ObsPy 3=========================================================================== 4 5This module provides read support for the moment tensor files (TEXT format) 6provided for the F-net broadband seismograph network operated by the National 7Research Institute for Earth Science and Disaster Prevention in Japan 8(NIED; http://www.fnet.bosai.go.jp/). 9 10:copyright: 11 The ObsPy Development Team (devs@obspy.org) 12:license: 13 GNU Lesser General Public License, Version 3 14 (https://www.gnu.org/copyleft/lesser.html) 15 16Example 17------- 18 19It works by utilizing ObsPy's :func:`~obspy.core.event.read_events` function. 20 21>>> import obspy 22>>> cat = obspy.read_events("/path/to/FNETMTCATALOG") 23>>> print(cat) 241 Event(s) in Catalog: 252011-03-11T05:46:18.120000Z | +38.103, +142.861 | 8.7 Mw 26 27The event will contain a couple of origins and magnitudes. 28 29>>> print(cat[0]) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE 30Event: 2011-03-11T05:46:18.120000Z | +38.103, +142.861 | 8.7 Mw 31<BLANKLINE> 32 resource_id: ResourceIdentifier(id="smi:local/fnetmt/2011excpds/event") 33 event_type: 'earthquake' 34 preferred_origin_id: ResourceIdentifier(id="smi:local/fnetmt/2011excpds/origin#MT") 35 preferred_magnitude_id: ResourceIdentifier(id="smi:local/fnetmt/2011excpds/magnitude#MT") 36 preferred_focal_mechanism_id: ResourceIdentifier(id="smi:local/fnetmt/2011excpds/focal_mechanism") 37 --------- 38 focal_mechanisms: 1 Elements 39 origins: 2 Elements 40 magnitudes: 2 Elements 41 42 43obspy.io.nied.knet - K-NET and KiK-net ASCII format support for ObsPy 44===================================================================== 45 46This module provides read support for the ASCII format for waveforms from the 47K-NET and KiK-net strong-motion seismograph networks operated by the National 48Research Institute for Earth Science and Disaster Prevention in Japan 49(NIED; http://www.kyoshin.bosai.go.jp/). 50 51KiK-net stations consist of one borehole and one surface sensor which are 52distinguished by their channel names: 53 54 ============ ============= ====================== 55 Channel name Sensor type Sensor orientation 56 ============ ============= ====================== 57 NS1 Borehole N 58 EW1 Borehole E 59 UD1 Borehole Z 60 NS2 Surface N 61 EW2 Surface E 62 UD2 Surface Z 63 ============ ============= ====================== 64 65K-NET stations only have one surface sensor with the following channel naming 66conventions: 67 68 ============ ====================== 69 Channel name Sensor orientation 70 ============ ====================== 71 NS N 72 EW E 73 UD Z 74 ============ ====================== 75 76:copyright: 77 The ObsPy Development Team (devs@obspy.org) 78:license: 79 GNU Lesser General Public License, Version 3 80 (https://www.gnu.org/copyleft/lesser.html) 81 82Example 83------- 84 85Reading K-NET/KiK-net files is handled by using ObsPy's 86standard :func:`~obspy.core.stream.read` function. The format is detected 87automatically. 88 89>>> from obspy import read 90>>> st = read('/path/to/test.knet') 91>>> print(st) # doctest: +ELLIPSIS 921 Trace(s) in Stream: 93BO.AKT013..EW | 1996-08-10T... - 1996-08-10T... | 100.0 Hz, 5900 samples 94 95Note that K-NET/KiK-net station names are 6 characters long. This will cause 96problems if you want to write MiniSEED as it only allows 5 character station 97names. In this case you can opt to write the last 2 characters of the station 98name into the location field. This is possible because the location is encoded 99in the channel name (see table above). 100 101>>> st = read('/path/to/test.knet',convert_stnm=True) 102>>> print(st) # doctest: +ELLIPSIS 1031 Trace(s) in Stream: 104BO.AKT0.13.EW | 1996-08-10T18:12... - 1996-08-10T... | 100.0 Hz, 5900 samples 105 106Additional header entries from the K-NET/KiK-net file are written to a 107dictionary called 'knet': 108 109>>> print(st[0].stats) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE 110 network: BO 111 station: AKT0 112 location: 13 113 channel: EW 114 starttime: 1996-08-10T18:12:24.000000Z 115 endtime: 1996-08-10T18:13:22.990000Z 116 sampling_rate: 100.0 117 delta: 0.01 118 npts: 5900 119 calib: 2.3841857...e-06 120 _format: KNET 121 knet: AttribDict(...) 122 123>>> print(st[0].stats.knet.stlo) 124140.3213 125 126>>> print(st[0].stats.knet.comment) 127A dummy comment 128 129The meaning of the entries in the 'knet' dictionary is as follows: 130 ==================== ================================================== 131 Name Description 132 ==================== ================================================== 133 evot Event origin time (UTC) 134 evla Event latitude 135 evlo Event longitude 136 evdp Event depth 137 mag Event magnitude 138 stla Station latitude 139 stlo Station longitude 140 stel Station elevation 141 accmax Maximum acceleration (after baseline removal) 142 duration Recording duration time [s] 143 comment Comment 144 last correction Time of last correction (Japanese standard time) 145 ==================== ================================================== 146 147""" 148 149from __future__ import (absolute_import, division, print_function, 150 unicode_literals) 151from future.builtins import * # NOQA 152 153 154if __name__ == '__main__': 155 import doctest 156 doctest.testmod(exclude_empty=True) 157