DATRW++ library: seismic data I/O with multiple formats
seifeformat.cc
Go to the documentation of this file.
1 /*! \file seifeformat.cc
2  * \brief seife format specific structures (implementation)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 30/11/2010
8  *
9  * seife format specific structures (implementation)
10  *
11  * Copyright (c) 2010 by Thomas Forbriger (BFO Schiltach)
12  *
13  * ----
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27  * ----
28  *
29  * REVISIONS and CHANGES
30  * - 30/11/2010 V1.0 Thomas Forbriger
31  *
32  * ============================================================================
33  */
34 #define DATRW_SEIFEFORMAT_CC_VERSION \
35  "DATRW_SEIFEFORMAT_CC V1.0 "
36 
37 #include <datrwxx/seife.h>
38 
39 namespace datrw {
40 
41  /*! \brief all the stuff to read and write seife data
42  *
43  * \defgroup group_seife I/O module for seife data
44  *
45  * \sa \ref page_seife_format
46  */
47 
48  /*! \brief Format properties
49  * \ingroup group_seife
50  * @{
51  */
52  const bool seife::isbinary=false;
53  const char* const seife::streamID="seife";
54  /**@}*/
55 
56 } // namespace datrw
57 
58 /*======================================================================*/
59 
60  /*! \page page_seife_format Definition of the seife format
61  *
62  * This format is defined by E. Wielandt for his time series analysis
63  * programs.
64  * You can find a copy of the source code at
65  * http://www.software-for-seismometry.de
66  *
67  * \section sec_seife_formatdefinition The format description taken from seife.doc
68  *
69  * This format was defined prior to most other presently used data formats,
70  * and I am still adhering to it although it is now obsolete. The structure
71  * of the data files is as follows:
72  *
73  * - one header line, arbitrary (will be echoed but not evaluated)
74  * - up to 48 comment or protocol lines marked with a % character in the
75  * first column. Protocol lines are automatically generated by SEIFE
76  * unless seife.par contains the code ‘ncl’ (no comment lines).
77  * - one line containing the number of samples, the FORTRAN format in which
78  * they are listed, the sampling interval, and an optional time stamp as
79  * described below.
80  * - data in the specified format (here 5f10.3, that is, five entries like
81  * 123456.789 per line).
82  *
83  * The entries in the last header line (which is the second line if there
84  * are no comments) must be in the FORTRAN format (i10,a20,f10.x). It may
85  * contain a time stamp, in which case the format is (i10,a20,3f10.x). The
86  * time stamp consists of two numbers: minutes and seconds after midnight.
87  * No date can be encoded, except by expressing it in minutes. The whole
88  * line might read:
89  *
90  * \code
91  * 12000 (5f10.3) 0.01 617. 23.45
92  * \endcode
93  * The strings begin at positions 1, 11, 31, 41, 51. The time of the first
94  * sample is 10:17:23.45.
95  *
96  * The SEIFE format applies only to files read with the ‘fil infile outfile’
97  * command line, and to the output files. Other ASCII data formats can be
98  * read with the asc, asl, bdf and mar commands; seife, gnuplot, and
99  * headerless single-column ASCII formats can be specified for the output.
100  * Miniseed files can be converted into ASL format with Quanterra’s CIMARRON
101  * software, and then read with SEIFE. A converter from GSE to ASCII format
102  * named CODECO written by Urs Kradolfer is also available. I am offering a
103  * WINDOWS executable of this program.
104  *
105  * \section sec_seife_format_libdatrwxx Specific format supported by this library
106  *
107  * Since we do not provide a full featured Fortran format parser, we limit
108  * the supported data format to an arbitrary sequence of floating point
109  * numbers separated by whitespace. This is any sequence, which can be read
110  * sequentially by the C++ input streams. If your data has no whitespace
111  * separating individual values (which is possible with fixed formats in
112  * Fortran), you should use the Fortran seife.f program itself to convert
113  * the data.
114  *
115  * The appropriate data format for output is
116  * \code
117  * 50 format (6(g12.5,1x))
118  * \endcode
119  * This produces
120  * \code
121  0.84147E+34 0.90930E+34 0.14112E+34 -0.75680E+34 -0.95892E+34 -0.27942E+34
122  0.65699E+34 0.98936E+34 0.41212E+34 -0.54402E+34 -0.99999E+34 -0.53657E+34
123  0.42017E+34 0.99061E+34 0.65029E+34 -0.28790E+34 -0.96140E+34 -0.75099E+34
124  0.14988E+34 0.91295E+34
125  * \endcode
126  *
127  * Similar output is produced by
128  * \code
129  int j=0;
130  for (int i=0;i<30;++i)
131  {
132  cout << setprecision(6) << setw(12);
133  cout << 1.e34*std::sin(i) << " ";
134  ++j;
135  if (j==5)
136  {
137  j=0;
138  cout << endl;
139  }
140  }
141  j=0;
142  for (int i=0;i<30;++i)
143  {
144  cout.setf(ios::scientific,ios::floatfield);
145  cout << setprecision(5) << setw(12);
146  cout << 0.4*std::sin(i) << " ";
147  ++j;
148  if (j==5)
149  {
150  j=0;
151  cout << endl;
152  }
153  }
154  * \endcode
155  *
156  * namely:
157  * \code
158  0 8.41471e+33 9.09297e+33 1.4112e+33 -7.56802e+33
159 -9.58924e+33 -2.79415e+33 6.56987e+33 9.89358e+33 4.12118e+33
160 -5.44021e+33 -9.9999e+33 -5.36573e+33 4.20167e+33 9.90607e+33
161  6.50288e+33 -2.87903e+33 -9.61397e+33 -7.50987e+33 1.49877e+33
162  9.12945e+33 8.36656e+33 -8.85131e+31 -8.4622e+33 -9.05578e+33
163 -1.32352e+33 7.62558e+33 9.56376e+33 2.70906e+33 -6.63634e+33
164  0.00000e+00 3.36588e-01 3.63719e-01 5.64480e-02 -3.02721e-01
165 -3.83570e-01 -1.11766e-01 2.62795e-01 3.95743e-01 1.64847e-01
166 -2.17608e-01 -3.99996e-01 -2.14629e-01 1.68067e-01 3.96243e-01
167  2.60115e-01 -1.15161e-01 -3.84559e-01 -3.00395e-01 5.99509e-02
168  3.65178e-01 3.34662e-01 -3.54052e-03 -3.38488e-01 -3.62231e-01
169 -5.29407e-02 3.05023e-01 3.82550e-01 1.08362e-01 -2.65454e-01
170  * \endcode
171  *
172  */
173 
174 /* ----- END OF seifeformat.cc ----- */
seife reading and writing module (prototypes)
Root namespace of library.
Definition: aalibdatrwxx.cc:16
const char *const streamID
Format properties.
Definition: seifeformat.cc:53
const bool isbinary
Format properties.
Definition: seifeformat.cc:52