Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

# -*- coding: utf-8 -*- 

#------------------------------------------------------------------------------ 

#  Purpose: Core classes of ObsPy: Python for Seismological Observatories 

#   Author: Robert Barsch 

#           Moritz Beyreuther 

#           Lion Krischer 

#           Tobias Megies 

# 

# Copyright (C) 2008-2012 Robert Barsch, Moritz Beyreuther, Lion Krischer, 

#                         Tobias Megies 

#------------------------------------------------------------------------------ 

""" 

obspy.core - Core classes of ObsPy 

================================== 

 

This package contains common methods and classes for ObsPy. It includes the 

:class:`~obspy.core.stream.Stream`, :class:`~obspy.core.trace.Trace`, 

:class:`~obspy.core.utcdatetime.UTCDateTime`, :class:`~obspy.core.trace.Stats` 

classes and methods for :func:`reading <obspy.core.stream.read>` seismogram 

files. 

 

:copyright: 

    The ObsPy Development Team (devs@obspy.org) 

:license: 

    GNU Lesser General Public License, Version 3 

    (http://www.gnu.org/copyleft/lesser.html) 

 

Summary 

------- 

Seismograms of various formats (e.g. SAC, MiniSEED, GSE2, SEISAN, Q, etc.) can 

be imported into a :class:`~obspy.core.stream.Stream` object using the 

:func:`~obspy.core.stream.read` function. 

 

Streams are list-like objects which contain multiple 

:class:`~obspy.core.trace.Trace` objects, i.e. gap-less continuous time series 

and related header/meta information. 

 

Each Trace object has the attribute ``data`` pointing to a NumPy_ 

:class:`~numpy.ndarray` of the actual time series and the attribute ``stats`` 

which contains all meta information in a dict-like 

:class:`~obspy.core.trace.Stats` object. Both attributes ``starttime`` and 

``endtime`` of the Stats object are 

:class:`~obspy.core.utcdatetime.UTCDateTime` objects. 

 

Example 

------- 

A :class:`~obspy.core.stream.Stream` with an example seismogram can be created 

by calling :func:`~obspy.core.stream.read()` without any arguments. 

Local files can be read by specifying the filename, files stored on http 

servers (e.g. at http://examples.obspy.org) can be read by specifying their 

URL. For details see the documentation of :func:`~obspy.core.stream.read`. 

 

>>> from obspy import read 

>>> st = read() 

>>> print(st)  # doctest: +ELLIPSIS 

3 Trace(s) in Stream: 

BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z - ... | 100.0 Hz, 3000 samples 

BW.RJOB..EHN | 2009-08-24T00:20:03.000000Z - ... | 100.0 Hz, 3000 samples 

BW.RJOB..EHE | 2009-08-24T00:20:03.000000Z - ... | 100.0 Hz, 3000 samples 

>>> tr = st[0] 

>>> print(tr)  # doctest: +ELLIPSIS 

BW.RJOB..EHZ | 2009-08-24T00:20:03.000000Z - ... | 100.0 Hz, 3000 samples 

>>> tr.data 

array([ 0.        ,  0.00694644,  0.07597424, ...,  1.93449584, 

        0.98196204,  0.44196924]) 

>>> print tr.stats  # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS 

         network: BW 

         station: RJOB 

        location: 

         channel: EHZ 

       starttime: 2009-08-24T00:20:03.000000Z 

         endtime: 2009-08-24T00:20:32.990000Z 

   sampling_rate: 100.0 

           delta: 0.01 

            npts: 3000 

           calib: 1.0 

           ... 

>>> tr.stats.starttime 

UTCDateTime(2009, 8, 24, 0, 20, 3) 

 

.. _NumPy: http://docs.scipy.org 

""" 

 

# don't change order 

from obspy.core.utcdatetime import UTCDateTime 

from obspy.core.util.attribdict import AttribDict 

from obspy.core.trace import Stats, Trace 

from obspy.core.stream import Stream, read 

from obspy.core.scripts.runtests import runTests 

 

 

if __name__ == '__main__': 

    import doctest 

    doctest.testmod(exclude_empty=True)