⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libmseed.h

📁 C编写的格式转换程序
💻 H
📖 第 1 页 / 共 2 页
字号:
/*************************************************************************** * libmseed.h: *  * Interface declarations for the Mini-SEED library (libmseed). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License (GNU-LGPL) for more details.  The * GNU-LGPL and further information can be found here: * http://www.gnu.org/ * * Written by Chad Trabant * IRIS Data Management Center ***************************************************************************/#ifndef LIBMSEED_H#define LIBMSEED_H 1#ifdef __cplusplusextern "C" {#endif#include "lmplatform.h"#define LIBMSEED_VERSION "2.1.6"#define LIBMSEED_RELEASE "2008.220"#define MINRECLEN   256      /* Minimum Mini-SEED record length, 2^8 bytes */#define MAXRECLEN   1048576  /* Maximum Mini-SEED record length, 2^20 bytes */  /* SEED data encoding types */#define DE_ASCII       0#define DE_INT16       1#define DE_INT32       3#define DE_FLOAT32     4#define DE_FLOAT64     5#define DE_STEIM1      10#define DE_STEIM2      11#define DE_GEOSCOPE24  12#define DE_GEOSCOPE163 13#define DE_GEOSCOPE164 14#define DE_SRO         30#define DE_DWWSSN      32/* Library return and error code values, error values should always be negative */#define MS_ENDOFFILE        1        /* End of file reached return value */#define MS_NOERROR          0        /* No error */#define MS_GENERROR        -1        /* Generic unspecified error */#define MS_NOTSEED         -2        /* Data not SEED */#define MS_WRONGLENGTH     -3        /* Length of data read was not correct */#define MS_OUTOFRANGE      -4        /* SEED record length out of range */#define MS_UNKNOWNFORMAT   -5        /* Unknown data encoding format */#define MS_STBADCOMPFLAG   -6        /* Steim, invalid compression flag(s) *//* Define the high precision time tick interval as 1/modulus seconds *//* Default modulus of 1000000 defines tick interval as a microsecond */#define HPTMODULUS 1000000/* Error code for routines that normally return a high precision time. * The time value corresponds to '1902/1/1 00:00:00.000000' with the * default HPTMODULUS */#define HPTERROR -2145916800000000LL/* Macros to scale between Unix/POSIX epoch time & high precision time */#define MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS#define MS_HPTIME2EPOCH(X) X / HPTMODULUS/* Macro to test a character for data record indicators */#define MS_ISDATAINDICATOR(X) (X=='D' || X=='R' || X=='Q' || X=='M')/* Macro to test default sample rate tolerance: abs(1-sr1/sr2) < 0.0001 */#define MS_ISRATETOLERABLE(A,B) (ms_dabs (1.0 - (A / B)) < 0.0001)/* Macro to test memory for a SEED data record signature by checking * SEED data record header values at known byte offsets to determine * if the memory contains a valid record. *  * Offset = Value * [0-5]  = Digits or NULL, SEED sequence number *     6  = Data record quality indicator *     7  = Space or NULL [not valid SEED] *     24 = Start hour (0-23) *     25 = Start minute (0-59) *     26 = Start second (0-60) * * Usage: *   MS_ISVALIDHEADER ((char *)X)  X buffer must contain at least 27 bytes */#define MS_ISVALIDHEADER(X) ((isdigit ((unsigned char) *(X)) || !*(X) ) &&     \			     (isdigit ((unsigned char) *(X+1)) || !*(X+1) ) && \			     (isdigit ((unsigned char) *(X+2)) || !*(X+2) ) && \			     (isdigit ((unsigned char) *(X+3)) || !*(X+3) ) && \			     (isdigit ((unsigned char) *(X+4)) || !*(X+4) ) && \			     (isdigit ((unsigned char) *(X+5)) || !*(X+5) ) && \			     MS_ISDATAINDICATOR(*(X+6)) &&                     \			     (*(X+7) == ' ' || *(X+7) == '\0') &&              \			     (int)(*(X+24)) >= 0 && (int)(*(X+24)) <= 23 &&    \			     (int)(*(X+25)) >= 0 && (int)(*(X+25)) <= 59 &&    \			     (int)(*(X+26)) >= 0 && (int)(*(X+26)) <= 60)/* Macro to test memory for a blank/noise SEED data record signature * by checking for a valid SEED sequence number and padding characters * to determine if the memory contains a valid blank/noise record. *  * Offset = Value * [0-5]  = Digits or NULL, SEED sequence number * [6-47] = Space character (ASCII 32), remainder of fixed header * * Usage: *   MS_ISVALIDBLANK ((char *)X)  X buffer must contain at least 27 bytes */#define MS_ISVALIDBLANK(X) ((isdigit ((unsigned char) *(X)) || !*(X) ) &&     \			    (isdigit ((unsigned char) *(X+1)) || !*(X+1) ) && \			    (isdigit ((unsigned char) *(X+2)) || !*(X+2) ) && \			    (isdigit ((unsigned char) *(X+3)) || !*(X+3) ) && \			    (isdigit ((unsigned char) *(X+4)) || !*(X+4) ) && \			    (isdigit ((unsigned char) *(X+5)) || !*(X+5) ) && \			    (*(X+6)==' ')&&(*(X+7)==' ')&&(*(X+8)==' ') &&    \			    (*(X+9)==' ')&&(*(X+10)==' ')&&(*(X+11)==' ') &&  \			    (*(X+12)==' ')&&(*(X+13)==' ')&&(*(X+14)==' ') && \			    (*(X+15)==' ')&&(*(X+16)==' ')&&(*(X+17)==' ') && \			    (*(X+18)==' ')&&(*(X+19)==' ')&&(*(X+20)==' ') && \			    (*(X+21)==' ')&&(*(X+22)==' ')&&(*(X+23)==' ') && \			    (*(X+24)==' ')&&(*(X+25)==' ')&&(*(X+26)==' ') && \			    (*(X+27)==' ')&&(*(X+28)==' ')&&(*(X+29)==' ') && \			    (*(X+30)==' ')&&(*(X+31)==' ')&&(*(X+32)==' ') && \			    (*(X+33)==' ')&&(*(X+34)==' ')&&(*(X+35)==' ') && \			    (*(X+36)==' ')&&(*(X+37)==' ')&&(*(X+38)==' ') && \			    (*(X+39)==' ')&&(*(X+40)==' ')&&(*(X+41)==' ') && \			    (*(X+42)==' ')&&(*(X+43)==' ')&&(*(X+44)==' ') && \			    (*(X+45)==' ')&&(*(X+46)==' ')&&(*(X+47)==' ') )/* Require a large (>= 64-bit) integer type for hptime_t */typedef int64_t hptime_t;/* A single byte flag type */typedef int8_t flag;/* SEED binary time */typedef struct btime_s{  uint16_t  year;  uint16_t  day;  uint8_t   hour;  uint8_t   min;  uint8_t   sec;  uint8_t   unused;  uint16_t  fract;}BTime;/* Fixed section data of header */struct fsdh_s{  char           sequence_number[6];  char           dataquality;  char           reserved;  char           station[5];  char           location[2];  char           channel[3];  char           network[2];  BTime          start_time;  uint16_t       numsamples;  int16_t        samprate_fact;  int16_t        samprate_mult;  uint8_t        act_flags;  uint8_t        io_flags;  uint8_t        dq_flags;  uint8_t        numblockettes;  int32_t        time_correct;  uint16_t       data_offset;  uint16_t       blockette_offset;};/* Blockette 100, Sample Rate (without header) */struct blkt_100_s{  float     samprate;  int8_t    flags;  uint8_t   reserved[3];};/* Blockette 200, Generic Event Detection (without header) */struct blkt_200_s{  float     amplitude;  float     period;  float     background_estimate;  uint8_t   flags;  uint8_t   reserved;  BTime     time;  char      detector[24];};/* Blockette 201, Murdock Event Detection (without header) */struct blkt_201_s{  float     amplitude;  float     period;  float     background_estimate;  uint8_t   flags;  uint8_t   reserved;  BTime     time;  uint8_t   snr_values[6];  uint8_t   loopback;  uint8_t   pick_algorithm;  char      detector[24];};/* Blockette 300, Step Calibration (without header) */struct blkt_300_s{  BTime     time;  uint8_t   numcalibrations;  uint8_t   flags;  uint32_t  step_duration;  uint32_t  interval_duration;  float     amplitude;  char      input_channel[3];  uint8_t   reserved;  uint32_t  reference_amplitude;  char      coupling[12];  char      rolloff[12];};/* Blockette 310, Sine Calibration (without header) */struct blkt_310_s{  BTime     time;  uint8_t   reserved1;  uint8_t   flags;  uint32_t  duration;  float     period;  float     amplitude;  char      input_channel[3];  uint8_t   reserved2;  uint32_t  reference_amplitude;  char      coupling[12];  char      rolloff[12];};/* Blockette 320, Pseudo-random Calibration (without header) */struct blkt_320_s{  BTime     time;  uint8_t   reserved1;  uint8_t   flags;  uint32_t  duration;  float     ptp_amplitude;  char      input_channel[3];  uint8_t   reserved2;  uint32_t  reference_amplitude;  char      coupling[12];  char      rolloff[12];  char      noise_type[8];};  /* Blockette 390, Generic Calibration (without header) */struct blkt_390_s{  BTime     time;  uint8_t   reserved1;  uint8_t   flags;  uint32_t  duration;  float     amplitude;  char      input_channel[3];  uint8_t   reserved2;};/* Blockette 395, Calibration Abort (without header) */struct blkt_395_s{  BTime     time;  uint8_t   reserved[2];};/* Blockette 400, Beam (without header) */struct blkt_400_s{  float     azimuth;  float     slowness;  uint16_t  configuration;  uint8_t   reserved[2];};/* Blockette 405, Beam Delay (without header) */struct blkt_405_s{  uint16_t  delay_values[1];};/* Blockette 500, Timing (without header) */struct blkt_500_s

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -