obspy.io.sac.sacpz.attach_paz

attach_paz(tr, paz_file, todisp=False, tovel=False, torad=False, tohz=False)[source]

Attach tr.stats.paz AttribDict to trace from SAC paz_file

This is experimental code, taken from obspy.io.gse2.libgse2.attach_paz and adapted to the SAC-pole-zero conventions. Especially the conversion from velocity to displacement and vice versa is still under construction. It works but I cannot guarantee that the values are correct. For more information on the SAC-pole-zero format see: https://ds.iris.edu/files/sac-manual/commands/transfer.html. For a useful discussion on polezero files and transfer functions in general see: http://seis-uk.le.ac.uk/equipment/downloads/data_management/seisuk_instrument_resp_removal.pdf Also bear in mind that according to the SAC convention for pole-zero files CONSTANT is defined as: digitizer_gain*seismometer_gain*A0. This means that it does not have explicit information on the digitizer gain and seismometer gain which we therefore set to 1.0.

Attaches to a trace a paz AttribDict containing poles zeros and gain.

Parameters:
  • tr – An ObsPy Trace object

  • paz_file – path to pazfile or file pointer

  • todisp – change a velocity transfer function to a displacement transfer function by adding another zero

  • tovel – change a displacement transfer function to a velocity transfer function by removing one 0,0j zero

  • torad – change to radians

  • tohz – change to Hertz

>>> from obspy import Trace
>>> import io
>>> tr = Trace()
>>> f = io.StringIO("""ZEROS 3
... -5.032 0.0
... POLES 6
... -0.02365 0.02365
... -0.02365 -0.02365
... -39.3011 0.
... -7.74904 0.
... -53.5979 21.7494
... -53.5979 -21.7494
... CONSTANT 2.16e18""")
>>> attach_paz(tr, f,torad=True)
>>> for z in tr.stats.paz['zeros']:
...     print("%.2f %.2f" % (z.real, z.imag))
-31.62 0.00
0.00 0.00
0.00 0.00