DATRW++ library: seismic data I/O with multiple formats
suformat.cc
Go to the documentation of this file.
1 /*! \file suformat.cc
2  * \brief format specific declarations for SeismicUnix (implementation)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 03/12/2010
8  *
9  * format specific declarations for SeismicUnix (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  * - 03/12/2010 V1.0 Thomas Forbriger
31  * - 21/01/2012 V1.1 provide option classes
32  * - 24/01/2012 V1.2 provide functions to evaluate output modifiers
33  *
34  * ============================================================================
35  */
36 #define DATRW_SUFORMAT_CC_VERSION \
37  "DATRW_SUFORMAT_CC V1.2"
38 
39 #include <datrwxx/debug.h>
40 #include <datrwxx/su.h>
41 #include <datrwxx/suformat.h>
42 #include <datrwxx/formatmodifier.h>
43 #include <datrwxx/sucomanager.h>
44 
45 namespace datrw {
46 
47  //@{
48  /*! \brief Format properties
49  * \ingroup group_su
50  */
51  const bool su::isbinary=true;
52  const char* const su::streamID="su";
53  //@}
54 
55  namespace su {
56 
57  namespace subformat {
58 
59  namespace key {
60 
61  const char* const forceseismic="seismic";
62  const char* const forceultrasonic="ultrasonic";
63  const char* const coodigits="digits";
64  const char* const scalco="scalco";
65  const char* const strict="strict";
66 
67  } // namespace key
68 
69  /*----------------------------------------------------------------------*/
70 
71  namespace def {
72 
73  const unsigned int coodigits=4;
74  const short scalco=-100;
75  const double thresholdzero=1.e-12;
76  const double thresholdcmp=1.e-4;
77 
78  } // namespace def
79 
80  } // namespace subformat
81 
82  /*======================================================================*/
83 
85  {
86  return (!(this->forceultrasonic && this->forceseismic));
87  } // bool options::TemporalSampling::isconsistent() const
88 
89  /*----------------------------------------------------------------------*/
90 
91  /*! \brief evaluate input stream format modifiers
92  * \ingroup group_su
93  */
94  options::SUHeaderControl inputmodifiers(const std::string& modifier,
95  const bool& debug)
96  {
98  datrw::Subformat subformat(modifier);
102  "su::inputmodifiers()");
103  DATRW_debug(debug,
104  "su::inputmodifiers()",
106  << "\n" <<
108  << "\n" <<
110  << "\n" <<
112  << "\n" <<
114  return(retval);
115  } // options::SUHeaderControl inputmodifiers(const std::string& mf)
116 
117  /*----------------------------------------------------------------------*/
118 
119  /*! \brief evaluate output stream format modifiers
120  * \ingroup group_su
121  */
122  options::SUHeaderControl outputmodifiers(const std::string& modifier,
123  const bool& debug)
124  {
126  datrw::Subformat subformat(modifier);
132  {
134  >> retval.spatialsampling.coodigits;
135  }
137  {
139  >> retval.spatialsampling.scalco;
140  }
143  "su::outputmodifiers(): "
144  "used format modifiers are in conflict");
146  "su::outputmodifiers()");
147  DATRW_debug(debug,
148  "su::outputmodifiers()",
150  << "\n" <<
152  << "\n" <<
154  << "\n" <<
156  << "\n" <<
158  return(retval);
159  } // options::SUHeaderControl outputmodifiers(const std::string& mf)
160 
161  /*----------------------------------------------------------------------*/
162 
163 
164  } // namespace su
165 
166 } // namespace datrw
167 
168 /* ----- END OF suformat.cc ----- */
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
provide format modifiers (prototypes)
macro function for debugging output (prototypes)
bool forceultrasonic
force ultrasonic headers
Definition: suformat.h:151
const char *const scalco
set desired scalco value
Definition: suformat.cc:64
TemporalSampling temporalsampling
Definition: suformat.h:170
unsigned int coodigits
maximum number of significant digits to be used
Definition: suformat.h:129
bool bestrict
if true: strictly use header definition by SeismicUnix source
Definition: suformat.h:133
const char *const forceseismic
understand data file as seismic data file in any case
Definition: suformat.cc:61
const double thresholdzero
Definition: suformat.cc:75
short scalco
preferred scalco value
Definition: suformat.h:131
options::SUHeaderControl inputmodifiers(const std::string &modifier, const bool &debug)
evaluate input stream format modifiers
Definition: suformat.cc:94
const char *const strict
strictly interpret header as defined in SeismicUnix source
Definition: suformat.cc:65
#define DATRW_assert_modifiers_are_recognized(S, F)
abort if user passed unused modifiers
Root namespace of library.
Definition: aalibdatrwxx.cc:16
const short scalco
default scalco value
Definition: suformat.cc:74
const bool isbinary
Format properties.
Definition: suformat.cc:51
const char *const forceultrasonic
understand data file as ultrasonic data file in any case
Definition: suformat.cc:62
const char *const streamID
Format properties.
Definition: suformat.cc:52
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
Class to handle format modifiersThis class is used to parse a format modifier string. Detailed instructions will be given upon request. For some hints have a look at tests/libdatrwxxtests.c.
bool isset(const std::string &k) const
check if user provided this key
const char *const coodigits
maximum number of significant digits to be used
Definition: suformat.cc:63
read Seismic Unix data (prototypes)
#define DATRW_value(V)
report value
Definition: debug.h:65
const unsigned int coodigits
default maximum number of significant digits to be used
Definition: suformat.cc:73
void fixscalevalue(short &s, const bool &strict)
fix a SeismicUn*x scale value
Definition: sucomanager.cc:498
const double thresholdcmp
Definition: suformat.cc:76
options to control the way header variables are handeled.
Definition: suformat.h:168
options::SUHeaderControl outputmodifiers(const std::string &modifier, const bool &debug)
evaluate output stream format modifiers
Definition: suformat.cc:122
bool forceseismic
force seismic headers
Definition: suformat.h:153