sffxx.cc 16.5 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
/*! \file sffxx.cc
 * \brief SFF library (implementation)
 * 
 * ----------------------------------------------------------------------------
 * 
6
 * $Id: sffxx.cc,v 1.18 2005-03-15 18:17:44 tforb Exp $
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
11
12
13
14
15
 * \author Thomas Forbriger
 * \date 21/12/2003
 * 
 * SFF library (implementation)
 * 
 * Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach) 
 * 
 * REVISIONS and CHANGES 
 *  - 21/12/2003   V1.0   Thomas Forbriger
16
17
 *  - 23/02/2004   V1.1   changed DAST and STAT reading code
 *                        there are not necessarily any flag characters
18
19
20
 *  - 07/04/2004   V1.2  
 *                        - provide debug output
 *                        - correct reading of FREE block
thomas.forbriger's avatar
thomas.forbriger committed
21
 *  - 23/12/2004   V1.3   added full block append to FREE
22
 *  - 26/01/2004   V1.4   SRCE reading and INFO reading was not satisfactory
thomas.forbriger's avatar
thomas.forbriger committed
23
24
25
26
27
 *  - 15/03/2005   V1.5   
 *                        - made SRCE date and time reading more robust against
 *                          whitespace 
 *                        - added some debug output
 *                        - check SFF file type version to be at least 1.10
thomas.forbriger's avatar
thomas.forbriger committed
28
29
30
31
 * 
 * ============================================================================
 */
#define TF_SFFXX_CC_VERSION \
thomas.forbriger's avatar
thomas.forbriger committed
32
  "TF_SFFXX_CC   V1.5"
thomas.forbriger's avatar
thomas.forbriger committed
33
#define TF_SFFXX_CC_CVSID \
34
  "$Id: sffxx.cc,v 1.18 2005-03-15 18:17:44 tforb Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
35

36
#include<sstream>
thomas.forbriger's avatar
thomas.forbriger committed
37
#include <sffxx.h>
thomas.forbriger's avatar
thomas.forbriger committed
38
#include <gsexx.h>
thomas.forbriger's avatar
thomas.forbriger committed
39
40
41

namespace sff {

42
43
44
45
46
47
48
  namespace helper {
    //! Check GSE identifier at beginning of line.
    template<class C>
    bool IDmatch(const std::string& line)
    { return(line.substr(0,4)==std::string(C::LINEID)); }
  } // namespace helper

thomas.forbriger's avatar
thomas.forbriger committed
49
  //! Fortran library version (to ensure compatibility)
thomas.forbriger's avatar
thomas.forbriger committed
50
  const double STAT::libversion=1.10;
thomas.forbriger's avatar
thomas.forbriger committed
51
52
53
54
55
56
  const char* const STAT::LINEID="STAT";
  const char* const FREE::LINEID="FREE";
  const char* const SRCE::LINEID="SRCE";
  const char* const DAST::LINEID="DAST";
  const char* const INFO::LINEID="INFO";

thomas.forbriger's avatar
thomas.forbriger committed
57
58
  /*----------------------------------------------------------------------*/

thomas.forbriger's avatar
thomas.forbriger committed
59
60
61
62
63
64
  char coosysID(const Ecoosys& csid)
  {
    char retval;
    if (csid == CS_cartesian) retval='C';
    else if (csid == CS_spherical) retval='S';
    else throw
thomas.forbriger's avatar
thomas.forbriger committed
65
      GSE2::Terror("ERROR (sff::coosysID): library inconsistency!");
thomas.forbriger's avatar
thomas.forbriger committed
66
67
68
69
70
    return(retval);
  } // coosysID

  Ecoosys coosysID(const char& csid)
  {
thomas.forbriger's avatar
thomas.forbriger committed
71
72
73
    Ecoosys retval;
    if (csid=='C') { retval=CS_cartesian; }
    else if (csid=='S') { retval=CS_spherical; }
thomas.forbriger's avatar
thomas.forbriger committed
74
    else throw
thomas.forbriger's avatar
thomas.forbriger committed
75
76
      GSE2::Terror("ERROR (sff::coosysID): unknown coordinate system key!");
    return(retval);
thomas.forbriger's avatar
thomas.forbriger committed
77
78
  } // coosysID

thomas.forbriger's avatar
thomas.forbriger committed
79
80
81
82
83
84
85
/*======================================================================*/
// SFF structs
// -----------
//
// STAT
// ----

86
87
88
89
90
91
92
  /*! \struct STAT
   *
   * The STAT line is the first line in the file header.
   * It contains the version of the library that wrote the file,
   * a timestamp and flags indicating the presence of optional elements lika a
   * FREE block or an SRCE line.
   */
thomas.forbriger's avatar
thomas.forbriger committed
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  STAT::STAT(): hasfree(false), hassrce(false) 
  { setstamp(libtime::now()); }

  void STAT::setstamp(const libtime::TAbsoluteTime& date) const
  {
    char stamp[14];
    int yeardigits, century;
    century=int(date.year()/100);
    yeardigits=date.year()-100*century;
    sprintf(stamp, "%2.2i%2.2li%2.2li.%2.2li%2.2li%2.2li",
            yeardigits, date.month(), date.day(),
            date.hour(), date.minute(), date.second());
    timestamp=std::string(stamp);
  }

  std::string STAT::line() const
  {
    this->setstamp(libtime::now());
    char charline[40];
    std::string code("");
    if (this->hasfree) { code.append("F"); }
    if (this->hassrce) { code.append("S"); }
thomas.forbriger's avatar
thomas.forbriger committed
115
    sprintf(charline, "%-4s  %6.2f %-13s %-10s\n",
thomas.forbriger's avatar
thomas.forbriger committed
116
117
118
119
120
121
122
123
            STAT::LINEID, 
            STAT::libversion,
            timestamp.c_str(),
            code.c_str());
    std::string retval(charline);
    return(retval);
  } // STAT::line()

thomas.forbriger's avatar
thomas.forbriger committed
124
  void STAT::read(std::istream& fis, const bool& debug)
125
  {
thomas.forbriger's avatar
thomas.forbriger committed
126
    if (debug) { std::cerr << "DEBUG (STAT::read):" << std::endl; }
127
128
129
    std::string theline;
    std::getline(fis, theline);
    std::istringstream is(theline);
thomas.forbriger's avatar
thomas.forbriger committed
130
    if (debug) { std::cerr << theline << std::endl; }
131
132
    std::string lineID;
    is >> lineID;
thomas.forbriger's avatar
thomas.forbriger committed
133
    if (debug) { std::cerr << lineID << std::endl; }
134
135
136
137
138
139
140
141
142
143
    if (!helper::IDmatch<STAT>(lineID)) throw
       GSE2::Terror("ERROR (STAT::read): missing STAT ID!");

    double inlibversion;
    is >> inlibversion;
    if (inlibversion>STAT::libversion) 
    { 
      throw 
        GSE2::Terror("ERROR (STAT::read): file library version too large!"); 
    }
thomas.forbriger's avatar
thomas.forbriger committed
144
145
146
147
148
    if (inlibversion<1.10) 
    { 
      throw 
        GSE2::Terror("ERROR (STAT::read): incompatible SFF version!"); 
    }
149
150
151
152
153
154
155

    is >> timestamp;

    std::string code;
    is >> code;
    this->hasfree=(code.find('F')!=std::string::npos);
    this->hassrce=(code.find('S')!=std::string::npos);
thomas.forbriger's avatar
thomas.forbriger committed
156
157
158
159
160
161
162
163
    if (debug)
    {
      if (this->hasfree) 
      { std::cerr << "DEBUG (STAT::read): has FREE block" << std::endl; }
      if (this->hassrce) 
      { std::cerr << "DEBUG (STAT::read): has SRCE line" << std::endl; }
      std::cerr << "DEBUG (STAT::read): finished" << std::endl;
    }
164
165
  } // STAT::read

thomas.forbriger's avatar
thomas.forbriger committed
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*----------------------------------------------------------------------*/
// SRCE
// ----

  SRCE::SRCE(): 
    type("NSP"), date(libtime::now()),
    cs(CS_cartesian), cx(0.), cy(0.), cz(0.) { }

  std::string SRCE::line() const
  {
    char charline[95];
    int yeardigits, century;
    century=int(date.year()/100);
    yeardigits=date.year()-100*century;
thomas.forbriger's avatar
thomas.forbriger committed
180
    sprintf(charline, "%-4s %-20s %1c %15.6f%15.6f%15.6f "
thomas.forbriger's avatar
thomas.forbriger committed
181
182
183
184
185
186
187
188
189
190
            "%2.2i%2.2li%2.2li %2.2li%2.2li%2.2li.%3.3li\n",
            SRCE::LINEID, 
            type.c_str(), 
            coosysID(cs), cx, cy, cz,
            yeardigits, date.month(), date.day(),
            date.hour(), date.minute(), date.second(), date.milsec());
    std::string retval(charline);
    return(retval);
  } // SRCE::line()

thomas.forbriger's avatar
thomas.forbriger committed
191
  void SRCE::read(std::istream& fis, const bool& debug)
192
  {
193
194
195
    std::string theline;
    std::getline(fis, theline);
    std::istringstream is(theline);
196
197
198
199
200
201
202
    std::string lineID;
    is >> lineID;
    if (!helper::IDmatch<SRCE>(lineID)) throw
       GSE2::Terror("ERROR (SRCE::read): missing SRCE ID!");

    char intype[21];
    is.get(intype, 21);
203
    type=&intype[1];
thomas.forbriger's avatar
thomas.forbriger committed
204
205
    if (debug)
    { std::cerr << "DEBUG (SRCE::read): type: " << type << std::endl; }
206
207
208
209
210
211
212

    char cschar;
    is >> cschar;
    cs=coosysID(cschar);
    is >> cx;
    is >> cy;
    is >> cz;
thomas.forbriger's avatar
thomas.forbriger committed
213
214
215
216
217
    if (debug)
    { 
      std::cerr << "DEBUG (SRCE::read): cs,cx,cy,cz: " 
        << cs << "," << cx << "," << cy << "," << cz << std::endl; 
    }
218
219

    std::string datestring,timestring;
thomas.forbriger's avatar
thomas.forbriger committed
220
221
222
223
224
225
226
227
228
229
230
231
232
    char indatestring[8];
    char intimestring[11];
    is.get(indatestring, 8);
    is.get(intimestring, 11);
    datestring=&indatestring[1];
    timestring=&intimestring[1];
    if (debug)
    { 
      std::cerr << "DEBUG (SRCE::read): datestring: " 
        << datestring << std::endl;
      std::cerr << "DEBUG (SRCE::read): timestring: " 
        << timestring << std::endl;
    }
233
    std::string fulldate("");
234
    fulldate+=datestring.substr(0,2);
235
    fulldate+="/";
236
    fulldate+=datestring.substr(2,2);
237
    fulldate+="/";
238
    fulldate+=datestring.substr(4,2);
239
    fulldate+=" ";
240
    fulldate+=timestring.substr(0,2);
241
    fulldate+=":";
242
    fulldate+=timestring.substr(2,2);
243
    fulldate+=":";
244
    fulldate+=timestring.substr(4,6);
thomas.forbriger's avatar
thomas.forbriger committed
245
246
247
    if (debug)
    { 
      std::cerr << "DEBUG (SRCE::read): convert string: " 
thomas.forbriger's avatar
thomas.forbriger committed
248
        << fulldate << std::endl; 
thomas.forbriger's avatar
thomas.forbriger committed
249
    }
250
    date=libtime::TAbsoluteTime(fulldate);
thomas.forbriger's avatar
thomas.forbriger committed
251
252
253
254
255
    if (debug)
    { 
      std::cerr << "DEBUG (SRCE::read): time: " 
        << date.timestring() << std::endl; 
    }
256
257
  } // SRCE::read

thomas.forbriger's avatar
thomas.forbriger committed
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/*----------------------------------------------------------------------*/
// DAST
// ----

  DAST::DAST(): 
    nchar(-1), ampfac(1.), hasfree(false), 
    hasinfo(false), last(false) { }

  std::string DAST::line() const
  {
    char charline[50];
    std::string code("");
    if (this->hasfree) { code.append("F"); }
    if (this->hasinfo) { code.append("I"); }
    if (!this->last) { code.append("D"); }
273
    // write -1 to nchar field in any case
thomas.forbriger's avatar
thomas.forbriger committed
274
    sprintf(charline, "%-4s  %10i %16.6E %-10s\n",
thomas.forbriger's avatar
thomas.forbriger committed
275
            DAST::LINEID, 
276
            -1, ampfac, code.c_str());
thomas.forbriger's avatar
thomas.forbriger committed
277
278
279
280
    std::string retval(charline);
    return(retval);
  } // DAST::line()

281
  void DAST::read(std::istream& fis, const bool& debug)
282
  {
283
284
285
286
287
288
289
290
    if (debug)
    {
      std::cerr << "DEBUG (DAST::read):" << std::endl;
    }
    std::string theline;
    std::getline(fis, theline);
    std::istringstream is(theline);
    if (debug) { std::cerr << theline << std::endl; }
291
292
    std::string lineID;
    is >> lineID;
293
    if (debug) { std::cerr << lineID << std::endl; }
294
295
296
297
298
299
    if (!helper::IDmatch<DAST>(lineID)) throw
       GSE2::Terror("ERROR (DAST::read): missing DAST ID!");
    is >> nchar;
    is >> ampfac;
    std::string code;
    is >> code;
300
301
302
303
304
    if (debug)
    {
      std::cerr << "DEBUG (DAST): read nchar=" << nchar
        << " ampfac=" << ampfac << " code=" << code << std::endl;
    }
305
306
307
308
309
    this->hasinfo=(code.find('I')!=std::string::npos);
    this->hasfree=(code.find('F')!=std::string::npos);
    this->last=(code.find('D')==std::string::npos);
  } // DAST::read

thomas.forbriger's avatar
thomas.forbriger committed
310
311
312
313
314
315
316
317
/*----------------------------------------------------------------------*/
// FREE
// ----

    FREE::FREE() { lines.clear(); }

    void FREE::write(std::ostream& os) const
    {
thomas.forbriger's avatar
thomas.forbriger committed
318
      os << FREE::LINEID << " " << std::endl;
thomas.forbriger's avatar
thomas.forbriger committed
319
320
321
      for(Tlines::const_iterator I=lines.begin();
          I != lines.end(); I++)
      { os << *I << std::endl; }
thomas.forbriger's avatar
thomas.forbriger committed
322
      os << FREE::LINEID << " " << std::endl;
thomas.forbriger's avatar
thomas.forbriger committed
323
324
    } // FREE::write

325
  void FREE::read(std::istream& is, const bool& debug)
326
327
  {
    std::string lineID;
328
    // getline(is,lineID);
329
    is >> lineID;
330
331
332
    if (debug) 
    { std::cerr << "DEBUG (FREE): lineID=" << lineID << std::endl; }
    if (!helper::IDmatch<FREE>(lineID.substr(0,4))) throw
333
       GSE2::Terror("ERROR (FREE::read): missing FREE ID!");
334
    lines.clear();
335
336
337
    is.ignore(10,'\n');
    getline(is,lineID);
    while (!helper::IDmatch<FREE>(lineID.substr(0,4)))
338
    {
339
340
      lines.push_back(lineID);
      getline(is,lineID);
341
342
343
    }
  } // FREE::read

thomas.forbriger's avatar
thomas.forbriger committed
344
  void FREE::append(const Tlines& newlines)
thomas.forbriger's avatar
thomas.forbriger committed
345
  {
thomas.forbriger's avatar
thomas.forbriger committed
346
347
    Tlines::const_iterator I(newlines.begin());
    while (I != newlines.end())
thomas.forbriger's avatar
thomas.forbriger committed
348
349
350
351
352
353
    {
      this->append(*I);
      ++I;
    }
  } // void FREE::append(const Tlines& lines)

thomas.forbriger's avatar
thomas.forbriger committed
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
/*----------------------------------------------------------------------*/
// WID2
// ----

  WID2::WID2():
    date(libtime::now()), station("NSP"), channel("NSP"), auxid("NSP"),
    nsamples(-1), dt(-1.), calib(-1.), calper(-1.), instype("NSP"),
    hang(-1.),vang(-1.) { }

  std::string WID2::line() const
  {
    GSE2::waveform::TWID2 wid2line;
    wid2line.Fyear=date.year();
    wid2line.Fmonth=date.month();
    wid2line.Fday=date.day();
    wid2line.Fhour=date.hour();
    wid2line.Fminute=date.minute();
    wid2line.Fseconds=double(date.second())+
      1.e-3*double(date.milsec()+1.e-3*double(date.micsec()));
    wid2line.Fstation=station;
    wid2line.Fchannel=channel;
    wid2line.Fauxid=auxid;
    wid2line.Fsamps=nsamples;
    wid2line.Fsamprate=1./dt;
    wid2line.Fcalib=calib;
    wid2line.Fcalper=calper;
    wid2line.Finstype=instype;
    wid2line.Fhang=hang;
    wid2line.Fvang=vang;
    return(wid2line.line());
  } // WID2::line()

386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
  void WID2::read(std::istream& is)
  {
    GSE2::waveform::TWID2 wid2line;
    wid2line.read(is);
    int second=int(wid2line.Fseconds);
    int milsec=int(1000*(wid2line.Fseconds-double(second)));
    date=libtime::TAbsoluteTime(wid2line.Fyear,
                                wid2line.Fmonth,
                                wid2line.Fday,
                                wid2line.Fhour,
                                wid2line.Fminute,
                                second, milsec);
    this->station=wid2line.Fstation;
    this->channel=wid2line.Fchannel;
    this->auxid=wid2line.Fauxid;
    this->nsamples=wid2line.Fsamps;
    this->dt=1./wid2line.Fsamprate;
    this->calib=wid2line.Fcalib;
    this->calper=wid2line.Fcalper;
    this->instype=wid2line.Finstype;
    this->hang=wid2line.Fhang;
    this->vang=wid2line.Fvang;
  } // WID2::read

thomas.forbriger's avatar
thomas.forbriger committed
410
411
412
413
414
415
416
417
418
419
/*----------------------------------------------------------------------*/
// INFO
// ----

  INFO::INFO():
    cs(CS_cartesian), cx(0.), cy(0.), cz(0.), nstacks(0) { }

  std::string INFO::line() const
  {
    char charline[60];
thomas.forbriger's avatar
thomas.forbriger committed
420
    sprintf(charline, "%-4s %1c %15.6f%15.6f%15.6f %4i\n",
thomas.forbriger's avatar
thomas.forbriger committed
421
422
423
424
425
426
            INFO::LINEID, 
            coosysID(cs), cx, cy, cz, nstacks);
    std::string retval(charline);
    return(retval);
  } // INFO::line()

427
  void INFO::read(std::istream& fis)
428
  {
429
430
431
    std::string theline;
    std::getline(fis, theline);
    std::istringstream is(theline);
432
433
    std::string lineID;
    is >> lineID;
434
435
    if (!helper::IDmatch<INFO>(lineID)) throw
       GSE2::Terror("ERROR (INFO::read): missing INFO ID!");
436
437
438
439
440
441
442
443
444
    char cschar;
    is >> cschar;
    cs=coosysID(cschar);
    is >> cx;
    is >> cy;
    is >> cz;
    is >> nstacks;
  } // INFO::read

thomas.forbriger's avatar
thomas.forbriger committed
445
446
447
448
449
450
451
452
453
454
455
/*----------------------------------------------------------------------*/
// FileHeader
// ----------

  void FileHeader::write(std::ostream& os) const
  {
    os << Mstat.line();
    if (Mstat.hasfree) { Mfree.write(os); }
    if (Mstat.hassrce) { os << Msrce.line(); }
  }

thomas.forbriger's avatar
thomas.forbriger committed
456
  void FileHeader::read(std::istream& is, const bool& debug)
457
  {
thomas.forbriger's avatar
thomas.forbriger committed
458
    Mstat.read(is, debug);
thomas.forbriger's avatar
thomas.forbriger committed
459
460
461
462
463
464
465
466
467
468
469
470
471
472
    if (Mstat.hasfree) 
    { 
      Mfree.read(is); 
      if (debug)
      { std::cerr << "DEBUG (FileHeader::read): file FREE read" << std::endl; }
    }
    if (Mstat.hassrce) 
    { 
      Msrce.read(is, debug); 
      if (debug)
      { std::cerr << "DEBUG (FileHeader::read): SRCE line read" << std::endl; }
    }
    if (debug)
    { std::cerr << "DEBUG (FileHeader::read): finished" << std::endl; }
473
474
  }

thomas.forbriger's avatar
thomas.forbriger committed
475
476
477
478
/*----------------------------------------------------------------------*/
// TraceHeader
// -----------

thomas.forbriger's avatar
thomas.forbriger committed
479
  void TraceHeader::writeheader(std::ostream& os) const
thomas.forbriger's avatar
thomas.forbriger committed
480
  {
481
    if (Mdebug) { std::cerr << "DEBUG: write DAST line" << std::endl; } 
thomas.forbriger's avatar
thomas.forbriger committed
482
    os << Mdast.line();
483
    if (Mdebug) { std::cerr << "DEBUG: write WID2 line" << std::endl; } 
thomas.forbriger's avatar
thomas.forbriger committed
484
    os << Mwid2.line();
thomas.forbriger's avatar
thomas.forbriger committed
485
486
487
488
  }

  void TraceHeader::writetrailer(std::ostream& os) const
  {
489
490
491
492
493
494
495
496
497
498
    if (Mdast.hasfree) 
    {
      if (Mdebug) { std::cerr << "DEBUG: write FREE block" << std::endl; } 
      Mfree.write(os);
    }
    if (Mdast.hasinfo) 
    {
      if (Mdebug) { std::cerr << "DEBUG: write INFO line" << std::endl; } 
      os << Minfo.line();
    }
thomas.forbriger's avatar
thomas.forbriger committed
499
500
  }

501
502
  void TraceHeader::readheader(std::istream& is) 
  {
503
504
505
    if (Mdebug) { std::cerr << "DEBUG: read DAST line" << std::endl; } 
    Mdast.read(is,Mdebug);
    if (Mdebug) { std::cerr << "DEBUG: read WID2 line" << std::endl; } 
506
507
508
509
510
    Mwid2.read(is);
  }

  void TraceHeader::readtrailer(std::istream& is) 
  {
511
512
513
514
515
516
517
518
519
520
521
522
    if (Mdebug) { std::cerr << "DEBUG: read trace trailer" << std::endl; } 
    if (Mdast.hasfree) 
    {
      if (Mdebug) { std::cerr << "DEBUG: read FREE block" << std::endl; } 
      Mfree.read(is, Mdebug); 
      if (Mdebug) { Mfree.write(std::cerr); }
    }
    if (Mdast.hasinfo) 
    {
      if (Mdebug) { std::cerr << "DEBUG: read INFO line" << std::endl; } 
      Minfo.read(is);
    }
523
524
  }

thomas.forbriger's avatar
thomas.forbriger committed
525
526
527
528
529
530
531
532
/*----------------------------------------------------------------------*/
// WaveformNormalizer
// ------------------

  const int WaveformNormalizer::limit=0x800000;

  WaveformNormalizer::WaveformNormalizer(const Enormmode& nm, 
                                         const double& maxval):
thomas.forbriger's avatar
thomas.forbriger committed
533
    Mmaxval(maxval), Mnorm(nm)
thomas.forbriger's avatar
thomas.forbriger committed
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
  {
    if (Mnorm == NM_one) 
    { 
      Mampfac=1.; 
      Mscale=false;
      if (Mmaxval > double(WaveformNormalizer::limit)) throw
        GSE2::Terror("ERROR (sff::WaveformNormalizer::scan): "
                     "dynamic range to large for non-normalizing mode");
    }
    else if (Mnorm == NM_ifneeded)
    { 
      Mampfac=1.;
      Mscale=false;
      if (Mmaxval > double(WaveformNormalizer::limit))
      {
        Mampfac=Mmaxval/double(WaveformNormalizer::limit); 
        Mscale=true;
      }
    }
    else if (Mnorm == NM_maxdyn)
    { 
      Mampfac=Mmaxval/double(WaveformNormalizer::limit); 
      Mscale=true;
    }
    else throw
      GSE2::Terror("ERROR (sff::WaveformNormalizer::scan): "
                   "library inconsistency!");
  }

563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
/*----------------------------------------------------------------------*/
// SkipWaveform
// ------------

    void SkipWaveform::read(std::istream& is) 
    {
      Mheader.readheader(is);;
      int nsamples=Mheader.wid2().nsamples;
      GSE2::waveform::TDAT2readCM6 freader(nsamples);
      int idata;
      for (int i=0; i<nsamples; i++)
      { idata=freader(is); }
      Mheader.readtrailer(is);
      Mvalid=true;
    } // SkipWaveform::read

thomas.forbriger's avatar
thomas.forbriger committed
579
580
581
} // namespace sff

/* ----- END OF sffxx.cc ----- */