49 #define DATRW_MSEEDREAD_MSEEDRECORD_READ_CC_VERSION \ 50 "DATRW_MSEEDREAD_MSEEDRECORD_READ_CC V1.5" 55 #include <datrwxx/mseedread.h> 59 #include <datrwxx/mseed_keywords.h> 60 #include <aff/subarray.h> 107 int nblocks=reclen/block.
bytesize();
111 bool filetellsnframes=
false;
114 filetellsnframes=
true;
119 "unreasonable number of frames (" 121 ") given in blockette1001\n" 122 <<
" consider to use format modifier \"estimateNframes\"");
128 "ERROR (reading MiniSEED record): " 129 "Can only decode Steim (1) or Steim (2) compression");
137 bool waitingforxn=
true;
142 while ((iblock <= nblocks) &&
144 ((iframe <
nframes) || (!filetellsnframes)))
148 while (pdata <
int(block.
bytesize()) &&
150 ((iframe <
nframes) || (!filetellsnframes)))
163 "compression format not supported");
170 "ERROR (reading MiniSEED record): " 175 "ERROR (reading MiniSEED record): " 195 sum += rframe.
diff();
206 if (iblock < nblocks)
212 "input stream is bad!");
221 while (iblock < nblocks)
228 "input stream is bad!");
242 const std::string CHintToFormatModifiers(
243 "consider to use format modifiers \"" 246 "if you like to ignore this inconsistency");
267 "usec-value in MiniSEED record is out of specified range\n" 269 "usec-value in [1001] Data Extension Blockette: " 271 "specified range SEED Reference Manual, " 272 "Version 2.4, August, 2012 (page 124):\n" 273 "The recommended value is from -50 to +49 usecs.\n" 274 "At the users option, this value may be from 0 to +99 usecs.\n" 275 << CHintToFormatModifiers);
290 "number of samples in MiniSEED record is inconsistent\n" 292 "number of samples announced in header: " 294 "number of samples actually used: " 296 << CHintToFormatModifiers);
318 (
Mdata(isample-1)==xn),
319 "data in MiniSEED record are inconsistent\n" 320 "consistency check \"" <<
key::data <<
"\" complains:\n" 321 "expected value of last sample " 322 "(i.e. reverse integration constant): " 324 "value of last sample (" 327 << CHintToFormatModifiers);
346 "number of frames in MiniSEED record is inconsistent\n" 347 "consistency check \"" <<
key::nframes <<
"\" complains:\n" 348 "number of frames announced in header: " 350 "number of frames actually used: " 352 << CHintToFormatModifiers);
356 if (is.good()) {
Mvalid=
true; }
ConsistencyChecks Mchecks
flags controlling consistency checks
bool fatal
Consequences of check.
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
ConsistencyCheckControl nsamples
Check for consistent number of samples.
MiniSEEDblock readheader(std::istream &is)
read header and return block
static const int blocksize
size of frame in bytes
ConsistencyCheckControl data
Check for consistent data values.
macro function for debugging output (prototypes)
SEED::DataExtensionBlockette Mblockette1001
Data Extension Blockette.
void read(std::istream &is)
read a full MiniSEED record including data samples
unsigned int bytesize() const
const char *const nframes
keywords for consistency checks
bool Mhasblockette1001
Data Extension Blockette is present.
int Mxm1
Expected value of last sample in previous block.
bool MestimateNframes
estimate number of frames
ConsistencyCheckControl usec
Check for usec field being in specified range.
const char *const data
keywords for consistency checks
bool needswap(const unsigned char &bytesex)
check bytesex
unsigned int ifcount() const
A copy of bytesex.h from libtfxx (prototypes)
aff::Series< Tvalue > Tseries
type of container for sample data
#define DATRW_warning(N, M)
Report a warning.
Root namespace of library.
bool docheck
Activation of check.
const char *const skipcheck
keywords for format modifiers
#define DATRW_abort(M)
Abort and give a message.
contains non-data information, like headers
bool inconsistencies_are_not_fatal
make inconsistencies non fatal
SEED::FixedDataRecordHeader Mrecordheader
Fixed Data Record Header.
#define DATRW_nonfatal_assert(F, C, M)
Macro to distinguish between fatal and non fatal assertions.
Tseries Mdata
Container for sample data.
void next()
step to next difference value
provide mini-SEED data (prototypes)
unsigned int iformat() const
unsigned int nsamples() const
number of samples
virtual int diff() const =0
return current difference value
bool valid() const
we are still inside the frame
const char *const nsamples
number of samples per minute block and channel
SEED::DataOnlySEEDBlockette Mblockette1000
Data Only SEED Blockette.
#define DATRW_value(V)
report value
Debug Mdebug
debug options
bool Mvalid
contains valid data
ConsistencyCheckControl nframes
Check for consistent number of frames.
unsigned char bytesex
Word order.
ESteimControl ctrl(const int &i) const
return control code for word i
unsigned int reclenbytes() const
const char *const nonfatal
keywords for format modifiers