📄 libmseed.h
字号:
{ float vco_correction; BTime time; int8_t usec; uint8_t reception_qual; uint32_t exception_count; char exception_type[16]; char clock_model[32]; char clock_status[128];};/* Blockette 1000, Data Only SEED (without header) */struct blkt_1000_s{ uint8_t encoding; uint8_t byteorder; uint8_t reclen; uint8_t reserved;};/* Blockette 1001, Data Extension (without header) */struct blkt_1001_s{ uint8_t timing_qual; int8_t usec; uint8_t reserved; uint8_t framecnt;};/* Blockette 2000, Opaque Data (without header) */struct blkt_2000_s{ uint16_t length; uint16_t data_offset; uint32_t recnum; uint8_t byteorder; uint8_t flags; uint8_t numheaders; char payload[1];};/* Blockette chain link, generic linkable blockette index */typedef struct blkt_link_s{ uint16_t blkt_type; /* Blockette type */ uint16_t next_blkt; /* Offset to next blockette */ void *blktdata; /* Blockette data */ uint16_t blktdatalen; /* Length of blockette data in bytes */ struct blkt_link_s *next;}BlktLink;typedef struct StreamState_s{ int64_t packedrecords; /* Count of packed records */ int64_t packedsamples; /* Count of packed samples */ int32_t lastintsample; /* Value of last integer sample packed */ flag comphistory; /* Control use of lastintsample for compression history */}StreamState;typedef struct MSRecord_s { char *record; /* Mini-SEED record */ int32_t reclen; /* Length of Mini-SEED record in bytes */ /* Pointers to SEED data record structures */ struct fsdh_s *fsdh; /* Fixed Section of Data Header */ 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 network[11]; /* Network designation, NULL terminated */ char station[11]; /* Station designation, NULL terminated */ char location[11]; /* Location designation, NULL terminated */ char channel[11]; /* Channel designation, NULL terminated */ char dataquality; /* Data quality indicator */ hptime_t starttime; /* Record start time, corrected (first sample) */ double samprate; /* Nominal sample rate (Hz) */ int32_t samplecnt; /* Number of samples in record */ int8_t encoding; /* Data encoding format */ int8_t byteorder; /* Original/Final byte order of record */ /* Data sample fields */ void *datasamples; /* Data samples, 'numsamples' of type 'sampletype'*/ int32_t numsamples; /* Number of data samples in datasamples */ char sampletype; /* Sample type code: a, i, f, d */ /* Stream oriented state information */ StreamState *ststate; /* Stream processing state information */}MSRecord;/* Container for a continuous trace, linkable */typedef struct MSTrace_s { char network[11]; /* Network designation, NULL terminated */ char station[11]; /* Station designation, NULL terminated */ char location[11]; /* Location designation, NULL terminated */ char channel[11]; /* Channel designation, NULL terminated */ 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; /* Number of samples in trace coverage */ void *datasamples; /* Data samples, 'numsamples' of type 'sampletype'*/ int32_t numsamples; /* Number of data samples in datasamples */ char sampletype; /* Sample type code: a, i, f, d */ void *prvtptr; /* Private pointer for general use, unused by libmseed */ StreamState *ststate; /* Stream processing state information */ struct MSTrace_s *next; /* Pointer to next trace */}MSTrace;/* Container for a group (chain) of traces */typedef struct MSTraceGroup_s { int32_t numtraces; /* Number of MSTraces in the trace chain */ struct MSTrace_s *traces; /* Root of the trace chain */}MSTraceGroup;/* Global variables (defined in pack.c) and macros to set/force * pack byte orders */extern flag packheaderbyteorder;extern flag packdatabyteorder;#define MS_PACKHEADERBYTEORDER(X) (packheaderbyteorder = X);#define MS_PACKDATABYTEORDER(X) (packdatabyteorder = X);/* Global variables (defined in unpack.c) and macros to set/force * unpack byte orders */extern flag unpackheaderbyteorder;extern flag unpackdatabyteorder;#define MS_UNPACKHEADERBYTEORDER(X) (unpackheaderbyteorder = X);#define MS_UNPACKDATABYTEORDER(X) (unpackdatabyteorder = X);/* Global variables (defined in unpack.c) and macros to set/force * encoding and fallback encoding */extern int unpackencodingformat;extern int unpackencodingfallback;#define MS_UNPACKENCODINGFORMAT(X) (unpackencodingformat = X);#define MS_UNPACKENCODINGFALLBACK(X) (unpackencodingfallback = X);/* Mini-SEED record related functions */extern int msr_unpack (char *record, int reclen, MSRecord **ppmsr, flag dataflag, flag verbose);extern int msr_pack (MSRecord *msr, void (*record_handler) (char *, int, void *), void *handlerdata, int *packedsamples, flag flush, flag verbose );extern int msr_pack_header (MSRecord *msr, flag normalize, flag verbose);extern MSRecord* msr_init (MSRecord *msr);extern void msr_free (MSRecord **ppmsr);extern void msr_free_blktchain (MSRecord *msr);extern BlktLink* msr_addblockette (MSRecord *msr, char *blktdata, int length, int blkttype, int chainpos);extern int msr_normalize_header (MSRecord *msr, flag verbose);extern MSRecord* msr_duplicate (MSRecord *msr, flag datadup);extern double msr_samprate (MSRecord *msr);extern double msr_nomsamprate (MSRecord *msr);extern hptime_t msr_starttime (MSRecord *msr);extern hptime_t msr_starttime_uc (MSRecord *msr);extern hptime_t msr_endtime (MSRecord *msr);extern char* msr_srcname (MSRecord *msr, char *srcname, flag quality);extern void msr_print (MSRecord *msr, flag details);extern double msr_host_latency (MSRecord *msr);/* MSTrace related functions */extern MSTrace* mst_init (MSTrace *mst);extern void mst_free (MSTrace **ppmst);extern MSTraceGroup* mst_initgroup (MSTraceGroup *mstg);extern void mst_freegroup (MSTraceGroup **ppmstg);extern MSTrace* mst_findmatch (MSTrace *startmst, char dataquality, char *network, char *station, char *location, char *channel);extern MSTrace* mst_findadjacent (MSTraceGroup *mstg, flag *whence, char dataquality, char *network, char *station, char *location, char *channel, double samprate, double sampratetol, hptime_t starttime, hptime_t endtime, double timetol);extern int mst_addmsr (MSTrace *mst, MSRecord *msr, flag whence);extern int mst_addspan (MSTrace *mst, hptime_t starttime, hptime_t endtime, void *datasamples, int numsamples, char sampletype, flag whence);extern MSTrace* mst_addmsrtogroup (MSTraceGroup *mstg, MSRecord *msr, flag dataquality, double timetol, double sampratetol);extern MSTrace* mst_addtracetogroup (MSTraceGroup *mstg, MSTrace *mst);extern int mst_groupheal (MSTraceGroup *mstg, double timetol, double sampratetol);extern int mst_groupsort (MSTraceGroup *mstg, flag quality);extern char * mst_srcname (MSTrace *mst, char *srcname, flag quality);extern void mst_printtracelist (MSTraceGroup *mstg, flag timeformat, flag details, flag gaps);extern void mst_printgaplist (MSTraceGroup *mstg, flag timeformat, double *mingap, double *maxgap);extern int mst_pack (MSTrace *mst, void (*record_handler) (char *, int, void *), void *handlerdata, int reclen, flag encoding, flag byteorder, int *packedsamples, flag flush, flag verbose, MSRecord *mstemplate);extern int mst_packgroup (MSTraceGroup *mstg, void (*record_handler) (char *, int, void *), void *handlerdata, int reclen, flag encoding, flag byteorder, int *packedsamples, flag flush, flag verbose, MSRecord *mstemplate);/* Reading Mini-SEED records from files */typedef struct MSFileParam_s{ FILE *fp; char *rawrec; char filename[512]; int autodet; int readlen; int packtype; off_t packhdroffset; off_t filepos; int recordcount;} MSFileParam;extern int ms_readmsr (MSRecord **ppmsr, char *msfile, int reclen, off_t *fpos, int *last, flag skipnotdata, flag dataflag, flag verbose);extern int ms_readmsr_r (MSFileParam **ppmsfp, MSRecord **ppmsr, char *msfile, int reclen, off_t *fpos, int *last, flag skipnotdata, flag dataflag, flag verbose);extern int ms_readtraces (MSTraceGroup **ppmstg, char *msfile, int reclen, double timetol, double sampratetol, flag dataquality, flag skipnotdata, flag dataflag, flag verbose);extern int ms_find_reclen (const char *recbuf, int recbuflen, FILE *fileptr);/* General use functions */extern char* ms_recsrcname (char *record, char *srcname, flag quality);extern int ms_strncpclean (char *dest, const char *source, int length);extern int ms_strncpopen (char *dest, const char *source, int length);extern int ms_doy2md (int year, int jday, int *month, int *mday);extern int ms_md2doy (int year, int month, int mday, int *jday);extern hptime_t ms_btime2hptime (BTime *btime);extern char* ms_btime2isotimestr (BTime *btime, char *isotimestr);extern char* ms_btime2mdtimestr (BTime *btime, char *mdtimestr);extern char* ms_btime2seedtimestr (BTime *btime, char *seedtimestr);extern int ms_hptime2btime (hptime_t hptime, BTime *btime);extern char* ms_hptime2isotimestr (hptime_t hptime, char *isotimestr, flag subsecond);extern char* ms_hptime2mdtimestr (hptime_t hptime, char *mdtimestr, flag subsecond);extern char* ms_hptime2seedtimestr (hptime_t hptime, char *seedtimestr, flag subsecond);extern hptime_t ms_time2hptime (int year, int day, int hour, int min, int sec, int usec);extern hptime_t ms_seedtimestr2hptime (char *seedtimestr);extern hptime_t ms_timestr2hptime (char *timestr);extern int ms_genfactmult (double samprate, int16_t *factor, int16_t *multiplier);extern int ms_ratapprox (double real, int *num, int *den, int maxval, double precision);extern int ms_bigendianhost ();extern double ms_dabs (double val);/* Lookup functions */extern uint8_t ms_samplesize (const char sampletype);extern char* ms_encodingstr (const char encoding);extern char* ms_blktdesc (uint16_t blkttype);extern uint16_t ms_blktlen (uint16_t blkttype, const char *blktdata, flag swapflag);extern char * ms_errorstr (int errorcode);/* Logging facility */#define MAX_LOG_MSG_LENGTH 200 /* Maximum length of log messages *//* Logging parameters */typedef struct MSLogParam_s{ void (*log_print)(); const char *logprefix; void (*diag_print)(); const char *errprefix;} MSLogParam;extern int ms_log (int level, ...);extern int ms_log_l (MSLogParam *logp, int level, ...);extern void ms_loginit (void (*log_print)(char*), const char *logprefix, void (*diag_print)(char*), const char *errprefix);extern MSLogParam *ms_loginit_l (MSLogParam *logp, void (*log_print)(char*), const char *logprefix, void (*diag_print)(char*), const char *errprefix);/* Generic byte swapping routines */extern void ms_gswap2 ( void *data2 );extern void ms_gswap3 ( void *data3 );extern void ms_gswap4 ( void *data4 );extern void ms_gswap8 ( void *data8 );/* Generic byte swapping routines for memory aligned quantities */extern void ms_gswap2a ( void *data2 );extern void ms_gswap4a ( void *data4 );extern void ms_gswap8a ( void *data8 );/* Byte swap macro for the BTime struct */#define MS_SWAPBTIME(x) \ ms_gswap2 (x.year); \ ms_gswap2 (x.day); \ ms_gswap2 (x.fract);#ifdef __cplusplus}#endif#endif /* LIBMSEED_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -