MST_CONVERTSAMPLES(3)
π MST_CONVERTSAMPLES(3) π
okay bestie, welcome to the Library Functions Manual entry for MST_CONVERTSAMPLES(3) β yes that's the header, yes it's giving very official, no we are not being boring about it πΈ
β¨ NAME β¨
mst_convertsamples β glow-up your data samples by converting them between numeric types π
π SYNOPSIS π
#include <libmseed.h>
int mst_convertsamples ( MSTrace *mst, char type, flag truncate);
int mstl_convertsamples ( MSTraceSeg *seg, char type, flag truncate);
π¦ DESCRIPTION π¦
so mst_convertsamples and mstl_convertsamples (the manual literally says mst_convertsamples twice, bestie, that's a lil typo β the second one is the mstl_ one up in the synopsis, we move on π) will take any data samples chillin' on an MSTrace or an MSTraceSeg and convert them to a type you specify. main character energy only.
the routines can convert between these three:
- 32-bit integers β type
i - 32-bit floats β type
f - 64-bit doubles β type
d
π the rounding situation
when you're converting float and double sample types to integer type, a simple rounding gets applied: it adds 0.5 to the sample value before converting (truncating) it to an integer. why tho? because machines are messy and this compensates for common machine representations of floating point values β like how "40.0" might actually be living its life as "39.99999999". not her fault, she's doing her best π
π the truncate flag, pay attention
- if the
truncateflag is true, data samples get truncated to integers even if loss of sample precision is detected. no thoughts, head empty, we're going anyway. - if the
truncateflag is false (0) and loss of precision is detected, an error is returned. she said absolutely not.
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 girlies
ASCII data samples (type a) cannot be converted. if supplied or requested, an error will be returned. that's it, that's the whole thing, type a is not invited to this party π
β RETURN VALUES β
mst_convertsamples and mstl_convertsamples return 0 on success and -1 on error. that's the vibe check: 0 = slay, -1 = not slay π₯
π SEE ALSO π
ms_intro(3). go read her, she's iconic π
πΈ AUTHOR πΈ
Chad Trabant IRIS Data Management Center
no cap, this whole thing is the Libmseed API, dated2013/10/01, and it's filed underMST_CONVERTSAMPLES(3). periodt. π«Άβ¨
π¦ where this page comes from
- debian bookworm: libmseed-doc 2.19.8-1 Β· LGPL-3.0-or-later
- debian trixie: libmseed-doc 2.19.8-1 Β· LGPL-3.0-or-later
- fedora 43: libmseed-devel 2.19.5-21.fc43 Β· LGPL-3.0-or-later
- fedora 43: libmseed-devel 2.19.5-21.fc43 Β· LGPL-3.0-or-later
- fedora 44: libmseed-devel 2.19.5-22.fc44 Β· LGPL-3.0-or-later
- fedora 44: libmseed-devel 2.19.5-22.fc44 Β· LGPL-3.0-or-later
- ubuntu jammy: libmseed-doc 2.19.6-3 Β· LGPL-3.0-or-later
- ubuntu noble: libmseed-doc 2.19.8-1ubuntu2 Β· LGPL-3.0-or-later
- ubuntu questing: libmseed-doc 2.19.8-1ubuntu2
- ubuntu resolute: libmseed-doc 2.19.8-1ubuntu3 Β· LGPL-3.0-or-later
- ubuntu stonking: libmseed-doc 2.19.8-1ubuntu3 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms