forked from EarthScope/libmseed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmst_convertsamples.3
48 lines (37 loc) · 1.61 KB
/
mst_convertsamples.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.TH MST_CONVERTSAMPLES 3 2013/10/01 "Libmseed API"
.SH NAME
mst_convertsamples - Convert data samples between numeric types
.SH SYNOPSIS
.nf
.B #include <libmseed.h>
.BI "int \fBmst_convertsamples\fP ( MSTrace *" mst ", char " type ", flag " truncate ");"
.BI "int \fBmstl_convertsamples\fP ( MSTraceSeg *" seg ", char " type ", flag " truncate ");"
.SH DESCRIPTION
\fBmst_convertsamples\fP and \fBmst_convertsamples\fP convert any data
samples associated with an \fIMSTrace\fP or \fIMSTraceSeg\fP to a
specified \fitype\fP.
The routines can convert between 32-bit integers (type \fIi\fP),
32-bit floats (type \fIf\fP) and 64-bit doubles (type \fId\fP).
When converting float and double sample types to integer type a simple
rounding is applied by adding 0.5 to the sample value before converting
(truncating) to integer. This compensates for common machine
representations of floating point values (e.g. "40.0" represented by
"39.99999999").
If the \fItruncate\fP flag is true data samples will be truncated to
integers even if loss of sample precision is detected. If the
\fItruncate\fP flag is false (0) and loss of precision is detected an
error is returned. Loss of precision is determined by testing that
the difference between the floating point value and the (truncated)
integer value is greater than 0.000001.
ASCII data samples (type \fIa\fP) cannot be converted, if supplied or
requested an error will be returned.
.SH RETURN VALUES
\fBmst_convertsamples\fP and \fBmstl_convertsamples\fP return 0 on
success and -1 on error.
.SH SEE ALSO
\fBms_intro(3)\fP.
.SH AUTHOR
.nf
Chad Trabant
IRIS Data Management Center
.fi