obspy.io.sac.sactrace.SACTrace._allt

SACTrace._allt(shift)[source]

Shift all relative time headers by some value (addition).

Similar to SAC’s “chnhdr allt”.

This method is triggered by setting an instance’s iztype or changing its reference time, which is the most likely use case for this functionality. If what you’re trying to do is set an origin time and make a file origin-based:

SAC> CHNHDR O GMT 1982 123 13 37 10 103 SAC> LISTHDR O O 123.103 SAC> CHNHDR ALLT -123.103 IZTYPE IO

...it is recommended to just make sure your target reference header is set and correct, and set the iztype:

>>> from obspy import UTCDateTime
>>> from obspy.core.util import get_example_file
>>> file_ = get_example_file("test.sac")
>>> sac = SACTrace.read(file_)
>>> sac.o = UTCDateTime(year=1982, julday=123,
...                     hour=13, minute=37,
...                     second=10, microsecond=103)
>>> sac.iztype = 'io'

The iztype setter will deal with shifting the time values.