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

added date comparison

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: 1464
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 8de511e9
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sffxx.h,v 1.9 2004-01-28 15:56:09 tforb Exp $
* $Id: sffxx.h,v 1.10 2004-01-30 14:45:49 tforb Exp $
* \author Thomas Forbriger
* \date 21/12/2003
*
......@@ -29,7 +29,7 @@
#define TF_SFFXX_H_VERSION \
"TF_SFFXX_H V1.2 "
#define TF_SFFXX_H_CVSID \
"$Id: sffxx.h,v 1.9 2004-01-28 15:56:09 tforb Exp $"
"$Id: sffxx.h,v 1.10 2004-01-30 14:45:49 tforb Exp $"
#include<string>
#include<list>
......@@ -409,20 +409,19 @@ namespace sff {
class WID2compare {
public:
WID2compare(const int& flags=(Fstation | Fchannel | Fdt)):
Mflags(flags), Mdttolerance(0.) { }
Mflags(flags), Mdttolerance(0.), Mdatetolerance(0.) { }
void set(const int& flags) { Mflags=Mflags | flags; }
void clear(const int& flags) { Mflags=Mflags & (0xffffffff ^ flags); }
void setdttolerance(const double& tol) { Mdttolerance=tol; }
void setdatetolerance(const libtime::TRelativeTime& tol)
{ Mdatetolerance=tol; }
void setdatetolerance(const double& tol) { Mdatetolerance=tol; }
bool operator()(const WID2& hd1, const WID2& hd2) const;
int flags() const { return(Mflags); }
double dttolerance() const { return(Mdttolerance); }
libtime::TRelativeTime datetolerance() const { return(Mdatetolerance); }
double datetolerance() const { return(Mdatetolerance); }
private:
int Mflags;
double Mdttolerance;
libtime::TRelativeTime Mdatetolerance;
double Mdatetolerance; //!< relative to mean sampling interval
}; // class WID2compare
} // namespace sff
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: wid2compare.cc,v 1.2 2004-01-28 15:56:09 tforb Exp $
* $Id: wid2compare.cc,v 1.3 2004-01-30 14:45:50 tforb Exp $
* \author Thomas Forbriger
* \date 28/01/2004
*
......@@ -19,7 +19,7 @@
#define TF_WID2COMPARE_CC_VERSION \
"TF_WID2COMPARE_CC V1.0 "
#define TF_WID2COMPARE_CC_CVSID \
"$Id: wid2compare.cc,v 1.2 2004-01-28 15:56:09 tforb Exp $"
"$Id: wid2compare.cc,v 1.3 2004-01-30 14:45:50 tforb Exp $"
#include <cmath>
#include <sffxx.h>
......@@ -31,7 +31,9 @@ namespace sff {
{
bool retval=true;
if (Mflags & Fdate) {
TFXX_abort("ERROR: date comparison not yet implemented!");
libtime::TRelativeTime diff=hd2.date-hd1.date;
retval=retval && (libtime::time2double(diff)
<= ((hd1.dt+hd2.dt)*0.5*Mdatetolerance));
}
if (Mflags & Fstation) { retval=retval && (hd1.station==hd2.station); }
if (Mflags & Fchannel) { retval=retval && (hd1.channel==hd2.channel); }
......
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