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

WID2 now also reads WIDX transparently

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: 3036
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 5fa7fbee
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: sffxx.cc,v 1.32 2010-04-13 11:11:00 tforb Exp $ * $Id: sffxx.cc,v 1.33 2010-04-13 21:38:08 tforb Exp $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 21/12/2003 * \date 21/12/2003
* *
...@@ -61,15 +61,17 @@ ...@@ -61,15 +61,17 @@
* - 17/12/2007 V1.12 - modified output format (printf), since underlying * - 17/12/2007 V1.12 - modified output format (printf), since underlying
* Fortran code of libtime does no longer use * Fortran code of libtime does no longer use
* long int * long int
* - 13/04/2010 V1.13 - round time correctly to milliseconds when writing * - 13/04/2010 V1.13
* - round time correctly to milliseconds when writing
* WID2 line * WID2 line
* - WIDX reading is now transparent
* *
* ============================================================================ * ============================================================================
*/ */
#define TF_SFFXX_CC_VERSION \ #define TF_SFFXX_CC_VERSION \
"TF_SFFXX_CC V1.13" "TF_SFFXX_CC V1.13"
#define TF_SFFXX_CC_CVSID \ #define TF_SFFXX_CC_CVSID \
"$Id: sffxx.cc,v 1.32 2010-04-13 11:11:00 tforb Exp $" "$Id: sffxx.cc,v 1.33 2010-04-13 21:38:08 tforb Exp $"
#include<sstream> #include<sstream>
#include <sffxx.h> #include <sffxx.h>
...@@ -625,26 +627,36 @@ c (90.0 if horizontal) ...@@ -625,26 +627,36 @@ c (90.0 if horizontal)
void WID2::read(std::istream& is) void WID2::read(std::istream& is)
{ {
GSE2::waveform::TWID2 wid2line; std::string line;
wid2line.read(is); std::getline(is, line);
int second=int(wid2line.Fmilsec/1000); if (line.substr(0,4) == WIDXID)
int milsec=wid2line.Fmilsec-1000*second; {
date=libtime::TAbsoluteTime(wid2line.Fyear, *this = WIDXline(line);
wid2line.Fmonth, }
wid2line.Fday, else
wid2line.Fhour, {
wid2line.Fminute, std::istringstream iss(line);
second, milsec); GSE2::waveform::TWID2 wid2line;
this->station=wid2line.Fstation; wid2line.read(iss);
this->channel=wid2line.Fchannel; int second=int(wid2line.Fmilsec/1000);
this->auxid=wid2line.Fauxid; int milsec=wid2line.Fmilsec-1000*second;
this->nsamples=wid2line.Fsamps; date=libtime::TAbsoluteTime(wid2line.Fyear,
this->dt=1./wid2line.Fsamprate; wid2line.Fmonth,
this->calib=wid2line.Fcalib; wid2line.Fday,
this->calper=wid2line.Fcalper; wid2line.Fhour,
this->instype=wid2line.Finstype; wid2line.Fminute,
this->hang=wid2line.Fhang; second, milsec);
this->vang=wid2line.Fvang; this->station=wid2line.Fstation;
this->channel=wid2line.Fchannel;
this->auxid=wid2line.Fauxid;
this->nsamples=wid2line.Fsamps;
this->dt=1./wid2line.Fsamprate;
this->calib=wid2line.Fcalib;
this->calper=wid2line.Fcalper;
this->instype=wid2line.Finstype;
this->hang=wid2line.Fhang;
this->vang=wid2line.Fvang;
}
} // void WID2::read(std::istream& is) } // void WID2::read(std::istream& is)
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
......
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