├── ChangeLog ├── LICENSE ├── Makefile ├── Makefile.wat ├── Makefile.win ├── README.md ├── doc ├── SimpleASCIITimeseries.txt ├── ascii2mseed.1 └── ascii2mseed.md ├── libmseed ├── .clang-format ├── ChangeLog ├── INSTALL.md ├── LICENSE.txt ├── Makefile ├── Makefile.wat ├── Makefile.win ├── README.byteorder ├── README.md ├── doc │ ├── gswap2.3 │ ├── libmseed-UsersGuide │ ├── ms_addselect.3 │ ├── ms_addselect_comp.3 │ ├── ms_bigendianhost.3 │ ├── ms_blktdesc.3 │ ├── ms_blktlen.3 │ ├── ms_btime2isotimestr.3 │ ├── ms_btime2mdtimestr.3 │ ├── ms_btime2seedtimestr.3 │ ├── ms_btime3hptime.3 │ ├── ms_detect.3 │ ├── ms_doy2md.3 │ ├── ms_encodingstr.3 │ ├── ms_errorstr.3 │ ├── ms_find_reclen.3 │ ├── ms_freeselections.3 │ ├── ms_genfactmult.3 │ ├── ms_gswap.3 │ ├── ms_gswap2.3 │ ├── ms_gswap2a.3 │ ├── ms_gswap3.3 │ ├── ms_gswap4.3 │ ├── ms_gswap4a.3 │ ├── ms_gswap8.3 │ ├── ms_gswap8a.3 │ ├── ms_hptime2btime.3 │ ├── ms_hptime2isotimestr.3 │ ├── ms_hptime2mdtimestr.3 │ ├── ms_hptime2seedtimestr.3 │ ├── ms_intro.3 │ ├── ms_log.3 │ ├── ms_log_l.3 │ ├── ms_loginit.3 │ ├── ms_loginit_l.3 │ ├── ms_lookup.3 │ ├── ms_matchselect.3 │ ├── ms_md2doy.3 │ ├── ms_parse_raw.3 │ ├── ms_printselections.3 │ ├── ms_ratapprox.3 │ ├── ms_readleapsecondfile.3 │ ├── ms_readleapseconds.3 │ ├── ms_readmsr.3 │ ├── ms_readmsr_r.3 │ ├── ms_readselectionsfile.3 │ ├── ms_readtracelist.3 │ ├── ms_readtracelist_selection.3 │ ├── ms_readtracelist_timewin.3 │ ├── ms_readtraces.3 │ ├── ms_readtraces_selection.3 │ ├── ms_readtraces_timewin.3 │ ├── ms_recsrcname.3 │ ├── ms_samplesize.3 │ ├── ms_seedtimestr2hptime.3 │ ├── ms_selection.3 │ ├── ms_splitsrcname.3 │ ├── ms_srcname.3 │ ├── ms_strncpclean.3 │ ├── ms_strncpopen.3 │ ├── ms_time.3 │ ├── ms_time2hptime.3 │ ├── ms_timestr2hptime.3 │ ├── ms_writemseed.3 │ ├── msr_addblockette.3 │ ├── msr_duplicate.3 │ ├── msr_endtime.3 │ ├── msr_free.3 │ ├── msr_free_blktchain.3 │ ├── msr_host_latency.3 │ ├── msr_init.3 │ ├── msr_nomsamprate.3 │ ├── msr_normalize_header.3 │ ├── msr_pack.3 │ ├── msr_pack_header.3 │ ├── msr_parse.3 │ ├── msr_parse_selection.3 │ ├── msr_print.3 │ ├── msr_samprate.3 │ ├── msr_srcname.3 │ ├── msr_starttime.3 │ ├── msr_starttime_uc.3 │ ├── msr_unpack.3 │ ├── msr_writemseed.3 │ ├── mst_addmsr.3 │ ├── mst_addmsrtogroup.3 │ ├── mst_addspan.3 │ ├── mst_addtracetogroup.3 │ ├── mst_convertsamples.3 │ ├── mst_findadjacent.3 │ ├── mst_findmatch.3 │ ├── mst_free.3 │ ├── mst_freegroup.3 │ ├── mst_groupheal.3 │ ├── mst_groupsort.3 │ ├── mst_init.3 │ ├── mst_initgroup.3 │ ├── mst_pack.3 │ ├── mst_packgroup.3 │ ├── mst_printgaplist.3 │ ├── mst_printsynclist.3 │ ├── mst_printtracelist.3 │ ├── mst_srcname.3 │ ├── mst_writemseed.3 │ ├── mst_writemseedgroup.3 │ ├── mstl_addmsr.3 │ ├── mstl_convertsamples.3 │ ├── mstl_free.3 │ ├── mstl_init.3 │ ├── mstl_printgaplist.3 │ ├── mstl_printsynclist.3 │ └── mstl_printtracelist.3 ├── example │ ├── Makefile │ ├── Makefile.wat │ ├── Makefile.win │ ├── README │ ├── msrepack.c │ ├── msview.c │ └── test.mseed ├── fileutils.c ├── genutils.c ├── gswap.c ├── libmseed.def ├── libmseed.h ├── libmseed.map ├── lmplatform.c ├── lmplatform.h ├── logging.c ├── lookup.c ├── matlab │ ├── Makefile │ ├── README │ ├── mexMsReadTraces.c │ └── mexMsReadTracesNative.c ├── mseed.pc.in ├── msrutils.c ├── pack.c ├── packdata.c ├── packdata.h ├── parseutils.c ├── selection.c ├── steimdata.h ├── test │ ├── Makefile │ ├── README │ ├── data │ │ ├── CDSN-encoded.mseed │ │ ├── DWWSSN-encoded.mseed │ │ ├── Float32-encoded.mseed │ │ ├── Float64-encoded.mseed │ │ ├── GEOSCOPE-16bit-3exp-encoded.mseed │ │ ├── Int16-encoded.mseed │ │ ├── Int32-1024byte.mseed │ │ ├── Int32-128byte.mseed │ │ ├── Int32-2048byte.mseed │ │ ├── Int32-256byte.mseed │ │ ├── Int32-4096byte.mseed │ │ ├── Int32-512byte.mseed │ │ ├── Int32-8192byte.mseed │ │ ├── Int32-oneseries-mixedlengths-mixedorder.mseed │ │ ├── SRO-encoded.mseed │ │ ├── Steim1-AllDifferences-BE.mseed │ │ ├── Steim1-AllDifferences-LE.mseed │ │ ├── Steim2-AllDifferences-BE.mseed │ │ ├── Steim2-AllDifferences-LE.mseed │ │ ├── corrupt-blockettes-wrongnext.mseed │ │ ├── detection.record.mseed │ │ ├── invalid-blockette-offset.mseed │ │ ├── no-blockette1000-steim1.mseed │ │ ├── text-encoded.mseed │ │ └── unapplied-timecorrection.mseed │ ├── lmtestpack.c │ ├── lmtestparse.c │ ├── pack-Float32-encoded.test │ ├── pack-Float32-encoded.test.ref │ ├── pack-Float64-encoded.test │ ├── pack-Float64-encoded.test.ref │ ├── pack-Int16-encoded.test │ ├── pack-Int16-encoded.test.ref │ ├── pack-Int32-encoded.test │ ├── pack-Int32-encoded.test.ref │ ├── pack-Steim1-encoded.test │ ├── pack-Steim1-encoded.test.ref │ ├── pack-Steim2-encoded.test │ ├── pack-Steim2-encoded.test.ref │ ├── pack-text-encoded.test │ ├── pack-text-encoded.test.ref │ ├── read-CDSN-encoded.test │ ├── read-CDSN-encoded.test.ref │ ├── read-DWWSSN-encoded.test │ ├── read-DWWSSN-encoded.test.ref │ ├── read-Float32-encoded.test │ ├── read-Float32-encoded.test.ref │ ├── read-Float64-encoded.test │ ├── read-Float64-encoded.test.ref │ ├── read-GEOSCOPE163-encoded.test │ ├── read-GEOSCOPE163-encoded.test.ref │ ├── read-Int16-encoded.test │ ├── read-Int16-encoded.test.ref │ ├── read-Int32-1024byte-encoded.test │ ├── read-Int32-1024byte-encoded.test.ref │ ├── read-Int32-128byte-encoded.test │ ├── read-Int32-128byte-encoded.test.ref │ ├── read-Int32-2048byte-encoded.test │ ├── read-Int32-2048byte-encoded.test.ref │ ├── read-Int32-256byte-encoded.test │ ├── read-Int32-256byte-encoded.test.ref │ ├── read-Int32-4096byte-encoded.test │ ├── read-Int32-4096byte-encoded.test.ref │ ├── read-Int32-512byte-encoded.test │ ├── read-Int32-512byte-encoded.test.ref │ ├── read-Int32-8192byte-encoded.test │ ├── read-Int32-8192byte-encoded.test.ref │ ├── read-SRO-encoded.test │ ├── read-SRO-encoded.test.ref │ ├── read-Steim1-bigendian.test │ ├── read-Steim1-bigendian.test.ref │ ├── read-Steim1-littleendian.test │ ├── read-Steim1-littleendian.test.ref │ ├── read-Steim2-bigendian.test │ ├── read-Steim2-bigendian.test.ref │ ├── read-Steim2-littleendian.test │ ├── read-Steim2-littleendian.test.ref │ ├── read-detection-record.test │ ├── read-detection-record.test.ref │ ├── read-invalid-blockette-offset.test │ ├── read-invalid-blockette-offset.test.ref │ ├── read-mixed-order-mixed-length-trace.test │ ├── read-mixed-order-mixed-length-trace.test.ref │ ├── read-no-blockette1000.test │ ├── read-no-blockette1000.test.ref │ ├── read-text-encoded.test │ ├── read-text-encoded.test.ref │ ├── read-unapplied-timecorrection.test │ └── read-unapplied-timecorrection.test.ref ├── tracelist.c ├── traceutils.c ├── unpack.c ├── unpackdata.c └── unpackdata.h ├── src ├── Makefile ├── Makefile.wat ├── Makefile.win └── ascii2mseed.c └── testdata ├── slist.ascii └── tspair.ascii /ChangeLog: -------------------------------------------------------------------------------- 1 | 2017.093: 1.5 2 | - Update libmseed to 2.19.3. 3 | - Remove dependency on ntwin32.mak for Windows nmake makefiles, now 4 | building works in plain MSVC development environments. 5 | - Add DEPRECATED notice to Makefile.wat and src/Makefile.wat. 6 | - Update licensing to GNU GPL 3. 7 | 8 | 2015.148: 1.4 9 | - Initialize new FDSH memory to zeros for MSRecord template when header 10 | flags are present (new feature in 1.2). 11 | - Set end time of MSTrace representation of accumulated data, will help 12 | in edge cases of sorting the traces properly. 13 | 14 | 2015.146: 1.3 15 | - Update libmseed to 2.16m release. 16 | - Add handling of FLOAT64 data, encode as 64-bit doubles. 17 | 18 | 2015.034: 1.2 19 | - Add parsing of optional header values at end of TIMESERIES declaration. 20 | 21 | 2015.030: 22 | - Update libmseed to 2.13 release. 23 | - Update packed trace, record and sample counters to 64-bit integers. 24 | - Clean up Makefile and src/Makefile, remove old targets. 25 | 26 | 2013.025: 1.1 27 | - Fix handling of non-integer sampling rates for TSPAIR input. Thanks 28 | to K. Anderson for reporting this. 29 | 30 | 2010.266: 1.0 31 | - Update libmseed to 2.5.1 release. 32 | - Use libmseed ms_splitsrcname() instead of internal version. 33 | - Mark as 1.0. 34 | 35 | 2009.325: 0.2 36 | - Allow sample list data values to be in 1 to 8 columns instead 37 | of a fixed 6 columns. 38 | - Add details of expected input data files to man page. 39 | - Fix memory leaks. 40 | 41 | 2009.324: 0.1 42 | - Initial version. 43 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | DIRS = libmseed src 3 | 4 | all clean static install :: 5 | @for d in $(DIRS) ; do \ 6 | echo "Running $(MAKE) $@ in $$d" ; \ 7 | if [ -f $$d/Makefile -o -f $$d/makefile ] ; \ 8 | then ( cd $$d && $(MAKE) $@ ) ; \ 9 | elif [ -d $$d ] ; \ 10 | then ( echo "ERROR: no Makefile/makefile in $$d for $(CC)" ) ; \ 11 | fi ; \ 12 | done 13 | 14 | -------------------------------------------------------------------------------- /Makefile.wat: -------------------------------------------------------------------------------- 1 | # 2 | # THIS FILE IS DEPRECATED AND WILL BE REMOVED IN A FUTURE RELEASE 3 | # 4 | # Wmake File for seisan2mseed - For Watcom's wmake 5 | # Use 'wmake -f Makefile.wat' 6 | 7 | all: .SYMBOLIC 8 | cd libmseed 9 | wmake -f Makefile.wat 10 | cd ..\src 11 | wmake -f Makefile.wat 12 | cd .. 13 | 14 | clean: .SYMBOLIC 15 | cd libmseed 16 | wmake -f Makefile.wat clean 17 | cd ..\src 18 | wmake -f Makefile.wat clean 19 | cd .. 20 | -------------------------------------------------------------------------------- /Makefile.win: -------------------------------------------------------------------------------- 1 | # 2 | # Nmake file - For MS Visual C++ version 3 | # Use 'nmake -f Makefile.win' 4 | 5 | all: 6 | cd libmseed 7 | nmake -f Makefile.win 8 | cd ..\src 9 | nmake -f Makefile.win 10 | cd .. 11 | 12 | clean: 13 | cd libmseed 14 | nmake -f Makefile.win clean 15 | cd ..\src 16 | nmake -f Makefile.win clean 17 | cd .. 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ascii2mseed - Convert ASCII time series data to miniSEED. 2 | 3 | ## Documentation 4 | 5 | For usage infromation see the [ascii2mseed manual](doc/ascii2mseed.md) in the 6 | 'doc' directory. 7 | 8 | ## Downloading and building 9 | 10 | The [releases](https://github.com/iris-edu/ascii2mseed/releases) area 11 | contains release versions. 12 | 13 | In most Unix/Linux environments a simple 'make' will build the program. 14 | 15 | The CC and CFLAGS environment variables can be used to configure 16 | the build parameters. 17 | 18 | In the Win32 environment the Makefile.win can be used with the nmake 19 | build tool included with Visual Studio. 20 | 21 | ## Licensing 22 | 23 | GNU GPL version 3. See included LICENSE file for details. 24 | 25 | Copyright (c) 2017 Chad Trabant 26 | -------------------------------------------------------------------------------- /doc/SimpleASCIITimeseries.txt: -------------------------------------------------------------------------------- 1 | 2 | ##### Simple ASCII time series format (2008.4.22) ###### 3 | 4 | Each contiguous time series segment (no gaps or overlaps) is represented 5 | with a header line followed by data samples in one of two styles: either 6 | sample lists or time-sample pairs. There are no restrictions on how the 7 | segments are organized into files, a file might contain a single segment 8 | or many, concatenated segments either for the same channel or many 9 | different channels. 10 | 11 | Header lines have the general form: 12 | 13 | "TIMESERIES SourceName, # samples, # sps, Time, Format, Type, Units" 14 | 15 | Header field descriptions: 16 | 17 | SourceName: "Net_Sta_Loc_Chan_Qual", no spaces, quality code optional 18 | # samples: Number of samples following header 19 | # sps: Sampling rate in samples per second 20 | Time: Time of first sample in ISO YYYY-MM-DDTHH:MM:SS.FFFFFF format 21 | Format: 'SLIST' (sample list) or 'TSPAIR' (time-sample pair) 22 | Type: Sample type 'INTEGER', 'FLOAT' or 'ASCII' 23 | Units: Units of time-series, e.g. Counts, M/S, etc., should not contain spaces 24 | 25 | Example header (no line wrapping): 26 | 27 | TIMESERIES NL_HGN_00_BHZ_R, 11947 samples, 40 sps, 2003-05-29T02:13:22.043400, SLIST, INTEGER, Counts 28 | 29 | 30 | Sample value format: 31 | 32 | For the SLIST (sample list) format, samples are listed in 6 columns with 33 | the time-series incrementing from left to right and wrapping to the next 34 | line. The time of the first sample is the time listed in the header. 35 | 36 | For the TSPAIR (time-sample pair) format, each sample is listed on a 37 | separate line with a specific time stamp in the same ISO format as used 38 | in the header line. 39 | 40 | 41 | Example SLIST format: 42 | 43 | TIMESERIES NL_HGN_00_BHZ_R, 12 samples, 40 sps, 2003-05-29T02:13:22.043400, SLIST, INTEGER, Counts 44 | 2787 2776 2774 2780 2783 2782 45 | 2776 2766 2759 2760 2765 2767 46 | 47 | Example TSPAIR format: 48 | 49 | TIMESERIES NL_HGN_00_BHZ_R, 12 samples, 40 sps, 2003-05-29T02:13:22.043400, TSPAIR, INTEGER, Counts 50 | 2003-05-29T02:13:22.043400 2787 51 | 2003-05-29T02:13:22.068400 2776 52 | 2003-05-29T02:13:22.093400 2774 53 | 2003-05-29T02:13:22.118400 2780 54 | 2003-05-29T02:13:22.143400 2783 55 | 2003-05-29T02:13:22.168400 2782 56 | 2003-05-29T02:13:22.193400 2776 57 | 2003-05-29T02:13:22.218400 2766 58 | 2003-05-29T02:13:22.243400 2759 59 | 2003-05-29T02:13:22.268400 2760 60 | 2003-05-29T02:13:22.293400 2765 61 | 2003-05-29T02:13:22.318400 2767 62 | 63 | -------------------------------------------------------------------------------- /doc/ascii2mseed.1: -------------------------------------------------------------------------------- 1 | .TH ASCII2MSEED 1 2017/04/03 2 | .SH NAME 3 | ASCII time series to miniSEED converter 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | ascii2mseed [options] file1 [file2 file3 ...] 8 | 9 | .fi 10 | .SH DESCRIPTION 11 | \fBascii2mseed\fP converts simple ASCII time series data to miniSEED 12 | format. If an input file name is prefixed with an '@' character the 13 | file is assumed to contain a list of input data files, see \fILIST 14 | FILES\fP below. All output miniSEED records will be written to a 15 | specified output file. 16 | 17 | .SH OPTIONS 18 | 19 | .IP "-V " 20 | Print program version and exit. 21 | 22 | .IP "-h " 23 | Print program usage and exit. 24 | 25 | .IP "-v " 26 | Be more verbose. This flag can be used multiple times ("-v -v" or 27 | "-vv") for more verbosity. 28 | 29 | .IP "-S " 30 | Include SEED blockette 100 in each output record with the sample rate 31 | in floating point format. The basic format for storing sample rates 32 | in SEED data records is a rational approximation 33 | (numerator/denominator). Precision will be lost if a given sample 34 | rate cannot be well approximated. This option should be used in those 35 | cases. 36 | 37 | .IP "-r \fIbytes\fP" 38 | Specify the miniSEED record length in \fIbytes\fP, default is 4096. 39 | 40 | .IP "-e \fIencoding\fP" 41 | Specify the miniSEED data encoding format, default is 11 (Steim-2 42 | compression) for integer data and 4 for floats (stored uncompressed). 43 | Other supported encoding formats include 10 (Steim-1 compression), 1 44 | (16-bit integers) and 3 (uncompressed 32-bit integers). 45 | 46 | .IP "-b \fIbyteorder\fP" 47 | Specify the miniSEED byte order, default is 1 (big-endian or most 48 | significant byte first). The other option is 0 (little-endian or 49 | least significant byte first). It is highly recommended to always 50 | create big-endian SEED. 51 | 52 | .IP "-o \fIoutfile\fP" 53 | Write all miniSEED records to \fIoutfile\fP, if \fIoutfile\fP is a 54 | single dash (-) then all miniSEED output will go to stdout. All 55 | diagnostic output from the program is written to stderr and should 56 | never get mixed with data going to stdout. 57 | 58 | .SH LIST FILES 59 | If an input file is prefixed with an '@' character the file is assumed 60 | to contain a list of file for input. Multiple list files can be 61 | combined with multiple input files on the command line. The last, 62 | space separated field on each line is assumed to be the file name to 63 | be read. 64 | 65 | An example of a simple text list: 66 | 67 | .nf 68 | tspair.ascii 69 | slist.ascii 70 | .fi 71 | 72 | .SH ASCII DATA 73 | The input ASCII data are expected to start with a simple header 74 | followed by data samples in one of two forms: a columnar sample value 75 | listing or time-sample pairs. The columnar sample value listing may 76 | have 1 to 8 columns. The header identifies the time series source 77 | parameters (SEED convention) along with number of samples, sample 78 | rate, time of first sample, sample list format, sample type and 79 | optionally the units of the samples. 80 | 81 | Header lines are of the general form: 82 | 83 | .nf 84 | "TIMESERIES SourceName, # samples, # sps, Time, Format, Type, Units, Headers" 85 | .fi 86 | 87 | Header field descriptions: 88 | 89 | .nf 90 | \fBSourceName\fP: "Net_Sta_Loc_Chan_Qual", no spaces, quality code optional 91 | \fB# samples\fP: Number of samples following header 92 | \fB# sps\fP: Sampling rate in samples per second 93 | \fBTime\fP: Time of first sample in ISO YYYY-MM-DDTHH:MM:SS.FFFFFF format 94 | \fBFormat\fP: 'SLIST' (sample list) or 'TSPAIR' (time-sample pair) 95 | \fBType\fP: Sample type 'INTEGER' or 'FLOAT' or 'FLOAT64' 96 | \fBUnits\fP: Units of time-series, optional (will not be present in miniSEED) 97 | \fBHeaders\fP: miniSEED header values and flags, optional 98 | .fi 99 | 100 | The header line should not be wrapped and must contain the spaces and 101 | commas as specified in the general form. The units field of the 102 | header is optional and will not be used by ascii2mseed (there is no 103 | place for units in miniSEED). No blanks lines should exist between 104 | the header and data samples. 105 | 106 | The \fBSourceName\fP field identifies the source of the time series 107 | data using the SEED name nomenclature separated by underscores. The 108 | data quality code is optional and defaults to 'D'. Spaces in the 109 | source name field are not supported. 110 | 111 | The \fBType\fP field identifies the expected value data type. The 112 | type instructs the converter to parse the data values with the 113 | following mapping: \fBINTEGER\fP => 32-bit integer, \fBFLOAT\fP => 114 | 32-bit float and \fBFLOAT64\fP => 64-bit float (double). 115 | 116 | More than one data segment (header and associated data samples) may be 117 | contained in any given input file. 118 | 119 | \fBExample data file using SLIST (sample list) format\fP 120 | 121 | .nf 122 | TIMESERIES XX_TEST__BHZ, 12 samples, 40 sps, 2003-05-29T02:13:22.043400, SLIST, INTEGER, Counts 123 | 2787 2776 2774 2780 2783 2782 124 | 2776 2766 2759 2760 2765 2767 125 | .fi 126 | 127 | \fBExample data file using TSPAIR (time-sample pair) format\fP 128 | 129 | .nf 130 | TIMESERIES XX_TEST__BHZ, 12 samples, 40 sps, 2003-05-29T02:13:22.043400, TSPAIR, INTEGER, Counts 131 | 2003-05-29T02:13:22.043400 2787 132 | 2003-05-29T02:13:22.068400 2776 133 | 2003-05-29T02:13:22.093400 2774 134 | 2003-05-29T02:13:22.118400 2780 135 | 2003-05-29T02:13:22.143400 2783 136 | 2003-05-29T02:13:22.168400 2782 137 | 2003-05-29T02:13:22.193400 2776 138 | 2003-05-29T02:13:22.218400 2766 139 | 2003-05-29T02:13:22.243400 2759 140 | 2003-05-29T02:13:22.268400 2760 141 | 2003-05-29T02:13:22.293400 2765 142 | 2003-05-29T02:13:22.318400 2767 143 | .fi 144 | 145 | .SH MINISEED HEADER VALUES 146 | 147 | The following miniSEED header values may be set in the TIMESERIES 148 | header line: 149 | 150 | .nf 151 | FSDH:ACTFLAGS:bit=value 152 | FSDH:IOFLAGS:bit=value 153 | FSDH:DQFLAGS:bit=value 154 | B1001:TIMINGQUALITY=value 155 | .fi 156 | 157 | The Fixed Section Data Header (FSDH) flag sets are single bytes where 158 | each bit is a flag. The Blockette 1001 (B1001) timinig quality value 159 | should be set from 0 to 100 percent. For details see the SEED format 160 | manual. 161 | 162 | Multiple values may be specified by concatinating the declarations 163 | using vertical-bar delimiters. For example: "FSDH:IOFLAGS:5=1|B1001:TIMINGQUALITY=100". 164 | This composite value would be specified in the header like so: 165 | 166 | .nf 167 | TIMESERIES XX_TEST__BHZ, 12 samples, 40 sps, 2003-05-29T02:13:22.043400, SLIST, INTEGER, Counts, FSDH:IOFLAGS:5=1|B1001:TIMINGQUALITY=100 168 | .fi 169 | 170 | The example above sets bit 5 of the IO flags (Clock locked) and sets the timing quality value of Blockette 1001 (Timing quality) to 100%. 171 | 172 | .SH AUTHOR 173 | .nf 174 | Chad Trabant 175 | IRIS Data Management Center 176 | .fi 177 | -------------------------------------------------------------------------------- /libmseed/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: LLVM 2 | AlwaysBreakAfterDefinitionReturnType: TopLevel 3 | SpaceBeforeParens: Always 4 | BreakBeforeBraces: Allman 5 | AlignConsecutiveAssignments: true 6 | ColumnLimit: 0 7 | -------------------------------------------------------------------------------- /libmseed/INSTALL.md: -------------------------------------------------------------------------------- 1 | 2 | The library requires that C99 integer types are available on the 3 | target computer. Specifically the int8_t, int16_t, int32_t, int64_t 4 | and their unsigned counterpart types. 5 | 6 | ## Unix, Linux, macOS 7 | 8 | A simple 'make' on most Unix-like systems should build the library. 9 | 10 | The included Makefile should work for most Unix-like environments and 11 | most make variants. It is know to work with GNU make, which, if not the 12 | default, is sometimes installed as gmake. 13 | 14 | The CC, CFLAGS, LDFLAGS and CPPFLAGS environment variables can be set 15 | to control the build. 16 | 17 | By default a statically linked version of the library is built: 'libmseed.a'. 18 | 19 | With GCC, clang or compatible build tools it is possible to build a shared 20 | library with 'make shared'. 21 | 22 | A simple install method for the shared library can be invoked with 23 | 'make install'. By default the installation destination is /usr/local. 24 | The install destination may be specified using the PREFIX variable, for 25 | example: 26 | 27 | make install PREFIX=/path/to/install/ 28 | 29 | ## Windows (Win32) 30 | 31 | On a WIN32 platform the library can be compiled by using the 32 | Nmake compatible Makefile.win (e.g. 'nmake -f Makefile.win') or Open 33 | Watcom's Wmake with Makefile.wat (e.g. 'wmake -f Makefile.wat'). The 34 | default target is a static library 'libmseed.lib'. The library has 35 | been tested with Open Watcom 1.8. A libmseed.def file is included 36 | for use building and linking a DLL. 37 | -------------------------------------------------------------------------------- /libmseed/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # Build environment can be configured the following 3 | # environment variables: 4 | # CC : Specify the C compiler to use 5 | # CFLAGS : Specify compiler options to use 6 | # LDFLAGS : Specify linker options to use 7 | # CPPFLAGS : Specify c-preprocessor options to use 8 | 9 | # Extract version from libmseed.h, expected line should include LIBMSEED_VERSION "#.#.#" 10 | MAJOR_VER = $(shell grep LIBMSEED_VERSION libmseed.h | grep -Eo '[0-9]+.[0-9]+.[0-9]+' | cut -d . -f 1) 11 | FULL_VER = $(shell grep LIBMSEED_VERSION libmseed.h | grep -Eo '[0-9]+.[0-9]+.[0-9]+') 12 | COMPAT_VER = $(MAJOR_VER).0.0 13 | 14 | # Default settings for install target 15 | PREFIX ?= /usr/local 16 | EXEC_PREFIX ?= $(PREFIX) 17 | LIBDIR ?= $(EXEC_PREFIX)/lib 18 | INCLUDEDIR ?= $(PREFIX)/include 19 | DATAROOTDIR ?= $(PREFIX)/share 20 | DOCDIR ?= $(DATAROOTDIR)/doc/libmseed 21 | MANDIR ?= $(DATAROOTDIR)/man 22 | MAN3DIR ?= $(MANDIR)/man3 23 | 24 | LIB_SRCS = fileutils.c genutils.c gswap.c lmplatform.c lookup.c \ 25 | msrutils.c pack.c packdata.c traceutils.c tracelist.c \ 26 | parseutils.c unpack.c unpackdata.c selection.c logging.c 27 | 28 | LIB_OBJS = $(LIB_SRCS:.c=.o) 29 | LIB_DOBJS = $(LIB_SRCS:.c=.lo) 30 | 31 | LIB_A = libmseed.a 32 | LIB_SO_BASE = libmseed.so 33 | LIB_SO_NAME = $(LIB_SO_BASE).$(MAJOR_VER) 34 | LIB_SO = $(LIB_SO_BASE).$(FULL_VER) 35 | LIB_DYN_NAME = libmseed.dylib 36 | LIB_DYN = libmseed.$(FULL_VER).dylib 37 | LIB_FILES = Blarg 38 | 39 | all: static 40 | 41 | static: $(LIB_A) 42 | 43 | # Build dynamic (.dylib) on macOS/Darwin, otherwise shared (.so) 44 | shared dynamic: 45 | ifeq ($(shell uname -s),Darwin) 46 | $(MAKE) $(LIB_DYN) 47 | else 48 | $(MAKE) $(LIB_SO) 49 | endif 50 | 51 | # Build static library 52 | $(LIB_A): $(LIB_OBJS) 53 | @echo "Building static library $(LIB_A)" 54 | $(RM) -f $(LIB_A) 55 | $(AR) -crs $(LIB_A) $(LIB_OBJS) 56 | 57 | # Build shared library using GCC-style options 58 | $(LIB_SO): $(LIB_DOBJS) 59 | @echo "Building shared library $(LIB_SO)" 60 | $(RM) -f $(LIB_SO) $(LIB_SONAME) $(LIB_SO_BASE) 61 | $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--version-script=libmseed.map -Wl,-soname,$(LIB_SO_NAME) -o $(LIB_SO) $(LIB_DOBJS) 62 | ln -s $(LIB_SO) $(LIB_SO_BASE) 63 | ln -s $(LIB_SO) $(LIB_SO_NAME) 64 | 65 | # Build dynamic library (usually for macOS) 66 | $(LIB_DYN): $(LIB_DOBJS) 67 | @echo "Building dynamic library $(LIB_DYN)" 68 | $(RM) -f $(LIB_DYN) $(LIB_DYN_NAME) 69 | $(CC) $(CFLAGS) -dynamiclib -compatibility_version $(COMPAT_VER) -current_version $(FULL_VER) -install_name $(LIB_DYN_NAME) -o $(LIB_DYN) $(LIB_DOBJS) 70 | ln -sf $(LIB_DYN) $(LIB_DYN_NAME) 71 | 72 | test check: static FORCE 73 | @$(MAKE) -C test test 74 | 75 | clean: 76 | @$(RM) -f $(LIB_OBJS) $(LIB_DOBJS) $(LIB_A) $(LIB_SO) $(LIB_SO_NAME) $(LIB_SO_BASE) $(LIB_DYN) $(LIB_DYN_NAME) 77 | @$(MAKE) -C test clean 78 | @echo "All clean." 79 | 80 | install: shared 81 | @echo "Installing into $(PREFIX)" 82 | @mkdir -p $(DESTDIR)$(PREFIX)/include 83 | @cp libmseed.h $(DESTDIR)$(PREFIX)/include 84 | @mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig 85 | ifneq ("$(wildcard $(LIB_SO))","") 86 | @cp -a $(LIB_SO_BASE) $(LIB_SO_NAME) $(LIB_SO) $(DESTDIR)$(LIBDIR) 87 | endif 88 | ifneq ("$(wildcard $(LIB_DYN))","") 89 | @cp -a $(LIB_DYN_NAME) $(LIB_DYN) $(DESTDIR)$(LIBDIR) 90 | endif 91 | @sed -e 's|@prefix@|$(PREFIX)|g' \ 92 | -e 's|@exec_prefix@|$(EXEC_PREFIX)|g' \ 93 | -e 's|@libdir@|$(LIBDIR)|g' \ 94 | -e 's|@includedir@|$(PREFIX)/include|g' \ 95 | -e 's|@PACKAGE_NAME@|libmseed|g' \ 96 | -e 's|@PACKAGE_URL@|http://ds.iris.edu/ds/nodes/dmc/software/downloads/libmseed/|g' \ 97 | -e 's|@VERSION@|$(FULL_VER)|g' \ 98 | mseed.pc.in > $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc 99 | @mkdir -p $(DESTDIR)$(DOCDIR)/example 100 | @cp -r example $(DESTDIR)$(DOCDIR)/ 101 | @cp doc/libmseed-UsersGuide $(DESTDIR)$(DOCDIR)/ 102 | @mkdir -p $(DESTDIR)$(MAN3DIR) 103 | @cp -a doc/ms*.3 $(DESTDIR)$(MAN3DIR)/ 104 | 105 | .SUFFIXES: .c .o .lo 106 | 107 | # Standard object building 108 | .c.o: 109 | $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ 110 | 111 | # Standard object building for dynamic library components using -fPIC 112 | .c.lo: 113 | $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@ 114 | 115 | FORCE: 116 | -------------------------------------------------------------------------------- /libmseed/Makefile.wat: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Wmake File For libmseed - For Watcom's wmake 4 | # Use 'wmake -f Makefile.wat' 5 | 6 | .BEFORE 7 | @set INCLUDE=.;$(%watcom)\H;$(%watcom)\H\NT 8 | @set LIB=.;$(%watcom)\LIB386 9 | 10 | cc = wcc386 11 | cflags = -zq 12 | lflags = OPT quiet OPT map 13 | cvars = $+$(cvars)$- -DWIN32 14 | 15 | # To build a DLL uncomment the following two lines 16 | #cflags = -zq -bd 17 | #lflags = OPT quiet OPT map SYS nt_dll 18 | 19 | LIB = libmseed.lib 20 | DLL = libmseed.dll 21 | 22 | INCS = -I. 23 | 24 | OBJS= fileutils.obj & 25 | genutils.obj & 26 | gswap.obj & 27 | lmplatform.obj & 28 | lookup.obj & 29 | msrutils.obj & 30 | pack.obj & 31 | packdata.obj & 32 | traceutils.obj & 33 | tracelist.obj & 34 | parseutils.obj & 35 | unpack.obj & 36 | unpackdata.obj & 37 | selection.obj & 38 | logging.obj 39 | 40 | all: lib 41 | 42 | lib: $(OBJS) .SYMBOLIC 43 | wlib -b -n -c -q $(LIB) +$(OBJS) 44 | 45 | dll: $(OBJS) .SYMBOLIC 46 | wlink $(lflags) name libmseed file {$(OBJS)} 47 | 48 | # Source dependencies: 49 | fileutils.obj: fileutils.c libmseed.h 50 | genutils.obj: genutils.c libmseed.h 51 | gswap.obj: gswap.c libmseed.h 52 | lmplatform.obj: lmplatform.c libmseed.h 53 | lookup.obj: lookup.c libmseed.h 54 | msrutils.obj: msrutils.c libmseed.h 55 | pack.obj: pack.c libmseed.h packdata.h 56 | packdata.obj: packdata.c libmseed.h packdata.h 57 | traceutils.obj: traceutils.c libmseed.h 58 | tracelist.obj: tracelist.c libmseed.h 59 | parseutils.obj: parseutils.c libmseed.h 60 | unpack.obj: unpack.c libmseed.h unpackdata.h 61 | unpackdata.obj: unpackdata.c libmseed.h unpackdata.h 62 | logging.obj: logging.c libmseed.h 63 | 64 | # How to compile sources: 65 | .c.obj: 66 | $(cc) $(cflags) $(cvars) $(INCS) $[@ -fo=$@ 67 | 68 | # Clean-up directives: 69 | clean: .SYMBOLIC 70 | del *.obj *.map 71 | del $(LIB) $(DLL) 72 | -------------------------------------------------------------------------------- /libmseed/Makefile.win: -------------------------------------------------------------------------------- 1 | # 2 | # Nmake file For libmseed - MS Visual C/C++ version 3 | # Use 'nmake -f Makefile.win' 4 | 5 | NODEBUG=1 6 | 7 | INCS = -I. 8 | OPTS = -D_CRT_SECURE_NO_WARNINGS 9 | LIB = libmseed.lib 10 | DLL = libmseed.dll 11 | 12 | OBJS= fileutils.obj \ 13 | genutils.obj \ 14 | gswap.obj \ 15 | lmplatform.obj \ 16 | lookup.obj \ 17 | msrutils.obj \ 18 | pack.obj \ 19 | packdata.obj \ 20 | traceutils.obj \ 21 | tracelist.obj \ 22 | parseutils.obj \ 23 | unpack.obj \ 24 | unpackdata.obj \ 25 | selection.obj \ 26 | logging.obj 27 | 28 | all: lib 29 | 30 | lib: $(OBJS) 31 | link.exe /lib /nologo /out:$(LIB) $(OBJS) 32 | 33 | dll: $(OBJS) 34 | link.exe /dll /nologo /out:$(DLL) $(OBJS) 35 | 36 | .c.obj: 37 | $(CC) /nologo $(CFLAGS) $(INCS) $(OPTS) /c $< 38 | 39 | # Clean-up directives 40 | clean: 41 | -del a.out core *.o *.obj *% *~ $(LIB) $(DLL) 42 | -------------------------------------------------------------------------------- /libmseed/README.byteorder: -------------------------------------------------------------------------------- 1 | 2 | -- Byte order handling in libmseed -- 3 | 4 | The SEED 2.4 standard allows data only SEED (Mini-SEED) to be either 5 | in big (most significant byte first) or little (least significant byte 6 | first) endian byte order. One exception is that Steim-1 and Steim-2 7 | data compression are only defined as big-endian, that said libmseed 8 | supports little-endian Steim compression schemes anyway. While 9 | libmseed supports all four combinations of big and little endian header 10 | and data the surest way to avoid compatibility problems is to always 11 | create big endian Mini-SEED records (header and data). 12 | 13 | 14 | Reading MiniSEED - how libmseed determines the byte order of a record: 15 | 16 | The byte order of a record header including blockettes is determined 17 | by checking if the record start year and day is a sane value (e.g. year 18 | between 1900 and 2100 and day between 1 and 366). The byte order of 19 | encoded data samples is determined by the byte order flag in the 20 | Blockette 1000, if a Blockette 1000 is not present the byte order is 21 | assumed to be the same as the header. To force the byte order 22 | determination of either the header or data section of a record the 23 | following environment variables can be set: 24 | 25 | UNPACK_HEADER_BYTEORDER 26 | UNPACK_DATA_BYTEORDER 27 | 28 | These variables should be set to either 0 (little endian) or 1 (big 29 | endian). A programmatic equivalent of setting these environment 30 | variables is provided via the following macros: 31 | 32 | MS_UNPACKHEADERBYTEORDER(X) 33 | MS_UNPACKDATABYTEORDER(X) 34 | 35 | 36 | Writing MiniSEED - in what byte order libmseed creates records: 37 | 38 | Normally the byte order of MiniSEED created by libmseed is controlled 39 | via a flag in the API. This byte order flag determines the ordering 40 | for both the header and data sections of a record. To force the byte 41 | order of either the header or data section of a record the following 42 | environment variables can be set: 43 | 44 | PACK_HEADER_BYTEORDER 45 | PACK_DATA_BYTEORDER 46 | 47 | These variables should be set to either 0 (little endian) or 1 (big 48 | endian). A programmatic equivalent of setting these environment 49 | variables is provided via the following macros: 50 | 51 | MS_PACKHEADERBYTEORDER(X) 52 | MS_PACKDATABYTEORDER(X) 53 | 54 | 55 | Note that some interpretations of the SEED 2.4 format imply that 56 | so-called little endian MiniSEED means that the record header is 57 | little endian but that the data section is big endian (as the only 58 | defined data encodings must be based on the SEED DDL which, in turn, 59 | must be defined in terms of big endian). Libmseed will not create 60 | MiniSEED of this flavor by default but can be configured to do so by 61 | setting the environment variables described above appropriately. 62 | -------------------------------------------------------------------------------- /libmseed/README.md: -------------------------------------------------------------------------------- 1 | 2 | # libmseed - The Mini-SEED library 3 | 4 | The Mini-SEED library provides a framework for manipulation of SEED 5 | data records including the unpacking and packing of data records. 6 | Functionality is also included for managing waveform data as 7 | continuous traces. 8 | 9 | All structures of SEED 2.4 data records are supported with the 10 | following exceptions: Blockette 2000 opaque data which has an unknown 11 | data structure by definition and Blockette 405 which depends on full 12 | SEED (SEED including full ASCII headers) for a full data description. 13 | 14 | The library should work in Linux, BSD (and derivatives like macOS), 15 | Solaris and Win32 environments. 16 | 17 | ## Documentation 18 | 19 | The [Wiki](https://github.com/iris-edu/libmseed/Wiki) provides an 20 | overview of using the library. For function level documentation, 21 | man pages are included in the [doc](doc) directory. 22 | 23 | ## Downloading and installing 24 | 25 | The [releases](https://github.com/iris-edu/libmseed/releases) area 26 | contains release versions. 27 | 28 | For installation instructions see the [INSTALL](INSTALL.md) file. 29 | For further information regarding the library interface see the 30 | documentation in the 'doc' directory. For example uses of libmseed 31 | see the source code in the 'examples' directory. 32 | 33 | ## License 34 | 35 | Copyright (C) 2016 Chad Trabant, IRIS Data Management Center 36 | 37 | This library is free software; you can redistribute it and/or modify 38 | it under the terms of the GNU Lesser General Public License as 39 | published by the Free Software Foundation; either version 3 of the 40 | License, or (at your option) any later version. 41 | 42 | This library is distributed in the hope that it will be useful, but 43 | WITHOUT ANY WARRANTY; without even the implied warranty of 44 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 45 | Lesser General Public License (GNU-LGPL) for more details. 46 | 47 | You should have received a copy of the GNU Lesser General Public 48 | License along with this software. 49 | If not, see . 50 | 51 | ## Acknowlegements 52 | 53 | Numerous improvements have been incorporated based on feedback and 54 | patches submitted by others. Individual acknowlegements are included 55 | in the ChangeLog. 56 | 57 | This library also uses code bits published in the public domain and 58 | acknowledgement is included in the code whenever possible. 59 | -------------------------------------------------------------------------------- /libmseed/doc/gswap2.3: -------------------------------------------------------------------------------- 1 | .TH GSWAP 3 2004/11/22 "Libmseed API" 2 | .SH DESCRIPTION 3 | Generalized, in-place byte swapping routines 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "void \fBgswap2\fP ( void *" data2 " );" 10 | 11 | .BI "void \fBgswap3\fP ( void *" data3 " );" 12 | 13 | .BI "void \fBgswap4\fP ( void *" data4 " );" 14 | 15 | .BI "void \fBgswap8\fP ( void *" data8 " );" 16 | 17 | .BI "void \fBgswap2a\fP ( void *" data2 " );" 18 | 19 | .BI "void \fBgswap4a\fP ( void *" data4 " );" 20 | 21 | .BI "void \fBgswap8a\fP ( void *" data8 " );" 22 | .fi 23 | 24 | .SH DESCRIPTION 25 | These routines swap between LSBF (little-endian) and MSBF (big-endian) 26 | byte orders. The specified quantities are swapped in-place. There 27 | are two versions of most routines: a generic one that works on 28 | quantities regardless of memory alignment (gswap#) and one that works 29 | on memory aligned quantities (gswap#a). The versions for memory 30 | aligned quantities are much faster than their generic versions, but 31 | the memory *must* be aligned. You have been warned. There is only a 32 | generic version for 3-byte quantities. 33 | 34 | .SH AUTHOR 35 | .nf 36 | Chad Trabant 37 | IRIS Data Management Center 38 | .fi 39 | -------------------------------------------------------------------------------- /libmseed/doc/ms_addselect.3: -------------------------------------------------------------------------------- 1 | ms_selection.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_addselect_comp.3: -------------------------------------------------------------------------------- 1 | ms_selection.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_bigendianhost.3: -------------------------------------------------------------------------------- 1 | .TH MS_BIGENDIANHOST 3 2004/11/22 "Libmseed API" 2 | .SH NAME 3 | ms_bigendianhost - Determine host computer byte order 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBms_bigendianhost\fP ();" 10 | .fi 11 | 12 | .SH DESCRIPTION 13 | \fBms_bigendianhost\fP is a run-time test of host computer byte order. 14 | It is assumed that there are only two possible byte orders: Most 15 | Significant Byte First (MSBF), i.e. big-endian, and Least Significant 16 | Byte First (LSBF), i.e. little-endian. No middle-endian schemes are 17 | accounted for. 18 | 19 | Binary quantities in SEED are commonly big-endian, but it is not 20 | necessarily so. 21 | 22 | .SH RETURN VALUES 23 | \fBms_bigendianhost\fP returns 1 if the host is big-endian and 0 if 24 | the host is little-endian. 25 | 26 | .SH AUTHOR 27 | .nf 28 | Chad Trabant 29 | IRIS Data Management Center 30 | .fi 31 | -------------------------------------------------------------------------------- /libmseed/doc/ms_blktdesc.3: -------------------------------------------------------------------------------- 1 | ms_lookup.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_blktlen.3: -------------------------------------------------------------------------------- 1 | ms_lookup.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_btime2isotimestr.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_btime2mdtimestr.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_btime2seedtimestr.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_btime3hptime.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_detect.3: -------------------------------------------------------------------------------- 1 | msr_parse.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_doy2md.3: -------------------------------------------------------------------------------- 1 | .TH MS_DOY2MD 3 2004/11/22 "Libmseed API" 2 | .SH NAME 3 | ms_doy2md - Convert between day of year and month and day of month 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBms_doy2md\fP ( int " year ", int " jday ", int *" month ", int *" mday " );" 10 | 11 | .BI "int \fBms_md2doy\fP ( int " year ", int " month ", int " mday ", int *" jday " );" 12 | .fi 13 | 14 | .SH DESCRIPTION 15 | \fBms_doy2md\fP calculates the \fImonth\fP and day of month 16 | (\fImday\fP) for a given \fIyear\fP and day of year (\fIjday\fP). 17 | 18 | \fBms_md2doy\fP calculates the day of year (\fIjday\fP) for a given 19 | \fIyear\fP, \fImonth\fP and day of month (\fImday\fP). 20 | 21 | For both routines the expected and resulting ranges for each value are: 22 | .sp 23 | .nf 24 | year : 1900 - 2100 25 | jday : 1 - 366 26 | month : 1 - 12 27 | mday : 1 - 31 28 | .fi 29 | 30 | A day of year of 366 corresponds to the last day of a leap year. 31 | 32 | .SH RETURN VALUES 33 | \fBms_doy2md\fP returns 0 on success and -1 on error. 34 | 35 | \fBms_md2doy\fP returns 0 on success and -1 on error. 36 | 37 | .SH AUTHOR 38 | .nf 39 | Chad Trabant 40 | IRIS Data Management Center 41 | .fi 42 | -------------------------------------------------------------------------------- /libmseed/doc/ms_encodingstr.3: -------------------------------------------------------------------------------- 1 | ms_lookup.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_errorstr.3: -------------------------------------------------------------------------------- 1 | ms_lookup.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_find_reclen.3: -------------------------------------------------------------------------------- 1 | .TH MS_FIND_RECLEN 3 2006/11/08 "Libmseed API" 2 | .SH NAME 3 | ms_find_reclen - Determine SEED record data length 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBms_find_reclen\fP ( const char *" recbuf ", int " recbuflen ", 10 | .BI " FILE " *fileptr " ); 11 | .fi 12 | 13 | .SH DESCRIPTION 14 | \fBms_find_reclen\fP verifies that the specified \fIrecbuf\fP buffer 15 | contains a SEED data record by looking for data record signatures in 16 | the fixed section data header and determines the data record length by 17 | 1) searching the buffer up to \fIrecbuflen\fP bytes for a Blockette 18 | 1000 and, failing that, 2) if \fIfileptr\fP is not NULL reading the 19 | next 48 bytes from the file and looking for a data record signature 20 | (with detection of the next data record implying the length of the 21 | current record). If data is read from \fIfileptr\fP the read position 22 | is returned to it's position prior to this function call. 23 | 24 | The MS_ISVALIDHEADER macro is used to verify that the buffer contains 25 | a valid SEED data record. When searching for the next record header 26 | to determine record length one of the macros MS_ISVALIDHEADER or 27 | MS_ISVALIDBLANK must test positively for a record to be detected. 28 | Blank/noise records are records with a valid SEED sequence number 29 | followed by ASCII space characters to the end of the record. 30 | 31 | \fBms_find_reclen\fP will return 0 when it detects that the buffer 32 | contains a SEED data record but cannot determine the record length. 33 | This happens when no Blockette 1000 is not found within 34 | \fIrecbuflen\fP bytes and, assuming a valid \fIfileptr\fP is supplied, 35 | no record header is detected in the next 48 bytes of the file. The 36 | idea is to then read more data from the file (i.e. the next larger, 37 | valid record length) and call \fBms_find_reclen\fP again and so on 38 | until the record length can be determined. 39 | 40 | .SH RETURN VALUES 41 | \fBms_find_reclen\fP returns the length of the Mini-SEED record in 42 | bytes or 0 if a data record was detected but the length could not be 43 | determined or -1 when no data record was detected. 44 | 45 | .SH SEE ALSO 46 | \fBms_readmsr(3)\fP, \fBms_readtraces(3)\fP and \fBmsr_unpack(3)\fP. 47 | 48 | .SH AUTHOR 49 | .nf 50 | Chad Trabant 51 | IRIS Data Management Center 52 | .fi 53 | -------------------------------------------------------------------------------- /libmseed/doc/ms_freeselections.3: -------------------------------------------------------------------------------- 1 | ms_selection.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_genfactmult.3: -------------------------------------------------------------------------------- 1 | .TH MS_GENFACTMULT 3 2016/10/07 "Libmseed API" 2 | .SH NAME 3 | ms_genfactmult - Generate SEED sample rate factor and multiplier 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBms_genfactmult\fP ( double " samprate ", int16_t *" factor ", 10 | .BI " int16_t *" multiplier " );" 11 | 12 | .BI "int \fBms_ratapprox\fP ( double " real ", int *" num ", int *" den ", 13 | .BI " int " maxval ", double " precision " );" 14 | .fi 15 | 16 | .SH DESCRIPTION 17 | \fBms_genfactmult\fP generates an appropriate SEED sample rate 18 | \fIfactor\fP and \fImultiplier\fP pair from a double precision sample 19 | rate. If \fIsamprate\fP is positive it is expected to represent a 20 | rate in samples/second, if negative is is expected to represent a 21 | period in seconds/sample. 22 | 23 | Non-integer sample rates and periods are supported between 32767.0 and 24 | 1/32767.0. An error will be returned for non-integer rates and 25 | periods outside this range. 26 | 27 | Integer sample rates and periods are supported between 1 and the 28 | maximum possible value (32767 * 32767). Values from 1 to 32767 are 29 | represented directly. Values larger than 32767 are factored and 30 | represented exactly when possible and approximated otherwise, with the 31 | discrepency becoming larger as the values reach the maximum possible 32 | value. 33 | 34 | The factor and multiplier are int16_t because that is the integer size 35 | needed for the fixed section of the SEED data header. 36 | 37 | \fBms_ratapprox\fP finds an approximate rational number for a real 38 | through continued fraction expansion. Given a double precision 39 | \fIreal\fP the routine tries to find a rational in numerator 40 | (\fInum\fP) and denominator (\fIden\fP) form whose absolute values are 41 | not larger than \fImaxval\fP while trying to reach a specified 42 | \fIprecision\fP. 43 | 44 | .SH RETURN VALUES 45 | \fBms_genfactmult\fP returns 0 on success and -1 when value is outside 46 | of the supported range or error. 47 | 48 | \fBms_ratapprox\fP returns the number of iterations performed. 49 | 50 | .SH AUTHOR 51 | .nf 52 | Chad Trabant 53 | IRIS Data Management Center 54 | .fi 55 | -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap.3: -------------------------------------------------------------------------------- 1 | .TH MS_GSWAP 3 2006/12/20 "Libmseed API" 2 | .SH NAME 3 | ms_gswap - Generalized, in-place byte swapping routines 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "void \fBms_gswap2\fP ( void *" data2 " );" 10 | 11 | .BI "void \fBms_gswap3\fP ( void *" data3 " );" 12 | 13 | .BI "void \fBms_gswap4\fP ( void *" data4 " );" 14 | 15 | .BI "void \fBms_gswap8\fP ( void *" data8 " );" 16 | 17 | .BI "void \fBms_gswap2a\fP ( void *" data2 " );" 18 | 19 | .BI "void \fBms_gswap4a\fP ( void *" data4 " );" 20 | 21 | .BI "void \fBms_gswap8a\fP ( void *" data8 " );" 22 | .fi 23 | 24 | .SH DESCRIPTION 25 | These routines swap between LSBF (little-endian) and MSBF (big-endian) 26 | byte orders. The specified quantities are swapped in-place. There 27 | are two versions of most routines: a generic one that works on 28 | quantities regardless of memory alignment (ms_gswap#) and one that works 29 | on memory aligned quantities (ms_gswap#a). The versions for memory 30 | aligned quantities are much faster than their generic versions, but 31 | the memory *must* be aligned. You have been warned. There is only a 32 | generic version for 3-byte quantities. 33 | 34 | .SH AUTHOR 35 | .nf 36 | Chad Trabant 37 | IRIS Data Management Center 38 | .fi 39 | -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap2.3: -------------------------------------------------------------------------------- 1 | ms_gswap.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap2a.3: -------------------------------------------------------------------------------- 1 | ms_gswap.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap3.3: -------------------------------------------------------------------------------- 1 | ms_gswap.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap4.3: -------------------------------------------------------------------------------- 1 | ms_gswap.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap4a.3: -------------------------------------------------------------------------------- 1 | ms_gswap.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap8.3: -------------------------------------------------------------------------------- 1 | ms_gswap.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_gswap8a.3: -------------------------------------------------------------------------------- 1 | ms_gswap.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_hptime2btime.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_hptime2isotimestr.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_hptime2mdtimestr.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_hptime2seedtimestr.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_log.3: -------------------------------------------------------------------------------- 1 | .TH MS_LOG 3 2014/07/16 2 | .SH NAME 3 | ms_log - Central logging facility for libmseed 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | .sp 9 | .BI "int \fBms_log\fP (int " level ", const char *" format ", ...); 10 | .sp 11 | .BI "int \fBms_log_l\fP (MSLogParam *" logp ", int " level ", const char *" format ", ...); 12 | .sp 13 | .BI "void \fBms_loginit\fP (void (*" log_print ")(char*), const char *" logprefix ", 14 | .BI " void (*" diag_print ")(char*), const char *" errprefix "); 15 | .sp 16 | .BI "MSLogParam * \fBms_loginit_l\fP (MSLogParam *" logp ", 17 | .BI " void (*" log_print ")(char*), const char *" logprefix ", 18 | .BI " void (*" diag_print ")(char*), const char *" errprefix "); 19 | .fi 20 | .SH DESCRIPTION 21 | The \fBms_log\fP functions are the central logging facility for 22 | all output from libmseed functions. They are also intended to be used 23 | by libmseed based programs if desired. 24 | 25 | Three message levels are recognized: 26 | 0 : Normal log messgaes, printed using log_print with logprefix 27 | 1 : Diagnostic messages, printed using diag_print with logprefix 28 | 2+ : Error messages, printed using diag_print with errprefix 29 | 30 | It is the task of the \fBms_log\fP functions to format a message using 31 | \fBprintf\fP conventions and pass the formatted string to the 32 | appropriate printing function (\fIlog_print\fP or \fIdiag_print\fP) 33 | 34 | \fBms_log\fP will process messages using the global logging 35 | parameters. 36 | 37 | \fBms_log_l\fP is a reentrant version of \fBms_log\fP. It will use 38 | the logging parameters specified in the supplied MSLogParam struct. 39 | If \fBlogp\fP is NULL global parameters will be used, this would be 40 | equivalent to a call to ms_log(). This is intended for use only when 41 | complicated logging schemes are desired, e.g. in a threaded 42 | application. Note that it is not possible to set thread specific 43 | logging parameters for the internal library functions because global 44 | parameters are used. 45 | 46 | The \fBms_loginit\fP functions are used to set the log and error 47 | printing functions and the log and error message prefixes used by the 48 | \fBms_log\fP functions. 49 | 50 | \fBms_loginit\fP will operate on the global logging parameters. 51 | 52 | \fBms_loginit_l\fP is a reentrant version of \fBms_loginit\fP. It 53 | will initialize or change the logging parameters specified in the 54 | MSLogParam struct. If \fIlogp\fP is NULL a new MSLogParam struct will 55 | be allocated. A pointer to the created or re-initialized MSLogParam 56 | struct will be returned. The returned pointer is suitable for use with 57 | \fBms_log_l\fP. 58 | 59 | Use NULL for the print function pointers or the prefixes if they 60 | should not be changed from previously set or default values. 61 | 62 | The default values for the logging parameters are: 63 | log_print = fprintf (printing to standard out) 64 | log_prefix = "" 65 | diag_print = fprintf (printing to standard error) 66 | err_prefix = "error: " 67 | 68 | By setting the printing functions it is possible to re-direct all of 69 | the output from these logging routines. This is useful when the 70 | libmseed based software is embedded in a system with it's own logging 71 | facilities. 72 | 73 | Most of the libmseed internal messages are logged at either the 74 | diagnostic or error level. 75 | 76 | .SH RETURN VALUES 77 | \fBms_log\fP and \fBms_log_l\fP return the number of characters 78 | formatted on success, and a negative value on error. 79 | 80 | \fBms_loginit_l\fP returns a pointer to the MSLogParam struct that it 81 | operated on. If the input MSLogParam struct is NULL a new struct will 82 | be allocated with \fBmalloc()\bP. 83 | 84 | .SH EXAMPLE 85 | Unless a complicated logging scheme is needed most uses of this 86 | logging facility will be limited to the ms_loginit and ms_log 87 | functions. 88 | 89 | An example of setting the printing functions: 90 | 91 | .nf 92 | #include 93 | 94 | void log_print (const char *message); 95 | void diag_print (const char *message); 96 | 97 | main () { 98 | ms_loginit (&log_print, "LOG: ", &diag_print, "ERR: "); 99 | 100 | /* Normal log message, "LOG: " will be prefixed */ 101 | ms_log (0, "Normal log message for %s\n", argv[0]); 102 | 103 | /* Diognostic message, "LOG: " will be prefixed */ 104 | ms_log (1, "Diagnositc message for %s\n", argv[0]); 105 | 106 | /* Error message, "ERR: " will be prefixed */ 107 | ms_log (2, "Error message for %s\n", argv[0]); 108 | } 109 | 110 | void log_print (const char *message) { 111 | /* Send message to external log message facility */ 112 | send_log(message); 113 | } 114 | 115 | void diag_print (const char *message) { 116 | /* Send message to external error message facility */ 117 | send_error(message); 118 | } 119 | .fi 120 | 121 | .SH AUTHOR 122 | .nf 123 | Chad Trabant 124 | IRIS Data Management Center 125 | .fi 126 | -------------------------------------------------------------------------------- /libmseed/doc/ms_log_l.3: -------------------------------------------------------------------------------- 1 | ms_log.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_loginit.3: -------------------------------------------------------------------------------- 1 | ms_log.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_loginit_l.3: -------------------------------------------------------------------------------- 1 | ms_log.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_lookup.3: -------------------------------------------------------------------------------- 1 | .TH MS_LOOKUP 3 2006/12/12 "Libmseed API" 2 | .SH NAME 3 | ms_lookup - Look up libmseed and Mini-SEED related information 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "char *\fBms_errorstr\fP ( int " errorcode " );" 10 | 11 | .BI "uint8_t \fBms_samplesize\fP ( const char " sampletype " );" 12 | 13 | .BI "char *\fBms_encodingstr\fP ( const char " encoding " );" 14 | 15 | .BI "char *\fBms_blktdesc\fP ( uint16_t " blkttype " );" 16 | 17 | .BI "uint16_t \fBms_blktlen\fP ( uint16_t " blkttype ", const char *" blktdata ", 18 | .BI " flag " swapflag " ); 19 | .fi 20 | 21 | .SH DESCRIPTION 22 | \fBms_errorstr\fP returns a pointer to a string describing the 23 | specified libmseed error code. The error codes are defined in 24 | libmseed.h and returned by various functions. 25 | 26 | \fBms_samplesize\fP returns the sample size based on the specified 27 | \fIsampletype\fP. In general libmseed uses the following character 28 | sample types: 29 | .sp 30 | .nf 31 | "a" = 1 byte (ASCII) 32 | "i" = 4 bytes (integer) 33 | "f" = 4 bytes (float) 34 | "d" = 8 bytes (double) 35 | .fi 36 | 37 | \fBms_encoding\fP returns a pointer to a string describing the 38 | specified data \fIencoding\fP format. If the encoding format is 39 | unknown an appropriate string is return stating just that. 40 | 41 | \fBms_blktdesc\fP returns a pointer to a string describing the 42 | specified blockette type (\fIblkttype\fP). If the blockette type is 43 | unknown NULL is returned. 44 | 45 | \fBms_blktlen\fP returns the total length of the specified blockette 46 | type (\fIblkttype\fP) in bytes. A pointer to the blockette itself 47 | (\fIblkt\fP) should also be provided along with a \fIswapflag\fP that 48 | should be set to 1 when the blockette is known to have a different 49 | byte order than the host computer. The length returned includes both 50 | the blockette "header" (type and next fields) and "body". 51 | 52 | Technically a pointer to blockette and the swapflag only need to be 53 | supplied when the blockette type is a variable length blockette and 54 | the length is contained within the blockette itself (e.g. blockette 55 | type 2000). For blockettes of known fixed length (most of them) the 56 | \fIblkt\fP pointer and \fIswapflag\fP are not used. 57 | 58 | In the case of blockette type 405 that is variable length and not self 59 | describing 0 will be returned. In the case of blockette type 2000 60 | that is variable length and self describing the length will be read 61 | from a known offset into the blockette data. 62 | 63 | 64 | .SH RETURN VALUES 65 | \fBms_errorstr\fP returns a pointer to a static string. 66 | 67 | \fBms_samplesize\fP returns the sample size in bytes or 0 for unknown 68 | sample type. 69 | 70 | \fBms_encoding\fP returns a pointer to a static string. 71 | 72 | \fBms_blktdesc\fP returns a pointer to a static string or NULL if the 73 | blockette type is unknown. 74 | 75 | \fBms_blktlen\fP returns the total length of the specified blockette 76 | type or 0 for unknown type. 77 | 78 | .SH AUTHOR 79 | .nf 80 | Chad Trabant 81 | IRIS Data Management Center 82 | .fi 83 | -------------------------------------------------------------------------------- /libmseed/doc/ms_matchselect.3: -------------------------------------------------------------------------------- 1 | ms_selection.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_md2doy.3: -------------------------------------------------------------------------------- 1 | ms_doy2md.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_parse_raw.3: -------------------------------------------------------------------------------- 1 | .TH MSR_PARSE 3 2010/12/30 "Libmseed API" 2 | .SH NAME 3 | msr_parse - Parse, validate and print details of a SEED data record 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBms_parse_raw\fP ( char *" record ", int " maxreclen "," 10 | .BI " flag " details ", flag " swapflag " );" 11 | .fi 12 | 13 | .SH DESCRIPTION 14 | \fBms_parse_raw\fP is a simple validating SEED data record header 15 | parser. The data in \fIrecord\fP is assumed to contain a SEED data 16 | record with a maximum length of \fImaxreclen\fP. In addition to 17 | validating header fields where possible, raw header fields can be 18 | printed. This routine is primarily intended for identifying invalid 19 | data record headers and printing record header contents. 20 | 21 | The \fIdetails\fP flag is interpreted as follows: 22 | .nf 23 | 0 = only print error messages for invalid header fields 24 | 1 = print basic fields in addition to invalid field errors 25 | 2 = print all fields in addition to invalid field errors 26 | .fi 27 | 28 | The \fIswapflag\fP flag is interpreted as follows: 29 | .nf 30 | 1 = swap multibyte quantities 31 | 0 = do no swapping 32 | -1 = autodetect byte order using year test, swap if needed 33 | .fi 34 | 35 | .SH RETURN VALUES 36 | \fBms_parse_raw\fP returns 0 when no errors were detected or a 37 | positive count of errors detected. 38 | 39 | .SH SEE ALSO 40 | \fBmsr_parse(3)\fP and \fBms_detect(3)\fP 41 | 42 | .SH AUTHOR 43 | .nf 44 | Chad Trabant 45 | IRIS Data Management Center 46 | .fi 47 | -------------------------------------------------------------------------------- /libmseed/doc/ms_printselections.3: -------------------------------------------------------------------------------- 1 | ms_selection.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_ratapprox.3: -------------------------------------------------------------------------------- 1 | ms_genfactmult.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readleapsecondfile.3: -------------------------------------------------------------------------------- 1 | ms_readleapseconds.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readleapseconds.3: -------------------------------------------------------------------------------- 1 | .TH MS_READLEAPSECONDS 3 2016/10/01 "Libmseed API" 2 | .SH NAME 3 | ms_readleapseconds - Read a leap second file into a global buffer 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBms_readleapseconds\fP ( char *" envvarname " );" 10 | 11 | .BI "int \fBms_readleapsecondfile\fP ( char *" filename " );" 12 | .fi 13 | 14 | .SH DESCRIPTION 15 | These functions read a leap seconds file and store a list of leap 16 | seconds in an internal, global list. The leap seconds are used to 17 | determine the proper end time of a record (and consquently a trace). 18 | The use of this facility causes the leap second indication in the 19 | fixed section data header to be ignored. 20 | 21 | The \fBms_readleapseconds\fP function takes and environment variable 22 | name that is expected to contain the name of a leap seconds file. The 23 | \fBms_readleapsecondfile\fP function takes the name of a leap second 24 | file. 25 | 26 | .SH LEAP SECOND LIST FILE 27 | The leap second list file is expected to contain a list of leap second 28 | times and TAI-UTC difference values. The first column should be time 29 | stamps as seconds since the NTP epoch (Jan. 1 1900). The second 30 | column should be an integer number of seconds that specify the 31 | difference between TAI and UTC. 32 | 33 | Usually the most recent version of this file is available here: 34 | https://www.ietf.org/timezones/data/leap-seconds.list 35 | 36 | .SH RETURN VALUES 37 | \fBms_readleapseconds\fP returns the number of leap seconds read on 38 | success, -1 on file read errors and -2 when the environment variable 39 | is not set. 40 | 41 | \fBms_readleapsecondfile\fP returns the number leap seconds read on 42 | success and -1 on errors. 43 | 44 | .SH AUTHOR 45 | .nf 46 | Chad Trabant 47 | IRIS Data Management Center 48 | .fi 49 | -------------------------------------------------------------------------------- /libmseed/doc/ms_readmsr_r.3: -------------------------------------------------------------------------------- 1 | ms_readmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readselectionsfile.3: -------------------------------------------------------------------------------- 1 | ms_selection.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readtracelist.3: -------------------------------------------------------------------------------- 1 | ms_readmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readtracelist_selection.3: -------------------------------------------------------------------------------- 1 | ms_readmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readtracelist_timewin.3: -------------------------------------------------------------------------------- 1 | ms_readmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readtraces.3: -------------------------------------------------------------------------------- 1 | ms_readmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readtraces_selection.3: -------------------------------------------------------------------------------- 1 | ms_readmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_readtraces_timewin.3: -------------------------------------------------------------------------------- 1 | ms_readmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_recsrcname.3: -------------------------------------------------------------------------------- 1 | ms_srcname.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_samplesize.3: -------------------------------------------------------------------------------- 1 | ms_lookup.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_seedtimestr2hptime.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_splitsrcname.3: -------------------------------------------------------------------------------- 1 | .TH MS_SPLITSRCNAME 3 2009/12/19 "Libmseed API" 2 | .SH NAME 3 | ms_splitsrcname - Split source names into the SEED naming nomenclature. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "char *\fBms_splitsrcname\fP ( char *" srcname ", char *" net ", char * " sta "," 10 | .BI " char * " loc ", char *" chan ", char *" qual " );" 11 | .fi 12 | 13 | .SH DESCRIPTION 14 | The \fBms_splitsrcname\fP routine parses SEED channel naming 15 | components from a source name string in the following format: 16 | 17 | .nf 18 | "NET_STA_LOC_CHAN[_QUAL]" 19 | .fi 20 | 21 | The first four components are required to uniquely identify a SEED 22 | channel, generally these are always present in a \fIsrcname\fP. The 23 | Quality code is normally optional in a source name. 24 | 25 | The arguments for the first four components (net, sta, loc & chan) are 26 | treated as strings but the quality code (qual) is treated as a pointer 27 | to a single character. 28 | 29 | Memory for the requested component strings must already be allocated. 30 | If a component pointer is NULL it will not be parsed from the string. 31 | 32 | Source names in the expected format are created, for example, by the 33 | \fBms_recsrcname(3)\fP, \fBmsr_srcname(3) and \fBmst_srcname(3)\fP 34 | routines. 35 | 36 | .SH LOCATION IDS AND SPACES 37 | The source name should never include spaces. The fixed format nature 38 | of SEED data records leads to blank or unused location IDs represented 39 | by spaces, in a source name such blank location IDs should be 40 | collapsed to nothing in the resulting sources names. A blank location 41 | ID is parsed from a source name as an empty string (not two spaces). 42 | 43 | .SH EXAMPLES 44 | This usage will result in net="IU", sta="ANMO", loc="00", 45 | chan="BHZ" and qual will remain unchanged (because it was not 46 | contained in the input srcname): 47 | .nf 48 | 49 | ms_splitsrcname("IU_ANMO_00_BHZ", net, sta, loc, chan, qual); 50 | 51 | .fi 52 | This usage will limit the parsing to only the network and station 53 | components with net="IU", sta="ANMO": 54 | .nf 55 | 56 | ms_splitsrcname("IU_ANMO_00_BHZ", net, sta, NULL, NULL, NULL); 57 | 58 | .fi 59 | The following usage illustrates a blank location ID and included 60 | quality code: 61 | .nf 62 | 63 | ms_splitsrcname("IU_ANMO__BHZ_Q", net, sta, loc, chan, qual); 64 | 65 | .fi 66 | The result is: 67 | .nf 68 | 69 | net = "IU" 70 | sta = "ANMO" 71 | loc = "" 72 | chan = "BHZ" 73 | qual = 'Q' 74 | .fi 75 | 76 | .SH RETURN VALUES 77 | Return 0 on success and -1 on error. 78 | 79 | .SH SEE ALSO 80 | \fBms_recsrcname(3)\fP, \fBmsr_srcname(3) and \fBmst_srcname(3)\fP. 81 | 82 | .SH AUTHOR 83 | .nf 84 | Chad Trabant 85 | IRIS Data Management Center 86 | .fi 87 | -------------------------------------------------------------------------------- /libmseed/doc/ms_srcname.3: -------------------------------------------------------------------------------- 1 | .TH MS_SRCNAME 3 2006/11/27 "Libmseed API" 2 | .SH NAME 3 | ms_srcname - Determine source names using the SEED naming nomenclature. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "char *\fBms_recsrcname\fP ( char *" record ", char *" srcname ", flag " quality " );" 10 | 11 | .BI "char *\fBmsr_srcname\fP ( MSRecord *" msr ", char *" srcname ", flag " quality " );" 12 | 13 | .BI "char *\fBmst_srcname\fP ( MSTrace *" mst ", char *" srcname ", flag " quality " );" 14 | .fi 15 | 16 | .SH DESCRIPTION 17 | These routines generate a source name using the SEED naming 18 | nomenclature in the format: 'NET_STA_LOC_CHAN' and stores it in the 19 | buffer provided at \fIsrcname\fP. If the \fIquality\fP flag is true 20 | the data quality character will be appended to the source name 21 | resulting in a format of: 'NET_STA_LOC_CHAN_QUAL'. 22 | 23 | The memory pointed to by \fIsrcname\fP must have enough room for the 24 | resulting string. As of SEED 2.4 this is a maximum of 18 characters 25 | including the terminating NULL. The MSRecord and MSTrace structs are 26 | capable of producing a source name of 42 characters (including the 27 | terminating NULL) and libmseed commonly allocates 50 characters for 28 | the \fIsrcname\fP buffer. 29 | 30 | \fBms_recsrcname\fP generates a source name string for the SEED data 31 | record at \fIrecord\fP. If the \fIquality\fP flag is true the quality 32 | character will be appended. 33 | 34 | \fBmsr_srcname\fP generates a source name string for the specified 35 | MSRecord struct. If the \fIquality\fP flag is true the quality 36 | character will be appended. 37 | 38 | \fBmst_srcname\fP generates a source name string in for the specified 39 | MSTrace struct. If the \fIquality\fP flag is true *and* 40 | mst->dataquality is not zero the quality character will be appended. 41 | 42 | .SH LOCATION IDS AND SPACES 43 | The source name produced by these routines never include spaces. The 44 | fixed format nature of SEED data records leads to blank or unused 45 | location IDs represented by spaces. Such blank location IDs will be 46 | collapsed to nothing in the resulting sources names. 47 | 48 | .SH RETURN VALUES 49 | The routines return a pointer to the resulting string or NULL on 50 | error. 51 | 52 | .SH AUTHOR 53 | .nf 54 | Chad Trabant 55 | IRIS Data Management Center 56 | .fi 57 | -------------------------------------------------------------------------------- /libmseed/doc/ms_strncpclean.3: -------------------------------------------------------------------------------- 1 | .TH MS_STRNCPCLEAN 3 2004/11/22 "Libmseed API" 2 | .SH NAME 3 | ms_strncpclean - Non-standard string copying 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBms_strncpclean\fP ( char *" dest ", const char *" source ", int " length " );" 10 | 11 | .BI "int \fBms_strncpopen\fP ( char *" dest ", const char *" source ", int " length " );" 12 | .fi 13 | 14 | .SH DESCRIPTION 15 | \fBms_strncpclean\fP copies up to \fIlength\fP characters from 16 | \fIsource\fP to \fIdest\fP while removing all spaces. The result is 17 | left justified and always NULL terminated. The destination string 18 | must have enough room for the non-space characters within \fIlength\fP 19 | and the NULL terminator, a maximum of \fPlength\fP + 1. 20 | 21 | \fBms_strncpopen\fP copies \fIlength\fP characters from \fIsource\fP 22 | to \fIdest\fP padding the right side with spaces if needed and leaves 23 | the string open-ended (unterminated). The result will always be 24 | \fIlength\fP characters and will never be NULL terminated. 25 | 26 | These routines are useful for converting to and from known length SEED 27 | string fields. 28 | 29 | .SH RETURN VALUES 30 | \fBms_strncpclean\fP returns the number of characters (not including 31 | the terminating NULL) in the destination string. 32 | 33 | \fBms_strncpopen\fP returns the number of characters copied from the 34 | source string. 35 | 36 | .SH AUTHOR 37 | .nf 38 | Chad Trabant 39 | IRIS Data Management Center 40 | .fi 41 | -------------------------------------------------------------------------------- /libmseed/doc/ms_strncpopen.3: -------------------------------------------------------------------------------- 1 | ms_strncpclean.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_time2hptime.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_timestr2hptime.3: -------------------------------------------------------------------------------- 1 | ms_time.3 -------------------------------------------------------------------------------- /libmseed/doc/ms_writemseed.3: -------------------------------------------------------------------------------- 1 | .TH MS_WRITEMSEED 3 2011/01/06 "Libmseed API" 2 | .SH NAME 3 | ms_writemseed - Write Mini-SEED records to files. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBmsr_writemseed\fP ( MSRecord *" msr ", char *" msfile ", flag " overwrite "," 10 | .BI " int " reclen ", flag " encoding ", flag " byteorder "," 11 | .BI " flag " verbose " );" 12 | 13 | .BI "int \fBmst_writemseed\fP ( MSTrace *" mst ", char *" msfile ", flag " overwrite "," 14 | .BI " int " reclen ", flag " encoding ", flag " byteorder "," 15 | .BI " flag " verbose " );" 16 | 17 | .BI "int \fBmst_writemseedgroup\fP ( MSTraceGroup *" msr ", char *" msfile "," 18 | .BI " flag " overwrite ", int " reclen ", flag " encoding "," 19 | .BI " flag " byteorder ", flag " verbose " );" 20 | .fi 21 | 22 | .SH DESCRIPTION 23 | These routines will packed the data contained in the \fBMSRecord\fP, 24 | \fBMSTrace\fP or \fBMSTraceGroup\fP into Mini-SEED records and write 25 | them to the specified file. The \fIoverwrite\fP flag controls whether 26 | the output file is overwritten or appended to. 27 | 28 | Mini-SEED records are created using the specified record length 29 | (\fIreclen\fP), Mini-SEED \fIencoding\fP and \fIbyteorder\fP. Default 30 | values will be used for any of the key characteristics of record 31 | length, encoding format and byte order that are specified as -1. The 32 | default values are: reclen = 4096 bytes, encoding = 11 (Steim2) and 33 | byteorder = 1 (MSBF or big-endian). 34 | 35 | \fIreclen\fP should be set to the desired data record length in bytes 36 | which must be expressible as 2 raised to the power of X where X is 37 | between (and including) 8 to 20. 38 | 39 | \fIencoding\fP should be set to one of the following supported 40 | Mini-SEED data encoding formats: DE_ASCII (0), DE_INT16 (1), DE_INT32 41 | (3), DE_FLOAT32 (4), DE_FLOAT64 (5), DE_STEIM1 (10) and DE_STEIM2 42 | (11). The encoding aliases are defined in libmseed.h. 43 | MSTrace.sampletype should indicated the sample type as either 'a' 44 | (ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd' (64-bit 45 | doubles). 46 | 47 | The encoding format must be appropriate for the sample type of the 48 | MSTrace samples. For example, Steim compression and integer encoding 49 | formats require integer samples and float encoding formats require the 50 | appropriate size floats as input. As a counter example, float samples 51 | cannot be packed using Steim compression or integer encoding formats. 52 | 53 | \fIbyteorder\fP must be either 0 (LSBF or little-endian) or 1 (MBF or 54 | big-endian). 55 | 56 | The \fIverbose\fP flag controls verbosity, a value of zero will result 57 | in no diagnostic output. 58 | 59 | .SH RETURN VALUES 60 | All of these routines return the number of records written on success 61 | and -1 on error. 62 | 63 | .SH EXAMPLE 64 | Skeleton code for writing Mini-SEED records with \fBmsr_writemseed(3)\fP: 65 | 66 | .nf 67 | main() { 68 | MSRecord *msr; 69 | int precords; 70 | 71 | msr = msr_init (NULL); 72 | 73 | /* Populate MSRecord values */ 74 | strcpy (msr->network, "XX"); 75 | strcpy (msr->station, "TEST"); 76 | strcpy (msr->channel, "BHE"); 77 | msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00"); 78 | msr->samprate = 40.0; 79 | msr->datasamples = dataptr; /* pointer to 32-bit integer data samples */ 80 | msr->numsamples = 1234; 81 | msr->sampletype = 'i'; /* declare type to be 32-bit integers */ 82 | 83 | /* Write record(s) with 4096-byte length, Steim-2 compression, big-endian */ 84 | precords = msr_writemseed (msr, "output.mseed", 1, 4096, DE_STEIM2, 1, 0); 85 | 86 | ms_log (0, "Wrote %d records\n", precords); 87 | 88 | msr_free (&msr); 89 | } 90 | .fi 91 | 92 | .SH SEE ALSO 93 | \fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmst_pack(3)\fP. 94 | 95 | .SH AUTHOR 96 | .nf 97 | Chad Trabant 98 | IRIS Data Management Center 99 | .fi 100 | -------------------------------------------------------------------------------- /libmseed/doc/msr_addblockette.3: -------------------------------------------------------------------------------- 1 | .TH MSR_ADDBLOCKETTE 3 2006/02/27 "Libmseed API" 2 | .SH NAME 3 | msr_addblockette - Add a blockette to the blockette chain of an MSRecord structure 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "BlktLink *\fBmsr_addblockette\fP ( MSRecord *" msr ", char *" blktdata ", 10 | .BI " int " length ", int " blkttype ", int " chainpos " ); 11 | .fi 12 | 13 | .SH DESCRIPTION 14 | \fBmsr_addblockette\fP adds a blockette to a blockette chain of an 15 | MSRecord structure. The \fIchainpos\fP value controls which end of 16 | the chain the blockette is added to. If \fIchainpos\fP is 0 the 17 | blockette will be added to the end of the chain (last blockette), 18 | other wise it will be added to the beginning of the chain (first 19 | blockette). A blockette chain is composed of linked BlktLink 20 | structures. A blockette chain for a given MSRecord structure begins 21 | at MSRecord.blkts. 22 | 23 | \fIblktdata\fP should be the blockette body (no blockette type and 24 | next header) of \fIlength\fP bytes and type \fIblkttype\fP. 25 | 26 | Data structures for all SEED 2.4 data blockette types are defined in 27 | \fBlibmseed.h\fP with these minor exceptions: Blockette 2000 (opaque 28 | data) is only partially represented as it has an unknown data 29 | structure by definition and Blockette 405 which depends on full SEED 30 | for a full data description. It is highly recommended to use these 31 | provided data structures when adding blockettes as it allows the 32 | library to manipulate the blockette (swap byte order, etc.) and 33 | assures SEED 2.4 compatibility. 34 | 35 | .SH RETURN VALUE 36 | \fBmsr_addblockette\fP returns a pointer to the BlktLink structure 37 | added to the blockette chain on success or NULL on error. 38 | 39 | .SH SEE ALSO 40 | \fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmsr_unpack(3)\fP. 41 | 42 | .SH AUTHOR 43 | .nf 44 | Chad Trabant 45 | IRIS Data Management Center 46 | .fi 47 | -------------------------------------------------------------------------------- /libmseed/doc/msr_duplicate.3: -------------------------------------------------------------------------------- 1 | .TH MSR_DUPLICATE 3 2007/04/28 "Libmseed API" 2 | .SH NAME 3 | msr_duplicate - Duplicate an MSRecord structure 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "MSRecord *\fBmsr_duplicate\fP ( MSRecord *" msr ", flag " datadup " );" 10 | .fi 11 | 12 | .SH DESCRIPTION 13 | \fBmsr_duplicate\fP creates a copy of an MSRecord structure including 14 | all sub-structures (FSDH and blockette chain). If the \fIdatadup\fP 15 | flag is true the data samples from \fImsr\fP will also be duplicated, 16 | otherwise the copy MSRecord will not have any associated data sample 17 | array regardless if the source MSRecord had any. 18 | 19 | .SH RETURN VALUE 20 | \fBmsr_dupliate\fP returns a pointer to an MSRecord on success and 21 | NULL on error. 22 | 23 | .SH SEE ALSO 24 | \fBms_intro(3)\fP 25 | 26 | .SH AUTHOR 27 | .nf 28 | Chad Trabant 29 | IRIS Data Management Center 30 | .fi 31 | -------------------------------------------------------------------------------- /libmseed/doc/msr_endtime.3: -------------------------------------------------------------------------------- 1 | msr_starttime.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_free.3: -------------------------------------------------------------------------------- 1 | msr_init.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_free_blktchain.3: -------------------------------------------------------------------------------- 1 | msr_init.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_host_latency.3: -------------------------------------------------------------------------------- 1 | .TH MSR_HOST_LATENCY 3 2006/02/27 "Libmseed API" 2 | .SH NAME 3 | msr_host_latency - Calculate latency between last sample in a Mini-SEED record and the 4 | host computer time. 5 | 6 | .SH SYNOPSIS 7 | .nf 8 | .B #include 9 | 10 | .BI "double \fBmsr_host_latency\fP ( MSRecord *" msr " );" 11 | .fi 12 | 13 | .SH DESCRIPTION 14 | \fBmsr_host_latency\fP calculates the latency in seconds of the 15 | Mini-SEED data as the difference between current time in UTC of the 16 | host computer and the time of the last sample in the record. 17 | 18 | This routine is only really useful when dealing with a telemetered 19 | data stream or something similar. 20 | 21 | Double precision is returned, but the true precision is dependent on 22 | the accuracy of the host system clock among other things. 23 | 24 | .SH RETURN VALUES 25 | \fBmsr_host_latency\fP returns seconds of latency or 0.0 on error 26 | (indistinguishable from 0.0 latency). 27 | 28 | .SH SEE ALSO 29 | \fBms_intro(3)\fP and \fBmsr_unpack(3)\fP. 30 | 31 | .SH AUTHOR 32 | .nf 33 | Chad Trabant 34 | IRIS Data Management Center 35 | .fi 36 | -------------------------------------------------------------------------------- /libmseed/doc/msr_init.3: -------------------------------------------------------------------------------- 1 | .TH MSR_INIT 3 2006/02/27 "Libmseed API" 2 | .SH NAME 3 | msr_init - Initializing and freeing MSRecord and related structures 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "MSRecord *\fBmsr_init\fP ( MSRecord *" msr " ); 10 | 11 | .BI "void \fBmsr_free\fP ( MSRecord **" ppmsr " ); 12 | 13 | .BI "void \fBmsr_free_blktchain\fP ( MSRecord *" msr " ); 14 | .fi 15 | 16 | .SH DESCRIPTION 17 | \fBmsr_init\fP will initialize a MSRecord structure. If the \fImsr\fP 18 | parameter is NULL a new structure will be allocated. If the \fImsr\fP 19 | parameter is not NULL the blockette chain (MSRecord.blkts) will be 20 | freed but any memory allocated for MSRecord.fsdh and 21 | MSRecord.datasamples will be preserved as it will cleanly be re-used 22 | by routines such as \fBmsr_unpack(3)\fP. 23 | 24 | \fBmsr_free\fP will free all memory associated with a MSRecord 25 | structure including the blockette chain and set the structure pointer 26 | (*ppmsr) to 0. 27 | 28 | \fBmsr_free_blktchain\fP will free all memory associated with the 29 | blockette chain of an MSRecord structure. The shortcut blockette 30 | pointers will also be reset. 31 | 32 | .SH RETURN VALUES 33 | \fBmsr_init\fP returns a pointer to the MSRecord structure initialized 34 | on success or NULL on error. 35 | 36 | .SH SEE ALSO 37 | \fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmsr_unpack(3)\fP. 38 | 39 | .SH AUTHOR 40 | .nf 41 | Chad Trabant 42 | IRIS Data Management Center 43 | .fi 44 | -------------------------------------------------------------------------------- /libmseed/doc/msr_nomsamprate.3: -------------------------------------------------------------------------------- 1 | msr_samprate.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_normalize_header.3: -------------------------------------------------------------------------------- 1 | .TH MSR_NORMALIZE_HEADER 3 2007/04/28 "Libmseed API" 2 | .SH NAME 3 | msr_normalize_header - Normalize or synchronize the header fields of an MSRecord structure. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBmsr_normalize_header\fP ( MSRecord *" msr ", flag " verbose ); 10 | .fi 11 | 12 | .SH DESCRIPTION 13 | \fBmsr_normalize_header\fP updates the SEED structures associated with 14 | an MSRecord structure (MSRecord.fsdh and the blockette chain at 15 | MSRecord.blkts) with primary values stored at the MSRecord level 16 | (e.g. MSRecord.starttime, MSRecord.samprate, etc.). 17 | 18 | The long explanation is that certain key values (start time, sample 19 | rate, etc.) are duplicated in a given MSRecord structure. For example 20 | the start time is stored at both MSRecord.starttime and in the BTIME 21 | structure in the FSDH at MSRecord.fsdh. The base values at the 22 | MSRecord level (e.g. MSRecord.starttime) are always the primary 23 | values. But before the data record can be packed these values must be 24 | translated back into the SEED structures. For these duplicated values 25 | the \fBmsr_normalize_header\fP routine peforms this translation. 26 | Normally this routine will be called via internal functions when 27 | \fBmsr_pack\fP is called, it could also be used to synchronize the 28 | header values when they are directly modified. 29 | 30 | .SH RETURN VALUE 31 | \fBmsr_normalize_header\fP returns the header length in bytes on 32 | success and -1 on error. 33 | 34 | .SH SEE ALSO 35 | \fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmsr_pack_header(3)\fP. 36 | 37 | .SH AUTHOR 38 | .nf 39 | Chad Trabant 40 | IRIS Data Management Center 41 | .fi 42 | -------------------------------------------------------------------------------- /libmseed/doc/msr_pack_header.3: -------------------------------------------------------------------------------- 1 | msr_pack.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_parse.3: -------------------------------------------------------------------------------- 1 | .TH MSR_PARSE 3 2013/01/07 "Libmseed API" 2 | .SH NAME 3 | msr_parse - Detect and parse a SEED data record from a memory buffer 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBmsr_parse\fP ( char *" record ", int " recbuflen ", MSRecord " **ppmsr "," 10 | .BI " int " reclen ", flag " dataflag ", flag " verbose " );" 11 | 12 | .BI "int \fBmsr_parse_selection\fP ( char *" recbuf ", int " recbuflen "," 13 | .BI " int64_t *" offset ", MSRecord " **ppmsr "," 14 | .BI " int " reclen ", Selections *" selections "," 15 | .BI " flag " dataflag ", flag " verbose " );" 16 | 17 | .BI "int \fBms_detect\fP ( const char *" record ", int " recbuflen " );" 18 | 19 | .SH DESCRIPTION 20 | \fBmsr_parse\fP will parse a SEED data record from the \fIrecord\fP 21 | buffer and populate the MSRecord structure at \fIppmsr\fP, allocating 22 | one if needed. The \fIrecbuflen\fP argument is the length of the 23 | \fIrecord\fP buffer. Records must begin at the start of the buffer. 24 | 25 | If \fIreclen\fP is 0 or negative the length of record is automatically 26 | determined, otherwise \fIreclen\fP should be the correct record 27 | length. For auto detection of record length the record should include 28 | a 1000 blockette or be followed by another record header in the 29 | buffer. 30 | 31 | If \fIdataflag\fP is true (non-zero) the data samples will be unpacked 32 | when parsing the record. This argument is passed directly to 33 | \fBmsr_unpack(3)\fP. 34 | 35 | \fBmsr_parse_selection\fP will parse the first SEED data record from 36 | the \fIrecbuf\fP buffer that matches the optional \fIselections\fP. 37 | The \fIoffset\fP value indicates where to start searching the buffer. 38 | On success, the MSRecord structure at \fIppmsr\fP is populated and the 39 | \fIoffset\fP to the record in the buffer is set. See the example 40 | below for the intended usage pattern. 41 | 42 | \fBms_detect\fP determines whether the supplied \fIrecord\fP buffer 43 | contains a SEED data record by verifying known signatures, if a record 44 | is found the record length is determined by: 45 | 46 | 1) Searching the buffer up to \fIrecbuflen\fP for a Blockette 1000. 47 | 48 | 2) If no Blockette 1000 is found search at MINRECLEN-byte offsets 49 | for the fixed section of the next header in the buffer, thereby 50 | implying the record length. 51 | 52 | .SH RETURN VALUES 53 | \fBmsr_parse\fP returns values: 54 | .nf 55 | 0 : On success and populates the supplied MSRecord. 56 | >0 : Data record was detected but not enough data is present in buffer, 57 | the value returned is a hint of how much more data is needed. 58 | <0 : On error a negative libmseed error value is returned. 59 | 60 | \fBms_detect\fP returns values: 61 | .nf 62 | -1 : Data record not detected or error 63 | 0 : Data record detected but could not determine length 64 | >0 : Length of the data record in bytes 65 | .fi 66 | 67 | .SH EXAMPLE USAGE OF MS_PARSE_SELECTION() 68 | The \fBms_parse_selection()\fP routine uses the initial setting of 69 | \fIoffset\fP as the starting point to search the buffer. On 70 | successful parsing of a miniSEED record the value of \fIoffset\fP will 71 | be the offset in the buffer to the record parsed. 72 | 73 | To properly parse all records matching specificed selection criteria, 74 | a caller must check and manage the value of \fIoffset\fP. In 75 | particular, when the end of the buffer is reached a value of 76 | MS_GENERROR will be returned and the caller should check if the offset 77 | is still within the buffer length to determine if this is a parsing 78 | error or simply the end of the buffer. 79 | 80 | The following example illustrates the intended usage: 81 | 82 | .nf 83 | char *recbuf = ; 84 | int64_t recbuflen = ; 85 | int64_t offset = 0; 86 | MSRecord *msr = NULL; 87 | int reclen = -1; 88 | Selections *selections = NULL; 89 | flag dataflag = 1; 90 | flag verbose = 0; 91 | 92 | // You probaby want to set Selections 93 | // For example with a call to ms_readselectionsfile (&selections, selectfile) 94 | 95 | /* Loop over all selected records in recbuf */ 96 | while ( offset < recbuflen ) 97 | { 98 | if ( msr_parse_selection (recbuf, recbuflen, &offset, &msr, reclen, selections, dataflag, verbose) ) 99 | { 100 | /* Only print error if offset is still within buffer length */ 101 | if ( verbose && offset < recbuflen ) 102 | ms_log (2, "Error parsing record at offset %"PRId64"\n", offset); 103 | } 104 | else /* Successfully found and parsed record */ 105 | { 106 | /* Do something with the record, for example print the details */ 107 | msr_print (msr, verbose); 108 | 109 | /* Increment offset in buffer for subsequent call to msr_parse_selection() */ 110 | offset += msr->reclen; 111 | } 112 | } 113 | 114 | /* Clean up */ 115 | msr_free (&msr); 116 | 117 | if ( selections ) 118 | ms_freeselections (selections); 119 | .fi 120 | 121 | .SH SEE ALSO 122 | \fBmsr_unpack(3)\fP, \fBms_parse_raw(3)\fP and \fBms_errorstr(3)\fP 123 | 124 | .SH AUTHOR 125 | .nf 126 | Chad Trabant 127 | IRIS Data Management Center 128 | .fi 129 | -------------------------------------------------------------------------------- /libmseed/doc/msr_parse_selection.3: -------------------------------------------------------------------------------- 1 | msr_parse.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_print.3: -------------------------------------------------------------------------------- 1 | .TH MSR_PRINT 3 2006/11/27 "Libmseed API" 2 | .SH NAME 3 | msr_print - Printing of Mini-SEED record header values. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "void \fBmsr_print\fP ( MSRecord *" msr ", flag " details " );" 10 | .fi 11 | 12 | .SH DESCRIPTION 13 | \fBmsr_print\fP prints formatted details from the given MSRecord 14 | struct (parsed record header), i.e. fixed section and blockettes. All 15 | output is printed using \fBms_log(3)\fP at level 0. The \fIdetails\fP 16 | flag controls how much information is printed: 17 | .nf 18 | 0 : a single line summarizing the record 19 | 1 : most commonly desired header details 20 | 2+ : all header details 21 | .fi 22 | 23 | If no fixed section header information is available at MSRecord.fsdh 24 | then a single line is printed from the other information in the 25 | MSRecord structure. 26 | 27 | .SH SEE ALSO 28 | \fBms_intro(3)\fP and \fBmsr_unpack(3)\fP. 29 | 30 | .SH AUTHOR 31 | .nf 32 | Chad Trabant 33 | IRIS Data Management Center 34 | .fi 35 | -------------------------------------------------------------------------------- /libmseed/doc/msr_samprate.3: -------------------------------------------------------------------------------- 1 | .TH MSR_SAMPRATE 3 2006/02/27 "Libmseed API" 2 | .SH NAME 3 | msr_samprate - Determine sample rate from an MSRecord structure 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "double \fBmsr_samprate\fP ( MSRecord *" msr " ); 10 | 11 | .BI "double \fBmsr_nomsamprate\fP ( MSRecord *" msr " ); 12 | .fi 13 | 14 | .SH DESCRIPTION 15 | \fBmsr_samprate\fP will calculate a double precision sample rate in 16 | samples per second using the header values in the specified MSRecord. 17 | If a Blockette 100 is included, the "Actual sample rate" (field 3) 18 | will be returned, otherwise a nominal sample rate will be calculated 19 | from the sample rate factor and multiplier in the fixed section data 20 | header. 21 | 22 | NOTE: The sample rate for a MSRecord structure is available directly 23 | at MSRecord.samplerate. libmseed based programs should use that 24 | sample rate whenever possible (\fBmsr_unpack\fP uses 25 | \fBmsr_samprate\fP to set MSRecord.samplerate). 26 | 27 | \fBmsr_nomsamprate\fP will calculate a double precision sample rate in 28 | samples per second using the sample rate factor and multiplier in the 29 | fixed section data header. 30 | 31 | .SH RETURN VALUES 32 | \fBmsr_samprate\fP returns a double precision sample rate on success 33 | and -1.0 on error. 34 | 35 | \fBmsr_nomsamprate\fP returns a double precision sample rate on 36 | success and -1.0 on error. 37 | 38 | .SH SEE ALSO 39 | \fBms_intro(3)\fP and \fBmsr_unpack(3)\fP. 40 | 41 | .SH AUTHOR 42 | .nf 43 | Chad Trabant 44 | IRIS Data Management Center 45 | .fi 46 | -------------------------------------------------------------------------------- /libmseed/doc/msr_srcname.3: -------------------------------------------------------------------------------- 1 | ms_srcname.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_starttime.3: -------------------------------------------------------------------------------- 1 | .TH MSR_STARTTIME 3 2015/03/02 "Libmseed API" 2 | .SH NAME 3 | msr_starttime - Start and end time determination for MSRecord structures 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "hptime_t \fBmsr_starttime\fP ( MSRecord *" msr " );" 10 | 11 | .BI "hptime_t \fBmsr_starttime_uc\fP ( MSRecord *" msr " );" 12 | 13 | .BI "hptime_t \fBmsr_endtime\fP ( MSRecord *" msr " );" 14 | .fi 15 | 16 | .SH DESCRIPTION 17 | \fBmsr_starttime\fP returns the start time of the record as a high 18 | precision epoch time (see \fBms_time(3)\fP). Any time correction 19 | given in the fixed section data header is applied if it has not 20 | already been applied. If Blockette 1001 is included and parsed the 21 | microseconds indicated (field 4) are also applied. 22 | 23 | NOTE: The record start time for a MSRecord structure is available 24 | directly at MSRecord.starttime. Libmseed based programs should use 25 | that start time whenever possible (\fBmsr_unpack\fP uses 26 | \fBmsr_starttime\fP to set MSRecord.starttime). 27 | 28 | \fBmsr_starttime_uc\fP is a version of \fBmsr_starttime\fP that 29 | applies no time corrections, just a basic conversion of the start time 30 | values in the fixed section data header. 31 | 32 | \fBmsr_endtime\fP returns the time of the last sample in the record as 33 | a high precision epoch time (seed \fBms_time(3)\fP). This is *not* 34 | the time "covered" by the last sample, but the actual sample time. 35 | This function calculates the record start time with 36 | \fBmsr_starttime\fP and then adds the time covered by the samples in 37 | the record which is calculated from the number of samples and sample 38 | rate. 39 | 40 | \fBmsr_endtime\fP will adjust the end time appropriately if the record 41 | is known to contain a positive leap second. If the 42 | \fBms_readleapseconds\fP or \fBms_readleapsecondfile\fP routines have 43 | been called to read a leap second file into an internal list, it will 44 | be checked to know when leap seconds occur. If a leap second list is 45 | not available the fixed section data header is checked for a positive 46 | leap second indicator. 47 | 48 | .SH RETURN VALUES 49 | \fBmsr_starttime\fP, \fBmsr_starttime_uc\fP and \fBmsr_endtime\fP 50 | return a high precision epoch time on success and HPTERROR on error. 51 | 52 | .SH SEE ALSO 53 | \fBms_intro(3)\fP, \fBms_time(3)\fP and \fBmsr_unpack(3)\fP 54 | 55 | .SH AUTHOR 56 | .nf 57 | Chad Trabant 58 | IRIS Data Management Center 59 | .fi 60 | -------------------------------------------------------------------------------- /libmseed/doc/msr_starttime_uc.3: -------------------------------------------------------------------------------- 1 | msr_starttime.3 -------------------------------------------------------------------------------- /libmseed/doc/msr_unpack.3: -------------------------------------------------------------------------------- 1 | .TH MSR_UNPACK 3 2012/12/22 "Libmseed API" 2 | .SH NAME 3 | msr_unpack - Unpacking of Mini-SEED records. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBmsr_unpack\fP ( char *" record ", int " reclen ", MSRecord **" ppmsr ", 10 | .BI " flag " dataflag ", flag " verbose " ); 11 | .fi 12 | 13 | .BI "int \fBmsr_unpack_data\fP ( MSRecord *" msr ", int " swapflag ", flag " verbose " ); 14 | .fi 15 | 16 | .SH DESCRIPTION 17 | \fBmsr_unpack\fP will unpack a Mini-SEED data record and populate a 18 | MSRecord data structure, optionally unpacking data samples. All 19 | multi-byte quantities will be byte-swapped to the host byte order. 20 | The MSRecord data structure is described in \fBms_intro(3)\fP. 21 | 22 | The \fIreclen\fP parameter specifies the length of the data record 23 | pointed to by \fIrecord\fP in bytes. 24 | 25 | If the \fI*ppmsr\fP pointer is NULL a new MSRecord will be allocated, 26 | if not the existing MSRecord will be reinitialized and reused 27 | destroying any previous contents. The \fIppmsr\fP pointer itself must 28 | not be NULL. 29 | 30 | If the \fIdataflag\fP flag is not zero any data samples in the record 31 | will be unpacked/decompressed. The following data encoding formats 32 | are supported: ASCII, INT16, INT32, FLOAT32, FLOAT64, STEIM1 and 33 | STEIM2. The MSRecord.datasamples pointer will be set appropriately 34 | and the samples will be either ASCII, 32-bit integers, 32-bit floats 35 | or 64-bit floats with the same byte order as the host machine. 36 | MSRecord.numsamples will be set to the actual number of samples 37 | unpacked/decompressed. MSRecord.sampletype will indicated the sample 38 | type as either 'a' (ASCII), 'i' (32-bit integers), 'f' (32-bit floats) 39 | or 'd' (64-bit doubles). The size of each sample type in bytes is 40 | returned by the get_samplesize(3) lookup routine. 41 | 42 | The \fIverbose\fP flag controls verbosity, a value of zero will result 43 | in no diagnostic output. 44 | 45 | \fBmsr_unpack_data\fP will unpack the data samples for an already 46 | parsed MSRecord structure from the original record available at the 47 | \fIMSRecord->record\fP pointer. Normally this is called by 48 | \fBmsr_unpack\fP when the \fIdataflag\fP is not zero, but it can be 49 | useful when the program needs to first unpack the header of a record 50 | and decide later if the samples are needed. If called independently 51 | the caller must determine if byte swapping of data samples is needed. 52 | 53 | .SH UNPACKING OVERRIDES 54 | The following macros and environment variables effect the unpacking of 55 | Mini-SEED: 56 | 57 | .nf 58 | Macros: 59 | MS_UNPACKHEADERBYTEORDER(X) 60 | MS_UNPACKDATABYTEORDER(X) 61 | MS_UNPACKDATAFORMAT(X) 62 | MS_UNPACKDATAFORMATFALLBACK(X) 63 | 64 | Environment variables: 65 | UNPACK_HEADER_BYTEORDER 66 | UNPACK_DATA_BYTEORDER 67 | UNPACK_DATA_FORMAT 68 | UNPACK_DATA_FORMAT_FALLBACK 69 | .fi 70 | 71 | The UNPACK_HEADER_BYTEORDER and UNPACK_DATA_BYTEORDER macros and 72 | variables force the byte order of the header and data respectively. 73 | They could be set to either 0 (little endian) or 1 (big endian). See 74 | \fBms_intro(3)\fP for a description of how libmseed determines a 75 | records byte order. 76 | 77 | The UNPACK_DATA_FORMAT macro and variable forces the encoding format, 78 | this should be set to any of the supported formats codes (i.e. 10 = 79 | Steim-1 compression). 80 | 81 | The UNPACK_DATA_FORMAT_FALLBACK macro and variable defines an encoding 82 | format that will be used when the SEED data record does not indicate 83 | the format, i.e. the record does not include a 1000 blockette. By 84 | default the fallback encoding format is 10 (Steim-1 compression). If 85 | this default is invoked and the byte order of the data is unspecified 86 | big endian byte order will be assumed. If a data record does not 87 | include a 1000 blockette it is not Mini-SEED, the capability to read 88 | these records is included only to support legacy data. 89 | 90 | .SH RETURN VALUE 91 | 92 | On the sucessful parsing of a record \fBmsr_unpack\fP returns 93 | MS_NOERROR and populates the MSRecord struct at *ppmsr. On error 94 | \fBmsr_unpack\fP returns a libmseed error code (defined in libmseed.h) 95 | 96 | .SH EXAMPLE 97 | Skeleton code for unpacking a Mini-SEED record with msr_unpack(3): 98 | 99 | .nf 100 | main() { 101 | MSRecord *msr = NULL; 102 | char *record; 103 | int reclen; 104 | int retcode; 105 | 106 | record = recordptr; /* pointer to Mini-SEED record */ 107 | reclen = 4096; /* 4096 byte record length */ 108 | 109 | /* Unpack record header and data samples */ 110 | retcode = msr_unpack (record, reclen, &msr, 1, verbose); 111 | 112 | if ( retcode != MS_NOERROR ) 113 | fprintf (stderr, "Error parsing record\\n"); 114 | else 115 | printf ("Unpacked %d samples\n", msr->numsamples); 116 | 117 | /* Print record information */ 118 | msr_print (msr, verbose); 119 | 120 | msr_free (&msr); 121 | } 122 | .fi 123 | 124 | .SH SEE ALSO 125 | \fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmsr_print(3)\fP. 126 | 127 | .SH AUTHOR 128 | .nf 129 | Chad Trabant 130 | IRIS Data Management Center 131 | .fi 132 | -------------------------------------------------------------------------------- /libmseed/doc/msr_writemseed.3: -------------------------------------------------------------------------------- 1 | ms_writemseed.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_addmsr.3: -------------------------------------------------------------------------------- 1 | .TH MST_ADDMSR 3 2013/05/17 "Libmseed API" 2 | .SH NAME 3 | mst_addmsr - Add time coverage and data samples to MSTrace structures 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int *\fBmst_addmsr\fP ( MSTrace *" mst ", MSRecord *" msr ", flag " whence " ); 10 | 11 | .BI "int \fBmst_addspan\fP ( MSTrace *" mst ", hptime_t " starttime ", hptime_t " endtime ", 12 | .BI " void *" datasamples ", int64_t " numsamples ", 13 | .BI " char " sampletype ", flag " whence " ); 14 | 15 | .BI "MSTrace *\fBmst_addmsrtogroup\fP ( MSTraceGroup *" mstg ", MSRecord *" msr ", 16 | .BI " flag " dataquality ", double " timetol ", 17 | .BI " double " sampratetol " ); 18 | 19 | .BI "MSTrace *\fBmst_addtracetogroup\fP ( MSTraceGroup *" mstg ", MSTrace *" mst " );" 20 | .fi 21 | 22 | .SH DESCRIPTION 23 | These routines provides different ways of adding time coverage to 24 | MSTrace objects. A common way to organize MSTrace objects is with a 25 | MSTraceGroup. The \fBmst_addmsrtogroup\fP provides a convenient way to add 26 | MSRecord data to a MSTraceGroup, hiding many of the details of MSTrace 27 | matching and bookkeeping. 28 | 29 | \fBmst_addmsr\fP will add the time coverage from a MSRecord to a 30 | MSTrace. The start or end time will be updated and data samples copied 31 | if they exist. No checking is done to verify that the record matches 32 | the trace in any way. If \fIwhence\fP is 1 the MSRecord coverage will 33 | be added at the end of the MSTrace. If \fIwhence\fP is 2 the MSRecord 34 | coverage will be added at the beginning of the MSTrace. 35 | 36 | \fBmst_addspan\fP does the same thing as \fBmsr_addmsr\fP except that 37 | time coverage and data samples are explicitly provided. See 38 | \fBms_time(3)\fP for a description of the high precision epoch time 39 | format needed for \fIstarttime\fP and \fIendtime\fP. See the 40 | \fBWaveform Data\fP section of \fBms_intro(3)\fP for a description of 41 | data sample representation. 42 | 43 | \fBmst_addmsrtogroup\fP adds time coverage from the specified MSRecord 44 | to the first adjacent MSTrace found in the specified MSTraceGroup. If 45 | the \fIdataquality\fP flag is true traces will be grouped by quality 46 | in addition to the source name identifiers. \fBmst_findadjacent(3)\fP 47 | is used with the specified sample rate and time tolerances to find an 48 | adjacent trace, see \fBmst_findadjacent(3)\fP for further details. If 49 | no adjacent MSTrace is found a new MSTrace will be added to the 50 | MSTraceGroup. 51 | 52 | \fBmst_addtracetogroup\fP adds a MSTrace structure to a MSTraceGroup 53 | structure. The MSTrace is added at the end of the MSTrace chain. 54 | 55 | .SH RETURN VALUES 56 | \fBmst_addmsr\fP and \fBmst_addspan\fP return 0 on success and -1 on 57 | error. 58 | 59 | \fBmst_addmsrtogroup\fP returns a pointer to the MSTrace updated or 0 on 60 | error. 61 | 62 | \fBmst_addtracetogroup\fP returns a pointer to the MSTrace added or 0 on 63 | error. 64 | 65 | .SH SEE ALSO 66 | \fBms_intro(3)\fP, \fBmst_init(3)\fP, \fBmst_findadjacent(3)\fP and 67 | \fBms_time(3)\fP. 68 | 69 | .SH AUTHOR 70 | .nf 71 | Chad Trabant 72 | IRIS Data Management Center 73 | .fi 74 | -------------------------------------------------------------------------------- /libmseed/doc/mst_addmsrtogroup.3: -------------------------------------------------------------------------------- 1 | mst_addmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_addspan.3: -------------------------------------------------------------------------------- 1 | mst_addmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_addtracetogroup.3: -------------------------------------------------------------------------------- 1 | mst_addmsr.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_convertsamples.3: -------------------------------------------------------------------------------- 1 | .TH MST_CONVERTSAMPLES 3 2013/10/01 "Libmseed API" 2 | .SH NAME 3 | mst_convertsamples - Convert data samples between numeric types 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBmst_convertsamples\fP ( MSTrace *" mst ", char " type ", flag " truncate ");" 10 | 11 | .BI "int \fBmstl_convertsamples\fP ( MSTraceSeg *" seg ", char " type ", flag " truncate ");" 12 | 13 | .SH DESCRIPTION 14 | \fBmst_convertsamples\fP and \fBmst_convertsamples\fP convert any data 15 | samples associated with an \fIMSTrace\fP or \fIMSTraceSeg\fP to a 16 | specified \fitype\fP. 17 | 18 | The routines can convert between 32-bit integers (type \fIi\fP), 19 | 32-bit floats (type \fIf\fP) and 64-bit doubles (type \fId\fP). 20 | 21 | When converting float and double sample types to integer type a simple 22 | rounding is applied by adding 0.5 to the sample value before converting 23 | (truncating) to integer. This compensates for common machine 24 | representations of floating point values (e.g. "40.0" represented by 25 | "39.99999999"). 26 | 27 | If the \fItruncate\fP flag is true data samples will be truncated to 28 | integers even if loss of sample precision is detected. If the 29 | \fItruncate\fP flag is false (0) and loss of precision is detected an 30 | error is returned. Loss of precision is determined by testing that 31 | the difference between the floating point value and the (truncated) 32 | integer value is greater than 0.000001. 33 | 34 | ASCII data samples (type \fIa\fP) cannot be converted, if supplied or 35 | requested an error will be returned. 36 | 37 | .SH RETURN VALUES 38 | \fBmst_convertsamples\fP and \fBmstl_convertsamples\fP return 0 on 39 | success and -1 on error. 40 | 41 | .SH SEE ALSO 42 | \fBms_intro(3)\fP. 43 | 44 | .SH AUTHOR 45 | .nf 46 | Chad Trabant 47 | IRIS Data Management Center 48 | .fi 49 | -------------------------------------------------------------------------------- /libmseed/doc/mst_findadjacent.3: -------------------------------------------------------------------------------- 1 | mst_findmatch.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_findmatch.3: -------------------------------------------------------------------------------- 1 | .TH MST_FINDMATCH 3 2006/02/27 "Libmseed API" 2 | .SH NAME 3 | mst_findmatch - Searching a MSTraceGroup for specific MSTrace structures. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "MSTrace *\fBmst_findmatch\fP ( MSTrace *" startmst ", char " dataquality ", 10 | .BI " char *" network ", char *" station ", 11 | .BI " char *" location ", char *" channel " ); 12 | 13 | .BI "MSTrace *\fBmst_findadjacent\fP ( MSTraceGroup *" mstg ", 14 | .BI " flag *" whence ", char " dataquality ", 15 | .BI " char *" network ", char *" station ", 16 | .BI " char *" location ", char *" channel ", 17 | .BI " double " samprate ", double " sampleratetol ", 18 | .BI " hptime_t " starttime ", hptime_t " endtime ", 19 | .BI " double " timetol ");" 20 | 21 | .SH DESCRIPTION 22 | \fBmst_findmatch\fP traverses a MSTrace chain starting at 23 | \fIstartmst\fP and returns the first entry that matches the source 24 | name identifiers. If \fIdataquality\fP is not zero it must also match 25 | the found entry. A calling program commonly calls this routine in a 26 | loop in order to find all matching MSTraces in a MSTraceGroup. 27 | 28 | \fBmst_findadjacent\fP finds the first entry in the MSTraceGroup 29 | pointed to by \fImstg\fP that matches the given source name 30 | identifiers and is time adjacent to the time coverage described by the 31 | \fIsamprate\fP, \fIstarttime\fP and \fIendtime\fP. If 32 | \fIdataquality\fP is not zero it must also match the found entry. See 33 | \fBms_time(3)\fP for a description of the high precision epoch time 34 | format needed for \fIstarttime\fP and \fIendtime\fP. 35 | 36 | The tolerance for sample rate and time matching can also be specified. 37 | If \fIsampratetol\fP is -1.0 the default tolerance of abs(1-sr1/sr2) < 38 | 0.0001 is used. If \fItimetol\fP is -1.0 the default time tolerance 39 | of 1/2 the sample period will be used. If \fIsampratetol\fP or 40 | \fItimetol\fP is -2.0 the respective tolerance check will not be 41 | performed. If time tolerance is not checked \fIwhence\fP will be set 42 | to whichever end fits best. The time tolerance is specified in 43 | seconds. 44 | 45 | When an adjacent MSTrace is found the \fIwhence\fP flag will be set to 46 | indicate where the indicated time span is adjacent in the following 47 | way: 48 | .sp 49 | .nf 50 | 1: time span fits at the end of the MSTrace 51 | 2: time span fits at the beginning of the MSTrace 52 | .fi 53 | 54 | .SH RETURN VALUES 55 | \fBmst_findmatch\fP returns a pointer to the matching MSTrace structure 56 | or 0 if no match found or error. 57 | 58 | \fBmst_findadjacent\fP returns a pointer to the adjacent MSTrace 59 | structure and the \fIwhence\fP flag is set when an adjacent MSTrace is 60 | found or 0 when no adjacent MSTrace is found. 61 | 62 | .SH SEE ALSO 63 | \fBms_intro(3)\fP, \fBmst_init(3)\fP and \fBms_time(3)\fP. 64 | 65 | .SH AUTHOR 66 | .nf 67 | Chad Trabant 68 | IRIS Data Management Center 69 | .fi 70 | -------------------------------------------------------------------------------- /libmseed/doc/mst_free.3: -------------------------------------------------------------------------------- 1 | mst_init.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_freegroup.3: -------------------------------------------------------------------------------- 1 | mst_init.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_groupheal.3: -------------------------------------------------------------------------------- 1 | mst_groupsort.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_groupsort.3: -------------------------------------------------------------------------------- 1 | .TH MST_GROUPSORT 3 2007/04/12 "Libmseed API" 2 | .SH NAME 3 | mst_groupsort - Manipulate MSTrace segments in a MSTraceGroup 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "MSTrace *\fBmst_groupsort\fP ( MSTraceGroup *" mstg ", flag " quality " ); 10 | 11 | .BI "MSTrace *\fBmst_groupheal\fP ( MSTraceGroup *" mstg ", double " timetol ", 12 | .BI " double " sampratetol " );" 13 | .fi 14 | 15 | .SH DESCRIPTION 16 | \fBmst_groupsort\fP will sort the MSTrace segments in a MSTraceGroup 17 | first on the source name (as returned by \fBmst_srcname\fP), then on 18 | start time, then on descending end time, and finally on sample rate. 19 | The \fIquality\fP flag, passed directly to \fBmst_srcname\fP, controls 20 | the addition of the quality indicator to the source name and thus the 21 | addition of sorting on the quality indicator (but only if the MSTrace 22 | has an associated quality, see \fBmst_srcname(3)\fP for more details). 23 | 24 | \fBmst_groupheal\fP will attempt to heal MSTrace segments in a 25 | MSTraceGroup if they fit within the specified time and sample rate 26 | tolerance (\fItimetol\fP and \fIsampratetol\fP respectively). This is 27 | useful when, for whatever reason, the MSTraceGroup has separate 28 | MSTrace segments which belong together. This usually only happens 29 | when data is added to a MSTraceGroup in random data time order. 30 | Before attempting to heal the MSTraces the MSTraceGroup will be sorted 31 | using \fBmst_groupsort\fP. 32 | 33 | If \fIsampratetol\fP is -1.0 the default tolerance of abs(1-sr1/sr2) 34 | is used. If \fItimetol\fP is -1.0 the default time tolerance of 1/2 35 | the sample period will be used. 36 | 37 | .SH RETURN VALUES 38 | \fBmst_groupsort\fP returns 0 on success and -1 on error. 39 | 40 | \fBmst_groupheal\fP returns the number of MSTrace segments merged on 41 | success and -1 on error. 42 | 43 | .SH SEE ALSO 44 | \fBms_intro(3)\fP and \fBmst_srcname(3)\fP. 45 | 46 | .SH AUTHOR 47 | .nf 48 | Chad Trabant 49 | IRIS Data Management Center 50 | .fi 51 | -------------------------------------------------------------------------------- /libmseed/doc/mst_init.3: -------------------------------------------------------------------------------- 1 | .TH MST_INIT 3 2006/10/10 "Libmseed API" 2 | .SH NAME 3 | mst_init - Initializing and freeing MSTrace and MSTraceGroup structures 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "MSTrace *\fBmst_init\fP ( MSTrace *" mst " ); 10 | 11 | .BI "void \fBmst_free\fP ( MSTrace **" ppmst " ); 12 | 13 | .BI "MSTraceGroup *\fBmst_initgroup\fP ( MSTraceGroup *" mstg " ); 14 | 15 | .BI "void \fBmst_freegroup\fP ( MSTraceGroup **" ppmstg " ); 16 | .fi 17 | 18 | .SH DESCRIPTION 19 | \fBmst_init\fP will initialize a MSTrace structure. If the \fImst\fP 20 | parameter is NULL a new structure will be allocated. If the \fImst\fP 21 | parameter is not NULL the structure will be cleared and any memory 22 | allocated for the MSTrace.datasamples and MSTrace.prvtptr members will 23 | be freed. 24 | 25 | \fBmst_free\fP will free all memory associated with a MSTrace structure 26 | and set the structure pointer (*\fIppmst\fP) to 0. This includes any 27 | memory pointed to by the \fIprvtptr\fP member of the MSTrace structure. 28 | 29 | \fBmst_initgroup\fP will initialize a MSTraceGroup structure. If the 30 | \fImstg\fP parameter is NULL a new structure will be allocated. If 31 | the \fImstg\fP parameter is not NULL the structure will be cleared and 32 | any all associated MSTrace structures will be freed. 33 | 34 | \fBmst_freegroup\fP will free all memory associated with a MSTraceGroup 35 | structure and set the structure pointer (*\fIppmstg\fP) to 0. 36 | 37 | .SH RETURN VALUES 38 | \fBmst_init\fP returns a pointer to the MSTrace structure initialized on 39 | success or NULL on error. 40 | 41 | \fBmst_initgroup\fP returns a pointer to the MSTraceGroup structure 42 | initialized on success or NULL on error. 43 | 44 | .SH SEE ALSO 45 | \fBms_intro(3)\fP. 46 | 47 | .SH AUTHOR 48 | .nf 49 | Chad Trabant 50 | IRIS Data Management Center 51 | .fi 52 | -------------------------------------------------------------------------------- /libmseed/doc/mst_initgroup.3: -------------------------------------------------------------------------------- 1 | mst_init.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_pack.3: -------------------------------------------------------------------------------- 1 | .TH MST_PACK 3 2013/05/17 "Libmseed API" 2 | .SH NAME 3 | mst_pack - Packing of Mini-SEED records from MSTrace segments. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "int \fBmst_pack\fP ( MSTrace *" mst "," 10 | .BI " void (*" record_handler ") (char *, int, void *)," 11 | .BI " void *" handlerdata ", int " reclen ", flag " encoding "," 12 | .BI " flag " byteorder ", int64_t *" packedsamples ", flag " flush "," 13 | .BI " flag " verbose ", MSRecord *" mstemplate " );" 14 | 15 | .BI "int \fBmsr_packgroup\fP ( MSTraceGroup *" mstg "," 16 | .BI " void (*" record_handler ") (char *, int, void *)," 17 | .BI " void *" handlerdata ", int " reclen ", flag " encoding "," 18 | .BI " flag " byteorder ", int64_t *" packedsamples ", flag " flush "," 19 | .BI " flag " verbose ", MSRecord *" mstemplate " );" 20 | .fi 21 | 22 | .SH DESCRIPTION 23 | \fBmst_pack\fP creates (packs) Mini-SEED data records from a MSTrace 24 | segment using the specified record length (\fIreclen\fP), Mini-SEED 25 | \fIencoding\fP and \fIbyteorder\fP. Using \fImstemplate\fP as a 26 | template, the common header fields and blockettes are packed into a 27 | record header. If no template will be used \fImstemplate\fP should be 28 | set to NULL. A Blockette 1000 will be added if one is not present in 29 | the template. The MSTrace.datasamples array and MSTrace.numsamples value 30 | will be adjusted (reduced) as samples are packed into data records. 31 | This routine will modify the record length, encoding format, byte 32 | order and sequence number of the MSRecord template. The start time, 33 | sample rate, data array, number of samples and sample type of the 34 | MSRecord template are preserved. 35 | 36 | Default values will be used for any of the key characteristics of 37 | record length, encoding format and byte order that are -1. The 38 | default values are: reclen = 4096 bytes, encoding = 11 (Steim2) and 39 | byteorder = 1 (MSBF or big-endian). 40 | 41 | \fIreclen\fP should be set to the desired data record length in bytes 42 | which must be expressible as 2 raised to the power of X where X is 43 | between (and including) 8 to 20. 44 | 45 | \fIencoding\fP should be set to one of the following supported 46 | Mini-SEED data encoding formats: DE_ASCII (0), DE_INT16 (1), DE_INT32 47 | (3), DE_FLOAT32 (4), DE_FLOAT64 (5), DE_STEIM1 (10) and DE_STEIM2 48 | (11). The encoding aliases are defined in libmseed.h. 49 | MSTrace.sampletype should indicated the sample type as either 'a' 50 | (ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd' (64-bit 51 | doubles). 52 | 53 | The encoding format must be appropriate for the sample type of the 54 | MSTrace samples. For example, Steim compression and integer encoding 55 | formats require integer samples and float encoding formats require the 56 | appropriate size floats as input. As a counter example, float samples 57 | cannot be packed using Steim compression or integer encoding formats. 58 | 59 | \fIbyteorder\fP must be either 0 (LSBF or little-endian) or 1 (MBF or 60 | big-endian). 61 | 62 | Each time a complete record is packed it will be passed to the 63 | \fIrecord_handler()\fP function which expects three arguments: 1) a 64 | char * to the record buffer, 2) the length of the record in bytes and 65 | 3) a void pointer supplied by the caller. It is the responsibility of 66 | \fIrecord_handler()\fP to process the record, the memory will be 67 | re-used or freed when \fIrecord_handler()\fP returns. This function 68 | pointer is required, there is no other way to access the packed 69 | records. 70 | 71 | The \fIhandlerdata\fP pointer will be passed as the 3rd argument to 72 | \fIrecord_handler()\fP. This allows the caller to optionally pass 73 | data directly to the \fIrecord_handler()\fP. 74 | 75 | The integer pointed to by \fIpackedsamples\fP will be set to the total 76 | number of samples packed. 77 | 78 | If the \fIflush\fP flag is not zero all of the data will be packed 79 | into records, otherwise records will only be packed while there are 80 | enough data samples to completely fill a record. 81 | 82 | The \fIverbose\fP flag controls verbosity, a value of zero will result 83 | in no diagnostic output. 84 | 85 | \fBmst_packgroup\fP simply calls \fBmst_pack\fP for each MSTrace in the 86 | specified MSTraceGroup. The integer pointed to by \fIpackedsamples\fP 87 | will be set to the total number of samples packed. 88 | 89 | .SH COMPRESSION HISTORY 90 | When the encoding format is Steim 1 or 2 compression contiguous 91 | records will be created including compression history. Put simply, 92 | this means that the first difference in the compression series will be 93 | the difference between the first sample of the current record and the 94 | last sample of the previous record. For the first record in a series 95 | (no previous record), a so-called cold start, the first difference 96 | will be zero. 97 | 98 | The compression history can be seeded by allocating the StreamState 99 | struct for the MSTrace and setting the \fBlastintsample\fP member to 100 | the integer sample value that preceded the first sample in the current 101 | series and setting the \fBcomphistory\fP flag to true (1). 102 | 103 | .SH RETURN VALUES 104 | \fBmst_pack\fP returns the number records created on success and -1 on 105 | error. 106 | 107 | \fBmst_packgroup\fP returns the total (for all MSTraces) number of 108 | record created on success and -1 on error. 109 | 110 | .SH CAVEATS 111 | When using a MSRecord template (\fImstemplate\fP) the dataquality 112 | member must be set to a valid value. It is also advisable to set the 113 | network, station, location and channel indicators to appropriate 114 | values. Unless these source indicators need to change they can simply 115 | be copied from the matching MSTrace members. 116 | 117 | .SH EXAMPLE 118 | Skeleton code for creating (packing) Mini-SEED records with 119 | mst_pack(3): 120 | 121 | .nf 122 | static void record_handler (char *record, int reclen, void *srcname) { 123 | if ( fwrite(record, reclen, 1, outfile) != 1 ) 124 | { 125 | ms_log (2, "Error writing %s to output file\n", (char *)srcname); 126 | } 127 | } 128 | 129 | main() { 130 | int64_t psamples; 131 | int precords; 132 | MSTrace *mst; 133 | char srcname[50]; 134 | 135 | mst = mst_init (NULL); 136 | 137 | /* Populate MSTrace values */ 138 | strcpy (mst->network, "XX"); 139 | strcpy (mst->station, "TEST"); 140 | strcpy (mst->channel, "BHE"); 141 | mst->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.000000"); 142 | mst->samprate = 40.0; 143 | 144 | /* The datasamples pointer and numsamples counter will be adjusted by 145 | the packing routine, the datasamples array must be dynamic memory 146 | allocated by the malloc() family of routines. */ 147 | mst->datasamples = dataptr; /* pointer to 32-bit integer data samples */ 148 | mst->numsamples = 1234; 149 | mst->sampletype = 'i'; /* declare type to be 32-bit integers */ 150 | 151 | mst_srcname (mst, srcname, 0); 152 | 153 | /* Pack 4096 byte, big-endian records, using Steim-2 compression */ 154 | precords = mst_pack (mst, &record_handler, srcname, 4096, DE_STEIM2, 155 | 1, &psamples, 1, verbose, NULL); 156 | 157 | ms_log (0, "Packed %"PRId64" samples into %d records\n", 158 | psamples, precords); 159 | 160 | mst_free (&mst); 161 | } 162 | .fi 163 | 164 | .SH SEE ALSO 165 | \fBms_intro(3)\fP and \fBmsr_pack(3)\fP. 166 | 167 | .SH AUTHOR 168 | .nf 169 | Chad Trabant 170 | IRIS Data Management Center 171 | .fi 172 | -------------------------------------------------------------------------------- /libmseed/doc/mst_packgroup.3: -------------------------------------------------------------------------------- 1 | mst_pack.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_printgaplist.3: -------------------------------------------------------------------------------- 1 | mst_printtracelist.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_printsynclist.3: -------------------------------------------------------------------------------- 1 | mst_printtracelist.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_printtracelist.3: -------------------------------------------------------------------------------- 1 | .TH MST_PRINT 3 2008/11/21 "Libmseed API" 2 | .SH NAME 3 | mst_print - Printing of MSTrace information. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "void \fBmst_printtracelist\fP ( MSTraceGroup *" mstg ", flag " timeformat "," 10 | .BI " flag " details ", flag " gaps " );" 11 | 12 | .BI "void \fBmst_printsynclist\fP ( MSTraceGroup *" mstg ", char *" dccid "," 13 | .BI " flag " subsecond " );" 14 | 15 | .BI "void \fBmst_printgaplist\fP ( MSTraceGroup *" mstg ", flag " timeformat "," 16 | .BI " double *" mingap ", double *" maxgap " );" 17 | .fi 18 | 19 | .SH DESCRIPTION 20 | \fBmst_printtracelist\fP prints a formatted list of the MSTrace 21 | segments in the given MSTraceGroup. If the \fIdetails\fP flag is 22 | greater than 0 the sample rate and sample count are printed for each 23 | trace. If the \fIgaps\fP flag is greater than zero the time gap from 24 | the previous MSTrace (if the source name matches) is printed. All 25 | output is printed using \fBms_log(3)\fP at level 0. 26 | 27 | \fBmst_printsynclist\fP prints a formatted list of the MSTrace 28 | segments in the given MSTraceGroup similar to \fBmst_printtracelist\fP 29 | but the format is a SYNC listing. If a \fIdccid\fP string is supplied 30 | it will be used along with the current system date to create the SYNC 31 | header line. If the \fIsubsecond\fP flag is true (non-zero) the time 32 | values in the SYNC lines will include full libmseed precision, 33 | otherwise they will be truncted to integer second values. 34 | 35 | \fBmst_printgaplist\fP prints a formatted list of the gaps between 36 | MSTrace segments in the given MSTraceGroup. If \fImingap\fP or 37 | \fImaxgap\fP is not NULL their values will be enforced and only 38 | gaps/overlaps matching their implied criteria will be printed. 39 | 40 | The \fItimeformat\fP argument for both \fBmst_printtracelist\fP and 41 | \fBmst_printgaplist\fP controls the format of the resulting time 42 | strings. Possible formats are: 43 | 44 | .nf 45 | 0 : SEED time format (2005,146,00:00:00.000000) 46 | 1 : ISO time format (2005-05-26T00:00:00.000000) 47 | 2 : Epoch time, seconds since the epoch (1117065600.00000000) 48 | .fi 49 | 50 | Both \fBmst_printtracelist\fP and \fBmst_printgaplist\fP represent 51 | time overlaps as negative gaps. For a single sample overlap the value 52 | of the gap is calculated as zero, this will be printed as "-0" or 53 | negative zero to indicate an overlap. 54 | 55 | .SH GAP/OVERLAP RULES 56 | The existence of gaps and overlaps is implicit in the structure of the 57 | MSTraceGroup, no special processing is done to detect gaps and overlaps 58 | in these routines. 59 | 60 | The value of a gap is calculated as the difference between the time of 61 | the last sample before the gap and the time of the first sample after 62 | the gap. No sample 'coverage' time is included. 63 | 64 | The value of an overlap is calculated as the time between two samples 65 | which represent the maximum amount of timeseries overlap. 66 | 67 | When the MSTraces in the MSTraceGroup include a small segment that is 68 | completely overlapped by another larger segment the gap/overlap value 69 | will not be correct for either the smaller segment or the segment 70 | following it. 71 | 72 | .SH SEE ALSO 73 | \fBms_intro(3)\fP 74 | 75 | .SH AUTHOR 76 | .nf 77 | Chad Trabant 78 | IRIS Data Management Center 79 | .fi 80 | -------------------------------------------------------------------------------- /libmseed/doc/mst_srcname.3: -------------------------------------------------------------------------------- 1 | ms_srcname.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_writemseed.3: -------------------------------------------------------------------------------- 1 | ms_writemseed.3 -------------------------------------------------------------------------------- /libmseed/doc/mst_writemseedgroup.3: -------------------------------------------------------------------------------- 1 | ms_writemseed.3 -------------------------------------------------------------------------------- /libmseed/doc/mstl_addmsr.3: -------------------------------------------------------------------------------- 1 | .TH MSTL_INIT 3 2008/11/21 "Libmseed API" 2 | .SH NAME 3 | mstl_init - Adding MSRecord data coverage to and MSTraceList structure 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "MSTraceSeg *\fBmstl_addmsr\fP ( MSTraceList *" mstl ", MSRecord *" msr "," 10 | .BI " flag " dataquality ", flag " autoheal "," 11 | .BI " double " timetol ", double " sampratetol " );" 12 | 13 | .fi 14 | 15 | .SH DESCRIPTION 16 | \fBmstl_addmsr\fP adds the data coverage in a MSRecord structure to 17 | the specified MSTraceList structure. If data samples are associated 18 | with the MSRecord they will also be added to the MSTraceList. New 19 | MSTraceID and MSTraceSeg sub-structures will be created and added to 20 | the MSTraceList as needed. 21 | 22 | Each MSTraceList contains a list of trace IDs as MSTraceID structures 23 | each of which contain a list of time segments as MSTraceSeg 24 | structures. This routine will maintain the list of trace IDs in 25 | alphanumeric sort order and the subsequent time segments in time 26 | order. 27 | 28 | If the \fIdataquality\fP flag is true traces will be grouped by 29 | quality in addition to the source name identifiers, in short 30 | differentiate using quality or not. 31 | 32 | If the \fIautoheal\fP flag is true any two trace segments which would 33 | fit together due to the addition of the new MSRecord coverage will be 34 | merged. The only reason to set this option to false (0) is if the 35 | \fBprvtptr\fP pointer member of the MSTraceSeg structures is being 36 | used since libmseed has no knowledge how such data should be merged. 37 | 38 | .SH RETURN VALUES 39 | \fBmstl_addmsr\fP returns NULL on error and a pointer to the 40 | MSTraceSeg structure to which the data coverage was added on success. 41 | 42 | .SH SEE ALSO 43 | \fBmstl_init(3)\fP and \fBmstl_free(3)\fP. 44 | 45 | .SH AUTHOR 46 | .nf 47 | Chad Trabant 48 | IRIS Data Management Center 49 | .fi 50 | -------------------------------------------------------------------------------- /libmseed/doc/mstl_convertsamples.3: -------------------------------------------------------------------------------- 1 | mst_convertsamples.3 -------------------------------------------------------------------------------- /libmseed/doc/mstl_free.3: -------------------------------------------------------------------------------- 1 | mstl_init.3 -------------------------------------------------------------------------------- /libmseed/doc/mstl_init.3: -------------------------------------------------------------------------------- 1 | .TH MSTL_INIT 3 2008/11/21 "Libmseed API" 2 | .SH NAME 3 | mstl_init - Initializing and freeing MSTraceList structures 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "MSTrace *\fBmstl_init\fP ( MSTrace *" mstl " );" 10 | 11 | .BI "void \fBmstl_free\fP ( MSTrace **" ppmstl ", flag " freeprvtptr " );" 12 | .fi 13 | 14 | .SH DESCRIPTION 15 | \fBmstl_init\fP will initialize a MSTraceList structure. If the 16 | \fImstl\fP parameter is not NULL the structure will be cleared before 17 | being reallocated any memory allocated for associated MSTraceID and 18 | relate sub-structures will be freed. 19 | 20 | \fBmstl_free\fP will free all memory associated with a MSTraceList 21 | structure and set the structure pointer (*\fIppmstl\fP) to 0. If the 22 | \fIfreeprvtptr\fP flag is true any memory pointed to by the 23 | \fIprvtptr\fP members of the MSTraceID or MSTraceSeg structures. 24 | 25 | .SH RETURN VALUES 26 | \fBmstl_init\fP returns a pointer to the MSTraceList structure 27 | initialized on success or NULL on error. 28 | 29 | .SH SEE ALSO 30 | \fBmstl_addmsr(3)\fP. 31 | 32 | .SH AUTHOR 33 | .nf 34 | Chad Trabant 35 | IRIS Data Management Center 36 | .fi 37 | -------------------------------------------------------------------------------- /libmseed/doc/mstl_printgaplist.3: -------------------------------------------------------------------------------- 1 | mstl_printtracelist.3 -------------------------------------------------------------------------------- /libmseed/doc/mstl_printsynclist.3: -------------------------------------------------------------------------------- 1 | mstl_printtracelist.3 -------------------------------------------------------------------------------- /libmseed/doc/mstl_printtracelist.3: -------------------------------------------------------------------------------- 1 | .TH MSTL_PRINT 3 2008/11/21 "Libmseed API" 2 | .SH NAME 3 | mstl_print - Printing of MSTrace information. 4 | 5 | .SH SYNOPSIS 6 | .nf 7 | .B #include 8 | 9 | .BI "void \fBmstl_printtracelist\fP ( MSTraceList *" mstl ", flag " timeformat "," 10 | .BI " flag " details ", flag " gaps " );" 11 | 12 | .BI "void \fBmstl_printsynclist\fP ( MSTraceList *" mstl ", char *" dccid "," 13 | .BI " flag " subsecond " );" 14 | 15 | .BI "void \fBmstl_printgaplist\fP ( MSTraceList *" mstl ", flag " timeformat "," 16 | .BI " double *" mingap ", double *" maxgap " );" 17 | .fi 18 | 19 | .SH DESCRIPTION 20 | \fBmstl_printtracelist\fP prints a formatted list of the trace 21 | segments in the given MSTraceList. If the \fIdetails\fP flag is 22 | greater than 0 the sample rate and sample count are printed for each 23 | trace. If the \fIgaps\fP flag is greater than zero the time gap from 24 | the previous segment is printed. All output is printed using 25 | \fBms_log(3)\fP at level 0. 26 | 27 | \fBmstl_printsynclist\fP prints a formatted list of the trace segments 28 | in the given MSTraceList similar to \fBmstl_printtracelist\fP but the 29 | format is a SYNC listing. If a \fIdccid\fP string is supplied it will 30 | be used along with the current system date to create the SYNC header 31 | line. If the \fIsubsecond\fP flag is true (non-zero) the time values 32 | in the SYNC lines will include full libmseed precision, otherwise they 33 | will be truncted to integer second values. 34 | 35 | \fBmstl_printgaplist\fP prints a formatted list of the gaps between 36 | trace segments in the given MSTraceList. If \fImingap\fP or 37 | \fImaxgap\fP is not NULL their values will be enforced and only 38 | gaps/overlaps matching their implied criteria will be printed. 39 | 40 | The \fItimeformat\fP argument for both \fBmstl_printtracelist\fP and 41 | \fBmstl_printgaplist\fP controls the format of the resulting time 42 | strings. Possible formats are: 43 | 44 | .nf 45 | 0 : SEED time format (2005,146,00:00:00.000000) 46 | 1 : ISO time format (2005-05-26T00:00:00.000000) 47 | 2 : Epoch time, seconds since the epoch (1117065600.00000000) 48 | .fi 49 | 50 | Both \fBmstl_printtracelist\fP and \fBmstl_printgaplist\fP represent 51 | time overlaps as negative gaps. For a single sample overlap the value 52 | of the gap is calculated as zero, this will be printed as "-0" or 53 | negative zero to indicate an overlap. 54 | 55 | .SH GAP/OVERLAP RULES 56 | The existence of gaps and overlaps is implicit in the structure of the 57 | MSTraceList, no special processing is done to detect gaps and overlaps 58 | in these routines. 59 | 60 | The value of a gap is calculated as the difference between the time of 61 | the last sample before the gap and the time of the first sample after 62 | the gap. No sample 'coverage' time is included. 63 | 64 | The value of an overlap is calculated as the time between two samples 65 | which represent the maximum amount of timeseries overlap. 66 | 67 | When the traces in the MSTraceList include a small segment that is 68 | completely overlapped by another larger segment the gap/overlap value 69 | will not be correct for either the smaller segment or the segment 70 | following it. 71 | 72 | .SH SEE ALSO 73 | \fBms_intro(3)\fP 74 | 75 | .SH AUTHOR 76 | .nf 77 | Chad Trabant 78 | IRIS Data Management Center 79 | .fi 80 | -------------------------------------------------------------------------------- /libmseed/example/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # Build environment can be configured the following 3 | # environment variables: 4 | # CC : Specify the C compiler to use 5 | # CFLAGS : Specify compiler options to use 6 | 7 | # Required compiler parameters 8 | CFLAGS += -I.. 9 | 10 | LDFLAGS = -L.. 11 | LDLIBS = -lmseed 12 | 13 | all: msview msrepack 14 | 15 | msview: msview.o 16 | $(CC) $(CFLAGS) -o $@ msview.o $(LDFLAGS) $(LDLIBS) 17 | 18 | msrepack: msrepack.o 19 | $(CC) $(CFLAGS) -o $@ msrepack.o $(LDFLAGS) $(LDLIBS) 20 | 21 | clean: 22 | rm -f msview.o msview msrepack.o msrepack 23 | 24 | install: 25 | @echo 26 | @echo "No install target, copy the executable(s) as needed" 27 | @echo 28 | -------------------------------------------------------------------------------- /libmseed/example/Makefile.wat: -------------------------------------------------------------------------------- 1 | # 2 | # Wmake file - For Watcom's wmake 3 | # Use 'wmake -f Makefile.wat' 4 | 5 | .BEFORE 6 | @set INCLUDE=.;$(%watcom)\H;$(%watcom)\H\NT 7 | @set LIB=.;$(%watcom)\LIB386 8 | 9 | cc = wcc386 10 | cflags = -zq 11 | lflags = OPT quiet OPT map LIBRARY ..\libmseed.lib 12 | cvars = $+$(cvars)$- -DWIN32 13 | 14 | BINS = msrepack.exe msview.exe 15 | 16 | INCS = -I.. 17 | 18 | all: $(BINS) 19 | 20 | msrepack.exe: msrepack.obj 21 | wlink $(lflags) name msrepack file {msrepack.obj} 22 | 23 | msview.exe: msview.obj 24 | wlink $(lflags) name msview file {msview.obj} 25 | 26 | # Source dependencies: 27 | msrepack.obj: msrepack.c 28 | msview.obj: msview.c 29 | 30 | # How to compile sources: 31 | .c.obj: 32 | $(cc) $(cflags) $(cvars) $(INCS) $[@ -fo=$@ 33 | 34 | # Clean-up directives: 35 | clean: .SYMBOLIC 36 | del *.obj *.map 37 | del $(BINS) 38 | -------------------------------------------------------------------------------- /libmseed/example/Makefile.win: -------------------------------------------------------------------------------- 1 | # 2 | # Nmake file - Windows version 3 | # Use 'nmake -f Makefile.win' 4 | 5 | NODEBUG=1 6 | 7 | INCS = /I.. 8 | OPTS = -D_CRT_SECURE_NO_WARNINGS 9 | LIBS = ../libmseed.lib 10 | BINS = msrepack.exe msview.exe 11 | 12 | all: $(BINS) 13 | 14 | msrepack.exe: msrepack.obj 15 | link.exe /nologo /out:msrepack.exe $(LIBS) msrepack.obj 16 | 17 | msview.exe: msview.obj 18 | link.exe /nologo /out:msview.exe $(LIBS) msview.obj 19 | 20 | .c.obj: 21 | $(CC) /nologo $(CFLAGS) $(INCS) $(OPTS) /c $< 22 | 23 | # Clean-up directives 24 | clean: 25 | -del a.out core *.o *.obj *% *~ $(BINS) 26 | -------------------------------------------------------------------------------- /libmseed/example/README: -------------------------------------------------------------------------------- 1 | 2 | Documentation of the libmseed interfaces can be found in the 'doc' 3 | directory. 4 | 5 | Unix: the Makefile should work for most systems, try 'make'. 6 | 7 | Win32: the Makefile.win is for Microsoft's nmake (e.g. 'nmake -f 8 | Makefile.win') and Makefile.wat is for Open Watcom's wmake 9 | (e.g. 'wmake -f Makefile.wat'). 10 | 11 | 12 | msview.c: 13 | 14 | An example program that demonstrates basic usage of libmseed. A 15 | Makefile is provided to build the program. The example does not 16 | exercise all of the functionality of libmseed but should illustrate 17 | some of the basic ideas. 18 | 19 | msrepack.c: 20 | 21 | An example of using libmseed to build Mini-SEED records, this 22 | program will repack input Mini-SEED data. 23 | -------------------------------------------------------------------------------- /libmseed/example/test.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/example/test.mseed -------------------------------------------------------------------------------- /libmseed/gswap.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * gswap.c: 3 | * 4 | * Functions for generalized, in-place byte swapping between LSBF and 5 | * MSBF byte orders. 6 | * 7 | * Some standard integer types are needed, namely uint8_t and 8 | * uint32_t, (these are normally declared by including inttypes.h or 9 | * stdint.h). Each function expects it's input to be a void pointer 10 | * to a quantity of the appropriate size. 11 | * 12 | * There are two versions of most routines, one that works on 13 | * quantities regardless of alignment (gswapX) and one that works on 14 | * memory aligned quantities (gswapXa). The memory aligned versions 15 | * (gswapXa) are much faster than the other versions (gswapX), but the 16 | * memory *must* be aligned. 17 | * 18 | * Written by Chad Trabant, 19 | * IRIS Data Management Center 20 | * 21 | * Version: 2010.006 22 | ***************************************************************************/ 23 | 24 | #include "libmseed.h" 25 | 26 | /* Swap routines that work on any (aligned or not) quantities */ 27 | 28 | void 29 | ms_gswap2 (void *data2) 30 | { 31 | uint8_t temp; 32 | 33 | union { 34 | uint8_t c[2]; 35 | } dat; 36 | 37 | memcpy (&dat, data2, 2); 38 | temp = dat.c[0]; 39 | dat.c[0] = dat.c[1]; 40 | dat.c[1] = temp; 41 | memcpy (data2, &dat, 2); 42 | } 43 | 44 | void 45 | ms_gswap3 (void *data3) 46 | { 47 | uint8_t temp; 48 | 49 | union { 50 | uint8_t c[3]; 51 | } dat; 52 | 53 | memcpy (&dat, data3, 3); 54 | temp = dat.c[0]; 55 | dat.c[0] = dat.c[2]; 56 | dat.c[2] = temp; 57 | memcpy (data3, &dat, 3); 58 | } 59 | 60 | void 61 | ms_gswap4 (void *data4) 62 | { 63 | uint8_t temp; 64 | 65 | union { 66 | uint8_t c[4]; 67 | } dat; 68 | 69 | memcpy (&dat, data4, 4); 70 | temp = dat.c[0]; 71 | dat.c[0] = dat.c[3]; 72 | dat.c[3] = temp; 73 | temp = dat.c[1]; 74 | dat.c[1] = dat.c[2]; 75 | dat.c[2] = temp; 76 | memcpy (data4, &dat, 4); 77 | } 78 | 79 | void 80 | ms_gswap8 (void *data8) 81 | { 82 | uint8_t temp; 83 | 84 | union { 85 | uint8_t c[8]; 86 | } dat; 87 | 88 | memcpy (&dat, data8, 8); 89 | temp = dat.c[0]; 90 | dat.c[0] = dat.c[7]; 91 | dat.c[7] = temp; 92 | 93 | temp = dat.c[1]; 94 | dat.c[1] = dat.c[6]; 95 | dat.c[6] = temp; 96 | 97 | temp = dat.c[2]; 98 | dat.c[2] = dat.c[5]; 99 | dat.c[5] = temp; 100 | 101 | temp = dat.c[3]; 102 | dat.c[3] = dat.c[4]; 103 | dat.c[4] = temp; 104 | memcpy (data8, &dat, 8); 105 | } 106 | 107 | /* Swap routines that work on memory aligned quantities */ 108 | 109 | void 110 | ms_gswap2a (void *data2) 111 | { 112 | uint16_t *data = data2; 113 | 114 | *data = (((*data >> 8) & 0xff) | ((*data & 0xff) << 8)); 115 | } 116 | 117 | void 118 | ms_gswap4a (void *data4) 119 | { 120 | uint32_t *data = data4; 121 | 122 | *data = (((*data >> 24) & 0xff) | ((*data & 0xff) << 24) | 123 | ((*data >> 8) & 0xff00) | ((*data & 0xff00) << 8)); 124 | } 125 | 126 | void 127 | ms_gswap8a (void *data8) 128 | { 129 | uint32_t *data4 = data8; 130 | uint32_t h0, h1; 131 | 132 | h0 = data4[0]; 133 | h0 = (((h0 >> 24) & 0xff) | ((h0 & 0xff) << 24) | 134 | ((h0 >> 8) & 0xff00) | ((h0 & 0xff00) << 8)); 135 | 136 | h1 = data4[1]; 137 | h1 = (((h1 >> 24) & 0xff) | ((h1 & 0xff) << 24) | 138 | ((h1 >> 8) & 0xff00) | ((h1 & 0xff00) << 8)); 139 | 140 | data4[0] = h1; 141 | data4[1] = h0; 142 | } 143 | -------------------------------------------------------------------------------- /libmseed/libmseed.def: -------------------------------------------------------------------------------- 1 | LIBRARY libmseed.dll 2 | EXPORTS 3 | msr_parse 4 | msr_parse_selection 5 | msr_unpack 6 | msr_pack 7 | msr_pack_header 8 | msr_init 9 | msr_free 10 | msr_free_blktchain 11 | msr_addblockette 12 | msr_normalize_header 13 | msr_duplicate 14 | msr_samprate 15 | msr_nomsamprate 16 | msr_starttime 17 | msr_starttime_uc 18 | msr_endtime 19 | msr_srcname 20 | msr_print 21 | msr_host_latency 22 | ms_detect 23 | ms_parse_raw 24 | mst_init 25 | mst_free 26 | mst_initgroup 27 | mst_freegroup 28 | mst_findmatch 29 | mst_findadjacent 30 | mst_addmsr 31 | mst_addspan 32 | mst_addmsrtogroup 33 | mst_addtracetogroup 34 | mst_groupheal 35 | mst_groupsort 36 | mst_srcname 37 | mst_printtracelist 38 | mst_printsynclist 39 | mst_printgaplist 40 | mst_pack 41 | mst_packgroup 42 | mstl_init 43 | mstl_free 44 | mstl_addmsr 45 | mstl_printtracelist 46 | mstl_printsynclist 47 | mstl_printgaplist 48 | ms_readmsr 49 | ms_readmsr_r 50 | ms_readmsr_main 51 | ms_readtraces 52 | ms_readtraces_timewin 53 | ms_readtraces_selection 54 | ms_readtracelist 55 | ms_readtracelist_timewin 56 | ms_readtracelist_selection 57 | msr_writemseed 58 | mst_writemseed 59 | mst_writemseedgroup 60 | ms_recsrcname 61 | ms_splitsrcname 62 | ms_strncpclean 63 | ms_strncpopen 64 | ms_doy2md 65 | ms_md2doy 66 | ms_btime2hptime 67 | ms_btime2isotimestr 68 | ms_btime2mdtimestr 69 | ms_btime2seedtimestr 70 | ms_hptime2btime 71 | ms_hptime2isotimestr 72 | ms_hptime2mdtimestr 73 | ms_hptime2seedtimestr 74 | ms_time2hptime 75 | ms_seedtimestr2hptime 76 | ms_timestr2hptime 77 | ms_nomsamprate 78 | ms_genfactmult 79 | ms_ratapprox 80 | ms_bigendianhost 81 | ms_dabs 82 | ms_samplesize 83 | ms_encodingstr 84 | ms_blktdesc 85 | ms_blktlen 86 | ms_errorstr 87 | ms_log 88 | ms_log_l 89 | ms_loginit 90 | ms_loginit_l 91 | ms_matchselect 92 | msr_matchselect 93 | ms_addselect 94 | ms_addselect_comp 95 | ms_readselectionsfile 96 | ms_freeselections 97 | ms_printselections 98 | ms_gswap2 99 | ms_gswap3 100 | ms_gswap4 101 | ms_gswap8 102 | ms_gswap2a 103 | ms_gswap4a 104 | ms_gswap8a 105 | -------------------------------------------------------------------------------- /libmseed/libmseed.map: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | ms_*; 4 | msr_*; 5 | mst_*; 6 | mstl_*; 7 | packheaderbyteorder; 8 | packdatabyteorder; 9 | unpackheaderbyteorder; 10 | unpackdatabyteorder; 11 | unpackencodingformat; 12 | unpackencodingfallback; 13 | 14 | local: 15 | *; 16 | }; 17 | -------------------------------------------------------------------------------- /libmseed/lmplatform.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * lmplatform.c: 3 | * 4 | * Platform portability routines. 5 | * 6 | * modified: 2010.304 7 | ***************************************************************************/ 8 | 9 | /* Define _LARGEFILE_SOURCE to get ftello/fseeko on some systems (Linux) */ 10 | #define _LARGEFILE_SOURCE 1 11 | 12 | #include "libmseed.h" 13 | 14 | /*************************************************************************** 15 | * lmp_ftello: 16 | * 17 | * Return the current file position for the specified descriptor using 18 | * the system's closest match to the POSIX ftello. 19 | ***************************************************************************/ 20 | off_t 21 | lmp_ftello (FILE *stream) 22 | { 23 | #if defined(LMP_WIN) 24 | return (off_t)ftell (stream); 25 | 26 | #else 27 | return (off_t)ftello (stream); 28 | 29 | #endif 30 | } /* End of lmp_ftello() */ 31 | 32 | /*************************************************************************** 33 | * lmp_fseeko: 34 | * 35 | * Seek to a specific file position for the specified descriptor using 36 | * the system's closest match to the POSIX fseeko. 37 | ***************************************************************************/ 38 | int 39 | lmp_fseeko (FILE *stream, off_t offset, int whence) 40 | { 41 | #if defined(LMP_WIN) 42 | return (int)fseek (stream, (long int)offset, whence); 43 | 44 | #else 45 | return (int)fseeko (stream, offset, whence); 46 | 47 | #endif 48 | } /* End of lmp_fseeko() */ 49 | -------------------------------------------------------------------------------- /libmseed/lmplatform.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * lmplatform.h: 3 | * 4 | * Platform specific headers. This file provides a basic level of platform 5 | * portability. 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Library General Public License 9 | * as published by the Free Software Foundation; either version 2 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Library General Public License (GNU-LGPL) for more details. The 16 | * GNU-LGPL and further information can be found here: 17 | * http://www.gnu.org/ 18 | * 19 | * Written by Chad Trabant, IRIS Data Management Center 20 | * 21 | * modified: 2015.134 22 | ***************************************************************************/ 23 | 24 | #ifndef LMPLATFORM_H 25 | #define LMPLATFORM_H 1 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* On some platforms (e.g. ARM) structures are aligned on word boundaries 32 | by adding padding between the elements. This library uses structs that 33 | map to SEED header/blockette structures that are required to have a 34 | layout exactly as specified, i.e. no padding. 35 | 36 | If "ATTRIBUTE_PACKED" is defined at compile time (e.g. -DATTRIBUTE_PACKED) 37 | the preprocessor will use the define below to add the "packed" attribute 38 | to effected structs. This attribute is supported by GCC and increasingly 39 | more compilers. 40 | */ 41 | #if defined(ATTRIBUTE_PACKED) 42 | #define LMP_PACKED __attribute__((packed)) 43 | #else 44 | #define LMP_PACKED 45 | #endif 46 | 47 | /* C99 standard headers */ 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | /* Set architecture specific defines and features */ 56 | #if defined(__linux__) || defined(__linux) || defined(__CYGWIN__) 57 | #define LMP_LINUX 1 58 | #define LMP_GLIBC2 1 /* Deprecated */ 59 | 60 | #include 61 | #include 62 | 63 | #elif defined(__sun__) || defined(__sun) 64 | #define LMP_SOLARIS 1 65 | 66 | #include 67 | #include 68 | 69 | #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) 70 | #define LMP_BSD 1 71 | 72 | #include 73 | #include 74 | 75 | #elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 76 | #define LMP_WIN 1 77 | #define LMP_WIN32 1 /* Deprecated */ 78 | 79 | #include 80 | #include 81 | 82 | /* For pre-MSVC 2010 define standard int types, otherwise use inttypes.h */ 83 | #if defined(_MSC_VER) && _MSC_VER < 1600 84 | typedef signed char int8_t; 85 | typedef unsigned char uint8_t; 86 | typedef signed short int int16_t; 87 | typedef unsigned short int uint16_t; 88 | typedef signed int int32_t; 89 | typedef unsigned int uint32_t; 90 | typedef signed __int64 int64_t; 91 | typedef unsigned __int64 uint64_t; 92 | #else 93 | #include 94 | #endif 95 | 96 | #if defined(_MSC_VER) 97 | #if !defined(PRId64) 98 | #define PRId64 "I64d" 99 | #endif 100 | #if !defined(SCNd64) 101 | #define SCNd64 "I64d" 102 | #endif 103 | 104 | #define snprintf _snprintf 105 | #define vsnprintf _vsnprintf 106 | #define strcasecmp _stricmp 107 | #define strncasecmp _strnicmp 108 | #define strtoull _strtoui64 109 | #define strdup _strdup 110 | #define fileno _fileno 111 | #endif 112 | 113 | #if defined(__MINGW32__) || defined(__MINGW64__) 114 | #define fstat _fstat 115 | #define stat _stat 116 | #endif 117 | 118 | #endif 119 | 120 | extern off_t lmp_ftello (FILE *stream); 121 | extern int lmp_fseeko (FILE *stream, off_t offset, int whence); 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif /* LMPLATFORM_H */ 128 | -------------------------------------------------------------------------------- /libmseed/lookup.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * lookup.c: 3 | * 4 | * Generic lookup routines for Mini-SEED information. 5 | * 6 | * Written by Chad Trabant, ORFEUS/EC-Project MEREDIAN 7 | * 8 | * modified: 2006.346 9 | ***************************************************************************/ 10 | 11 | #include 12 | 13 | #include "libmseed.h" 14 | 15 | /*************************************************************************** 16 | * ms_samplesize(): 17 | * 18 | * Returns the sample size based on type code or 0 for unknown. 19 | ***************************************************************************/ 20 | uint8_t 21 | ms_samplesize (const char sampletype) 22 | { 23 | switch (sampletype) 24 | { 25 | case 'a': 26 | return 1; 27 | case 'i': 28 | case 'f': 29 | return 4; 30 | case 'd': 31 | return 8; 32 | default: 33 | return 0; 34 | } /* end switch */ 35 | 36 | } /* End of ms_samplesize() */ 37 | 38 | /*************************************************************************** 39 | * ms_encodingstr(): 40 | * 41 | * Returns a string describing a data encoding format. 42 | ***************************************************************************/ 43 | char * 44 | ms_encodingstr (const char encoding) 45 | { 46 | switch (encoding) 47 | { 48 | case 0: 49 | return "ASCII text"; 50 | case 1: 51 | return "16 bit integers"; 52 | case 2: 53 | return "24 bit integers"; 54 | case 3: 55 | return "32 bit integers"; 56 | case 4: 57 | return "IEEE floating point"; 58 | case 5: 59 | return "IEEE double precision float"; 60 | case 10: 61 | return "STEIM 1 Compression"; 62 | case 11: 63 | return "STEIM 2 Compression"; 64 | case 12: 65 | return "GEOSCOPE Muxed 24 bit int"; 66 | case 13: 67 | return "GEOSCOPE Muxed 16/3 bit gain/exp"; 68 | case 14: 69 | return "GEOSCOPE Muxed 16/4 bit gain/exp"; 70 | case 15: 71 | return "US National Network compression"; 72 | case 16: 73 | return "CDSN 16 bit gain ranged"; 74 | case 17: 75 | return "Graefenberg 16 bit gain ranged"; 76 | case 18: 77 | return "IPG - Strasbourg 16 bit gain"; 78 | case 19: 79 | return "STEIM 3 Compression"; 80 | case 30: 81 | return "SRO Gain Ranged Format"; 82 | case 31: 83 | return "HGLP Format"; 84 | case 32: 85 | return "DWWSSN Format"; 86 | case 33: 87 | return "RSTN 16 bit gain ranged"; 88 | default: 89 | return "Unknown format code"; 90 | } /* end switch */ 91 | 92 | } /* End of ms_encodingstr() */ 93 | 94 | /*************************************************************************** 95 | * ms_blktdesc(): 96 | * 97 | * Return a string describing a given blockette type or NULL if the 98 | * type is unknown. 99 | ***************************************************************************/ 100 | char * 101 | ms_blktdesc (uint16_t blkttype) 102 | { 103 | switch (blkttype) 104 | { 105 | case 100: 106 | return "Sample Rate"; 107 | case 200: 108 | return "Generic Event Detection"; 109 | case 201: 110 | return "Murdock Event Detection"; 111 | case 300: 112 | return "Step Calibration"; 113 | case 310: 114 | return "Sine Calibration"; 115 | case 320: 116 | return "Pseudo-random Calibration"; 117 | case 390: 118 | return "Generic Calibration"; 119 | case 395: 120 | return "Calibration Abort"; 121 | case 400: 122 | return "Beam"; 123 | case 500: 124 | return "Timing"; 125 | case 1000: 126 | return "Data Only SEED"; 127 | case 1001: 128 | return "Data Extension"; 129 | case 2000: 130 | return "Opaque Data"; 131 | } /* end switch */ 132 | 133 | return NULL; 134 | 135 | } /* End of ms_blktdesc() */ 136 | 137 | /*************************************************************************** 138 | * ms_blktlen(): 139 | * 140 | * Returns the total length of a given blockette type in bytes or 0 if 141 | * type unknown. 142 | ***************************************************************************/ 143 | uint16_t 144 | ms_blktlen (uint16_t blkttype, const char *blkt, flag swapflag) 145 | { 146 | uint16_t blktlen = 0; 147 | 148 | switch (blkttype) 149 | { 150 | case 100: /* Sample Rate */ 151 | blktlen = 12; 152 | break; 153 | case 200: /* Generic Event Detection */ 154 | blktlen = 28; 155 | break; 156 | case 201: /* Murdock Event Detection */ 157 | blktlen = 36; 158 | break; 159 | case 300: /* Step Calibration */ 160 | blktlen = 32; 161 | break; 162 | case 310: /* Sine Calibration */ 163 | blktlen = 32; 164 | break; 165 | case 320: /* Pseudo-random Calibration */ 166 | blktlen = 28; 167 | break; 168 | case 390: /* Generic Calibration */ 169 | blktlen = 28; 170 | break; 171 | case 395: /* Calibration Abort */ 172 | blktlen = 16; 173 | break; 174 | case 400: /* Beam */ 175 | blktlen = 16; 176 | break; 177 | case 500: /* Timing */ 178 | blktlen = 8; 179 | break; 180 | case 1000: /* Data Only SEED */ 181 | blktlen = 8; 182 | break; 183 | case 1001: /* Data Extension */ 184 | blktlen = 8; 185 | break; 186 | case 2000: /* Opaque Data */ 187 | /* First 2-byte field after the blockette header is the length */ 188 | if (blkt) 189 | { 190 | memcpy ((void *)&blktlen, blkt + 4, sizeof (int16_t)); 191 | if (swapflag) 192 | ms_gswap2 (&blktlen); 193 | } 194 | break; 195 | } /* end switch */ 196 | 197 | return blktlen; 198 | 199 | } /* End of ms_blktlen() */ 200 | 201 | /*************************************************************************** 202 | * ms_errorstr(): 203 | * 204 | * Return a string describing a given libmseed error code or NULL if the 205 | * code is unknown. 206 | ***************************************************************************/ 207 | char * 208 | ms_errorstr (int errorcode) 209 | { 210 | switch (errorcode) 211 | { 212 | case MS_ENDOFFILE: 213 | return "End of file reached"; 214 | case MS_NOERROR: 215 | return "No error"; 216 | case MS_GENERROR: 217 | return "Generic error"; 218 | case MS_NOTSEED: 219 | return "No SEED data detected"; 220 | case MS_WRONGLENGTH: 221 | return "Length of data read does not match record length"; 222 | case MS_OUTOFRANGE: 223 | return "SEED record length out of range"; 224 | case MS_UNKNOWNFORMAT: 225 | return "Unknown data encoding format"; 226 | case MS_STBADCOMPFLAG: 227 | return "Bad Steim compression flag(s) detected"; 228 | } /* end switch */ 229 | 230 | return NULL; 231 | 232 | } /* End of ms_blktdesc() */ 233 | -------------------------------------------------------------------------------- /libmseed/matlab/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # Matlab/GNU Octave MEX build 3 | 4 | MEX = mex 5 | 6 | # Location of Matlab's mex 7 | #MEX = /Applications/MATLAB_R2011a.app/bin/mex 8 | 9 | # Location of GNU Octave's mkoctfile 10 | #MEX = /usr/local/bin/mkoctfile --mex 11 | 12 | LIBSRC = ../libmseed.a 13 | 14 | all: 15 | $(MEX) mexMsReadTracesNative.c $(LIBSRC) 16 | $(MEX) mexMsReadTraces.c $(LIBSRC) 17 | 18 | clean: 19 | rm -f *.mex* *.o 20 | -------------------------------------------------------------------------------- /libmseed/matlab/README: -------------------------------------------------------------------------------- 1 | 2 | The contents of this directory are wrapper MEX functions that interface 3 | libmseed functionality with Matlab and GNU Octave. 4 | 5 | A help message is included for each function interface wrapper, simply 6 | typing the name of the function from within Matlab/Octave will display 7 | a simple usage message. 8 | 9 | -- Building -- 10 | 11 | The static libmseed.a library must already be built before compiling the 12 | mex interface routines. 13 | 14 | On most Unix like systems you'll first need to edit Makefile and set the 15 | MEX variable to your desired 'mex'/'mkoctfile'. Then a simple 'make' 16 | should compile the mex interface routines. 17 | 18 | -------------------------------------------------------------------------------- /libmseed/matlab/mexMsReadTraces.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * mexMsReadTraces.c 3 | * 4 | * This file is part of the library libmseed. 5 | * 6 | * libmseed is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * libmseed is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Foobar; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Mex wrapper function for the msReadTraces function in the libmseed library. 21 | * 22 | * mexMsReadTraces takes the following arguments: 23 | * filename 24 | * [timetolerance] 25 | * [sampratetolerance] 26 | * [verbosity] 27 | * 28 | * The return value is a Matlab structure similiar to the libmseed structure 29 | * MSTrace_s containing the trace header and data. 30 | * 31 | * Original written by Stefan Mertl 32 | * Vienna University of Technology 33 | * Institute of Geodesy and Geophysics 34 | * Dept. of Geophysics 35 | * 36 | * Further modification by Chad Trabant, IRIS Data Managment Center 37 | * 38 | * modified: 2008.171 39 | ***************************************************************************/ 40 | 41 | #include "mex.h" 42 | #include "../libmseed.h" 43 | 44 | void 45 | mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) 46 | { 47 | MSTraceGroup *mstg = NULL; 48 | MSTrace *mst = NULL; 49 | const char **my_fnames = NULL; 50 | char *filename; 51 | int buflen; 52 | double timetol = -1.0; 53 | double sampratetol = -1.0; 54 | flag verbose = 0; 55 | int i, j, nfields; 56 | mxArray *tmp_val; 57 | double *tmp_val_ptr; 58 | int *data; 59 | 60 | /* Sanity check input and output */ 61 | if ( nrhs < 1 ) 62 | { 63 | mexPrintf ("mexMsReadTraces - Read Mini-SEED data into Matlab\n\n"); 64 | mexPrintf ("Usage: mexMsReadTraces (filename, [timetol], [sampratetol], [verbosity])\n"); 65 | mexPrintf (" filename - Name of file to read Mini-SEED data from\n"); 66 | mexPrintf (" timetol - Time tolerance, default is 1/2 sample period (-1)\n"); 67 | mexPrintf (" sampratetol - Sample rate tolerance, default is rate depdendent (-1)\n"); 68 | mexPrintf (" verbosity - Level of diagnostic messages, default 0\n\n"); 69 | mexErrMsgTxt ("At lease one 1 argument required."); 70 | } 71 | else if ( nlhs > 1 ) 72 | { 73 | mexErrMsgTxt ("Too many output arguments."); 74 | } 75 | 76 | /* Redirect libmseed logging messages to Matlab functions */ 77 | ms_loginit ((void *)&mexPrintf, NULL, (void *)&mexWarnMsgTxt, NULL); 78 | 79 | /* Get the length of the input string */ 80 | buflen = (mxGetM (prhs[0]) * mxGetN (prhs[0])) + 1; 81 | 82 | /* Allocate memory for input string */ 83 | filename = mxCalloc (buflen, sizeof (char)); 84 | 85 | /* Assign the input arguments to variables */ 86 | if ( mxGetString (prhs[0], filename, buflen) ) 87 | mexErrMsgTxt ("Not enough space. Filename string is truncated."); 88 | if ( nrhs >= 2 ) 89 | timetol = mxGetScalar(prhs[1]); 90 | if ( nrhs >= 3 ) 91 | sampratetol = mxGetScalar(prhs[2]); 92 | if ( nrhs >= 4 ) 93 | verbose = (flag) mxGetScalar(prhs[3]); 94 | 95 | /* Read the file */ 96 | if ( ms_readtraces (&mstg, filename, -1, timetol, sampratetol, 1, 1, 1, verbose) != MS_NOERROR ) 97 | mexErrMsgTxt ("Error reading files"); 98 | 99 | /* Print some information to the Matlab command prompt */ 100 | mst_printtracelist (mstg, 0, verbose, 1); 101 | 102 | /* Create the Matlab output structure */ 103 | mst = mstg->traces; 104 | for (i=0; i < mstg->numtraces; i++) 105 | { 106 | if (i==0) 107 | { 108 | nfields = 13; 109 | my_fnames = mxCalloc (nfields, sizeof (*my_fnames)); 110 | my_fnames[0] = "network"; 111 | my_fnames[1] = "station"; 112 | my_fnames[2] = "location"; 113 | my_fnames[3] = "channel"; 114 | my_fnames[4] = "dataquality"; 115 | my_fnames[5] = "type"; 116 | my_fnames[6] = "startTime"; 117 | my_fnames[7] = "endTime"; 118 | my_fnames[8] = "sampleRate"; 119 | my_fnames[9] = "sampleCount"; 120 | my_fnames[10] = "numberOfSamples"; 121 | my_fnames[11] = "sampleType"; 122 | my_fnames[12] = "data"; 123 | plhs[0] = mxCreateStructMatrix(mstg->numtraces, 1, nfields, my_fnames); 124 | mxFree(my_fnames); 125 | } 126 | 127 | /* Copy the data of the mst structure to the matlab output structure. */ 128 | data = (int*)mst->datasamples; 129 | tmp_val = mxCreateDoubleMatrix(mst->numsamples, 1, mxREAL); 130 | tmp_val_ptr = mxGetPr(tmp_val); 131 | for (j = 0; j < mst->numsamples; j++) 132 | { 133 | tmp_val_ptr[j] = data[j]; 134 | } 135 | 136 | mxSetFieldByNumber(plhs[0], i, 0, mxCreateString(mst->network)); 137 | mxSetFieldByNumber(plhs[0], i, 1, mxCreateString(mst->station)); 138 | mxSetFieldByNumber(plhs[0], i, 2, mxCreateString(mst->location)); 139 | mxSetFieldByNumber(plhs[0], i, 3, mxCreateString(mst->channel)); 140 | mxSetFieldByNumber(plhs[0], i, 4, mxCreateDoubleScalar((int)mst->dataquality)); 141 | mxSetFieldByNumber(plhs[0], i, 5, mxCreateDoubleScalar((int)mst->type)); 142 | mxSetFieldByNumber(plhs[0], i, 6, mxCreateDoubleScalar(mst->starttime)); 143 | mxSetFieldByNumber(plhs[0], i, 7, mxCreateDoubleScalar(mst->endtime)); 144 | mxSetFieldByNumber(plhs[0], i, 8, mxCreateDoubleScalar(mst->samprate)); 145 | mxSetFieldByNumber(plhs[0], i, 9, mxCreateDoubleScalar(mst->samplecnt)); 146 | mxSetFieldByNumber(plhs[0], i, 10, mxCreateDoubleScalar(mst->numsamples)); 147 | mxSetFieldByNumber(plhs[0], i, 11, mxCreateDoubleScalar((int)mst->sampletype)); 148 | mxSetFieldByNumber(plhs[0], i, 12, tmp_val); 149 | 150 | mst = mst->next; 151 | } 152 | 153 | mst_freegroup (&mstg); 154 | } 155 | -------------------------------------------------------------------------------- /libmseed/matlab/mexMsReadTracesNative.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * mexMsReadTracesNative.c 3 | * 4 | * This file is part of the library libmseed. 5 | * 6 | * libmseed is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * libmseed is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Foobar; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Mex wrapper function for the msReadTraces function in the libmseed library. 21 | * 22 | * mexMsReadTracesNative takes the same input arguments as the 23 | * ms_readtraces() funciton does except for the first argument. 24 | * 25 | * The return value is a Matlab structure similiar to the libmseed structure 26 | * MSTrace_s containing the trace header and data. 27 | * 28 | * Original written by Stefan Mertl 29 | * Vienna University of Technology 30 | * Institute of Geodesy and Geophysics 31 | * Dept. of Geophysics 32 | * 33 | * Further modification by Chad Trabant, IRIS Data Managment Center 34 | * 35 | * modified: 2008.171 36 | ***************************************************************************/ 37 | 38 | #include "mex.h" 39 | #include "../libmseed.h" 40 | 41 | void 42 | mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) 43 | { 44 | MSTraceGroup *mstg = NULL; 45 | MSTrace *mst = NULL; 46 | const char **my_fnames = NULL; 47 | char *filename; 48 | int buflen; 49 | int reclen; 50 | double timetol, sampratetol; 51 | flag dataquality, skipnodata, dataflag, verbose; 52 | int i, j, nfields; 53 | mxArray *tmp_val; 54 | double *tmp_val_ptr; 55 | int *data; 56 | 57 | /* Sanity check input and output */ 58 | if ( nrhs != 8 ) 59 | { 60 | mexPrintf ("mexMsReadTracesNative - Read Mini-SEED data into Matlab\n\n"); 61 | mexPrintf ("Usage: mexMsReadTracesNative (filename, reclen, timetol, sampratetol, dataquality, skipnotdata, dataflag, verbosity)\n"); 62 | mexPrintf (" filename - Name of file to read Mini-SEED data from\n"); 63 | mexPrintf (" reclen - Mini-SEED data record length, -1 for autodetection\n"); 64 | mexPrintf (" timetol - Time tolerance, use -1.0 for 1/2 sample period\n"); 65 | mexPrintf (" sampratetol - Sample rate tolerance, use -1.0 for default tolerance\n"); 66 | mexPrintf (" dataquality - Include data quality in determination of unique time series, use 0 or 1\n"); 67 | mexPrintf (" skipnotdata - Skip blocks in input file that are not Mini-SEED data\n"); 68 | mexPrintf (" dataflag - Flag to control return of data samples or not, 0 or 1\n"); 69 | mexPrintf (" verbosity - Level of diagnostic messages, use 0 - 3\n\n"); 70 | mexErrMsgTxt ("8 input arguments required."); 71 | } 72 | else if ( nlhs > 1 ) 73 | { 74 | mexErrMsgTxt ("Too many output arguments."); 75 | } 76 | 77 | /* Redirect libmseed logging messages to Matlab functions */ 78 | ms_loginit ((void *)&mexPrintf, NULL, (void *)&mexWarnMsgTxt, NULL); 79 | 80 | /* Get the length of the input string */ 81 | buflen = (mxGetM (prhs[0]) * mxGetN (prhs[0])) + 1; 82 | 83 | /* Allocate memory for input string */ 84 | filename = mxCalloc (buflen, sizeof (char)); 85 | 86 | /* Assign the input arguments to variables */ 87 | if ( mxGetString (prhs[0], filename, buflen) ) 88 | mexErrMsgTxt ("Not enough space. Filename string is truncated."); 89 | reclen = (int) mxGetScalar(prhs[1]); 90 | timetol = mxGetScalar(prhs[2]); 91 | sampratetol = mxGetScalar(prhs[3]); 92 | dataquality = (flag) mxGetScalar(prhs[4]); 93 | skipnodata = (flag) mxGetScalar(prhs[5]); 94 | dataflag = (flag) mxGetScalar(prhs[6]); 95 | verbose = (flag) mxGetScalar(prhs[7]); 96 | 97 | /* Read the file */ 98 | if ( ms_readtraces (&mstg, filename, reclen, timetol, sampratetol, dataquality, 99 | skipnodata, dataflag, verbose) != MS_NOERROR ) 100 | mexErrMsgTxt ("Error reading files"); 101 | 102 | /* Print some information to the Matlab command prompt */ 103 | mst_printtracelist (mstg, 0, verbose, 1); 104 | 105 | /* Create the Matlab output structure */ 106 | mst = mstg->traces; 107 | for (i=0; i < mstg->numtraces; i++) 108 | { 109 | if (i==0) 110 | { 111 | nfields = 13; 112 | my_fnames = mxCalloc (nfields, sizeof (*my_fnames)); 113 | my_fnames[0] = "network"; 114 | my_fnames[1] = "station"; 115 | my_fnames[2] = "location"; 116 | my_fnames[3] = "channel"; 117 | my_fnames[4] = "dataquality"; 118 | my_fnames[5] = "type"; 119 | my_fnames[6] = "startTime"; 120 | my_fnames[7] = "endTime"; 121 | my_fnames[8] = "sampleRate"; 122 | my_fnames[9] = "sampleCount"; 123 | my_fnames[10] = "numberOfSamples"; 124 | my_fnames[11] = "sampleType"; 125 | my_fnames[12] = "data"; 126 | plhs[0] = mxCreateStructMatrix(mstg->numtraces, 1, nfields, my_fnames); 127 | mxFree(my_fnames); 128 | } 129 | 130 | /* Copy the data of the mst structure to the matlab output structure. */ 131 | data = (int*)mst->datasamples; 132 | tmp_val = mxCreateDoubleMatrix(mst->numsamples, 1, mxREAL); 133 | tmp_val_ptr = mxGetPr(tmp_val); 134 | for (j = 0; j < mst->numsamples; j++) 135 | { 136 | tmp_val_ptr[j] = data[j]; 137 | } 138 | 139 | mxSetFieldByNumber(plhs[0], i, 0, mxCreateString(mst->network)); 140 | mxSetFieldByNumber(plhs[0], i, 1, mxCreateString(mst->station)); 141 | mxSetFieldByNumber(plhs[0], i, 2, mxCreateString(mst->location)); 142 | mxSetFieldByNumber(plhs[0], i, 3, mxCreateString(mst->channel)); 143 | mxSetFieldByNumber(plhs[0], i, 4, mxCreateDoubleScalar((int)mst->dataquality)); 144 | mxSetFieldByNumber(plhs[0], i, 5, mxCreateDoubleScalar((int)mst->type)); 145 | mxSetFieldByNumber(plhs[0], i, 6, mxCreateDoubleScalar(mst->starttime)); 146 | mxSetFieldByNumber(plhs[0], i, 7, mxCreateDoubleScalar(mst->endtime)); 147 | mxSetFieldByNumber(plhs[0], i, 8, mxCreateDoubleScalar(mst->samprate)); 148 | mxSetFieldByNumber(plhs[0], i, 9, mxCreateDoubleScalar(mst->samplecnt)); 149 | mxSetFieldByNumber(plhs[0], i, 10, mxCreateDoubleScalar(mst->numsamples)); 150 | mxSetFieldByNumber(plhs[0], i, 11, mxCreateDoubleScalar((int)mst->sampletype)); 151 | mxSetFieldByNumber(plhs[0], i, 12, tmp_val); 152 | 153 | mst = mst->next; 154 | } 155 | 156 | mst_freegroup (&mstg); 157 | } 158 | -------------------------------------------------------------------------------- /libmseed/mseed.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @PACKAGE_NAME@ 7 | Description: The Mini-SEED library provides a framework for manipulation of SEED 8 | (Standard for the Exchange of Earthquake Data) data records. 9 | URL: @PACKAGE_URL@ 10 | Version: @VERSION@ 11 | Cflags: -I${includedir} 12 | Libs: -L${libdir} -lmseed 13 | -------------------------------------------------------------------------------- /libmseed/packdata.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * packdata.h: 3 | * 4 | * Interface declarations for the Mini-SEED packing routines in 5 | * packdata.c 6 | * 7 | * modified: 2016.273 8 | ***************************************************************************/ 9 | 10 | #ifndef PACKDATA_H 11 | #define PACKDATA_H 1 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #define STEIM1_FRAME_MAX_SAMPLES 60 18 | #define STEIM2_FRAME_MAX_SAMPLES 105 19 | 20 | /* Control for printing debugging information, declared in packdata.c */ 21 | extern int encodedebug; 22 | 23 | extern int msr_encode_text (char *input, int samplecount, char *output, 24 | int outputlength); 25 | extern int msr_encode_int16 (int32_t *input, int samplecount, int16_t *output, 26 | int outputlength, int swapflag); 27 | extern int msr_encode_int32 (int32_t *input, int samplecount, int32_t *output, 28 | int outputlength, int swapflag); 29 | extern int msr_encode_float32 (float *input, int samplecount, float *output, 30 | int outputlength, int swapflag); 31 | extern int msr_encode_float64 (double *input, int samplecount, double *output, 32 | int outputlength, int swapflag); 33 | extern int msr_encode_steim1 (int32_t *input, int samplecount, int32_t *output, 34 | int outputlength, int32_t diff0, int swapflag); 35 | extern int msr_encode_steim2 (int32_t *input, int samplecount, int32_t *output, 36 | int outputlength, int32_t diff0, char *srcname, 37 | int swapflag); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /libmseed/steimdata.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * steimdata.h: 3 | * 4 | * Declarations for Steim compression routines. 5 | * 6 | * modified: 2004.278 7 | ***************************************************************************/ 8 | 9 | #ifndef STEIMDATA_H 10 | #define STEIMDATA_H 1 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #define STEIM1_FRAME_MAX_SAMPLES 60 17 | #define STEIM2_FRAME_MAX_SAMPLES 105 18 | 19 | #define VALS_PER_FRAME 15 /* # of ints for data per frame.*/ 20 | 21 | #define STEIM1_SPECIAL_MASK 0 22 | #define STEIM1_BYTE_MASK 1 23 | #define STEIM1_HALFWORD_MASK 2 24 | #define STEIM1_FULLWORD_MASK 3 25 | 26 | #define STEIM2_SPECIAL_MASK 0 27 | #define STEIM2_BYTE_MASK 1 28 | #define STEIM2_123_MASK 2 29 | #define STEIM2_567_MASK 3 30 | 31 | typedef union u_diff { /* union for Steim objects. */ 32 | int8_t byte[4]; /* 4 1-byte differences. */ 33 | int16_t hw[2]; /* 2 halfword differences. */ 34 | int32_t fw; /* 1 fullword difference. */ 35 | } U_DIFF; 36 | 37 | typedef struct frame { /* frame in a seed data record. */ 38 | uint32_t ctrl; /* control word for frame. */ 39 | U_DIFF w[15]; /* compressed data. */ 40 | } FRAME; 41 | 42 | typedef struct dframes { /* seed data frames. */ 43 | FRAME f[1]; /* data record header frames. */ 44 | } DFRAMES; 45 | 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* STEIMDATA_H */ 52 | -------------------------------------------------------------------------------- /libmseed/test/Makefile: -------------------------------------------------------------------------------- 1 | # This Makefile requires GNU make, sometimes available as gmake. 2 | # 3 | # A simple test suite for libmseed. 4 | # See README for description. 5 | # 6 | # Build environment can be configured the following 7 | # environment variables: 8 | # CC : Specify the C compiler to use 9 | # CFLAGS : Specify compiler options to use 10 | 11 | # Required compiler parameters 12 | CFLAGS += -I.. 13 | 14 | LDFLAGS = -L.. 15 | LDLIBS = -lmseed 16 | 17 | SRCS := $(sort $(wildcard *.c)) 18 | BINS := $(SRCS:%.c=%) 19 | 20 | TESTS := $(sort $(wildcard *.test)) 21 | TESTOUTS := $(TESTS:%.test=%.test.out) 22 | 23 | # ASCII color coding for test results, green for PASSED and red for FAILED 24 | PASSED := \033[0;32mPASSED\033[0m 25 | FAILED := \033[0;31mFAILED\033[0m 26 | 27 | TESTCOUNT := 0 28 | 29 | test all: $(BINS) $(TESTOUTS) 30 | @printf '%d tests conducted\n' $(TESTCOUNT) 31 | 32 | # Build programs and check for executable 33 | $(BINS) : % : %.c 34 | @$(eval TESTCOUNT=$(shell echo $$(($(TESTCOUNT)+1)))) 35 | @$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS); exit 0; 36 | @if test -x $@; \ 37 | then printf '$(PASSED) Building $<\n'; \ 38 | else printf '$(FAILED) Building $<\n'; exit 1; \ 39 | fi 40 | 41 | # Run test scripts, create %.test.out files and compare to %.test.ref references 42 | $(TESTOUTS) : %.test.out : %.test $(BINS) FORCE 43 | @$(eval TESTCOUNT=$(shell echo $$(($(TESTCOUNT)+1)))) 44 | @$(shell ./$< > $@ 2>&1) 45 | @diff $<.ref $@ >/dev/null; \ 46 | if [ $$? -eq 0 ]; \ 47 | then printf '$(PASSED) Test $<\n'; \ 48 | else printf '$(FAILED) Test $<, Compare $<.ref $@\n'; \ 49 | exit 0; \ 50 | fi 51 | 52 | clean: 53 | @rm -f $(BINS) $(TESTOUTS) 54 | 55 | # Any targets using this empty FORCE rule as a prerequisite will always run 56 | FORCE: 57 | -------------------------------------------------------------------------------- /libmseed/test/README: -------------------------------------------------------------------------------- 1 | == The libmseed test suite == 2 | 3 | General mechanics: 4 | 5 | Each *.c file is compiled into an executable, linking options for libmseed 6 | are included. The test passes if an executable is produced. 7 | 8 | Each *.test file must be an executable (e.g. shell script) and have a 9 | companion *.test.ref reference file. The *.test file is executed, the 10 | output saved to *.test.out and compared to the reference. If the files 11 | match the test passes. 12 | 13 | The executables are built first as they are used in the later tests. 14 | -------------------------------------------------------------------------------- /libmseed/test/data/CDSN-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/CDSN-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/DWWSSN-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/DWWSSN-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Float32-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Float32-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Float64-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Float64-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/GEOSCOPE-16bit-3exp-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/GEOSCOPE-16bit-3exp-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int16-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int16-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-1024byte.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-1024byte.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-128byte.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-128byte.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-2048byte.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-2048byte.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-256byte.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-256byte.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-4096byte.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-4096byte.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-512byte.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-512byte.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-8192byte.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-8192byte.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Int32-oneseries-mixedlengths-mixedorder.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Int32-oneseries-mixedlengths-mixedorder.mseed -------------------------------------------------------------------------------- /libmseed/test/data/SRO-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/SRO-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Steim1-AllDifferences-BE.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Steim1-AllDifferences-BE.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Steim1-AllDifferences-LE.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Steim1-AllDifferences-LE.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Steim2-AllDifferences-BE.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Steim2-AllDifferences-BE.mseed -------------------------------------------------------------------------------- /libmseed/test/data/Steim2-AllDifferences-LE.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/Steim2-AllDifferences-LE.mseed -------------------------------------------------------------------------------- /libmseed/test/data/corrupt-blockettes-wrongnext.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/corrupt-blockettes-wrongnext.mseed -------------------------------------------------------------------------------- /libmseed/test/data/detection.record.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/detection.record.mseed -------------------------------------------------------------------------------- /libmseed/test/data/invalid-blockette-offset.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/invalid-blockette-offset.mseed -------------------------------------------------------------------------------- /libmseed/test/data/no-blockette1000-steim1.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/no-blockette1000-steim1.mseed -------------------------------------------------------------------------------- /libmseed/test/data/text-encoded.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/text-encoded.mseed -------------------------------------------------------------------------------- /libmseed/test/data/unapplied-timecorrection.mseed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/data/unapplied-timecorrection.mseed -------------------------------------------------------------------------------- /libmseed/test/pack-Float32-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestpack -e 4 -o - 5 | -------------------------------------------------------------------------------- /libmseed/test/pack-Float32-encoded.test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/pack-Float32-encoded.test.ref -------------------------------------------------------------------------------- /libmseed/test/pack-Float64-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestpack -e 5 -o - 5 | -------------------------------------------------------------------------------- /libmseed/test/pack-Float64-encoded.test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/pack-Float64-encoded.test.ref -------------------------------------------------------------------------------- /libmseed/test/pack-Int16-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestpack -e 1 -o - 5 | -------------------------------------------------------------------------------- /libmseed/test/pack-Int16-encoded.test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/pack-Int16-encoded.test.ref -------------------------------------------------------------------------------- /libmseed/test/pack-Int32-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestpack -e 3 -o - 5 | -------------------------------------------------------------------------------- /libmseed/test/pack-Int32-encoded.test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/pack-Int32-encoded.test.ref -------------------------------------------------------------------------------- /libmseed/test/pack-Steim1-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestpack -e 10 -o - 5 | -------------------------------------------------------------------------------- /libmseed/test/pack-Steim1-encoded.test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/pack-Steim1-encoded.test.ref -------------------------------------------------------------------------------- /libmseed/test/pack-Steim2-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestpack -e 11 -o - 5 | -------------------------------------------------------------------------------- /libmseed/test/pack-Steim2-encoded.test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/pack-Steim2-encoded.test.ref -------------------------------------------------------------------------------- /libmseed/test/pack-text-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestpack -e 0 -o - 5 | -------------------------------------------------------------------------------- /libmseed/test/pack-text-encoded.test.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iris-edu/ascii2mseed/34177bdb4e775b3e0b0c9eae069c8649d5c23068/libmseed/test/pack-text-encoded.test.ref -------------------------------------------------------------------------------- /libmseed/test/read-CDSN-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/CDSN-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-DWWSSN-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/DWWSSN-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Float32-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Float32-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Float64-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Float64-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Float64-encoded.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST__VHE, 000001, D, 4096, 504 samples, 0.1 Hz, 1986,360,02:12:05.864800 2 | -1.0625 -1.078125 -1.078125 -1.078125 -1.078125 -1.078125 3 | -1.0859375 -1.0859375 -1.0859375 -1.0859375 -1.09375 -1.09375 4 | -1.09375 -1.09375 -1.0859375 -1.0859375 -1.0703125 -1.0625 5 | -1.0625 -1.0546875 -1.0546875 -1.0546875 -1.0546875 -1.0546875 6 | -1.0625 -1.078125 -1.09375 -1.109375 -1.1171875 -1.125 7 | -1.125 -1.125 -1.1171875 -1.09375 -1.0859375 -1.0859375 8 | -1.078125 -1.0859375 -1.09375 -1.109375 -1.125 -1.1328125 9 | -1.140625 -1.15625 -1.1640625 -1.1875 -1.2109375 -1.234375 10 | -1.2578125 -1.2734375 -1.2890625 -1.296875 -1.2890625 -1.296875 11 | -1.3046875 -1.3046875 -1.3046875 -1.3046875 -1.3046875 -1.3046875 12 | -1.3046875 -1.3046875 -1.3046875 -1.3046875 -1.3046875 -1.3046875 13 | -1.3046875 -1.3046875 -1.3046875 -1.3046875 -1.296875 -1.2890625 14 | -1.2734375 -1.2578125 -1.25 -1.234375 -1.21875 -1.203125 15 | -1.1875 -1.171875 -1.15625 -1.1484375 -1.1328125 -1.125 16 | -1.109375 -1.1015625 -1.0703125 -1.0546875 -1.03125 -1.0234375 17 | -1.015625 -1.015625 -1.0078125 -1.0078125 -1 -0.9921875 18 | -0.9765625 -0.96875 -0.96875 -0.9609375 -0.9609375 -0.953125 19 | -0.9453125 -0.9453125 -0.9609375 -0.96875 -0.984375 -0.9921875 20 | -0.9921875 -0.9921875 -0.9765625 -0.9609375 -0.9375 -0.90625 21 | -0.8828125 -0.8671875 -0.8671875 -0.859375 -0.859375 -0.859375 22 | -0.8671875 -0.875 -0.8984375 -0.90625 -0.9296875 -0.9375 23 | -0.9453125 -0.953125 -0.9453125 -0.9375 -0.9375 -0.9296875 24 | -0.9140625 -0.9140625 -0.9296875 -0.9296875 -0.9375 -0.9453125 25 | -0.9453125 -0.9375 -0.9375 -0.9296875 -0.9140625 -0.8984375 26 | -0.890625 -0.8671875 -0.859375 -0.84375 -0.828125 -0.828125 27 | -0.8359375 -0.8515625 -0.859375 -0.8671875 -0.8671875 -0.875 28 | -0.875 -0.875 -0.890625 -0.8984375 -0.9140625 -0.9296875 29 | -0.9375 -0.953125 -0.9609375 -0.9765625 -1 -1.015625 30 | -1.03125 -1.046875 -1.0546875 -1.0625 -1.0546875 -1.0546875 31 | -1.0546875 -1.0625 -1.0859375 -1.1015625 -1.1171875 -1.1171875 32 | -1.125 -1.1171875 -1.1171875 -1.1171875 -1.1015625 -1.1015625 33 | -1.0859375 -1.078125 -1.0703125 -1.0703125 -1.0546875 -1.0625 34 | -1.0859375 -1.1015625 -1.125 -1.140625 -1.1640625 -1.1640625 35 | -1.1796875 -1.171875 -1.171875 -1.15625 -1.1484375 -1.1328125 36 | -1.125 -1.1171875 -1.1171875 -1.1171875 -1.125 -1.1328125 37 | -1.15625 -1.171875 -1.1875 -1.1953125 -1.203125 -1.1953125 38 | -1.1875 -1.15625 -1.1484375 -1.140625 -1.140625 -1.1328125 39 | -1.1484375 -1.1484375 -1.1484375 -1.140625 -1.125 -1.125 40 | -1.140625 -1.1484375 -1.1640625 -1.1875 -1.1953125 -1.1796875 41 | -1.171875 -1.1640625 -1.15625 -1.15625 -1.1796875 -1.1953125 42 | -1.2265625 -1.25 -1.2578125 -1.25 -1.2421875 -1.234375 43 | -1.21875 -1.2109375 -1.2109375 -1.2265625 -1.234375 -1.2421875 44 | -1.2421875 -1.25 -1.25 -1.2421875 -1.25 -1.2578125 45 | -1.2578125 -1.265625 -1.2734375 -1.2578125 -1.25 -1.234375 46 | -1.2265625 -1.2265625 -1.2265625 -1.2421875 -1.25 -1.25 47 | -1.2578125 -1.25 -1.25 -1.2421875 -1.25 -1.2421875 48 | -1.2421875 -1.2265625 -1.2265625 -1.2109375 -1.203125 -1.2109375 49 | -1.2109375 -1.21875 -1.2265625 -1.2265625 -1.21875 -1.203125 50 | -1.1875 -1.1796875 -1.1796875 -1.171875 -1.171875 -1.171875 51 | -1.1796875 -1.1875 -1.203125 -1.21875 -1.21875 -1.21875 52 | -1.2265625 -1.2265625 -1.2265625 -1.2109375 -1.203125 -1.1953125 53 | -1.1875 -1.171875 -1.1640625 -1.140625 -1.125 -1.109375 54 | -1.0859375 -1.0703125 -1.0625 -1.0546875 -1.0546875 -1.0625 55 | -1.0859375 -1.0859375 -1.1015625 -1.109375 -1.1171875 -1.1171875 56 | -1.1171875 -1.109375 -1.1015625 -1.09375 -1.0859375 -1.078125 57 | -1.078125 -1.078125 -1.09375 -1.09375 -1.109375 -1.125 58 | -1.140625 -1.1640625 -1.1796875 -1.1875 -1.1875 -1.1875 59 | -1.1953125 -1.2109375 -1.2265625 -1.25 -1.265625 -1.2890625 60 | -1.296875 -1.3046875 -1.3046875 -1.3125 -1.328125 -1.328125 61 | -1.328125 -1.3203125 -1.3046875 -1.3046875 -1.296875 -1.296875 62 | -1.2890625 -1.28125 -1.2734375 -1.25 -1.2265625 -1.1875 63 | -1.1640625 -1.1328125 -1.125 -1.125 -1.125 -1.1171875 64 | -1.1015625 -1.078125 -1.0546875 -1.0390625 -1.0234375 -1.0234375 65 | -1.015625 -1.0078125 -1.015625 -1.015625 -1.0234375 -1.015625 66 | -1.0078125 -1 -1 -0.9765625 -0.9609375 -0.9375 67 | -0.921875 -0.90625 -0.890625 -0.8828125 -0.875 -0.859375 68 | -0.8515625 -0.8515625 -0.8515625 -0.859375 -0.8671875 -0.8671875 69 | -0.8671875 -0.875 -0.875 -0.859375 -0.84375 -0.8359375 70 | -0.8359375 -0.828125 -0.8359375 -0.8515625 -0.859375 -0.8671875 71 | -0.859375 -0.8515625 -0.84375 -0.84375 -0.8515625 -0.859375 72 | -0.8828125 -0.890625 -0.8984375 -0.90625 -0.90625 -0.90625 73 | -0.90625 -0.8984375 -0.8984375 -0.890625 -0.8984375 -0.890625 74 | -0.90625 -0.9140625 -0.921875 -0.9296875 -0.9296875 -0.921875 75 | -0.90625 -0.8984375 -0.8671875 -0.84375 -0.8359375 -0.859375 76 | -0.8828125 -0.921875 -0.9609375 -0.984375 -1 -1.015625 77 | -1.0234375 -1.0234375 -1.0234375 -1.03125 -1.046875 -1.0546875 78 | -1.0546875 -1.046875 -1.03125 -1.015625 -1 -0.984375 79 | -0.9765625 -0.9609375 -0.9375 -0.9140625 -0.8828125 -0.875 80 | -0.875 -0.8984375 -0.921875 -0.9609375 -0.9921875 -1.0234375 81 | -1.0390625 -1.03125 -1.0078125 -0.9765625 -0.9609375 -0.9453125 82 | -0.9375 -0.9296875 -0.9296875 -0.9375 -0.9375 -0.9375 83 | -0.9453125 -0.9609375 -0.984375 -0.9921875 -1 -1 84 | -1 -1 -0.9921875 -0.9921875 -0.9921875 -1 85 | -1.015625 -1.015625 -1.0078125 -1.015625 -1.03125 -1.0546875 86 | 87 | -------------------------------------------------------------------------------- /libmseed/test/read-GEOSCOPE163-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/GEOSCOPE-16bit-3exp-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int16-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int16-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-1024byte-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-1024byte.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-1024byte-encoded.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_LHZ, 000001, R, 1024, 240 samples, 1 Hz, 2010,058,06:52:56.069539 2 | -230467 -228682 -231926 -238261 -242006 -245765 3 | -239994 -227824 -226956 -228796 -228197 -233827 4 | -241222 -243646 -238977 -232624 -233808 -238003 5 | -233604 -226769 -232569 -242266 -242432 -240215 6 | -239860 -239961 -243139 -243961 -239645 -238433 7 | -239628 -237879 -230947 -216815 -210216 -219208 8 | -226749 -231751 -240772 -248271 -251898 -245388 9 | -235334 -231916 -227298 -229323 -236615 -232681 10 | -228306 -231119 -231595 -229975 -224902 -220008 11 | -226886 -231931 -233318 -243096 -244472 -241192 12 | -247230 -246482 -235244 -232261 -238046 -231154 13 | -222094 -228092 -236876 -237286 -223455 -215738 14 | -221718 -215970 -211063 -217789 -226489 -236163 15 | -233766 -237352 -259142 -255587 -224426 -202003 16 | -196505 -199975 -193732 -183508 -177868 -177994 17 | -214663 -283583 -337053 -354811 -339701 -291068 18 | -250048 -248179 -268654 -279926 -263758 -238408 19 | -209084 -197043 -206031 -209659 -223931 -247397 20 | -251511 -260703 -292788 -297331 -292395 -319377 21 | -335343 -324355 -309173 -293888 -264565 -230931 22 | -201796 -158943 -125628 -123229 -132884 -155870 23 | -194547 -218837 -238223 -251088 -229406 -214976 24 | -219910 -249216 -302237 -299153 -258906 -255588 25 | -276575 -287032 -263807 -227028 -199568 -179185 26 | -201937 -233678 -189395 -132652 -140562 -192282 27 | -240497 -296909 -374164 -360273 -287149 -274391 28 | -260260 -226016 -209527 -166900 -91498 -43739 29 | -63756 -131096 -201665 -259967 -308654 -329027 30 | -296625 -226045 -174478 -147349 -130313 -154186 31 | -164166 -159619 -204546 -240437 -263827 -312241 32 | -341525 -353176 -338880 -286534 -251189 -211543 33 | -146709 -106984 -137975 -208311 -227973 -227836 34 | -253819 -279231 -314337 -327678 -305514 -292535 35 | -271426 -229295 -192256 -189025 -214292 -230273 36 | -231145 -252867 -300861 -313972 -301713 -301984 37 | -280033 -238469 -210717 -194525 -176091 -164971 38 | -170273 -184965 -201809 -210752 -227498 -263971 39 | -287069 -283833 -266161 -235613 -193005 -159264 40 | -150687 -156856 -197227 -276346 -345373 -372618 41 | -372164 -362788 -336698 -273568 -206809 -183226 42 | 43 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-128byte-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-128byte.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-128byte-encoded.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_LHZ, 000001, R, 128, 16 samples, 1 Hz, 2010,058,06:50:00.069539 2 | -231946 -228438 -223155 -221231 -225429 -230129 3 | -229728 -228817 -233187 -237367 -237121 -237361 4 | -235678 -227339 -221762 -224099 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-2048byte-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-2048byte.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-2048byte-encoded.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_LHZ, 000001, R, 2048, 496 samples, 1 Hz, 2010,058,06:56:56.069539 2 | -153142 -112621 -108174 -121595 -163772 -231395 3 | -270350 -288753 -304109 -302338 -300778 -282568 4 | -245124 -226804 -227315 -260468 -293530 -271944 5 | -232782 -204782 -194992 -206028 -207578 -221963 6 | -242765 -217153 -201427 -236012 -260995 -258674 7 | -263005 -271003 -270739 -279633 -295216 -299011 8 | -280857 -265731 -260924 -215157 -168762 -180296 9 | -184273 -154518 -140922 -155432 -178463 -200607 10 | -228174 -254796 -270731 -269554 -240173 -211544 11 | -224445 -261870 -277797 -266351 -246381 -238594 12 | -243567 -232571 -234355 -261495 -294276 -327916 13 | -310426 -258126 -224013 -198251 -173335 -148752 14 | -139762 -154674 -177566 -209649 -257652 -308614 15 | -331780 -317352 -291222 -250509 -206368 -195671 16 | -187246 -168846 -172226 -199595 -223823 -244274 17 | -275537 -276885 -261202 -260538 -251797 -223075 18 | -196424 -205061 -218585 -220573 -234741 -245827 19 | -223697 -185842 -183428 -203071 -211929 -223713 20 | -247288 -255950 -240446 -234971 -235723 -222330 21 | -211872 -215788 -230936 -238070 -234855 -246731 22 | -257686 -236964 -206322 -204750 -216560 -217981 23 | -226653 -237003 -242783 -257508 -268579 -262645 24 | -254204 -259499 -260122 -232852 -180834 -140139 25 | -144696 -169033 -190141 -228975 -269997 -276903 26 | -285253 -308844 -301321 -271087 -244280 -220569 27 | -202535 -197005 -205360 -218262 -236081 -248782 28 | -248330 -256011 -257864 -237608 -224279 -215166 29 | -203219 -211161 -231676 -255386 -272862 -268279 30 | -262797 -268099 -274091 -272494 -263878 -259147 31 | -249660 -242775 -240408 -215452 -195356 -212178 32 | -230986 -233003 -235740 -236263 -233361 -237647 33 | -247467 -246493 -227905 -228260 -261081 -281438 34 | -279807 -275367 -253652 -223139 -212913 -210332 35 | -208374 -225539 -243653 -241678 -246387 -260689 36 | -264077 -251243 -227182 -222746 -233373 -223532 37 | -217621 -239334 -252764 -246165 -246659 -246775 38 | -218864 -187998 -186707 -199330 -211903 -219740 39 | -222383 -225045 -212794 -194552 -202550 -220939 40 | -232946 -241558 -247774 -270469 -294629 -301781 41 | -309569 -303583 -275393 -240016 -205927 -191853 42 | -186273 -183135 -198108 -207586 -201709 -207517 43 | -235987 -263228 -275097 -286544 -290636 -277695 44 | -264982 -258884 -250249 -234362 -214014 -193644 45 | -176935 -169985 -180880 -204947 -220197 -236478 46 | -263505 -285066 -301828 -299965 -278655 -251655 47 | -224113 -209154 -195774 -186595 -193882 -194233 48 | -191637 -203411 -202638 -198700 -217732 -230889 49 | -237470 -245618 -245037 -247105 -246187 -244817 50 | -242214 -229021 -229936 -233248 -215994 -204777 51 | -211173 -220496 -234765 -254575 -281075 -313106 52 | -314341 -285604 -263135 -252154 -247184 -233674 53 | -210465 -191402 -182731 -185053 -191015 -206098 54 | -231972 -256272 -274980 -275607 -249333 -217660 55 | -201644 -209756 -237549 -251051 -241565 -252667 56 | -293586 -319854 -309013 -282163 -259919 -241593 57 | -229562 -224727 -221459 -230323 -244189 -233705 58 | -218369 -228600 -239990 -243579 -244683 -229500 59 | -215888 -222520 -235689 -244473 -256318 -270484 60 | -272690 -261001 -252185 -255254 -255331 -252787 61 | -253097 -256101 -260132 -251467 -230683 -204627 62 | -184980 -185784 -201149 -209942 -208079 -211238 63 | -216075 -217279 -217423 -215135 -207566 -199652 64 | -205410 -202898 -185477 -190434 -207050 -214138 65 | -217694 -211413 -208388 -224136 -241706 -250372 66 | -253818 -257980 -268245 -279442 -277317 -255591 67 | -232030 -225150 -225479 -218335 -214132 -219107 68 | -217857 -217412 -229705 -230218 -217094 -215904 69 | -212652 -211149 -233324 -260703 -283315 -278890 70 | -242075 -231039 -257612 -275039 -270845 -266561 71 | -262649 -253867 -249885 -248436 -252968 -273765 72 | -290464 -294012 -306412 -320115 -304248 -269886 73 | -262026 -275199 -278267 -279449 -289280 -296468 74 | -297748 -297082 -284177 -264050 -239977 -204326 75 | -167900 -123985 -74606 -43546 -31084 -37694 76 | -68998 -118271 -178355 -238917 -271991 -276766 77 | -282415 -284514 -271273 -249298 -231788 -230756 78 | -239504 -232175 -214385 -220514 -227132 -226224 79 | -245661 -253885 -248665 -267883 -290752 -291883 80 | -275917 -247774 -220966 -199874 -191575 -200071 81 | -189521 -169543 -178301 -183565 -189754 -224881 82 | -252000 -269963 -305768 -340653 -331089 -288133 83 | -261050 -225752 -159312 -91095 -39003 -15020 84 | -22829 -43200 -45658 -34768 85 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-256byte-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-256byte.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-256byte-encoded.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_LHZ, 000001, R, 256, 48 samples, 1 Hz, 2010,058,06:50:16.069539 2 | -228777 -234345 -238060 -237690 -233484 -226807 3 | -221838 -222905 -228070 -226135 -220353 -223352 4 | -235952 -246300 -247116 -250785 -253608 -251682 5 | -253629 -250490 -245121 -242061 -232787 -225785 6 | -226529 -224716 -220290 -216479 -211732 -210463 7 | -216741 -226807 -234022 -237295 -241529 -242458 8 | -234416 -226815 -221225 -221087 -227538 -226381 9 | -226037 -235504 -243223 -244629 -244677 -245257 10 | 11 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-4096byte-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-4096byte.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-512byte-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-512byte.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-512byte-encoded.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_LHZ, 000001, R, 512, 112 samples, 1 Hz, 2010,058,06:51:04.069539 2 | -242196 -236764 -232792 -228731 -227703 -228600 3 | -226246 -229232 -236837 -242076 -250265 -255144 4 | -253173 -249842 -243233 -234785 -227107 -223531 5 | -223693 -225294 -231239 -239464 -244761 -246077 6 | -246577 -244055 -238917 -237413 -234418 -230777 7 | -231926 -233408 -234711 -233149 -227798 -226125 8 | -227125 -228063 -231572 -233373 -232137 -232426 9 | -234394 -237939 -241583 -242455 -239557 -236956 10 | -236771 -235263 -232660 -231147 -230543 -231936 11 | -237536 -243775 -251344 -258638 -255612 -246594 12 | -237183 -227889 -220941 -217647 -220374 -224977 13 | -231367 -238490 -240979 -244094 -248001 -247919 14 | -246365 -243834 -236909 -230138 -227595 -224857 15 | -225123 -229146 -231778 -236068 -240339 -241034 16 | -240845 -240140 -238566 -235599 -230959 -225653 17 | -223451 -227170 -232013 -236121 -239385 -238218 18 | -235712 -235218 -236993 -241780 -242478 -237200 19 | -234327 -233657 -232972 -232951 -231650 -229043 20 | -225799 -225264 -228318 -230680 21 | -------------------------------------------------------------------------------- /libmseed/test/read-Int32-8192byte-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-8192byte.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-SRO-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/SRO-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Steim1-bigendian.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Steim1-AllDifferences-BE.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Steim1-littleendian.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Steim1-AllDifferences-LE.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Steim2-bigendian.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Steim2-AllDifferences-BE.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-Steim2-littleendian.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Steim2-AllDifferences-LE.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-detection-record.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/detection.record.mseed -pp 5 | -------------------------------------------------------------------------------- /libmseed/test/read-detection-record.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_BHZ, 656063, D 2 | start time: 2004,210,20:28:09.000000 3 | number of samples: 0 4 | sample rate factor: 0 (0 samples per second) 5 | sample rate multiplier: 0 6 | activity flags: [00000000] 8 bits 7 | I/O and clock flags: [00000000] 8 bits 8 | data quality flags: [00000000] 8 bits 9 | number of blockettes: 2 10 | time correction: 0 11 | data offset: 0 12 | first blockette offset: 48 13 | BLOCKETTE 1000: (Data Only SEED) 14 | next blockette: 56 15 | encoding: ASCII text (val:0) 16 | byte order: Big endian (val:1) 17 | record length: 512 (val:9) 18 | reserved byte: 0 19 | BLOCKETTE 201: (Murdock Event Detection) 20 | next blockette: 0 21 | signal amplitude: 80 22 | signal period: 0.4 23 | background estimate: 18 24 | event detection flags: [10000000] 8 bits 25 | [Bit 0] 1: Dilation wave 26 | reserved byte: 0 27 | signal onset time: 2004,210,20:28:06.1850 28 | SNR values: 1 3 2 1 4 0 29 | loopback value: 2 30 | pick algorithm: 0 31 | detector name: Z_SPWWSS 32 | -------------------------------------------------------------------------------- /libmseed/test/read-invalid-blockette-offset.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/invalid-blockette-offset.mseed 5 | -------------------------------------------------------------------------------- /libmseed/test/read-invalid-blockette-offset.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_LHZ, 000001, M, 512, 112 samples, 1 Hz, 2010,058,06:50:00.069539 2 | XX_TEST_00_LHZ, 000000, M, 512, 185 samples, 1 Hz, 2010,058,06:51:52.069541 3 | Error: Invalid blockette offset (12365) less than or equal to current offset (12365) 4 | -------------------------------------------------------------------------------- /libmseed/test/read-mixed-order-mixed-length-trace.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/Int32-oneseries-mixedlengths-mixedorder.mseed -tg 5 | -------------------------------------------------------------------------------- /libmseed/test/read-mixed-order-mixed-length-trace.test.ref: -------------------------------------------------------------------------------- 1 | Source Start sample End sample Gap Hz Samples 2 | XX_TEST_00_LHZ 2010,058,06:50:00.069539 2010,058,07:55:51.069539 == 1 3952 3 | Total: 1 trace(s) with 1 segment(s) 4 | -------------------------------------------------------------------------------- /libmseed/test/read-no-blockette1000.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/no-blockette1000-steim1.mseed -d -pp 5 | -------------------------------------------------------------------------------- /libmseed/test/read-no-blockette1000.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST__BHE, 000000, D 2 | start time: 1995,265,00:00:18.238400 3 | number of samples: 3632 4 | sample rate factor: 20 (20 samples per second) 5 | sample rate multiplier: 1 6 | activity flags: [00000000] 8 bits 7 | I/O and clock flags: [00000000] 8 bits 8 | data quality flags: [00000000] 8 bits 9 | number of blockettes: 0 10 | time correction: 0 11 | data offset: 48 12 | first blockette offset: 0 13 | 337 396 454 503 547 581 14 | XX_TEST__BHE, 000000, D 15 | start time: 1995,265,00:03:19.838500 16 | number of samples: 3680 17 | sample rate factor: 20 (20 samples per second) 18 | sample rate multiplier: 1 19 | activity flags: [00000000] 8 bits 20 | I/O and clock flags: [00000000] 8 bits 21 | data quality flags: [00000000] 8 bits 22 | number of blockettes: 0 23 | time correction: 0 24 | data offset: 48 25 | first blockette offset: 0 26 | -110 -188 -261 -329 -391 -448 27 | -------------------------------------------------------------------------------- /libmseed/test/read-text-encoded.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/text-encoded.mseed -D 5 | -------------------------------------------------------------------------------- /libmseed/test/read-text-encoded.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST__LOG, 000030, D, 4096, 3994 samples, 0 Hz, 2004,160,10:47:32.810000 2 | ASCII Data: 3 | 4 | Quanterra Packet Baler Model 14 Restart. Version 1.45 5 | Control Port 3512 Opened 6 | Baler ready on Serial at 115200 baud 7 | Retry of command type 5A 8 | Retry of command type 5A 9 | Retry of command type 5A 10 | Retry of command type 5A 11 | Retry of command type 5A 12 | Power Cycled Baler Acknowledged 13 | Commands Accepted by Q330 14 | Access timeout: 11265 sec 15 | Control Port 1490 Opened 16 | Data Port 1491 Opened 17 | Registered with Q330 18 | Combination Record Received 19 | Window=4 Min. Timeout=10 Max. Timeout=30 20 | Link Reset, starting window sequence: 9705 21 | GPS Receiver ID Received 22 | Msg From 1xx.xx.xx.xxx:Baler readback. 368 recs. seq end: 9698 23 | Baler clock set to 2004-06-08 10:47:31 24 | Starting to Read DP Tokens 25 | Msg From 1xx.xx.xx.xxx:Baler14-1.45 registered. clock set: 2004-06-08 10:47:31 26 | DP Tokens loaded, size=1274 bytes 27 | Webserver advertising 1xx.xx.xx.xxx:80 28 | filters & delay BHZ:1@40,Linear below 100sps=0.405462 29 | filters & delay BHN:2@40,Linear below 100sps=0.405462 30 | filters & delay BHE:3@40,Linear below 100sps=0.405462 31 | filters & delay LHZ:1@1,Linear below 100sps=14.930462 32 | filters & delay LHN:2@1,Linear below 100sps=14.930462 33 | filters & delay LHE:3@1,Linear below 100sps=14.930462 34 | filters & delay VHZ:LHZ@0.1000=214.430462 35 | filters & delay VHN:LHN@0.1000=214.430462 36 | filters & delay VHE:LHE@0.1000=214.430462 37 | filters & delay UHZ:VHZ@0.0100=2209.430462 38 | filters & delay UHN:VHN@0.0100=2209.430462 39 | filters & delay UHE:VHE@0.0100=2209.430462 40 | [2004-06-08 00:57:51.000000] continuity found: 9698 139971471.000000 Q=58 41 | [2004-06-08 00:57:51.000000] restoring continuity 42 | Sending DT_OPEN 43 | Station: TA-V04C 44 | Q330 Serial Number: 0100000000000000 45 | AMB Serial Number: 0100000000000000 46 | Seismo 1 Serial Number: 0000000000000000 47 | Seismo 2 Serial Number: 0000000000000000 48 | QAPCHP 1 Serial Number: 0000000 49 | QAPCHP 2 Serial Number: 0 50 | KMI Property Tag Number: 000 51 | System Software Version: 1.53 52 | Slave Processor Version: 1.10 53 | Calibrator Type: QCAL330 54 | Calibrator Version: 1.6 55 | Clock Type: Motorola M12 56 | PLD Version: 4.6 57 | GPS Engine Identification 58 | SFTW P/N # 61-G10002A 59 | SOFTWARE VER # 1 60 | SOFTWARE REV # 8 61 | SOFTWARE DATE MAY 15 2002 62 | MODEL # P273000000 63 | HWDR P/N # 2 64 | SERIAL # P05ISY 65 | MANUFACTUR DATE 3D17 66 | Total Hours: 4188.05 67 | Power On Hours: 1737.89 68 | Time of Last Boot: 2004-06-07 22:15:01 69 | Total Number of Boots: 34 70 | Time of Last Re-Sync: 2004-06-07 22:28:15 71 | Total Number of Re-Syncs: 39 72 | Status Inputs: 00000000 73 | AC OK: Off, Input 1,2: Off,Off, Analog Fault: Off 74 | Clock Quality: 44% 75 | Clock quality mapping: L=100 T=90 H=80 N=0 zone=0 76 | Clock Phase: 1 usec. max allowed=50000 77 | Boom positions: 78 | Ch1: -11 Ch2: 0 Ch3: -2 Ch4: 20 Ch5: 20 Ch6: 20 79 | Analog Status 80 | Analog Positive Supply: 5.47V 81 | Input Voltage: 12.00V 82 | System Temperature: 23C 83 | Main Current: 39ma 84 | Antenna Current: 0ma 85 | GPS Status 86 | Time: 87 | Date: 88 | Fix Type: OFF 89 | Height: 90 | Latitude: 91 | Longitude: 92 | Off Time: 169min 93 | Sat. Used: 0 94 | In View: 0 95 | Checksum Errors: 0 96 | Last GPS timemark: 2004-06-08 07:58:07 97 | PLL Status 98 | State: Hold 99 | Intitial VCO: 1955.836792 100 | Time Error: 0.000003 101 | RMS VCO: 0.0000000 102 | Best VCO: 1955.84 103 | Seconds Since Track or Lock: 10169.4 104 | Vco Control: 1957 105 | timing mode: internal GPS 106 | internal GPS power management mode: Until PLL lock 107 | tempco normal 108 | power off-time: 180m max on-time: 120m resync at: 0 109 | PLL update: 10s PLL lock criterion: 5us 110 | Pfrac: 150.00 111 | VCO slope: -0.0175000 112 | VCO intercept: 7.1100001 113 | Km delta: 600.0000000 114 | Logical Port 4 Status 115 | Data Packets Sent: 9715 116 | Flood Packets Sent: 0 117 | Packets Re-Sent: 18 118 | Sequence Errors: 0 119 | Packet Buffer Used: 4194044 120 | Physical Port: Serial 2 121 | Baler Model: 14 Software Version: 1.45 122 | MAC Address: F2:3F:09:9E:AF:C2 123 | Disk Size: 20000669696 124 | Percent of 1177 data files in use: 2.2 125 | DMU2 Software Version=4, Serial Number=0100000000000000 126 | Supply Voltage=11.9 127 | Temperature=20C 128 | Disk Model: IC250000000000-0 Revision: C0000000 129 | [2004-06-08 00:57:51.000000] SEQUENCE GAP 16134 FROM 9698 TO 25832 130 | [2004-06-08 05:26:45.000003] time label discontinuity: LCQ 16133.000003 131 | 132 | -------------------------------------------------------------------------------- /libmseed/test/read-unapplied-timecorrection.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=.. \ 3 | DYLD_LIBRARY_PATH=.. \ 4 | ./lmtestparse data/unapplied-timecorrection.mseed -pp 5 | -------------------------------------------------------------------------------- /libmseed/test/read-unapplied-timecorrection.test.ref: -------------------------------------------------------------------------------- 1 | XX_TEST_00_BHZ, 000001, R 2 | start time: 2003,149,02:13:23.043400 3 | number of samples: 5980 4 | sample rate factor: 32760 (40 samples per second) 5 | sample rate multiplier: -819 6 | activity flags: [00000000] 8 bits 7 | I/O and clock flags: [00000000] 8 bits 8 | data quality flags: [00000000] 8 bits 9 | number of blockettes: 2 10 | time correction: 10000 11 | data offset: 128 12 | first blockette offset: 48 13 | BLOCKETTE 1000: (Data Only SEED) 14 | next blockette: 64 15 | encoding: STEIM 2 Compression (val:11) 16 | byte order: Big endian (val:1) 17 | record length: 4096 (val:12) 18 | reserved byte: 0 19 | BLOCKETTE 100: (Sample Rate) 20 | next blockette: 0 21 | actual sample rate: 40 22 | undefined flags: [00000000] 8 bits 23 | reserved bytes (3): 0,0,0 24 | -------------------------------------------------------------------------------- /libmseed/unpackdata.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * unpackdata.h: 3 | * 4 | * Interface declarations for the Mini-SEED unpacking routines in 5 | * unpackdata.c 6 | * 7 | * modified: 2016.273 8 | ***************************************************************************/ 9 | 10 | #ifndef UNPACKDATA_H 11 | #define UNPACKDATA_H 1 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /* Control for printing debugging information, declared in unpackdata.c */ 18 | extern int decodedebug; 19 | 20 | extern int msr_decode_int16 (int16_t *input, int samplecount, int32_t *output, 21 | int outputlength, int swapflag); 22 | extern int msr_decode_int32 (int32_t *input, int samplecount, int32_t *output, 23 | int outputlength, int swapflag); 24 | extern int msr_decode_float32 (float *input, int samplecount, float *output, 25 | int outputlength, int swapflag); 26 | extern int msr_decode_float64 (double *input, int samplecount, double *output, 27 | int outputlength, int swapflag); 28 | extern int msr_decode_steim1 (int32_t *input, int inputlength, int samplecount, 29 | int32_t *output, int outputlength, char *srcname, 30 | int swapflag); 31 | extern int msr_decode_steim2 (int32_t *input, int inputlength, int samplecount, 32 | int32_t *output, int outputlength, char *srcname, 33 | int swapflag); 34 | extern int msr_decode_geoscope (char *input, int samplecount, float *output, 35 | int outputlength, int encoding, char *srcname, 36 | int swapflag); 37 | extern int msr_decode_cdsn (int16_t *input, int samplecount, int32_t *output, 38 | int outputlength, int swapflag); 39 | extern int msr_decode_sro (int16_t *input, int samplecount, int32_t *output, 40 | int outputlength, char *srcname, int swapflag); 41 | extern int msr_decode_dwwssn (int16_t *input, int samplecount, int32_t *output, 42 | int outputlength, int swapflag); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # Build environment can be configured the following 3 | # environment variables: 4 | # CC : Specify the C compiler to use 5 | # CFLAGS : Specify compiler options to use 6 | 7 | # Required compiler parameters 8 | CFLAGS += -I../libmseed 9 | 10 | LDFLAGS = -L../libmseed 11 | LDLIBS = -lmseed 12 | 13 | BIN = ascii2mseed 14 | 15 | SRCS = ascii2mseed.c 16 | 17 | OBJS = $(SRCS:.c=.o) 18 | 19 | all: $(BIN) 20 | 21 | $(BIN): $(OBJS) 22 | $(CC) $(CFLAGS) -o ../$@ $(OBJS) $(LDFLAGS) $(LDLIBS) 23 | 24 | clean: 25 | rm -f $(OBJS) ../$(BIN) 26 | 27 | install: 28 | @echo 29 | @echo "No install target, copy the executable(s) yourself" 30 | @echo 31 | -------------------------------------------------------------------------------- /src/Makefile.wat: -------------------------------------------------------------------------------- 1 | # 2 | # THIS FILE IS DEPRECATED AND WILL BE REMOVED IN A FUTURE RELEASE 3 | # 4 | # Wmake File - for Watcom's wmake 5 | # Use 'wmake -f Makefile.wat' 6 | 7 | .BEFORE 8 | @set INCLUDE=.;$(%watcom)\H;$(%watcom)\H\NT 9 | @set LIB=.;$(%watcom)\LIB386 10 | 11 | cc = wcc386 12 | cflags = -zq 13 | lflags = OPT quiet OPT map LIBRARY ..\libmseed\libmseed.lib 14 | cvars = $+$(cvars)$- -DWIN32 15 | 16 | BIN = ..\ascii2mseed.exe 17 | 18 | INCS = -I..\libmseed 19 | 20 | all: $(BIN) 21 | 22 | $(BIN): ascii2mseed.obj 23 | wlink $(lflags) name $(BIN) file {ascii2mseed.obj} 24 | 25 | # Source dependencies: 26 | ascii2mseed.obj: ascii2mseed.c 27 | 28 | # How to compile sources: 29 | .c.obj: 30 | $(cc) $(cflags) $(cvars) $(INCS) $[@ -fo=$@ 31 | 32 | # Clean-up directives: 33 | clean: .SYMBOLIC 34 | del *.obj *.map $(BIN) 35 | -------------------------------------------------------------------------------- /src/Makefile.win: -------------------------------------------------------------------------------- 1 | # 2 | # Nmake file - Windows version 3 | # Use 'nmake -f Makefile.win' 4 | 5 | NODEBUG=1 6 | 7 | INCS = /I..\libmseed 8 | OPTS = -D_CRT_SECURE_NO_WARNINGS 9 | LIBS = ..\libmseed\libmseed.lib 10 | 11 | BIN = ..\ascii2mseed.exe 12 | 13 | all: $(BIN) 14 | 15 | $(BIN): ascii2mseed.obj 16 | link.exe /nologo /out:$(BIN) $(LIBS) ascii2mseed.obj 17 | 18 | .c.obj: 19 | $(CC) /nologo $(CFLAGS) $(INCS) $(OPTS) /c $< 20 | 21 | # Clean-up directives 22 | clean: 23 | -del a.out core *.o *.obj *% *~ $(BIN) 24 | --------------------------------------------------------------------------------