DATRW++ library: seismic data I/O with multiple formats
suheader.cc
Go to the documentation of this file.
1 /*! \file suheader.cc
2  * \brief handle a Seismic Unix trace header (implementation)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 19/11/2010
8  *
9  * handle a Seismic Unix trace header (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  * - 19/11/2010 V1.0 Thomas Forbriger
31  * - 17.12.2010 V1.1 bug fixed in scalcof() and scalelf()
32  * - 17.07.2011 V1.2 make scalel==0 non-fatal
33  * - 24.08.2011 V1.3 static cast to integer type just truncates
34  * round sampling interval properly to nearest integer
35  * - 21/01/2012 V1.4 provide online help regarding header fields
36  * - 22/01/2012 V1.5
37  * - pass control parameters to ScalCoo and Coordinates
38  * - delegate to scale value handling functions
39  * - indicate ultrasonic data
40  * - renamed absdelay -> absdelrt
41  * - 23/01/2012 V1.6
42  * - scaling of delay for ultrasonic data
43  * - reading of ultrasonic data fully supported
44  * - scaling of dt and delrt when setting header values
45  * for ultrasonic data is implemented
46  * V1.7
47  * - added debug output
48  * - check ultrasonic vs. seismic scaling for dt and
49  * delrt; works fine after correction of a few errors
50  *
51  * ============================================================================
52  */
53 #define DATRW_SUHEADER_CC_VERSION \
54  "DATRW_SUHEADER_CC V1.7"
55 
56 #include <datrwxx/suheader.h>
57 #include <datrwxx/error.h>
58 #include <datrwxx/debug.h>
59 #include <datrwxx/sucomanager.h>
60 #include <sstream>
61 #include <cstring>
62 #include <cmath>
63 #include <climits>
64 
65 namespace datrw {
66 
67  namespace su {
68 
69 
70  /*----------------------------------------------------------------------*/
71 
72  void SUheader::read(std::istream& is)
73  {
74  char *ipointer=reinterpret_cast<char *>(&Mheader);
75  DATRW_Xassert(is.read(ipointer, sizeof(TraceHeaderStruct)),
76  "ERROR (SUheader::read): reading SU header",
78  DATRW_debug(Mdebug, "SUheader::read",
79  "some fields upon input:\n"
80  "trid="<<Mheader.trid<<" "
81  "scalco="<<Mheader.scalco<<" "
82  "scalel="<<Mheader.scalel<<"\n");
87  DATRW_debug(Mdebug, "SUheader::read",
88  "some fields upon return:\n"
89  "trid="<<Mheader.trid<<" "
90  "scalco="<<Mheader.scalco<<" "
91  "scalel="<<Mheader.scalel<<"\n");
92  } // void SUheader::read(std::istream& is)
93 
94  /*----------------------------------------------------------------------*/
95 
96  void SUheader::write(std::ostream& os) const
97  {
98  const char *ipointer=reinterpret_cast<const char *>(&Mheader);
99  DATRW_assert(os.write(ipointer, sizeof(TraceHeaderStruct)),
100  "ERROR (SUheader::write): writing SU header");
101  DATRW_debug(Mdebug, "SUheader::write(std::ostream& os)",
102  "wrote "
103  << sizeof(TraceHeaderStruct) << " bytes; "
104  << "os.good() returns " << os.good());
105  } // void write(std::ostream& os) const
106 
107  /*----------------------------------------------------------------------*/
108 
109  //! constructor
111  const bool& debug)
112  : Mheadercontrol(hc), Mdebug(debug)
113  {
114  DATRW_debug(Mdebug, "SUheader::SUheader",
115  "hc.spatialsampling.scalco "
116  << hc.spatialsampling.scalco);
117  this->setdefaults();
118  } // SUheader::SUheader()
119 
120  /*----------------------------------------------------------------------*/
121 
122  //! clear header struct
124  {
125  memset(static_cast<void *>(&Mheader), 0, sizeof(TraceHeaderStruct));
126  Mhaswid2=false;
127  Mhasinfo=false;
128  Mhassrce=false;
129  DATRW_debug(Mdebug, "SUheader::clear()", "cleared all fields");
130  } // void SUheader::clear()
131 
132  /*----------------------------------------------------------------------*/
133 
134  //! set defaults to struct
136  {
137  this->clear();
144  Mheader.trid=1;
145  Mheader.cdpt=1;
146  Mheader.counit=1;
147  Mheader.gain=1;
148  Mheader.igc=1;
149  Mheader.igi=1;
150  Mheader.corr=1;
151  } // void SUheader::setdefaults()
152 
153  /*----------------------------------------------------------------------*/
154 
155  //! return sampling interval
156  double SUheader::dt() const
157  {
158  double factor=1.e-6;
159  if (this->isultrasonic()) { factor=1.e-9; }
160  return (static_cast<double>(Mheader.dt)*factor);
161  } // double SUheader::dt() const
162 
163  /*----------------------------------------------------------------------*/
164 
165  //! true if header defines ultrasonic data sampling
167  {
168  bool retval=false;
169  DATRW_assert(Mheader.d1>=0.,
170  "negative d1 value (header byte offset 180) is illegal");
172  {
173  float seismicdt=static_cast<double>(Mheader.dt)*1.e-6;
174  float ultrasonicdt=static_cast<double>(Mheader.dt)*1.e-9;
175  float seismicres=1.-(seismicdt/Mheader.d1);
176  float ultrasonicres=1.-(ultrasonicdt/Mheader.d1);
177  seismicres=seismicres<0 ? -seismicres : seismicres;
178  ultrasonicres=ultrasonicres<0 ? -ultrasonicres : ultrasonicres;
179  if (seismicres > subformat::def::thresholdcmp)
180  {
182  "d1 value (header byte offset 180) neither matches "
183  "seismic nor ultrasonic data");
184  retval=true;
185  }
186  }
187  return(retval);
188  } // bool SUheader::isultrasonic() const
189 
190  /*----------------------------------------------------------------------*/
191 
192  /*! return factor defined by scalel
193  *
194  * \todo better handle non-standard values only if appropriate file type
195  * modifiers are set; file type modifiers still have to be implemented
196  */
197  double SUheader::scalelf() const
198  {
199  return(scalefactor(Mheader.scalel,
201  } // double SUheader::scalelf() const
202 
203  /*----------------------------------------------------------------------*/
204 
205  //! return scaling factor defined by scalco
206  double SUheader::scalcof() const
207  {
208  return(scalefactor(Mheader.scalco,
210  } // double SUheader::scalcof() const
211 
212  /*----------------------------------------------------------------------*/
213 
214  //! return date of first sample
215  libtime::TAbsoluteTime SUheader::dateoffirstsample() const
216  {
217  libtime::TAbsoluteTime date=this->dateofshot();
218  if (this->delayispositive())
219  {
220  date += this->delay();
221  } else {
222  date -= this->delay();
223  }
224  return(date);
225  } // libtime::TAbsoluteTime SUheader::dateoffirstsample() const
226 
227  /*----------------------------------------------------------------------*/
228 
229  // is delay positive
231  {
232  return(Mheader.delrt>=0);
233  } // bool SUheader::delayispositive() const
234 
235  /*----------------------------------------------------------------------*/
236 
237  // absolute delay value
238  int SUheader::absdelrt() const
239  {
240  return(Mheader.delrt>=0 ? Mheader.delrt : -Mheader.delrt);
241  } // int SUheader::absdelrt() const
242 
243  /*----------------------------------------------------------------------*/
244 
245  /*! return recording delay
246  *
247  * libtime::TRelativeTime has microsecond resolution such that the return
248  * type of the function is also appropriate for ultrasonic data
249  */
250  libtime::TRelativeTime SUheader::delay() const
251  {
252  double factor=1.e-3;
253  if (this->isultrasonic()) { factor=1.e-6; }
254  return(libtime::double2time(factor
255  *static_cast<double>(this->absdelrt())));
256  } // libtime::TRelativeTime SUheader::delay() const
257 
258  /*----------------------------------------------------------------------*/
259 
260  //! return date of shot
261  libtime::TAbsoluteTime SUheader::dateofshot() const
262  {
263  libtime::TAbsoluteTime retval(Mheader.year, 0,
264  Mheader.day,
265  Mheader.hour,
266  Mheader.minute,
267  Mheader.sec);
268  retval.setdoy(Mheader.day);
269  return(retval);
270  } // libtime::TAbsoluteTime SUheader::dateofshot() const
271 
272  /*----------------------------------------------------------------------*/
273 
274  //! return SRCE line
275  ::sff::SRCE SUheader::srce() const
276  {
277  DATRW_assert((Mheader.counit == 1) || (Mheader.counit == 0),
278  "ERROR (SUheader::srce): coordinate units not supported");
279  ::sff::SRCE retval;
280  double scalcof=this->scalcof();
281  retval.cs=::sff::CS_cartesian;
282  retval.cx=static_cast<double>(Mheader.sx)*scalcof;
283  retval.cy=static_cast<double>(Mheader.sy)*scalcof;
284  retval.cz=-static_cast<double>(Mheader.sdepth)*this->scalelf();
285  retval.date=this->dateofshot();
286  return(retval);
287  } // ::sff::SRCE SUheader::srce() const
288 
289  /*----------------------------------------------------------------------*/
290 
291  //! return INFO line
292  ::sff::INFO SUheader::info() const
293  {
294  DATRW_assert((Mheader.counit == 1) || (Mheader.counit == 0),
295  "ERROR (SUheader::info): coordinate units not supported");
296  ::sff::INFO retval;
297  double scalcof=this->scalcof();
298  retval.cs=::sff::CS_cartesian;
299  retval.cx=static_cast<double>(Mheader.gx)*scalcof;
300  retval.cy=static_cast<double>(Mheader.gy)*scalcof;
301  retval.cz=static_cast<double>(Mheader.gelev)*this->scalelf();
302  retval.nstacks=Mheader.nvs;
303  return(retval);
304  } // ::sff::INFO SUheader::info() const
305 
306  /*----------------------------------------------------------------------*/
307 
308  //! return WID2 line
309  ::sff::WID2 SUheader::wid2() const
310  {
312  "ERROR (SUheader::wid2): no seismic data");
313  ::sff::WID2 retval;
314  retval.nsamples=Mheader.ns;
315  retval.dt=this->dt();
316  retval.date=this->dateoffirstsample();
317  std::ostringstream oss;
318  /* set channel and station to tracf:
319  * Trace number within original field record
320  */
321  oss.width(3); oss.fill('0'); oss << Mheader.tracf;
322  retval.channel=oss.str();
323  retval.station=oss.str();
324  oss.str("");
325  /* set auxid to fldr
326  * Original field record number
327  */
328  oss.width(3); oss.fill('0'); oss << Mheader.fldr;
329  retval.auxid=oss.str();
330  return(retval);
331  } // ::sff::WID2 SUheader::wid2() const
332 
333  /*----------------------------------------------------------------------*/
334 
335  //! set values from SRCE line
336  void SUheader::set(const ::sff::SRCE &srce)
337  {
338  DATRW_debug(Mdebug, "SUheader::set(const ::sff::SRCE &srce)",
339  "set SRCE values:"
340  " cx: " << srce.cx <<
341  " cy: " << srce.cy <<
342  " cz: " << srce.cz);
343  DATRW_assert(srce.cs == ::sff::CS_cartesian,
344  "ERROR (SUheader::set SRCE): "
345  "can only handle cartesian cooridnates");
347  coo.getvaluesfrom(Mheader);
348  coo.sx.set(srce.cx);
349  coo.sy.set(srce.cy);
350  coo.sdepth.set(-srce.cz);
351  coo.setvaluesin(Mheader);
352  Msrcedate=srce.date;
353  Mhassrce=true;
354  this->settimes();
355  } // void SUheader::set(const ::sff::SRCE &srce)
356 
357  /*----------------------------------------------------------------------*/
358 
359  //! set values from INFO line
360  void SUheader::set(const ::sff::INFO &info)
361  {
362  DATRW_debug(Mdebug, "SUheader::set(const ::sff::INFO &info)",
363  "set INFO values:"
364  " cx: " << info.cx <<
365  " cy: " << info.cy <<
366  " cz: " << info.cz);
367  DATRW_assert(info.cs == ::sff::CS_cartesian,
368  "ERROR (SUheader::set INFO): "
369  "can only handle cartesian cooridnates");
370  DATRW_debug(Mdebug, "SUheader::set(const ::sff::INFO &info)",
371  "values upon entry:"
372  << DATRW_value(Mheader.gx) << ", "
373  << DATRW_value(Mheader.gy) << ", "
376  coo.getvaluesfrom(Mheader);
377  coo.gx.set(info.cx);
378  coo.gy.set(info.cy);
379  coo.gelev.set(info.cz);
380  coo.setvaluesin(Mheader);
381  Mheader.nvs=static_cast<short>(info.nstacks);
382  DATRW_debug(Mdebug, "SUheader::set(const ::sff::INFO &info)",
383  "values upon exit:"
384  << DATRW_value(Mheader.gx) << ", "
385  << DATRW_value(Mheader.gy) << ", "
387  } // void SUheader::set(const ::sff::INFO &info)
388 
389  /*----------------------------------------------------------------------*/
390 
391  //! set values from WID2 line
392  void SUheader::set(const ::sff::WID2 &wid2)
393  {
394  DATRW_debug(Mdebug, "SUheader::set(const ::sff::WID2 &wid2)",
395  "set WID2 values");
396  Mheader.ns=static_cast<unsigned short>(wid2.nsamples);
397  Mwid2dt=wid2.dt;
398  Mwid2date=wid2.date;
399  Mhaswid2=true;
400  {
401  std::istringstream iss(wid2.channel);
402  iss >> Mheader.tracf;
403  }
404  {
405  std::istringstream iss(wid2.auxid);
406  iss >> Mheader.fldr;
407  }
408  this->settimes();
409  } // void SUheader::set(const ::sff::WID2 &wid2)
410 
411  /*----------------------------------------------------------------------*/
412 
413  //! set date
414  void SUheader::set(const libtime::TAbsoluteTime &date)
415  {
416  Mheader.year=static_cast<short>(date.year());
417  Mheader.day=static_cast<short>(date.doy());
418  Mheader.hour=static_cast<short>(date.hour());
419  Mheader.minute=static_cast<short>(date.minute());
420  Mheader.sec=static_cast<short>(date.second());
421  } // void SUheader::set(const libtime::TAbsoluteTime &date)
422 
423  /*----------------------------------------------------------------------*/
424 
425  //! set time values
427  {
428  // report inpu data for debugging
430  "ERROR SUheader::settimes: ",
431  "set times: Mhaswid2 " << Mhaswid2
432  << " Mhassrce " << Mhassrce);
434  "ERROR SUheader::settimes: ",
435  "WID2 time: " << Mwid2date.timestring()
436  << " WID2 dt: " << Mwid2dt);
438  "ERROR SUheader::settimes: ",
439  "SRCE time: " << Msrcedate.timestring());
440  // check whether evaluation of this function makes sense at all
442  "ERROR SUheader::settimes: "
443  "function called at wrong instance");
444 
445  // ultrasonic flag is required for setting delrt
446  bool ultrasonic=false;
447  // set sampling interval if WID2 data is present
448  // ---------------------------------------------
449  if (Mhaswid2)
450  {
451  DATRW_assert(this->Mwid2dt>0,
452  "received non-positive sampling interval");
453  // evaluate dt and check for ultrasonic data
454  double dtfactor=1.e6;
455  double scaleddt=nearbyint(dtfactor*this->Mwid2dt);
458  {
460  {
461  ultrasonic=true;
462  dtfactor=1.e9;
463  scaleddt=nearbyint(dtfactor*this->Mwid2dt);
465  "SUheader::settimes",
466  "ultrasonic scaling is forced");
467  }
468  else
469  {
471  "SUheader::settimes",
472  "seismic scaling is forced");
473  }
474  }
475  else
476  {
477  if ((!ultrasonic) && scaleddt <1.)
478  {
479  ultrasonic=true;
480  dtfactor=1.e9;
481  scaleddt=nearbyint(dtfactor*this->Mwid2dt);
483  "SUheader::settimes",
484  "ultrasonic scaling because of dt "
485  << scaleddt << "ns value");
486  }
487  else
488  {
490  "SUheader::settimes",
491  "seismic scaling because of dt "
492  << scaleddt << "us value");
493  }
494  }
495  if (scaleddt > USHRT_MAX)
496  {
497  std::cerr << "received sampling interval: " << scaleddt;
498  if (ultrasonic)
499  {
500  std::cerr << " ns";
501  }
502  else
503  {
504  std::cerr << " us";
505  }
506  std::cerr << std::endl;
507  }
508  DATRW_assert(scaleddt <= USHRT_MAX,
509  "ERROR (SUheader::set): "
510  "sampling interval cannot be represented by "
511  "a field of type unsigend short");
512  Mheader.dt=static_cast<unsigned short>(scaleddt);
513  Mheader.d1=0.;
514  if (ultrasonic)
515  { Mheader.d1=static_cast<double>(Mheader.dt)/dtfactor; }
516  }
517 
518  // set source time and trigger delay
519  // ---------------------------------
520  if (Mhaswid2 && Mhassrce)
521  {
522  libtime::TRelativeTime del=Mwid2date-Msrcedate;
523  this->set(Msrcedate);
524  double delfactor=1.e3;
525  if (ultrasonic) { delfactor=1.e6; }
526  double delvalue=std::floor(delfactor*libtime::time2double(del));
527  if (Mwid2date<Msrcedate) { delvalue *= -1.; }
528  DATRW_assert(((delvalue >= SHRT_MIN) && (delvalue <= SHRT_MAX)),
529  "ERROR (SUheader::set): "
530  "trigger delay cannot be represented by "
531  "a field of type short.");
532  this->Mheader.delrt=static_cast<short>(delvalue);
533  }
534  else if (Mhaswid2)
535  {
536  this->set(Mwid2date);
537  this->Mheader.delrt=0;
538  }
539  else if (Mhassrce)
540  {
541  this->set(Msrcedate);
542  this->Mheader.delrt=0;
543  }
544  } // void SUheader::settimes();
545 
546  /*----------------------------------------------------------------------*/
547 
548  void SUheader::help(std::ostream& os)
549  {
550  os <<
551  "The library uses only few header fields. Upon reading the\n"
552  "following fields are used:\n";
553  os <<
554  "wid2.nsamples = header.ns\n"
555  "wid2.dt = header.dt*1.e-6\n"
556  "wid2.date = srce.date+header.delrt*1.e-3\n"
557  "wid2.channel = header.tracf\n"
558  " (tracf = Trace number within original field record)\n"
559  "wid2.station = header.tracf\n"
560  "wid2.auxid = header.fldr\n"
561  " (fldr = Original field record number)\n";
562  os <<
563  "info.cx = header.gx*scalcof\n"
564  "info.cy = header.gy*scalcof\n"
565  "info.cz = header.gelev*scalelf\n"
566  "info.nstacks = header.nvs\n";
567  os <<
568  "srce.cx = header.sx*scalcof\n"
569  "srce.cy = header.sy*scalcof\n"
570  "srce.cz = header.sdepth*scalelf\n"
571  "srce.date = date(year,day,hour,minute,sec)\n";
572  os <<
573  "header.scalco and header.scalel are as defined for the SEG-Y "
574  "format:\n"
575  "http://www.seg.org/SEGportalWEBproject/prod/SEG-Publications/Pub-Technical-Standards/Documents/seg_y_rev1.pdf\n"
576  "except when their modulus is smaller than 10 and larger than 0.\n"
577  "In this case the scaling factors scalcof and scalelf are taken to be\n"
578  "10 to the power of header.scalco or header.scalel, respectively\n";
579  os <<
580  "Notice that in contrast to the definition of the SeismicUn*x format\n"
581  "this library also supports high frequency sampling for ultrasonic\n"
582  "data. A special meaning of header fields was defined within the TOAST\n"
583  "project:\n";
584  os <<
585  "Small sampling interval (smaller than 1 microsecond) as used in\n"
586  "ultrasonic recordings are to be stored in SeismicUn*x data format\n"
587  "within TOAST as follows:\n";
588  os <<
589  "1. Time values for ultrasonic data will be given in nanoseconds for\n"
590  " dt and microseconds for delrt.\n"
591  "2. This applies to fields\n"
592  " a) dt (byte# 117-118): sample interval\n"
593  " b) delrt (byte# 109-110): delay recording time\n";
594  os <<
595  "3. Time units other than microseconds or nanoseconds for dt and\n"
596  " milliseconds or microseconds for delrt are not allowed.\n"
597  "4. Field d1 (byte# 181-184) in TOAST data will be\n"
598  " a) either zero, indicating standard seismic data with a\n"
599  " micro seconds time scale or\n"
600  " b) provide the sampling interval in seconds, thus indicating\n"
601  " i) either standard seismic data, if d1 in seconds matches\n"
602  " dt if the latter is taken in microseconds or\n"
603  " ii) ultrasonic data, if d1 in seconds matches dt if the\n"
604  " latter is taken in nanoseconds and delrt is taken\n"
605  " in microseconds\n";
606  os <<
607  "This way it is possible to use SU tools to sort traces or similar\n"
608  "or even waveform filters. The user just has to take care to pass\n"
609  "filter frequencies in kHz rather than Hz in the case of ultrasonic\n"
610  "data.\n";
611  } // void SUheader::help(std::ostream& os) const
612 
613  } // namespace su
614 
615 } // namespace datrw
616 
617 /* ----- END OF suheader.cc ----- */
int gy
Group coordinate - Y.
int sy
Source coordinate - Y.
short sec
second of minute
float d1
sample spacing for non-seismic data
short scalel
Scalar to be applied to the previous 7 entries to give the real value (see details).
bool Mhassrce
we received srce data
Definition: suheader.h:225
bool delayispositive() const
is delay positive recording delay
Definition: suheader.cc:230
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
short gain
Gain type of field instruments code (see dateils).
int sx
Source coordinate - X.
macro function for debugging output (prototypes)
full set of coordinates.This struct holds a full set of coordinates for a SEG-Y trace header...
Definition: sucomanager.h:195
short minute
minute of hour
double Mwid2dt
intermediately store sampling interval from wid2 line
Definition: suheader.h:235
bool forceultrasonic
force ultrasonic headers
Definition: suformat.h:151
ScalCoo gy
receiver y coordinate
Definition: sucomanager.h:217
short year
year data recorded
TemporalSampling temporalsampling
Definition: suformat.h:170
int fldr
Original field record number.
short igi
instrument early or initial gain
::sff::INFO info() const
return INFO line
Definition: suheader.cc:292
SEG-Y and SU trace header as taken from segy.h coming with SeismicUnixsegy - trace identification hea...
short hour
hour of day (24 hour clock)
bool bestrict
if true: strictly use header definition by SeismicUnix source
Definition: suformat.h:133
ScalCoo sx
source x coordinate
Definition: sucomanager.h:211
void clear()
clear header struct
Definition: suheader.cc:123
const double thresholdzero
Definition: suformat.cc:75
::sff::WID2 wid2() const
return WID2 line
Definition: suheader.cc:309
short scalco
preferred scalco value
Definition: suformat.h:131
libtime::TAbsoluteTime dateoffirstsample() const
return date of first sample
Definition: suheader.cc:215
bool Mhaswid2
we received wid2 data
Definition: suheader.h:227
#define DATRW_Xassert(C, M, E)
Check an assertion and report by throwing an exception.
Definition: error.h:76
double dt() const
return sampling interval
Definition: suheader.cc:156
short corr
correlated: 1 = no, 2 = yes
int gelev
Receiver group elevation from sea level (all elevations above the Vertical datum are positive and bel...
double scalelf() const
return factor defined by scalel
Definition: suheader.cc:197
datrw::su::options::SUHeaderControl Mheadercontrol
all options taken from the user
Definition: suheader.h:202
bool Mdebug
be verbose
Definition: suheader.h:204
exception class declaration for libdatrwxx (prototypes)
short igc
instrument gain constant
short trid
Trace identification code (see details).
short nvs
Number of vertically summed traces yielding this trace: 1 is one trace, 2 is two summed traces...
ScalCoo gx
receiver x coordinate
Definition: sucomanager.h:215
unsigned short dt
sample interval; in micro-seconds
int sdepth
Source depth below surface (a positive number).
unsigned short ns
number of samples in this trace
int absdelrt() const
absolute (always positive) delay value
Definition: suheader.cc:238
Root namespace of library.
Definition: aalibdatrwxx.cc:16
ScalCoo gelev
source y coordinate
Definition: sucomanager.h:221
short scalco
Scalar to be applied to the next 4 entries to give the real value (see details).
void set(const datrw::su::options::SUHeaderControl &hc)
set control parameters
Definition: suheader.h:129
short delrt
Delay recording time (see details).
ScalCoo sdepth
source z coordinate
Definition: sucomanager.h:219
void write(std::ostream &os) const
write struct to file
Definition: suheader.cc:96
bool isultrasonic() const
true if header defines sampling of ultrasonic data
Definition: suheader.cc:166
int gx
Group coordinate - X.
libtime::TAbsoluteTime Mwid2date
date from WID2 line
Definition: suheader.h:233
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
libtime::TRelativeTime delay() const
recording delay
Definition: suheader.cc:250
::sff::SRCE srce() const
return SRCE line
Definition: suheader.cc:275
ScalCoo sy
source y coordinate
Definition: sucomanager.h:213
SUheader(const datrw::su::options::SUHeaderControl &ch, const bool &debug=false)
constructor
Definition: suheader.cc:110
int tracf
Trace number within original field record.
int cdpt
Trace number within the ensemble.
libtime::TAbsoluteTime dateofshot() const
return date of shot
Definition: suheader.cc:261
void settimes()
set time values correctly
Definition: suheader.cc:426
void read(std::istream &is)
read struct from file
Definition: suheader.cc:72
#define DATRW_value(V)
report value
Definition: debug.h:65
void set(const short &s, const int &c)
set from header fields
Definition: sucomanager.cc:124
static void help(std::ostream &os)
print online help regarding header fields and TOAST data
Definition: suheader.cc:548
double scalcof() const
return factor defined by scalco
Definition: suheader.cc:206
libtime::TAbsoluteTime Msrcedate
date from SRCE line
Definition: suheader.h:231
void fixscalevalue(short &s, const bool &strict)
fix a SeismicUn*x scale value
Definition: sucomanager.cc:498
short counit
Coordinate units (see details).
void setvaluesin(TraceHeaderStruct &h)
set values in SU header
Definition: sucomanager.cc:384
bool Mhasinfo
we received info data
Definition: suheader.h:229
const double thresholdcmp
Definition: suformat.cc:76
options to control the way header variables are handeled.
Definition: suformat.h:168
TraceHeaderStruct Mheader
the actual data fields are provided for public access
Definition: suheader.h:239
void setdefaults()
set defaults to struct
Definition: suheader.cc:135
void getvaluesfrom(const TraceHeaderStruct &h)
read values from SU header
Definition: sucomanager.cc:360
bool forceseismic
force seismic headers
Definition: suformat.h:153
double scalefactor(short s, const bool &strict)
convert scale value to a factor to be applied
Definition: sucomanager.cc:546