Thread: SAC/SACA file format verification

Started: 2009-03-28 04:44:59
Last activity: 2009-03-28 20:30:33
Topics: SAC Help
Daniel Griscom
2009-03-28 04:44:59
Dear Sirs/Madams,

I'm the author of a free IRIS-supported Macintosh program called
SeisMac, which uses Mac laptops' built in accelerometers to convert
the laptops into (not very accurate) seismographs. You can find more
about it at http://www.suitable.com/tools/seismac.html.

I'm finishing off an update which will let you export selected data
as a binary SAC or ascii SACA file. I think I've got it right (Global
Earthquake Explorer successfully reads the SAC files), but I'd love
to have further confirmation. Would any of you be able to review
example files and tell me if I've made any format errors? Or, point
me to other tools which will read/validate SAC/SACA files?


I've uploaded the same set of data in three ways:

- Comma-separated values (all three axis):
http://www.suitable.com/temp/SeisMacData.CSV

- Binary SAC file (Z axis only): http://www.suitable.com/temp/SeisMacData.SAC

- Ascii SACA file (Z axis only):
http://www.suitable.com/temp/SeisMacData.SACA

(If you have a Mac laptop and would like to play with exporting data
yourself, the latest binary is at
http://www.suitable.com/temp/SeisMac30b2.zip)


Thanks,
Dan

--
Daniel T. Griscom griscom<at>suitable.com
Suitable Systems http://www.suitable.com/
1 Centre Street, Suite 204 (781) 665-0053
Wakefield, MA 01880-2400

  • Chad Trabant
    2009-03-28 04:36:24

    Hi Dan,

    Very cool stuff. The binary file seems to work fine in sac (the
    reference application), the PQL waveform viewer and my sac2mseed
    converter.

    The ASCII/ALPHA file has a small problem. The recognized NULL value
    is "-12345.00", as you can see from the snippet below from
    SeisMacData.SACA the null value seems to have "61" in place of "00"
    which causes minor havoc with the interpretation.

    Chad

    -- top of SeisMacData.SACA --
    0.020000 -12345.61 -12345.61 -12345.61
    -12345.61
    0.000000 21.34106 -12345.61 -12345.61
    -12345.61
    -12345.61 -12345.61 -12345.61 -12345.61
    -12345.61
    -12345.61 -12345.61 -12345.61 -12345.61
    -12345.61
    -12345.61 -12345.61 -12345.61 -12345.61
    -12345.61
    -12345.61 -12345.61 -12345.61 -12345.61
    -12345.61
    -12345.61 -12345.61 -12345.61 -12345.61
    -12345.61


    On Mar 27, 2009, at 6:44 PM, Daniel Griscom wrote:

    Dear Sirs/Madams,

    I'm the author of a free IRIS-supported Macintosh program called
    SeisMac, which uses Mac laptops' built in accelerometers to convert
    the laptops into (not very accurate) seismographs. You can find more
    about it at http://www.suitable.com/tools/seismac.html.

    I'm finishing off an update which will let you export selected data
    as a binary SAC or ascii SACA file. I think I've got it right
    (Global Earthquake Explorer successfully reads the SAC files), but
    I'd love to have further confirmation. Would any of you be able to
    review example files and tell me if I've made any format errors? Or,
    point me to other tools which will read/validate SAC/SACA files?


    I've uploaded the same set of data in three ways:

    - Comma-separated values (all three axis): http://www.suitable.com/temp/SeisMacData.CSV


    - Binary SAC file (Z axis only): http://www.suitable.com/temp/SeisMacData.SAC


    - Ascii SACA file (Z axis only): http://www.suitable.com/temp/SeisMacData.SACA


    (If you have a Mac laptop and would like to play with exporting data
    yourself, the latest binary is at http://www.suitable.com/temp/SeisMac30b2.zip
    )


    Thanks,
    Dan

    --
    Daniel T. Griscom griscom<at>suitable.com
    Suitable Systems http://www.suitable.com/
    1 Centre Street, Suite 204 (781) 665-0053
    Wakefield, MA 01880-2400
    _______________________________________________
    sac-help mailing list
    sac-help<at>iris.washington.edu
    http://www.iris.washington.edu/mailman/listinfo/sac-help



    • Daniel Griscom
      2009-03-28 15:28:03
      Dear Chad and George,

      Many thanks: this is exactly the help I was looking for. In detail:

      At 9:36 PM -0700 3/27/09, Chad Trabant wrote:
      The ASCII/ALPHA file has a small problem. The recognized NULL value
      is "-12345.00", as you can see from the snippet below from
      SeisMacData.SACA the null value seems to have "61" in place of "00"
      which causes minor havoc with the interpretation.

      Hello, Chad. Ooops, missed that. I fixed a rounding issue and broke
      something else. I'll try again.

      At 10:39 AM +0000 3/28/09, George Helffrich wrote:
      1) Undefined character values in the binary file should be
      padded with blanks, not trailing zero characters, to their field
      lengths (8 or 16 characters, as appropriate);

      Are you sure? The SACA example I have uses trailing nulls (which surprised me).

      2) Undefined values should numerically be -12345.00 in the
      alphanumeric file.

      I'll fix this.

      3) I think that you can safely set IDEP to IACC (integer
      number 8) to signify that the dependent variable is acceleration.

      The values in the data section are in m/s/s, not nm/s/s; would you
      still suggest IACC ("Acceleration in nm/sec/sec")?

      4) The component naming fields KCMPNM for the traces don't
      follow FDSN standards. (See Appendix A of the SEED manual). My
      reading of the manual suggests that, for the sample rate shown, the
      channels should be named with three-letter codes BNx, where x is the
      orientation letter. N (middle character) is the code for an
      accelerometer. ZNE aren't useful because orientation can't be
      guaranteed. XYZ are probably OK for consistent usage with your
      program documentation, though they aren't FDSN-endorsed. FDSN would
      prescribe them to be 123 (orthogonal but orientation not guaranteed).

      Ah, hadn't seen that reference. Excellent. Letter by letter:

      1: The band code letter. My sample rates can be from 20Hz to 500Hz
      (user selected). Should I change based on the sample rate? If so then
      I'd switch between S, E or D, assuming that for accelerometers
      "corner period" means the native resonance of the detector, which in
      this case is extremely high.

      2: Instrument code: pretty clearly "N".

      3: Orientation code. I want the vertical samples to be marked
      vertical, but don't want to imply specific directions for the two
      horizontal vectors. I'm using "1", "2" and "Z" right now; should I
      switch to "X", "Y" and "Z"? Or perhaps even "2", "3" and "Z" (with
      vertical being the primary component of interest)?


      Thanks again,
      Dan


      P.S. For all you Mac-owning seismologists, I'd also be interested in
      any feedback you may have about the data export process. Right now
      you choose the axis and name and then save, which means to save all
      three axes you have to enter three different names. I'm considering
      going to saving a folder instead of a file, with the folder
      containing three axis files. Thoughts?

      --
      Daniel T. Griscom griscom<at>suitable.com
      Suitable Systems http://www.suitable.com/
      1 Centre Street, Suite 204 (781) 665-0053
      Wakefield, MA 01880-2400

      • George Helffrich
        2009-03-28 20:30:33
        Dear Dan -

        Some responses to your queries:

        On 28 Mar 2009, at 12:28, Daniel Griscom wrote:

        ...

        At 10:39 AM +0000 3/28/09, George Helffrich wrote:
        1) Undefined character values in the binary file should be padded
        with blanks, not trailing zero characters, to their field lengths (8
        or 16 characters, as appropriate);

        Are you sure? The SACA example I have uses trailing nulls (which
        surprised me).

        Positive. The binary format is defined by Fortran behavior. Character
        fields are blank-filled; trailing nulls have no significance in
        Fortran.

        ...

        3) I think that you can safely set IDEP to IACC (integer number 8)
        to signify that the dependent variable is acceleration.

        The values in the data section are in m/s/s, not nm/s/s; would you
        still suggest IACC ("Acceleration in nm/sec/sec")?

        I'm not particularly bothered by the units discrepancy, but you could
        fix it either by 1) multiplying samples by 10**9; 2) setting SCALE to
        be 10**-9 with unchanged samples; 3) go back to setting IDEP to IUNKN
        (but you *do* know, after all).


        4) The component naming fields KCMPNM for the traces don't follow
        FDSN standards. (See Appendix A of the SEED manual). My reading of
        the manual suggests that, for the sample rate shown, the channels
        should be named with three-letter codes BNx, where x is the
        orientation letter. N (middle character) is the code for an
        accelerometer. ZNE aren't useful because orientation can't be
        guaranteed. XYZ are probably OK for consistent usage with your
        program documentation, though they aren't FDSN-endorsed. FDSN would
        prescribe them to be 123 (orthogonal but orientation not guaranteed).

        Ah, hadn't seen that reference. Excellent. Letter by letter:

        1: The band code letter. My sample rates can be from 20Hz to 500Hz
        (user selected). Should I change based on the sample rate? If so then
        I'd switch between S, E or D, assuming that for accelerometers "corner
        period" means the native resonance of the detector, which in this case
        is extremely high.

        2: Instrument code: pretty clearly "N".

        3: Orientation code. I want the vertical samples to be marked
        vertical, but don't want to imply specific directions for the two
        horizontal vectors. I'm using "1", "2" and "Z" right now; should I
        switch to "X", "Y" and "Z"? Or perhaps even "2", "3" and "Z" (with
        vertical being the primary component of interest)?

        Hmmm. The first character choice depends on the idea of a
        seismometer's corner period, where its response to velocity turns flat.
        Accelerometers aren't built to be flat to velocity anywhere. Their
        response is broad band, however, because they are flat to acceleration
        from DC to a very high frequency. In that spirit, I'd use either B or
        H as appropriate to the sample rate.

        My vote for the last character is XYZ, since you'll never be
        FDSN-compliant if you want to use Z (but a laptop on my lap isn't
        guaranteed to have Z up, either). At least there will be a clear link
        between the trace names and the computer-fixed coordinate system.

        ...
        P.S. For all you Mac-owning seismologists, I'd also be interested in
        any feedback you may have about the data export process. Right now you
        choose the axis and name and then save, which means to save all three
        axes you have to enter three different names. I'm considering going to
        saving a folder instead of a file, with the folder containing three
        axis files. Thoughts?

        Only this: Folders don't seem to have any benefit other than reducing
        file name typing. In the save dialog just provide a choice of a file
        prefix and whether to save X, Y, Z, or all components. Then generate
        the suffixes like the component names. Trying to encode too much
        information in a file name leads to quite cumbersome names like what
        rdseed writes!

        George Helffrich
        george<at>geology.bristol.ac.uk


  • George Helffrich
    2009-03-28 17:39:09
    Dear Dan -

    This will be a very useful SeisMac feature. There are two minor
    problems with the specimens that you provided:

    1) Undefined character values in the binary file should be padded with
    blanks, not trailing zero characters, to their field lengths (8 or 16
    characters, as appropriate);

    2) Undefined values should numerically be -12345.00 in the
    alphanumeric file.

    Something else you might think about are:

    3) I think that you can safely set IDEP to IACC (integer number 8) to
    signify that the dependent variable is acceleration.

    4) The component naming fields KCMPNM for the traces don't follow FDSN
    standards. (See Appendix A of the SEED manual). My reading of the
    manual suggests that, for the sample rate shown, the channels should be
    named with three-letter codes BNx, where x is the orientation letter.
    N (middle character) is the code for an accelerometer. ZNE aren't
    useful because orientation can't be guaranteed. XYZ are probably OK
    for consistent usage with your program documentation, though they
    aren't FDSN-endorsed. FDSN would prescribe them to be 123 (orthogonal
    but orientation not guaranteed).

    On 28 Mar 2009, at 01:44, Daniel Griscom wrote:

    Dear Sirs/Madams,

    I'm the author of a free IRIS-supported Macintosh program called
    SeisMac, which uses Mac laptops' built in accelerometers to convert
    the laptops into (not very accurate) seismographs. You can find more
    about it at http://www.suitable.com/tools/seismac.html.

    I'm finishing off an update which will let you export selected data as
    a binary SAC or ascii SACA file. I think I've got it right (Global
    Earthquake Explorer successfully reads the SAC files), but I'd love to
    have further confirmation. Would any of you be able to review example
    files and tell me if I've made any format errors? Or, point me to
    other tools which will read/validate SAC/SACA files?


    I've uploaded the same set of data in three ways:

    - Comma-separated values (all three axis):
    http://www.suitable.com/temp/SeisMacData.CSV

    - Binary SAC file (Z axis only):
    http://www.suitable.com/temp/SeisMacData.SAC

    - Ascii SACA file (Z axis only):
    http://www.suitable.com/temp/SeisMacData.SACA

    (If you have a Mac laptop and would like to play with exporting data
    yourself, the latest binary is at
    http://www.suitable.com/temp/SeisMac30b2.zip)


    Thanks,
    Dan

    --
    Daniel T. Griscom griscom<at>suitable.com
    Suitable Systems http://www.suitable.com/
    1 Centre Street, Suite 204 (781) 665-0053
    Wakefield, MA 01880-2400
    _______________________________________________
    sac-help mailing list
    sac-help<at>iris.washington.edu
    http://www.iris.washington.edu/mailman/listinfo/sac-help

    George Helffrich
    george<at>geology.bristol.ac.uk


14:51:42 v.01697673