Thread: SAC format questions

Started: 2006-02-22 18:33:51
Last activity: 2006-02-22 21:52:04
Topics: SAC Developers
Chad Trabant
2006-02-22 18:33:51

Howdy,

I recently put together a simple SAC to miniSEED converter (a bit of wheel
reinventing). My sac2mseed has some nice features: format and byte order
autodetection, autoscaling of floats to ints when needed. I had a few
questions regarding the format:

- Most SAC reading code out there works with version '6' of the header, how
common are other versions of the header, does 6 cover the vast majority?

- Autodetection of format tests the first 4 bytes in a file, if they're spaces
alphanumeric format is assumed. Is this test valid?

- Besides little/big endian binary with 32-bit floats and alphanumeric are
there any other format variants in the wild?

Any comments would be appreciated.

cheers,
Chad

  • Arthur Snoke
    2006-02-22 21:52:04
    - Most SAC reading code out there works with version '6' of the header,
    how common are other versions of the header, does 6 cover the vast
    majority?

    Brian Savage found the attached file and sent it to me.

    The short version is that I do not think we have to think about earlier
    versionsSAC version history

    History: In reverse order
    * 821001: Header version 6 installed.
    * 801018: Header version 5 installed.
    * 800809: Fixed bug with headers of files from Octopus.
    * 800510: Header version 4 installed.
    * 800105: Original Prime version.

    Version 1: "Original Prime Version"
    * I am assuming this as Version 1 as it was not documented in updhdr.c

    Version 2: changed the values in each of the header field types
    * used to represent an undefined state. Previously they were all
    * equivalent to the ascii 'UNDEF'. Now they are:
    * - FUNDEF = -12345. for floating point fields.
    * - NUNDEF = -12345 for integer fields.
    * - IUNDEF = -12345 for selected value fields.
    * - KUNDEF = 'UNDEF' for alphanumeric fields.
    * - no value for undefined logical fields.
    * - Version 1 was never supported on the Prime.

    Version 3:
    * - added FINI in FHDR(40).
    * - added SB in FHDR(55).
    * - added SDELTA in FHDR(56).
    * - added FMEAN in FHDR(57).
    * - replaced ICOMP in IHDR(4) and HORZO in FHDR(21)
    * with CMPAZ in FHDR(58), CMPINC in FHDR(59),
    * KCMPNM in KHDR(1,6), and LPSPOL in LHDR(2).
    * - possible values of ICOMP were IRADNV=23, ITANNV=24,
    * IRADEV=25, ITANEV=26, INORTH=27, IEAST=28,
    * IHORZA=29, IDOWN=30, and IUP=31.

    Version 4:
    * - added LOVROK in LHDR(3).
    * - moved NZHOUR from NHDR(5) to NHDR(4).
    * - moved NZMIN from NHDR(6) to NHDR(5).
    * - equivalenced NZDTTM array to NZYEAR in NHDR(2).
    * - changed entire KHDR array. Before each entry was 24 characters
    * in length. Now they may be any multiple of 8 characters in
    * length.
    * KHDR was changed to a 1 dimensional array but the length was
    * not changed.
    *
    * variable old_loc new_loc new_len
    * -------- ------- ------- -------
    * KSTNM 1 1 1
    * KEVNM 4 2 2
    * KHOLE 7 4 3
    * KZTIME 10 7 2
    * KZDATE 13 9 3
    * KCMPNM 16 12 3
    * KUSER NEW 13 3

    Version 5:
    * - Changed alphanumeric undefined fields from 'UNDEF' to '-12345'.
    * - Changed all KHDR fields from dimensioned CHAR*8 variables
    * to non dimensioned variables of correct character length.
    * - Decreased size of KHOLE from 24 to 8 characters.
    * - Changed KUSER of length 24 char. to KUSER0, KUSER1, and KUSER2
    * each of length 8 char. Moved them from KHDR(13) to KHDR(18).
    * - Deleted KZDATE, KZTIME and KCMPNM.
    * - Added 13 new alpha fields: KO, KA, KTn (n=0,9), and KF.
    * - Current arrangement of KHDR is therefore:
    * variable old_loc new_loc new_len
    * -------- ------- ------- -------
    * KSTNM 1 1 1
    * KEVNM 2 2 2
    * KHOLE 4 4 1
    * KO NEW 5 1
    * KA NEW 6 1
    * KTn NEW 7-16 1 each
    * KF NEW 17 1
    * KUSER0 13 18 1
    * KUSER1 14 19 1
    * KUSER2 15 20 1
    * KHDR21 EMPTY 21 1
    * KHDR22 EMPTY 22 1
    * KHDR23 EMPTY 23 1
    * KHDR24 EMPTY 24 1
    * - Moved NSNPTS from NHDR(10) to NHDR(11).
    * - Moved NPTS from NHDR(1) to NHDR(10).
    * - Changed size of NZDTTM array from 4 to 6.
    * - Moved NZDTTM and NZYEAR from NHDR(2) to NHDR(1).
    * - Moved NZJDAY from NHDR(3) to NHDR(2).
    * - Moved NZHOUR from NHDR(4) to NHDR(3).
    * - Moved NZMIN from NHDR(5) to NHDR(4).
    * - Converted ZSECS in FHDR(5) to NZSEC in NHDR(5) and
    * NZMSEC in NHDR(6).
    * - Moved FINI from FHDR(40) to FHDR(21).

    Version 6:
    * (1) Added LCALDA. If .TRUE. distance/azimuth are always
    * recomputed each time file is read.


09:18:26 v.22510d55