[SAC-HELP] Now able to write sac header in C

Arthur Snoke snoke at vt.edu
Sun Jan 1 15:05:51 PST 2012


I had not answered because my calls to wsac0 have been using Fortran so I 
hoped that someone would respond.  This being a vacation time for much of 
the world, that has not happened. So I will try.

I looked at the help pages and was surprised to find that between v101.3 
and 101.4 discussionas about C and Fortran subroutines were left out of 
the user_manual sections on input_output and appendix.  Here is a short 
section from the old input_output that addresses some of your questions?

WSAC0

         C:              void wsac0(kname, xarray, yarray, nerr, kname_s)
                         char     *kname;
                         float    *xarray;
                         float    *yarray;
                         long int *nerr;
                         long int kname_s;

         FORTRAN:        call wsac0(kname, xarray, yarray, nerr)
                         character*8 kname
                         real*4      xarray(*)
                         real*4      yarray(*)
                         integer*4   nerr

         purpose:        To write a SAC file to disk using current header
                         values.

         Input variables:
                         kname:  Name of disk file to write (padded at the
                                end with blanks or '\0's).
                         xarray: contains the independent variable.
                         yarray: contains the dependent variable.
                         kname_s: (C only) string length of kname

         Output variables:
                         nerr:   error status; always 0 if there was no
                                 error.

Subroutine wsac0 can write SAC files with even spacing (LEVEN true) in 
which case xarray is just a dummy file.  Or it can write unevenly0spaced 
or spectral files (LEVEN false). Perhaps you need to include the line

           setlhv ( "LEVEN" , &true , &nerr , 5 ) ;

Let me know if this helps -- or if you need more information.

We will look into adding more documentation about subroutines to the HELP 
file.  We cannot change files in the distribution until the next release, 
but it is easy to alter the online HELP files at IRIS.

Arthur




More information about the sac-help mailing list