34 #define DATRW_READHPMO_CC_VERSION \ 35 "DATRW_READHPMO_CC V1.0 " 38 #include <datrwxx/readhpmo.h> 49 std::getline(is, this->
Mline);
51 if (verbose) { std::cout <<
Mline << std::endl; }
52 std::string secstring=
Mline.substr(17,2);
54 std::string timestring;
55 const std::string sep(
"/");
56 timestring=
Mline.substr(6,4)+sep+
Mline.substr(0,2)+sep+
58 if (verbose) { std::cout << timestring << std::endl; }
59 Mtime=libtime::TAbsoluteTime(timestring);
60 if (verbose) { std::cout <<
Mtime.timestring() << std::endl; }
61 std::string timezone=
Mline.substr(23,3);
62 if (verbose) { std::cout << timezone << std::endl; }
64 "unexpected time code string!");
65 std::string errorcode=
Mline.substr(34,1);
66 if (verbose) { std::cout << errorcode << std::endl; }
68 if (verbose) { std::cout <<
Merrorflag << std::endl; }
75 os <<
"Header: " << this->
headerline() << std::endl;
76 os <<
" " << this->
time().timestring() << std::endl;
83 libtime::TRelativeTime
dt()
90 libtime::TRelativeTime
toffset(
const int& ichannel)
92 double delay=(ichannel-1)*0.06;
94 if (ichannel==1) { delay += 0.04; }
95 else { delay += 0.41e-3; }
96 return(libtime::double2time(delay));
104 "illegal channel number!");
111 std::string retval(
"unknown flag!");
112 if (flag == 0) { retval=std::string(
"OK"); }
113 if (flag == 1) { retval=std::string(
"bad DCF reception"); }
114 if (flag == 2) { retval=std::string(
"dummy block (2.999999 V)"); }
115 if (flag == 3) { retval=std::string(
"bad DCF reception and ")
116 +std::string(
"dummy block (2.999999 V)"); }
117 if (flag == 4) { retval=std::string(
"RS-232 error"); }
118 if (flag == 8) { retval=std::string(
"possibly error in PC clock"); }
119 if (flag == 16) { retval=std::string(
"invalid header"); }
128 for (
int i=0; i<nblocks; ++i)
133 std::ostringstream oss;
135 retval.append(
"quality flag @ " + blocks[i].Mtime.timestring()
137 retval.append(
" this means: " +
quality(qf));
149 for (
int i=0; i<ninsamples; i++)
155 std::getline(is, dummy);
167 os.setf(std::ios_base::fixed,std::ios_base::basefield);
173 os.flags(std::ios_base::showpos);
174 os.setf(std::ios_base::fixed,std::ios_base::floatfield);
176 os << block(ic, is) <<
" ";
179 os << std::endl <<
" ";
183 os.flags(std::ios_base::showpos);
184 os.setf(std::ios_base::fixed,std::ios_base::floatfield);
186 os << block(ic, is) <<
" ";
188 os.unsetf(std::ios_base::showpos);
197 os << block.
Mtime.timestring() << std::endl;
222 if (verbose) { std::cout <<
"extracting block # "; }
224 while (is.good() && (hot))
234 std::cerr <<
"ERROR (datrw::hpmo::read): " 235 <<
"after reading " << retval.size() <<
" blocks" 239 std::cerr <<
" last successfull block @ " 240 << retval[retval.size()-1].Mtime.timestring() << std::endl;
247 retval.push_back(block);
248 if (verbose) { std::cout << ++iblock <<
" "; }
251 if (verbose) { std::cout << std::endl; }
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
sff::FREE qualityreports(const MinuteBlock *blocks, const int &nblocks)
prepare a report on unusual quality reports
const double sampling_interval
sampling interval in seconds
const int nchannels
number of channels in HP MO data acquisition system
std::vector< MinuteBlock > Tvecofblocks
within the inner reading functions, we use vector to hold minute blocks
libtime::TRelativeTime dt()
return sampling interval of HPMO data acquisition (i.e. 5 sec)
static bool report_on_construct_flag()
return report on construct flag
static void dont_report_on_construct()
Issue NO screen report on construction of exception.
double Msamples[nchannels *nsamples]
const int nsamples
number of samples per minute block and channel
exception class declaration for libdatrwxx (prototypes)
Base class for exceptions.
libtime::TRelativeTime toffset(const int &ichannel)
return time offset for channel ichannel (due to multiplexer)
Root namespace of library.
libtime::TAbsoluteTime Mtime
hold samples of one minute-block
Tvecofblocks readfile(std::istream &is, const bool &verbose)
read a full data file
std::string quality(const int &flag)
return meaning of quality flag
void dump(std::ostream &os, const SampleBlock &block)
dump one block of samples
void check_channel_no(const int &ichannel)
check if channel number is valid
virtual void report() const
Screen report.
std::istream & operator>>(std::istream &is, MinuteBlock &block)
read a full minute block from C++ stream
SampleBlock readdata(std::istream &is, const bool &verbose)
read one minute block of samples