Hi.
I'm coding in C on Linux, using the sacio.a library. How can I tell the
length of the data section of a sac file? I thought it was supposed to
be in the NPTS header, but if I try to read with an undersize array,
NPTS returns the array size, not the data size.
Example: I have a file with 25000 data points. Not knowing the size in
advance, I size the array as float fData[10000]. Using the syntax on
the web site to call rsac1( kname, yarray, &nlen, &beg, &del, &max,
&nerr, strlen( kname ) ) ; I provide fData[10000] as yarray and 10000 as
max. When I read the NPTS header, it is 10000, as is the nlen and max
variables. nerr returns 0, not -803 as documented for "number of points
in file is greater than max."
This gives me no way I can find to actually determine the size of the
data segment. What am I doing wrong, and/or how do I work around this
problem?
Thanks!
-- John
I'm coding in C on Linux, using the sacio.a library. How can I tell the
length of the data section of a sac file? I thought it was supposed to
be in the NPTS header, but if I try to read with an undersize array,
NPTS returns the array size, not the data size.
Example: I have a file with 25000 data points. Not knowing the size in
advance, I size the array as float fData[10000]. Using the syntax on
the web site to call rsac1( kname, yarray, &nlen, &beg, &del, &max,
&nerr, strlen( kname ) ) ; I provide fData[10000] as yarray and 10000 as
max. When I read the NPTS header, it is 10000, as is the nlen and max
variables. nerr returns 0, not -803 as documented for "number of points
in file is greater than max."
This gives me no way I can find to actually determine the size of the
data segment. What am I doing wrong, and/or how do I work around this
problem?
Thanks!
-- John
-
John
Thanks for the reporting of this.
Which version of the SAC are you using ?
And would you send me an example code of the problem
so I can track down the bug.
Cheers,
Brian
On Aug 1, 2007, at 11:53 PM , John D. West wrote:
Hi.
I'm coding in C on Linux, using the sacio.a library. How can I
tell the length of the data section of a sac file? I thought it
was supposed to be in the NPTS header, but if I try to read with an
undersize array, NPTS returns the array size, not the data size.
Example: I have a file with 25000 data points. Not knowing the
size in advance, I size the array as float fData[10000]. Using
the syntax on the web site to call rsac1( kname, yarray, &nlen,
&beg, &del, &max, &nerr, strlen( kname ) ) ; I provide fData[10000]
as yarray and 10000 as max. When I read the NPTS header, it is
10000, as is the nlen and max variables. nerr returns 0, not -803
as documented for "number of points in file is greater than max."
This gives me no way I can find to actually determine the size of
the data segment. What am I doing wrong, and/or how do I work
around this problem?
Thanks!
-- John
_______________________________________________
sac-help mailing list
sac-help<at>iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/sac-help