_write_tspair(stream, filename, **kwargs)[source]

Writes a ASCII TSPAIR file.


This function should NOT be called directly, it registers via the the write() method of an ObsPy Stream object, call this instead.

  • stream (Stream) The ObsPy Stream object to write.
  • filename (str) Name of file to write.


>>> from obspy import read
>>> st = read()
>>> st.write("tspair.ascii", format="TSPAIR")  

TSPAIR Format Description

TSPAIR is a simple ASCII time series format. Each contiguous time series segment (no gaps or overlaps) is represented with a header line followed by data samples in time-sample pairs. There are no restrictions on how the segments are organized into files, a file might contain a single segment or many, concatenated segments either for the same channel or many different channels.

Header lines have the general form:

TIMESERIES SourceName, # samples, # sps, Time, Format, Type, Units


“Net_Sta_Loc_Chan_Qual”, no spaces, quality code optional
# samples
Number of samples following header
# sps
Sampling rate in samples per second
Time of first sample in ISO YYYY-MM-DDTHH:MM:SS.FFFFFF format
‘TSPAIR’ (fixed)
Sample type ‘INTEGER’, ‘FLOAT’ or ‘ASCII’
Units of time-series, e.g. Counts, M/S, etc., may not contain spaces

Example TSPAIR file:

TIMESERIES NL_HGN_00_BHZ_R, 12 samples, 40 sps, 2003-05-29T02:13:22.043400, TSPAIR, INTEGER, Counts
2003-05-29T02:13:22.043400  2787
2003-05-29T02:13:22.068400  2776
2003-05-29T02:13:22.093400  2774
2003-05-29T02:13:22.118400  2780
2003-05-29T02:13:22.143400  2783
2003-05-29T02:13:22.168400  2782
2003-05-29T02:13:22.193400  2776
2003-05-29T02:13:22.218400  2766
2003-05-29T02:13:22.243400  2759
2003-05-29T02:13:22.268400  2760
2003-05-29T02:13:22.293400  2765
2003-05-29T02:13:22.318400  2767