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

added debug option to SAC module

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: 3051
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 64179a1e
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: readany.cc,v 1.17 2009-11-12 16:34:25 tforb Exp $
* $Id: readany.cc,v 1.18 2010-05-03 11:07:45 tforb Exp $
* \author Thomas Forbriger
* \date 06/04/2004
*
......@@ -34,13 +34,14 @@
* - 29/06/2007 V1.3 added SAC binary format
* - 19/09/2007 V1.4 added raw GSE format
* - 12/11/2009 V1.5 added TSOFT format
* - 03/05/2010 V1.6 sac provides debugging
*
* ============================================================================
*/
#define DATREAD_READANY_CC_VERSION \
"DATREAD_READANY_CC V1.5"
"DATREAD_READANY_CC V1.6"
#define DATREAD_READANY_CC_CVSID \
"$Id: readany.cc,v 1.17 2009-11-12 16:34:25 tforb Exp $"
"$Id: readany.cc,v 1.18 2010-05-03 11:07:45 tforb Exp $"
#include <datreadxx/readany.h>
#include<datreadxx/sff.h>
......@@ -64,7 +65,7 @@ namespace datread {
else if (Mformat==Fsff) { Mis=new isffstream(is, debug); }
else if (Mformat==Fhpmo) { Mis=new ihpmostream(is); }
else if (Mformat==Fmseed) { Mis=new imseedstream(is, debug); }
else if (Mformat==Fsac) { Mis=new isacstream(is); }
else if (Mformat==Fsac) { Mis=new isacstream(is, debug); }
else if (Mformat==Fgse) { Mis=new igsestream(is); }
else if (Mformat==Ftsoft) { Mis=new itsoftstream(is); }
else
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sac.h,v 1.5 2007-06-29 13:50:07 tforb Exp $
* $Id: sac.h,v 1.6 2010-05-03 11:07:45 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2004
*
......@@ -29,6 +29,7 @@
*
* REVISIONS and CHANGES
* - 21/12/2004 V1.0 Thomas Forbriger
* - 03/05/2010 V1.1 sac provides debugging option
*
* ============================================================================
*/
......@@ -37,9 +38,9 @@
#ifndef TF_SAC_H_VERSION
#define TF_SAC_H_VERSION \
"TF_SAC_H V1.0 "
"TF_SAC_H V1.1"
#define TF_SAC_H_CVSID \
"$Id: sac.h,v 1.5 2007-06-29 13:50:07 tforb Exp $"
"$Id: sac.h,v 1.6 2010-05-03 11:07:45 tforb Exp $"
#include<datreadxx/datread.h>
......@@ -52,7 +53,7 @@ namespace datread {
class isacstream: public idatstream {
public:
typedef idatstream Tbase;
isacstream(std::istream& is);
isacstream(std::istream& is, const bool& debug=false);
virtual ~isacstream() { }
virtual Tdseries dseries();
virtual Tfseries fseries();
......@@ -61,6 +62,7 @@ namespace datread {
static void help(std::ostream& os=std::cout);
private:
void readheader();
bool Mdebug;
}; // class isacstream
} // namespace datread
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sac.cc,v 1.8 2007-07-02 08:42:08 tforb Exp $
* $Id: sac.cc,v 1.9 2010-05-03 11:07:45 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2004
*
......@@ -29,13 +29,14 @@
*
* REVISIONS and CHANGES
* - 21/12/2004 V1.0 Thomas Forbriger
* - 03/05/2010 V1.1 sac provides debugging option
*
* ============================================================================
*/
#define TF_SAC_CC_VERSION \
"TF_SAC_CC V1.0 "
"TF_SAC_CC V1.1"
#define TF_SAC_CC_CVSID \
"$Id: sac.cc,v 1.8 2007-07-02 08:42:08 tforb Exp $"
"$Id: sac.cc,v 1.9 2010-05-03 11:07:45 tforb Exp $"
#include <string>
#include <sstream>
......@@ -43,10 +44,12 @@
#include <datreadxx/sacread.h>
#include <datreadxx/error.h>
#include <datreadxx/util.h>
#include <datreadxx/debug.h>
namespace datread {
isacstream::isacstream(std::istream& is): Tbase(is, true, true, true)
isacstream::isacstream(std::istream& is, const bool& debug):
Tbase(is, true, true, true), Mdebug(debug)
{ }
/*----------------------------------------------------------------------*/
......@@ -75,19 +78,29 @@ namespace datread {
void isacstream::skipseries()
{
DATREAD_debug(this->Mdebug, "isacstream::skipseries()",
"entered function: call this->readheader()");
this->readheader();
DATREAD_debug(this->Mdebug, "isacstream::skipseries()",
"finished; return from function");
}
/*----------------------------------------------------------------------*/
void isacstream::readheader()
{
DATREAD_debug(this->Mdebug, "isacstream::readheader()",
"start reading header");
this->newtrace();
sff::FREE free;
sff::WID2 wid2;
sff::INFO info;
std::ostringstream oss;
DATREAD_debug(this->Mdebug, "isacstream::readheader()",
"calling datread::sac::read_sac_header");
datread::sac::SACheader hd=datread::sac::read_sac_header(this->Mis);
DATREAD_debug(this->Mdebug, "isacstream::readheader()",
"returned from datread::sac::read_sac_header");
oss << "location: ";
if (hd.stla>0) { oss << hd.stla << "N; "; }
......@@ -95,6 +108,7 @@ namespace datread {
if (hd.stlo>0) { oss << hd.stlo << "E; "; }
else { oss << -hd.stlo << "W"; }
free.append(oss.str());
DATREAD_debug(this->Mdebug, "isacstream::readheader()", oss.str());
free.append("values from SAC binary header "
"that do not fit into SFF trace header");
wid2.dt=hd.delta;
......@@ -125,6 +139,9 @@ namespace datread {
this->setinfo(info);
this->settracefree(free);
this->setlast();
DATREAD_debug(this->Mdebug, "isacstream::readheader()",
"finished; return from function");
}
/*----------------------------------------------------------------------*/
......
Markdown is supported
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