Thread: ASCII to SAC

Started: 2009-11-04 23:49:36
Last activity: 2017-06-13 14:37:34
Topics: SAC Help
Geo .
2009-11-04 23:49:36
Hello everyone,
I have a time series of synthetic traces and would like to convert them to
SAC format. I know I could use the CONVERT function but before that I have
to format the ASCII (time series) file by arranging the values for sac
header. Is there a utility to do this pre-formatting before I could use the
CONVERT function?
ex. I believe my ASCII file should look like the following before using
CONVERT
0.125 -7441.313 4087.937 1 -12345
-12.73499 4.265015 -1145.083 -0.7329407 2
-7.154175 -11.04712 -5.158936 -12345 -12345
-12345 -12345 -12345 -12345 -12345
-12345 -12345 -12345 -12345 -12345
-12345 -12345 -12345 -12345 -12345
-12345 49.69189 11.22172 499.5 0
-18.58 -177.847 -12345 406800 6.3
153.6304 92.23995 118.4234 -12345 -12345
-12345 -12345 -12345 -12345 -12345
16459.75 348.8256 16.44247 148.1168 -12345
-12345 11.20899 0 0 -12345
-12345 -12345 -12345 -12345 -12345
-12345 -12345 -12345 -12345 -12345
2007 8 21 11 25
723 6 0 0 137
-12345 3 -12345 -12345 -12345
1 7 -12345 -12345 -12345
-12345 -12345 -12345 -12345 -12345
-12345 -12345 -12345 -12345 -12345
-12345 -12345 -12345 -12345 -12345
1 0 1 1 0
GRA1 -12345
-12345
PKP PKIKP PKiKP
-12345 -12345 -12345
-12345 -12345 -12345
-12345 -12345 -12345
-12345 -12345 BHZ
GR -12345 -12345
-187.3201 -188.5614 -217.869 -206.1952 -207.0166
-215.3447 -195.2354 -180.3634 -132.7042 -73.69939
-41.64182 20.88158 27.19209 49.59732 147.0182
84.607 63.40969 54.25536 80.00433 81.05703
88.90465 90.763 85.95925 49.39476 22.92792
-49.27525 -137.7821 -148.9169 -235.7549 -260.8252
-287.5518 -289.338 -262.7619 -247.1613 -195.9543
-143.929 -87.96223 -55.86754 42.96152 41.11675
88.47706 110.7524 203.3549 248.1527 288.513
289.4476 425.0559 414.4856 489.2326 529.2755
708.3331 979.9971 1099.924 1216.979 1358.369

I am not sure how I could get the values related to sac header organized (a
program?). Any ideas?

Thank you very much.

Januka.
--
"Nothing can start to exist nor can cease to exist, only transformation is
possible"

Januka Attanayake
Solid Earth Geophysics & Economics
University of Connecticut
Beach Hall U-2045
354,Mansfield Rd;
Storrs.CT 06269

Tel: 1 860 486 0475
URL: http://sites.google.com/site/janukaattanayake/

  • Arthur Snoke
    2009-11-05 00:10:28
    You do not have to construct a SAC header from scratch. SAC has
    subroutines that can be called in C or Fortran programs that put things in
    the right place. In SAC, enter

    SAC> help tutorial

    and read the section on reading and writing data files.

    On Wed, 4 Nov 2009, Januka Attanayake wrote:

    Hello everyone,
    I have a time series of synthetic traces and would like to convert them to
    SAC format. I know I could use the CONVERT function but before that I have
    to format the ASCII (time series) file by arranging the values for sac
    header. Is there a utility to do this pre-formatting before I could use the
    CONVERT function?
    ex. I believe my ASCII file should look like the following before using
    CONVERT
    0.125      -7441.313       4087.937              1         -12345
    -12.73499       4.265015      -1145.083     -0.7329407              2
    -7.154175      -11.04712      -5.158936         -12345         -12345
    -12345         -12345         -12345         -12345         -12345
    -12345         -12345         -12345         -12345         -12345
    -12345         -12345         -12345         -12345         -12345
    -12345       49.69189       11.22172          499.5              0
    -18.58       -177.847         -12345         406800            6.3
    153.6304       92.23995       118.4234         -12345         -12345
    -12345         -12345         -12345         -12345         -12345
    16459.75       348.8256       16.44247       148.1168         -12345
    -12345       11.20899              0              0         -12345
    -12345         -12345         -12345         -12345         -12345
    -12345         -12345         -12345         -12345         -12345
    2007         8        21        11        25
    723         6         0         0       137
    -12345         3    -12345    -12345    -12345
    1         7    -12345    -12345    -12345
    -12345    -12345    -12345    -12345    -12345
    -12345    -12345    -12345    -12345    -12345
    -12345    -12345    -12345    -12345    -12345
    1         0         1         1         0
    GRA1     -12345
    -12345
    PKP     PKIKP   PKiKP
    -12345  -12345  -12345
    -12345  -12345  -12345
    -12345  -12345  -12345
    -12345  -12345  BHZ
    GR      -12345  -12345
    -187.3201      -188.5614       -217.869      -206.1952      -207.0166
    -215.3447      -195.2354      -180.3634      -132.7042      -73.69939
    -41.64182       20.88158       27.19209       49.59732       147.0182
    84.607       63.40969       54.25536       80.00433       81.05703
    88.90465         90.763       85.95925       49.39476       22.92792
    -49.27525      -137.7821      -148.9169      -235.7549      -260.8252
    -287.5518       -289.338      -262.7619      -247.1613      -195.9543
    -143.929      -87.96223      -55.86754       42.96152       41.11675
    88.47706       110.7524       203.3549       248.1527        288.513
    289.4476       425.0559       414.4856       489.2326       529.2755
    708.3331       979.9971       1099.924       1216.979       1358.369

    I am not sure how I could get the values related to sac header organized (a
    program?). Any ideas?

    Thank you very much.

    Januka.
    --
    "Nothing can start to exist nor can cease to exist, only transformation is
    possible"

    Januka Attanayake
    Solid Earth Geophysics & Economics
    University of Connecticut
    Beach Hall   U-2045
    354,Mansfield Rd;
    Storrs.CT 06269

    Tel: 1 860 486 0475
    URL: http://sites.google.com/site/janukaattanayake/



    • Yannik Behr
      2009-11-05 19:01:28
      We've developed a python package called obspy
      (http://svn.geophysik.uni-muenchen.de/trac/obspy) that allows you
      creating SAC-files from a raw timeseries in python.

      Cheers,
      Yannik

      Arthur Snoke wrote:
      You do not have to construct a SAC header from scratch. SAC has
      subroutines that can be called in C or Fortran programs that put things in
      the right place. In SAC, enter

      SAC> help tutorial

      and read the section on reading and writing data files.

      On Wed, 4 Nov 2009, Januka Attanayake wrote:

      Hello everyone,
      I have a time series of synthetic traces and would like to convert them to
      SAC format. I know I could use the CONVERT function but before that I have
      to format the ASCII (time series) file by arranging the values for sac
      header. Is there a utility to do this pre-formatting before I could use the
      CONVERT function?
      ex. I believe my ASCII file should look like the following before using
      CONVERT
      0.125 -7441.313 4087.937 1 -12345
      -12.73499 4.265015 -1145.083 -0.7329407 2
      -7.154175 -11.04712 -5.158936 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      -12345 49.69189 11.22172 499.5 0
      -18.58 -177.847 -12345 406800 6.3
      153.6304 92.23995 118.4234 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      16459.75 348.8256 16.44247 148.1168 -12345
      -12345 11.20899 0 0 -12345
      -12345 -12345 -12345 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      2007 8 21 11 25
      723 6 0 0 137
      -12345 3 -12345 -12345 -12345
      1 7 -12345 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      -12345 -12345 -12345 -12345 -12345
      1 0 1 1 0
      GRA1 -12345
      -12345
      PKP PKIKP PKiKP
      -12345 -12345 -12345
      -12345 -12345 -12345
      -12345 -12345 -12345
      -12345 -12345 BHZ
      GR -12345 -12345
      -187.3201 -188.5614 -217.869 -206.1952 -207.0166
      -215.3447 -195.2354 -180.3634 -132.7042 -73.69939
      -41.64182 20.88158 27.19209 49.59732 147.0182
      84.607 63.40969 54.25536 80.00433 81.05703
      88.90465 90.763 85.95925 49.39476 22.92792
      -49.27525 -137.7821 -148.9169 -235.7549 -260.8252
      -287.5518 -289.338 -262.7619 -247.1613 -195.9543
      -143.929 -87.96223 -55.86754 42.96152 41.11675
      88.47706 110.7524 203.3549 248.1527 288.513
      289.4476 425.0559 414.4856 489.2326 529.2755
      708.3331 979.9971 1099.924 1216.979 1358.369

      I am not sure how I could get the values related to sac header organized (a
      program?). Any ideas?

      Thank you very much.

      Januka.
      --
      "Nothing can start to exist nor can cease to exist, only transformation is
      possible"

      Januka Attanayake
      Solid Earth Geophysics & Economics
      University of Connecticut
      Beach Hall U-2045
      354,Mansfield Rd;
      Storrs.CT 06269

      Tel: 1 860 486 0475
      URL: http://sites.google.com/site/janukaattanayake/





      --
      Yannik Behr
      PhD Student in Seismology
      School of Geography, Environment, and Earth Sciences
      Victoria University of Wellington
      P.O. Box 600
      Wellington 6015
      New Zealand

      yannik.behr<at>vuw.ac.nz

      ph. +64 (4) 463 5233 8369
      fax.+64 (4) 463 5186

  • Pierre Arroucau
    2009-11-05 00:50:20
    Dear Manuka,

    Again the most convenient way I've found to perform conversions between ascii and binary sacfiles is to use the subroutines contained in the module sac_i_o that comes with the fortran program sac2xy and that you can download from the following webpage :

    http://web.utah.edu/thorne/software.html

    Regards,
    Pierre


    ----- Original Message -----
    From: Januka Attanayake <jattanayake<at>gmail.com>
    Date: Wednesday, November 4, 2009 3:53 pm
    Subject: [SAC-HELP] ASCII to SAC
    To: sac-help<at>iris.washington.edu

    Hello everyone,
    I have a time series of synthetic traces and would like to convert them to SAC format. I know I could use the CONVERT function but before that I have to format the ASCII (time series) file by arranging the values for sac header. Is there a utility to do this pre-formatting before I could use the CONVERT function?
    ex. I believe my ASCII file should look like the following before using CONVERT > 0.125 -7441.313 4087.937 1 -12345
    -12.73499 4.265015 -1145.083 -0.7329407 2
    -7.154175 -11.04712 -5.158936 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    -12345 49.69189 11.22172 499.5 0
    -18.58 -177.847 -12345 406800 6.3
    153.6304 92.23995 118.4234 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    16459.75 348.8256 16.44247 148.1168 -12345
    -12345 11.20899 0 0 -12345
    -12345 -12345 -12345 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    2007 8 21 11 25
    723 6 0 0 137
    -12345 3 -12345 -12345 -12345
    1 7 -12345 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    -12345 -12345 -12345 -12345 -12345
    1 0 1 1 0
    GRA1 -12345
    -12345
    PKP PKIKP PKiKP
    -12345 -12345 -12345
    -12345 -12345 -12345
    -12345 -12345 -12345
    -12345 -12345 BHZ
    GR -12345 -12345
    -187.3201 -188.5614 -217.869 -206.1952 -207.0166
    -215.3447 -195.2354 -180.3634 -132.7042 -73.69939
    -41.64182 20.88158 27.19209 49.59732 147.0182
    84.607 63.40969 54.25536 80.00433 81.05703
    88.90465 90.763 85.95925 49.39476 22.92792
    -49.27525 -137.7821 -148.9169 -235.7549 -260.8252
    -287.5518 -289.338 -262.7619 -247.1613 -195.9543
    -143.929 -87.96223 -55.86754 42.96152 41.11675
    88.47706 110.7524 203.3549 248.1527 288.513
    289.4476 425.0559 414.4856 489.2326 529.2755
    708.3331 979.9971 1099.924 1216.979 1358.369
    >
    I am not sure how I could get the values related to sac header organized (a program?). Any ideas?

    Thank you very much.

    Januka.
    --
    "Nothing can start to exist nor can cease to exist, only transformation is possible"
    >
    Januka Attanayake
    Solid Earth Geophysics & Economics
    University of Connecticut
    Beach Hall U-2045
    354,Mansfield Rd;
    Storrs.CT 06269

    Tel: 1 860 486 0475
    URL: http://sites.google.com/site/janukaattanayake/
    >
    > _______________________________________________
    sac-help mailing list
    sac-help<at>iris.washington.edu
    http://www.iris.washington.edu/mailman/listinfo/sac-help

  • Kostantia Makra
    2009-11-05 18:45:53
    (no body)
  • SUJIT CHEL
    2017-06-12 06:38:04
    Did you get your answer ?
    my question is how do I convert .BHE / BHN / .BHZ to .SAC format ?
    please help.!
    Thank u
05:44:38 v.b3198453