DATRW++ library: seismic data I/O with multiple formats

◆ iasciistream()

datrw::iasciistream::iasciistream ( std::istream &  is,
const std::string &  modifier = "",
const bool &  debug = false 
)

Definition at line 61 of file iasciistream.cc.

References DATRW_assert_modifiers_are_recognized, datrw::Subformat::isset(), datrw::ascii::keyauxid, datrw::ascii::keycalib, datrw::ascii::keycalper, datrw::ascii::keychannel, datrw::ascii::keydate, datrw::ascii::keydt, datrw::ascii::keyhang, datrw::ascii::keyinstype, datrw::ascii::keynonfatal, datrw::ascii::keynsamples, datrw::ascii::keynstacks, datrw::ascii::keyRECVCS, datrw::ascii::keyRECVX, datrw::ascii::keyRECVY, datrw::ascii::keyRECVZ, datrw::ascii::keySRCECS, datrw::ascii::keySRCEdate, datrw::ascii::keySRCEtype, datrw::ascii::keySRCEX, datrw::ascii::keySRCEY, datrw::ascii::keySRCEZ, datrw::ascii::keystation, datrw::ascii::keyvang, Mcurrentline, Mcurrentsrce, Mdefaultinfo, Mdefaultsrce, Mdefaultwid2, datrw::idatstream::Mis, Mmodifier, Mnonfatal, Mreadsrce, readheader(), datrw::idatstream::setsrce(), and datrw::Subformat::value().

63  :
64  Tbase(is, true, true, true, debug), Mmodifier(modifier)
65  {
66  // format modifiers must be used here to set defaults
67  datrw::Subformat subformat(Mmodifier);
68  // WID2
69  {
70  libtime::TAbsoluteTime date(subformat.value(ascii::keydate,"2000/1/1"));
71  this->Mdefaultwid2.date=date;
72  }
73  subformat(ascii::keydt, "1.") >> this->Mdefaultwid2.dt;
74  subformat(ascii::keynsamples, "0") >> this->Mdefaultwid2.nsamples;
75  subformat(ascii::keyhang, "-1.") >> this->Mdefaultwid2.hang;
76  subformat(ascii::keyvang, "90.") >> this->Mdefaultwid2.vang;
77  subformat(ascii::keycalib, "1.") >> this->Mdefaultwid2.calib;
78  subformat(ascii::keycalper, "1.") >> this->Mdefaultwid2.calper;
79  this->Mdefaultwid2.station=subformat.value(ascii::keystation,"NSP");
80  this->Mdefaultwid2.channel=subformat.value(ascii::keychannel,"NSP");
81  this->Mdefaultwid2.auxid=subformat.value(ascii::keyauxid,"NSP");
82  this->Mdefaultwid2.instype=subformat.value(ascii::keyinstype,"NSP");
83  // INFO
84  subformat(ascii::keynstacks, "1") >> this->Mdefaultinfo.nstacks;
85  subformat(ascii::keyRECVX, "0.") >> this->Mdefaultinfo.cx;
86  subformat(ascii::keyRECVY, "0.") >> this->Mdefaultinfo.cy;
87  subformat(ascii::keyRECVZ, "0.") >> this->Mdefaultinfo.cz;
88  this->Mdefaultinfo.cs
89  =::sff::coosysID(subformat.value(ascii::keyRECVCS,"C").c_str()[0]);
90  // SRCE
91  subformat(ascii::keySRCEX, "0.") >> this->Mdefaultsrce.cx;
92  subformat(ascii::keySRCEY, "0.") >> this->Mdefaultsrce.cy;
93  subformat(ascii::keySRCEZ, "0.") >> this->Mdefaultsrce.cz;
94  {
95  libtime::TAbsoluteTime
96  date(subformat.value(ascii::keySRCEdate,"2000/1/1"));
97  this->Mdefaultsrce.date=date;
98  }
99  this->Mdefaultsrce.type=subformat.value(ascii::keySRCEtype,"NSP");
100  this->Mdefaultsrce.cs
101  =::sff::coosysID(subformat.value(ascii::keySRCECS,"C").c_str()[0]);
102 
103  this->Mnonfatal=subformat.isset(ascii::keynonfatal);
104 
106  "iasciistream");
107 
108  // read first line
109  std::getline(Mis, this->Mcurrentline);
110  this->readheader();
111  // take FREE blocks only for traces, otherwise FREE blocks will be
112  // mutliplied when reading and rewriting ASCII data
113  // if (this->Mreadfree) { this->setfilefree(this->Mcurrentfree); }
114  if (this->Mreadsrce) { this->setsrce(this->Mcurrentsrce); }
115  } // iasciistream::iasciistream
const char *const keyinstype
key for WID2 line header field
Definition: ascii.cc:51
const char *const keySRCEtype
key for SRCE line header field
Definition: ascii.cc:58
idatstream Tbase
Definition: ascii.h:68
const char *const keySRCEY
key for SRCE line header field
Definition: ascii.cc:60
const char *const keynonfatal
format modifier key
Definition: ascii.cc:75
::sff::INFO Mdefaultinfo
Definition: ascii.h:92
const char *const keyRECVY
key for INFO line header field
Definition: ascii.cc:65
std::string Mmodifier
format modifier
Definition: ascii.h:83
std::string Mcurrentline
Definition: ascii.h:84
const char *const keydt
key for WID2 line header field
Definition: ascii.cc:46
const char *const keyRECVCS
key for INFO line header field
Definition: ascii.cc:67
const char *const keyhang
key for WID2 line header field
Definition: ascii.cc:54
void setsrce(const sff::SRCE &srce)
Definition: datread.cc:129
::sff::SRCE Mcurrentsrce
Definition: ascii.h:96
std::istream & Mis
Definition: datread.h:126
#define DATRW_assert_modifiers_are_recognized(S, F)
abort if user passed unused modifiers
const char *const keycalib
key for WID2 line header field
Definition: ascii.cc:52
const char *const keyauxid
key for WID2 line header field
Definition: ascii.cc:50
bool debug()
indicate debug mode
Definition: datread.h:116
const char *const keychannel
key for WID2 line header field
Definition: ascii.cc:49
::sff::WID2 Mdefaultwid2
Definition: ascii.h:87
const char *const keydate
key for WID2 line header field
Definition: ascii.cc:45
const char *const keynstacks
key for INFO line header field
Definition: ascii.cc:68
const char *const keySRCEdate
key for SRCE line header field
Definition: ascii.cc:57
const char *const keyRECVX
key for INFO line header field
Definition: ascii.cc:64
::sff::SRCE Mdefaultsrce
Definition: ascii.h:95
const char *const keycalper
key for WID2 line header field
Definition: ascii.cc:53
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.
const char *const keynsamples
key for WID2 line header field
Definition: ascii.cc:47
const char *const keySRCEX
key for SRCE line header field
Definition: ascii.cc:59
const char *const keyRECVZ
key for INFO line header field
Definition: ascii.cc:66
const char *const keySRCECS
key for SRCE line header field
Definition: ascii.cc:62
const char *const keyvang
key for WID2 line header field
Definition: ascii.cc:55
const char *const keystation
key for WID2 line header field
Definition: ascii.cc:48
const char *const keySRCEZ
key for SRCE line header field
Definition: ascii.cc:61
Here is the call graph for this function: