MS_WRITEMSEED(3)
π MS_WRITEMSEED(3) π
okay bestie, so this is a page from the Library Functions Manual and it's literally about ms_writemseed β writing Mini-SEED records to files. sit down, hydrate, we're doing this π«Ά
β¨ NAME β¨
ms_writemseed β Write Mini-SEED records to files.
no cap, that's the whole job. it packs your data into Mini-SEED records and yeets them into a file π
πΈ SYNOPSIS πΈ
#include <libmseed.h>
int msr_writemseed ( MSRecord *msr, char *msfile, flag overwrite,
int reclen, flag encoding, flag byteorder,
flag verbose );
int mst_writemseed ( MSTrace *mst, char *msfile, flag overwrite,
int reclen, flag encoding, flag byteorder,
flag verbose );
int mst_writemseedgroup ( MSTraceGroup *msr, char *msfile,
flag overwrite, int reclen, flag encoding,
flag byteorder, flag verbose );
three icons, three functions, same energy π«
π¦ DESCRIPTION π¦
so these routines will packed the data contained in the MSRecord, MSTrace or MSTraceGroup into Mini-SEED records and write them to the file you specify. yes, "will packed" β that's the original wording and we respect the author's truth π the overwrite flag is the one in charge of whether the output file gets overwritten or appended to. it's giving "choose your own adventure" but for file contents.
Mini-SEED records get created using the record length you pass as reclen, plus the Mini-SEED encoding and byteorder. and here's the slay part: if you set any of those key characteristics β record length, encoding format, byte order β to -1, the defaults swoop in and save you. the default values are:
reclen=4096bytesencoding=11(Steim2)byteorder=1(MSBFor big-endian)
reclen should be set to the desired data record length in bytes, and it must be expressible as 2 raised to the power of X where X is between (and including) 8 to 20. that's not a vibe suggestion, that's a law of the land π§
encoding should be set to one of the following supported Mini-SEED data encoding formats:
DE_ASCII(0)DE_INT16(1)DE_INT32(3)DE_FLOAT32(4)DE_FLOAT64(5)DE_STEIM1(10)DE_STEIM2(11)
the encoding aliases are defined in libmseed.h. and MSTrace.sampletype should indicated the sample type as either 'a' (ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd' (64-bit doubles). (again, "should indicated" β author's words, we keep them π)
now the important part, bestie, listen up: the encoding format must be appropriate for the sample type of the MSTrace samples. for example, Steim compression and integer encoding formats require integer samples, and float encoding formats require the appropriate size floats as input. and as a counter example β and this is the one that gets people every single time β float samples cannot be packed using Steim compression or integer encoding formats. periodt. π
byteorder must be either 0 (LSBF or little-endian) or 1 (MBF or big-endian).
verbose controls verbosity β a value of zero will result in no diagnostic output. so if you want silence, you get silence. iconic π
β RETURN VALUES β
all of these routines return the number of records written on success and -1 on error. that's it, that's the whole deal β count or -1, no in-between π
π EXAMPLE π
skeleton code for writing Mini-SEED records with msr_writemseed(3):
main() {
MSRecord *msr;
int precords;
msr = msr_init (NULL);
/* Populate MSRecord values */
strcpy (msr->network, "XX");
strcpy (msr->station, "TEST");
strcpy (msr->channel, "BHE");
msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00");
msr->samprate = 40.0;
msr->datasamples = dataptr; /* pointer to 32-bit integer data samples */
msr->numsamples = 1234;
msr->sampletype = 'i'; /* declare type to be 32-bit integers */
/* Write record(s) with 4096-byte length, Steim-2 compression, big-endian */
precords = msr_writemseed (msr, "output.mseed", 1, 4096, DE_STEIM2, 1, 0);
ms_log (0, "Wrote %d records0, precords);
msr_free (&msr);
}
yes, thems_logline has a missing quote and an extra0in there. that's exactly how it appears in the original and we are not touching it β copy-paste-at-your-own-risk energy, iykyk π
π SEE ALSO π
ms_intro(3), msr_pack(3) and mst_pack(3).
π AUTHOR π
Chad Trabant IRIS Data Management Center
and that's the whole page, bestie!! this came to you from the Libmseed API, dated 2011/01/06 β a certified classic, lowkey vintage, highkey still relevant πΈ go write some Mini-SEED records, you're gonna eat πβ¨
π¦ 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