obspy.io.gcf.core._write_gcf

_write_gcf(stream, filename, stream_id=None, system_id=None, is_leap=False, gain=None, ttl=None, digi=None, sys_type=None, misalign=0.1, **kwargs)[source]

Writes a Stream or a Trace to a GCF file

Only GCF data records are supported. Function supports format as described by GCF Reference SWA-RFC-GCFR Issue F, December 2021.

Warning

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

Note

Sampling rate is restricted, most sampling rates between 1-250 samples per second (minus a few exceptions)are supported, for greater or lower sampling rates format support can be checked with function compatible_sps().

First data sample in each trace may only be sampled at non-integer second if sampling rate > 250. For sampling rates > 250 first data sample in each trace must start at an integer nominator of the denominator associated with the ampling rate. e.g. for a sampling rate of 1000 samples per second the associated denominator is 4 hence first data sample must be sampled at either ss.00 (0/4), ss.25 (1/4), ss.50 (2/4), or ss.75 (3/4). Use function get_time_denominator() to get the associated denominator.

The GCF format is only guaranteed to support 32-bit signed integer values. While data with values out of range may be properly stored in the GCF format (if first and last data sample can be represented as a 32-bit signed integer as well as all first difference values of the data vector) the current implementaion only permitts input data to be representable as a 32-bit signed integer. If input waveforms cannot be representable as 32-bit signed integers they will be clipped at -2,147,483,648 and 2,147,483,647

Parameters:
  • stream (Stream or Trace) – waveform to write to file,

  • filename (str) – path to GCF file to read

  • stream_id (str) – 6-character stream ID, first 4 characters (the unit ID) should be in the range 0-9, A-Z fifth character should be the orientation code (e.g. Z, N, E) and the last character an integer yielding the tap the data were output from in the digitizer. If not specified stream_id will be taken from stats.gcf.stream_id for each Trace object in the input Stream object if present else stream_id will be constructed as: stats.station.ljust(4, x)[:4]+stats.channel[-1]+'0'

  • system_id (str) –

    4- to 6-character SysID (4 if sys_type is 2, 5 if

    sys_type is 1 and 6 if sys_type is 0). If not specified

    system_id will be taken from stats.gcf.system_id for each

    Trace object in the input Stream object and if present else system_id will be extracted from stream_id starting from first character.

  • is_leap (int) – should be set to True if first sample is sampled at an integer second that is a leap second. If not specified value will be taken from stats.gcf.t_leap for each Trace object in the input Stream if present else the default value is 0

  • gain (int) – digitizer gain (permitted values are 2^n; n <= 6, and -1 if combined with sys_type = 0), if not specified gain will be taken from stats.gcf.gain for each Trace object in the input Stream object if present else the default value is 0.

  • ttl (int) – tap-table-lookup reference. if not specified ttl will be taken from t``stats.gcf.gain`` for each Trace object in the input Stream object if present else the default value is 0

  • digi (int) – digitizer type (permitted values are 0 or 1), if not specified type will be taken from stats.gcf.digi for each Trace object in the input Stream object if present else the default value is 0

  • sys_type (int) – system_id type (permitted values are 0, 1, or 2), if not specified sys_type will be taken from stats.gcf.sys_type for each Trace object in the input Stream object if present else the default value is 0

  • misalign (float) – fraction of a sampling interval (permitted range is 0-0.5) of tolerated misalignment of starttime. If not specified default value is 0.1