1MST_CONVERTSAMPLES(3)      Library Functions Manual      MST_CONVERTSAMPLES(3)
2
3
4

NAME

6       mst_convertsamples - Convert data samples between numeric types
7
8

SYNOPSIS

10       #include <libmseed.h>
11
12       int  mst_convertsamples ( MSTrace *mst, char type, flag truncate);
13
14       int  mstl_convertsamples ( MSTraceSeg *seg, char type, flag truncate);
15
16

DESCRIPTION

18       mst_convertsamples  and  mst_convertsamples  convert  any  data samples
19       associated with an MSTrace or MSTraceSeg to a specified type.
20
21       The routines can convert  between  32-bit  integers  (type  i),  32-bit
22       floats (type f) and 64-bit doubles (type d).
23
24       When  converting float and double sample types to integer type a simple
25       rounding is applied by adding 0.5 to the sample value before converting
26       (truncating) to integer.  This compensates for common machine represenā€
27       tations  of  floating  point  values  (e.g.   "40.0"   represented   by
28       "39.99999999").
29
30       If the truncate flag is true data samples will be truncated to integers
31       even if loss of sample precision is detected.  If the truncate flag  is
32       false (0) and loss of precision is detected an error is returned.  Loss
33       of precision is determined by testing that the difference  between  the
34       floating  point value and the (truncated) integer value is greater than
35       0.000001.
36
37       ASCII data samples  (type  a)  cannot  be  converted,  if  supplied  or
38       requested an error will be returned.
39
40

RETURN VALUES

42       mst_convertsamples  and  mstl_convertsamples return 0 on success and -1
43       on error.
44
45

SEE ALSO

47       ms_intro(3).
48
49

AUTHOR

51       Chad Trabant
52       IRIS Data Management Center
53
54
55
56Libmseed API                      2013/10/01             MST_CONVERTSAMPLES(3)
Impressum