Commit ba980ae5 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2000
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 129859a4
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.22 2006-03-13 10:09:03 tforb Exp $
# $Id: Makefile,v 1.23 2006-03-15 15:34:29 tforb Exp $
#
# Copyright (c) 2004 by Thomas Forbriger (BFO Schiltach)
#
......@@ -14,7 +14,7 @@
HEADERS=$(wildcard *.h */*.h)
HEADERS=datread.h bonjer.h bonjer/readbonjer.h readany.h error.h \
pdas.h pdas/pdasread.h pdas/pdasflags.h \
pdas.h pdas/pdasread.h pdas/pdasflags.h mseed/seedstructdump.h \
sff.h mseed.h mseed/mseedread.h mseed/seedstructs.h \
hpmo.h hpmo/readhpmo.h hpmo/hpmodata.h util.h
......@@ -22,7 +22,7 @@ HEADERS=datread.h bonjer.h bonjer/readbonjer.h readany.h error.h \
# misc/blitzfortranio.cc hacks/hack_blitztogrepg.cc
LIBSRC=$(wildcard *.cc */*.cc)
LIBSRC=datread.cc bonjer/bonjer.cc bonjer/readbonjer.cc readany.cc error.cc \
pdas/pdas.cc pdas/pdasread.cc \
pdas/pdas.cc pdas/pdasread.cc mseed/seedstructdump.cc \
sff/sff.cc mseed/mseedread.cc mseed/mseed.cc mseed/seedstructs.cc \
hpmo/hpmo.cc hpmo/readhpmo.cc hpmo/hpmodata.cc \
util.cc
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: mseedread.cc,v 1.5 2006-03-13 10:09:04 tforb Exp $
* $Id: mseedread.cc,v 1.6 2006-03-15 15:34:30 tforb Exp $
* \author Thomas Forbriger
* \date 15/07/2004
*
......@@ -19,7 +19,7 @@
#define TF_MSEEDREAD_CC_VERSION \
"TF_MSEEDREAD_CC V1.0 "
#define TF_MSEEDREAD_CC_CVSID \
"$Id: mseedread.cc,v 1.5 2006-03-13 10:09:04 tforb Exp $"
"$Id: mseedread.cc,v 1.6 2006-03-15 15:34:30 tforb Exp $"
#include <string>
#include <datreadxx/mseedread.h>
......@@ -75,11 +75,19 @@ namespace datread {
}
} // MiniSEEDblock::MiniSEEDblock
std::string char2string(char* in,int len)
/*----------------------------------------------------------------------*/
//! convert BTIME structure to libtime structure
libtime::TAbsoluteTime convert(const SEED::BTIME& t)
{
return(std::string("not yet coded"));
}
int milsec=int(t.tmilsec/10);
int micsec=100*(t.tmilsec-milsec*10);
libtime::TAbsoluteTime retval(t.year, 1, 1,
t.hour, t.min, t.sec,
milsec, micsec);
retval.setdoy(t.doy);
return(retval);
} // libtime::TAbsoluteTime convert(const SEED::BTIME& t)
} // namespace mseed
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: mseedread.h,v 1.4 2006-03-13 10:09:04 tforb Exp $
* $Id: mseedread.h,v 1.5 2006-03-15 15:34:30 tforb Exp $
* \author Thomas Forbriger
* \date 15/07/2004
*
......@@ -23,11 +23,12 @@
#define TF_MSEEDREAD_H_VERSION \
"TF_MSEEDREAD_H V1.0 "
#define TF_MSEEDREAD_H_CVSID \
"$Id: mseedread.h,v 1.4 2006-03-13 10:09:04 tforb Exp $"
"$Id: mseedread.h,v 1.5 2006-03-15 15:34:30 tforb Exp $"
#include<new>
#include<iostream>
#include<datreadxx/seedstructs.h>
#include<libtime++.h>
namespace datread {
......@@ -103,9 +104,8 @@ namespace datread {
/*======================================================================*/
// functions
//! convert character sequence to string
std::string char2string(char* ,int);
//! convert BTIME structure to libtime structure
libtime::TAbsoluteTime convert(const SEED::BTIME& t);
} // namespace mseed
......
/*! \file seedstructdump.cc
* \brief dump SEED structs in human readable form (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id: seedstructdump.cc,v 1.1 2006-03-15 15:34:30 tforb Exp $
* \author Thomas Forbriger
* \date 15/03/2006
*
* dump SEED structs in human readable form (implementation)
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 15/03/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define TF_SEEDSTRUCTDUMP_CC_VERSION \
"TF_SEEDSTRUCTDUMP_CC V1.0 "
#define TF_SEEDSTRUCTDUMP_CC_CVSID \
"$Id: seedstructdump.cc,v 1.1 2006-03-15 15:34:30 tforb Exp $"
#include<string>
#include<iomanip>
#include<datreadxx/seedstructdump.h>
#include<datreadxx/mseedread.h>
namespace datread {
namespace mseed {
namespace SEED {
namespace util {
void print_field_name(const char* f, std::ostream& os)
{
os.width(30);
os.fill(' ');
os << f << ": ";
} // void print_field_name(const char* f, std::ostream& os)
void print_flags(const unsigned char& f, std::ostream& os)
{
unsigned short int v=f;
std::ostream::fmtflags flags=os.flags();
os.setf(std::ios_base::hex, std::ios_base::basefield);
os.setf(std::ios_base::showbase);
os << v;
os << " (" << std::setbase(1) << v << ")";
os.flags(flags);
} // void print_flags(const unsigned char& f, std::ostream& os)
void print_address(const unsigned short int& f, std::ostream& os)
{
std::ostream::fmtflags flags=os.flags();
os.setf(std::ios_base::hex, std::ios_base::basefield);
os.setf(std::ios_base::showbase);
os << f;
os.flags(flags);
} // void print_address(const unsigned short int& f, std::ostream& os)
} // namespace util
void dump(const ControlHeader& s, std::ostream& os)
{
os << "Control Header:" << std::endl;
util::print_field_name("sequence no", os);
os << std::string(s.seqno, 6);
os << std::endl;
util::print_field_name("type", os);
os << s.type;
os << std::endl;
util::print_field_name("cont", os);
os << s.cont;
os << std::endl;
} // void dump(const ControlHeader& s, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const BlocketteHeader& s, std::ostream& os)
{
} // void dump(const BlocketteHeader& s, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const BTIME& s, std::ostream& os)
{
libtime::TAbsoluteTime thetime=convert(s);
os << thetime.timestring();
} // void dump(const BTIME& s, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const DataExtensionBlockette& s, std::ostream& os)
{
} // void dump(const DataExtensionBlockette& s, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const DataOnlySEEDBlockette& s, std::ostream& os)
{
} // void dump(const DataOnlySEEDBlockette& s, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const DataRecordBlocketteHeader& s, std::ostream& os)
{
} // void dump(const DataRecordBlocketteHeader& s, std::ostream& os)
/*----------------------------------------------------------------------*/
void dump(const FixedDataRecordHeader& s, std::ostream& os)
{
os << "Fixed Data Record Header:" << std::endl;
dump(s.controlheader, os);
util::print_field_name("station identifier code", os);
os << std::string(s.stat, 5) << std::endl;
util::print_field_name("location identifier", os);
os << std::string(s.loc, 2) << std::endl;
util::print_field_name("channel identifier", os);
os << std::string(s.chan, 3) << std::endl;
util::print_field_name("network code", os);
os << std::string(s.net, 2) << std::endl;
util::print_field_name("record start time", os);
os << convert(s.stime).timestring() << std::endl;
util::print_field_name("number of samples", os);
os << s.nsamp << std::endl;
util::print_field_name("sample rate factor", os);
os << s.srate << std::endl;
util::print_field_name("sample rate multiplier", os);
os << s.srmult << std::endl;
util::print_field_name("activity flags", os);
util::print_flags(s.aflags, os);
os << std::endl;
util::print_field_name("i/o and clock flags", os);
util::print_flags(s.ioflags, os);
os << std::endl;
util::print_field_name("data quality flags", os);
util::print_flags(s.qflags, os);
os << std::endl;
util::print_field_name("number of blockettes", os);
os << int(s.numblock) << std::endl;
util::print_field_name("time correction", os);
os << s.tcorr << std::endl;
util::print_field_name("beginning of data", os);
util::print_address(s.dbeg, os);
os << std::endl;
util::print_field_name("first blockette", os);
util::print_address(s.fblock, os);
os << std::endl;
} // void dump(const FixedDataRecordHeader& s, std::ostream& os)
} // namespace SEED
} // namespace mseed
} // namespace datread
/* ----- END OF seedstructdump.cc ----- */
/*! \file seedstructdump.h
* \brief dump SEED structs in human readable form (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id: seedstructdump.h,v 1.1 2006-03-15 15:34:30 tforb Exp $
* \author Thomas Forbriger
* \date 15/03/2006
*
* dump SEED structs in human readable form (prototypes)
*
* Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 15/03/2006 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef TF_SEEDSTRUCTDUMP_H_VERSION
#define TF_SEEDSTRUCTDUMP_H_VERSION \
"TF_SEEDSTRUCTDUMP_H V1.0 "
#define TF_SEEDSTRUCTDUMP_H_CVSID \
"$Id: seedstructdump.h,v 1.1 2006-03-15 15:34:30 tforb Exp $"
#include<iostream>
#include<datreadxx/seedstructs.h>
namespace datread {
namespace mseed {
namespace SEED {
void dump(const ControlHeader& s, std::ostream& os);
void dump(const BlocketteHeader& s, std::ostream& os);
void dump(const BTIME& s, std::ostream& os);
void dump(const DataExtensionBlockette& s, std::ostream& os);
void dump(const DataOnlySEEDBlockette& s, std::ostream& os);
void dump(const DataRecordBlocketteHeader& s, std::ostream& os);
void dump(const FixedDataRecordHeader& s, std::ostream& os);
} // namespace SEED
} // namespace mseed
} // namespace datread
#endif // TF_SEEDSTRUCTDUMP_H_VERSION (includeguard)
/* ----- END OF seedstructdump.h ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seedstructs.h,v 1.4 2006-03-13 10:09:05 tforb Exp $
* $Id: seedstructs.h,v 1.5 2006-03-15 15:34:30 tforb Exp $
* \author Thomas Forbriger
* \date 16/07/2004
*
......@@ -23,7 +23,7 @@
#define TF_SEEDSTRUCTS_H_VERSION \
"TF_SEEDSTRUCTS_H V1.0 "
#define TF_SEEDSTRUCTS_H_CVSID \
"$Id: seedstructs.h,v 1.4 2006-03-13 10:09:05 tforb Exp $"
"$Id: seedstructs.h,v 1.5 2006-03-15 15:34:30 tforb Exp $"
namespace datread {
......@@ -57,7 +57,7 @@ namespace datread {
template<class C>
void copy_from_pointer(C* target, const char* p)
{ *target = *((C*)(p)); }
{ *target = *(reinterpret_cast<const C*>(p)); }
/*! a structure to hold any control header
*
......@@ -141,6 +141,57 @@ namespace datread {
unsigned short int tmilsec;
}; // BTIME
/*! a structure to hold activity flags
*
* used in Fixed Data Record Header
* see chapter 8, page 93
*/
struct ActivityFlags {
ActivityFlags() { }
ActivityFlags(const char* p) { copy_from_pointer(this, p); }
bool calpres: 1; //!< calibration signals present
bool tcorrapp: 1; //!< time correction applied
bool begevent: 1; //!< beginning of event
bool endevent: 1; //!< end of event
bool posleap: 1; //!< a positive leap second happend
bool negleap: 1; //!< a negative leap second happend
bool event: 1; //!< event in progress
}; // ActivityFlags
/*! a structure to hold I/O flags
*
* used in Fixed Data Record Header
* see chapter 8, page 93
*/
struct IOFlags {
IOFlags() { }
IOFlags(const char* p) { copy_from_pointer(this, p); }
bool parityerr: 1; //!< station volume parity error possibly present
bool longrec: 1; //!< long record read
bool shortrec: 1; //!< short record read
bool start: 1; //!< start of time series
bool end: 1; //!< end of time series
bool locked: 1; //!< clock locked
}; // IOFlags
/*! a structure to hold quality flags
*
* used in Fixed Data Record Header
* see chapter 8, page 93
*/
struct QualityFlags {
QualityFlags() { }
QualityFlags(const char* p) { copy_from_pointer(this, p); }
bool ampsat: 1; //!< amplifier saturation detected
bool clip: 1; //!< digitizer clipping detected
bool spike: 1; //!< spikes detected
bool glitch: 1; //!< glitches detected
bool miss: 1; //!< missing/padded data present
bool telsynch: 1; //!< telemetry synchronization error
bool charging: 1; //!< a digital filter may be charging
bool time: 1; //!< time tag is questionable
}; // QualityFlags
/*! a strcuture to hold a fixed data record header
*
* see chapter 8, page 92.
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: mseedtest.cc,v 1.3 2006-03-13 10:09:05 tforb Exp $
* $Id: mseedtest.cc,v 1.4 2006-03-15 15:34:31 tforb Exp $
* \author Thomas Forbriger
* \date 15/07/2004
*
......@@ -19,13 +19,14 @@
#define MSEEDTEST_VERSION \
"MSEEDTEST V1.0 test mini-SEED reading"
#define MSEEDTEST_CVSID \
"$Id: mseedtest.cc,v 1.3 2006-03-13 10:09:05 tforb Exp $"
"$Id: mseedtest.cc,v 1.4 2006-03-15 15:34:31 tforb Exp $"
#include <fstream>
#include <iostream>
#include <tfxx/commandline.h>
#include <datreadxx/error.h>
#include <datreadxx/mseedread.h>
#include <datreadxx/seedstructdump.h>
#include <datreadxx/mseed.h>
using std::cout;
......@@ -119,6 +120,7 @@ int main(int iargc, char* argv[])
<< "-"
<< controlheader.cont
<< endl;
datread::mseed::SEED::dump(controlheader, cout);
if (controlheader.type == 'D')
{
datread::mseed::SEED::FixedDataRecordHeader
......@@ -127,6 +129,7 @@ int main(int iargc, char* argv[])
cout << "contains " << int(dataheader.numblock)
<< " blockette(s)" << endl;
cout << "data starts at offset " << int(dataheader.fblock) << endl;
datread::mseed::SEED::dump(dataheader, cout);
}
ifs >> block;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment