MS_LOOKUP(3)

πŸ’– MS_LOOKUP(3) β€” the libmseed ✨lookup✨ girlies (Library Functions Manual)

okay bestie, welcome to ms_lookup, it's a whole collection of little helper functions from libmseed that just... look stuff up for you. no cap. it's giving "reference desk at the library but make it C". πŸŽ€


🌸 NAME 🌸

ms_lookup β€” go look up libmseed and Mini-SEED related info, periodt πŸ’…


✨ SYNOPSIS ✨

#include <libmseed.h>

char    *ms_errorstr ( int errorcode );

uint8_t  ms_samplesize ( const char sampletype );

char    *ms_encodingstr ( const char encoding );

char    *ms_blktdesc ( uint16_t blkttype );

uint16_t ms_blktlen ( uint16_t blkttype, const char *blktdata,
                      flag swapflag );

like, five little functions, five little besties, all doing their own thing 🫢


πŸ’œ DESCRIPTION πŸ’œ

okay so let's go one by one, i got you:

ms_errorstr hands you back a pointer to a string that describes the libmseed error code you passed in. those error codes are defined in libmseed.h and they get returned by a bunch of different functions, so this is your translator when something goes wrong 😭

ms_samplesize tells you the sample size based on the sampletype you give it. in general libmseed rolls with these character sample types:

  • "a" = 1 byte (ASCII)
  • "i" = 4 bytes (integer)
  • "f" = 4 bytes (float)
  • "d" = 8 bytes (double)

ms_encoding returns a pointer to a string describing the data encoding format you specified. and if the encoding format is unknown? it still returns an appropriate string, one that just... says that. iconic honestly, it always answers 🌈

ms_blktdesc returns a pointer to a string describing the blockette type (blkttype) you passed. if the blockette type is unknown, it returns NULL. sad but honest πŸ’€

ms_blktlen returns the total length of the specified blockette type (blkttype), in bytes. you also gotta hand over a pointer to the blockette itself (blkt) plus a swapflag β€” set that swapflag to 1 when you know the blockette has a different byte order than the host computer. and btw the length it gives back includes both the blockette "header" (the type and next fields) and the "body". full package deal πŸ’–


πŸ¦‹ the little technical caveat, listen up πŸ¦‹

technically?? you only need to supply the blockette pointer and the swapflag when the blockette type is a variable length blockette and the length lives inside the blockette itself (like, say, blockette type 2000). for blockettes of known fixed length β€” which is most of them, bestie β€” the blkt pointer and swapflag just don't get used. so don't stress 🧚

⚠️ and here's the spicy part: for blockette type 405, which is variable length but not self describing, 0 will be returned. meanwhile for blockette type 2000, which is variable length and self describing, the length gets read from a known offset into the blockette data. different vibes, different rules, iykyk πŸ”₯

πŸ‘‘ RETURN VALUES πŸ‘‘

  • ms_errorstr returns a pointer to a static string.
  • ms_samplesize returns the sample size in bytes, or 0 for an unknown sample type.
  • ms_encoding returns a pointer to a static string.
  • ms_blktdesc returns a pointer to a static string, or NULL if the blockette type is unknown.
  • ms_blktlen returns the total length of the specified blockette type, or 0 for an unknown type.

πŸŽ€ AUTHOR πŸŽ€

Chad Trabant IRIS Data Management Center


and that's the whole page, bestie!! πŸ’–βœ¨πŸ¦‹πŸŒΈ this libmseed API moment is dated 2006/12/12, so yeah she's a vintage icon and we love her for it. mwah πŸ’…πŸ’œ