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

WIDX is tested

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: 3035
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent db494ea7
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: offset.cc,v 1.2 2007-03-02 11:17:41 tforb Exp $
* $Id: offset.cc,v 1.3 2010-04-13 21:32:34 tforb Exp $
* \author Thomas Forbriger
* \date 02/03/2007
*
......@@ -29,17 +29,17 @@
*
* REVISIONS and CHANGES
* - 02/03/2007 V1.0 Thomas Forbriger
* - 13/04/2010 V1.1 use my own error handling code (not libtfxx)
*
* ============================================================================
*/
#define TF_OFFSET_CC_VERSION \
"TF_OFFSET_CC V1.0 "
#define TF_OFFSET_CC_CVSID \
"$Id: offset.cc,v 1.2 2007-03-02 11:17:41 tforb Exp $"
"$Id: offset.cc,v 1.3 2010-04-13 21:32:34 tforb Exp $"
#include <cmath>
#include <sffxx.h>
#include <tfxx/error.h>
namespace sff {
......@@ -48,7 +48,7 @@ namespace sff {
const double& radius)
{
double retval;
TFXX_assert((srce.cs == info.cs),
SFF_assert((srce.cs == info.cs),
"ERROR (offset): inconsistent coordinate systems!");
if (srce.cs == CS_spherical)
{
......@@ -68,7 +68,7 @@ namespace sff {
}
else
{
TFXX_abort("ERROR (offset): unknown coordinate system!");
SFF_abort("ERROR (offset): unknown coordinate system!");
}
return(retval);
} // double offset(const SRCE& srce, const INFO& info;
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sfftest.cc,v 1.11 2010-04-13 20:33:42 tforb Exp $
* $Id: sfftest.cc,v 1.12 2010-04-13 21:32:34 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2003
*
......@@ -36,7 +36,7 @@
#define SFFTEST_VERSION \
"SFFTEST V1.0 test library modules"
#define SFFTEST_CVSID \
"$Id: sfftest.cc,v 1.11 2010-04-13 20:33:42 tforb Exp $"
"$Id: sfftest.cc,v 1.12 2010-04-13 21:32:34 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -61,7 +61,7 @@ void test_extended_functions()
mywid2.channel="UGZ";
mywid2.instype="ET-19";
mywid2.nsamples=2048;
mywid2.dt=0.01;
mywid2.dt=60.;
mywid2.hang=98.3342;
mywid2.vang=-15.3;
sff::verbose(cout, mywid2);
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sffxx.h,v 1.36 2010-04-13 20:33:42 tforb Exp $
* $Id: sffxx.h,v 1.37 2010-04-13 21:32:34 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2003
*
......@@ -40,7 +40,9 @@
* - 27/06/2006 V1.5 added INFO comparison
* - 02/03/2007 V1.6 added offset calculation
* - 26/06/2007 V1.7 added verbose output
* - 13/04/2010 V1.8 start implementing WIDX
* - 13/04/2010 V1.8
* - start implementing WIDX
* - provide error handling macros
*
* ============================================================================
*/
......@@ -51,12 +53,13 @@
#define TF_SFFXX_H_VERSION \
"TF_SFFXX_H V1.8"
#define TF_SFFXX_H_CVSID \
"$Id: sffxx.h,v 1.36 2010-04-13 20:33:42 tforb Exp $"
"$Id: sffxx.h,v 1.37 2010-04-13 21:32:34 tforb Exp $"
#include<string>
#include<cmath>
#include<list>
#include<iostream>
#include<sstream>
#include<libtime++.h>
#include<aff/iterator.h>
#include<tfxx/commandline.h>
......@@ -73,9 +76,27 @@ namespace sff {
class Terror: public GSE2::Terror
{
public:
Terror(char* message): GSE2::Terror(message) { }
Terror(const std::string& message): GSE2::Terror(message) { }
}; // class Terror
//! check condition
#define SFF_assert( C , M ) \
if (!(C)) { \
std::ostringstream os; \
os << "Condition " << #C << " at line #" << __LINE__ \
<< " in " << __FILE__ << " is false: " << M; \
throw(Terror(os.str())); \
}
//! abort by throwing an exception
#define SFF_abort( M ) \
{ \
std::ostringstream os; \
os << "ABORT at line #" << __LINE__ \
<< " in " << __FILE__ << " because of " << M; \
throw(Terror(os.str())); \
}
/*======================================================================*/
// enum
// ----
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: widXio.cc,v 1.2 2010-04-13 20:33:42 tforb Exp $
* $Id: widXio.cc,v 1.3 2010-04-13 21:32:34 tforb Exp $
* \author Thomas Forbriger
* \date 13/04/2010
*
......@@ -35,7 +35,7 @@
#define TF_WIDXIO_CC_VERSION \
"TF_WIDXIO_CC V1.0"
#define TF_WIDXIO_CC_CVSID \
"$Id: widXio.cc,v 1.2 2010-04-13 20:33:42 tforb Exp $"
"$Id: widXio.cc,v 1.3 2010-04-13 21:32:34 tforb Exp $"
#include <sffxx.h>
#include <sstream>
......@@ -150,6 +150,23 @@ namespace sff {
sff::WID2 WIDXline(const std::string& line)
{
sff::WID2 retval;
SFF_assert(line.substr(0,4) == WIDXID,
"wrong line ID");
retval.date=libtime::TAbsoluteTime(line.substr(5,26));
retval.station=line.substr(32,5);
retval.channel=line.substr(38,3);
retval.auxid=line.substr(42,4);
retval.instype=line.substr(47,6);
std::istringstream is(line.substr(54));
is >> retval.nsamples;
std::string type;
is >> type;
is >> retval.dt;
if (type == "r") { retval.dt = 1./retval.dt; }
is >> retval.calib;
is >> retval.calper;
is >> retval.hang;
is >> retval.vang;
return(retval);
} // sff::WID2 WIDXline(const std::string& line)
......
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