📄 ms_intro.3
字号:
.TH MS_INTRO 3 2007/08/16.SH NAMEIntroduction to libmseed.SH INTRODUCTIONThe Mini-SEED library provides a framework for manipulation of SEEDdata records including the unpacking and packing of data records.Functionality is also included for managing waveform data ascontinuous traces. All structures of SEED 2.4 data records aresupported with the following exceptions: Blockette 2000 opaque datawhich has an unknown data structure by definition and Blockette 405which depends on full SEED (SEED including full ASCII headers) for afull data description.The primary purpose of the library is to hide the details of Mini-SEEDin order to allow rapid development of Mini-SEED reading/writingsoftware. The framework allows everything from manipulation ofMini-SEED on a record-by-record basis to reading of Mini-SEED intocontinuous trace segments to packing of large continuous traces usinga record template.Certain common tasks have, through library design, been streamlined,for example: reading Mini-SEED records from a file, adding data fromunpacked records to a group of traces or packing a group of continuoustraces into Mini-SEED records.The following data encoding formats are supported for both unpackingand packing: ASCII, INT16, INT32, FLOAT32, FLOAT64, STEIM1 and STEIM2.The INT and FLOAT encodings each have two versions for quantities witha different number of bits of representation. The STEIM decompressionproduces 32-bit integers; likewise the compression routines require32-bit integers as input. The following data encoding formats aresupported for unpacking only: GEOSCOPE (24-bit, 16/3 and 16/4 gainranged), SRO and DWWSSN..SH DATA RECORDSA Mini-SEED record is represented in the library using the datastructure given below. This structure is used for both unpacking andpacking of Mini-SEED records. When unpacking with msr_unpack(3) thisstructure is populated. When packing with msr_pack(3) this structureis used as a template for the resulting data records and as a sourceof samples to be packed.Blockettes following the fixed section of the header are contained inthe blockette chain of BlktLink structures. Shortcut pointers tocommonly used blockettes are maintained for types 100, 1000 and 1001.Many common header fields which are not easily accessible/usable inthe raw header are available directly from the structure. When thisstructure is used as a packing template, these common header fieldsare packed into the appropriate place in the fixed section orblockette. As examples, the ASCII stream identifiers (network,station, location and channel) are available as NULL terminatedstrings, the start time is available as a high precision epoch time(see ms_time(3)) and the sample rate is available as a doubleprecision floating point value.The MSRecord data structure:.nftypedef struct MSRecord_s { char *record; /* Mini-SEED record */ int32_t reclen; /* Length of Mini-SEED record */ /* Pointers to SEED data record structures */ struct fsdh_s *fsdh; /* Fixed Section of Data Header */ struct BlktLink *blkts; /* Root of blockette chain */ struct blkt_100_s *Blkt100; /* Blockette 100, if present */ struct blkt_1000_s *Blkt1000; /* Blockette 1000, if present */ struct blkt_1001_s *Blkt1001; /* Blockette 1001, if present */ /* Common header fields in accessible form */ int32_t sequence_number; /* SEED record sequence number */ char dataquality; /* Data quality indicator */ char network[11]; /* Network designation */ char station[11]; /* Station designation */ char location[11]; /* Location designation */ char channel[11]; /* Channel designation */ hptime_t starttime; /* Record start time */ double samprate; /* Nominal sample rate (Hz) */ int32_t samplecnt; /* Number of samples in record */ int8_t encoding; /* Data encoding format */ int8_t byteorder; /* Byte order of record */ /* Data sample fields */ void *datasamples; /* Data samples */ int32_t numsamples; /* Number of data samples */ char sampletype; /* Sample type code: a, i, f, d */ /* Stream oriented state information */ StreamState *ststate; /* Stream processing state information */}MSRecord;.fi.SS Explanation of fields.IP record:Pointer to the Mini-SEED record which was unpacked into the MSRecord..IP reclen:When unpacking this is the record length in bytes of the recordpointed to by the 'record' pointer. When packing this is the lengthof records to pack..IP fsdh:A pointer to the Fixed Section of the Data Header, all appropriatemulti-byte quantities are in host byte order..IP blkts:The root of the blockette chain. The chain is constructed fromlinked BlktLink structures. All appropriate multi-byte quantitiesin the blockettes are in host byte order. The msr_addblockette(3)routine can be used to add blockettes to this chain. The BlktLinkstructure and SEED blockette structures are defined in libmseed.h..IP Blkt100:.IP Blkt1000:.IP Blkt1001:Shortcut pointers to common blockettes in the blockette chain. If agiven blockette does not exist in the blockette chain the shortcutpointer will be 0. If more than one of these blockette types existin the chain this pointer will point to the last one..IP sequence_number:SEED record sequence number, should be between 0 and 999999..IP dataquality:Data record and quality indicator, should be 'D', 'R', 'Q' or 'M'..IP network:.IP station:.IP location:.IP channel:SEED stream identifiers as a NULL terminated strings..IP starttime:Record start time, the time of the first sample, as a high precisionepoch time (see ms_time(3)). This time can be converted using thevarious ms_hptime2<X> functions..IP samprate:The sample rate in samples per second in double precision. Duringunpacking this value will be set to the sample rate given in the 100blockette if it is present, otherwise the sample rate derived fromthe factor and multiplier in the fixed section of the header. In apacking template this value will be used to derive a factor andmultiplier for the fixed section of the header and will be writteninto 100 blockettes if any are in the blockette chain..IP samplecnt:The sample count, i.e. number of data samples in the record..IP encoding:The SEED data sample encoding format. During packing this dictateswhat format will be used to pack the data samples. Supported packingformats are 0 (DE_ASCII), 1 (DE_INT16), 3 (DE_INT32), 4 (DE_FLOAT32),5 (DE_FLOAT64), 10 (DE_STEIM1) and 11 (DE_STEIM2)..IP byteorder:Byte order of multi-byte quantities in the record. A value of 0indicates little endian and a value of 1 indicates big endian.During packing this dictates the byte order of the final records..IP datasamples:A pointer to the unpacked data samples. If no data samples wereunpacked this will be 0. The 'numsamples' field indicates how manysamples are in this array and the 'sampletype' field indicates whattype of samples they are..IP numsamples:The number of samples pointed to by the 'datasamples' pointer..IP sampletype:The type of samples pointed to by the 'datasamples' pointer.Supported types are 'a' (ASCII), 'i' (integer), 'f' (float) and 'd'(double). The size of each sample type in bytes is returnedby the get_samplesize(3) lookup routine..IP ststate:Pointer to a StreamState struct used internally to track streamoriented state variables. Memory for this only allocated when needed..SH TRACESIn order to manage continuous trace segments the library defines aMSTrace data structure and a MSTraceGroup data structure in which MSTracestructures can be grouped. While a MSTrace structure is normally usedto hold trace information and associated data samples it can also beused without data samples as a means to keep trace of data coveragewithout actual samples.Numerous routines are provided for basic management of MSTracestructures, including the creation of new MSTrace structures, addingdata from Mini-SEED data structures to MSTrace structures, printingtrace information, etc.The MSTraceGroup data structure acts as a very simple place to begin achain of MSTrace structures and keep track of the number of traces.The MSTrace and MSTraceGroup data structures:.nftypedef struct MSTrace_s { char network[11]; /* Network designation */ char station[11]; /* Station designation */ char location[11]; /* Location designation */ char channel[11]; /* Channel designation */ char dataquality; /* Data quality indicator */ char type; /* MSTrace type code */ hptime_t starttime; /* Time of first sample */ hptime_t endtime; /* Time of last sample */ double samprate; /* Nominal sample rate (Hz) */ int32_t samplecnt; /* Num. in trace coverage */ void *datasamples; /* Data samples */ int32_t numsamples; /* Num. samples in datasamples */ char sampletype; /* Sample type code: a, i, f, d */ void *prvtptr /* Private pointer for general use */ struct MSTrace_s *next; /* Pointer to next trace */}MSTrace;typedef struct MSTraceGroup_s { int32_t numtraces; /* Number of MSTraces in trace chain */ struct MSTrace_s *traces; /* Root of the trace chain */}MSTraceGroup;.fi.SS Explanation of fields.IP dataquality:SEED data quality indicator, either 'D', 'R', 'Q' or 'M'. This valuewill be (binary) 0 when the quality is unknown or mixed..IP network:.IP station:.IP location:.IP channel:MSTrace identifiers as a NULL terminated strings..IP type:A single character trace type indicator. This field is not used bylibmseed but could be used for application specific traceidentification..IP starttime:MSTrace start time, the time of the first sample, as a high precisionepoch time (see ms_time(3)). This time can be converted using thevarious ms_hptime2<X> functions..IP endtime:MSTrace end time, the time of the last sample, as a high precision epochtime (see ms_time(3)). This time can be converted using thevarious ms_hptime2<X> functions..IP samprate:The sample rate in samples per second in double precision..IP samplecnt:The sample count, i.e. number of data samples in the trace..IP datasamples:A pointer to the data samples. If no data samples are included thiswill be 0. The 'numsamples' field indicates how many samples are inthis array and the 'sampletype' field indicates what type of samplesthey are.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -