Brief description of class still missing. More...
#include <MiniSeedTrace.h>
Classes | |
class | Record |
Public Member Functions | |
void | addRecord (LibMSeed::MSRecord *msr, off_t pos) |
bool | belongsTo (LibMSeed::MSRecord *msr) |
QString | channel () const |
QString | location () const |
MiniSeedTrace (LibMSeed::MSRecord *msr) | |
QString | network () const |
int | nSamples () const |
MiniSeedRecords | records () const |
double | samplingFrequency () const |
MiniSeedTrace * | split () |
QDateTime | startTime () const |
QString | station () const |
double | t0 () const |
~MiniSeedTrace () |
Brief description of class still missing.
Represents a Mini Seed trace. This class is used only while reading a new file. Function records() returns a compact description of records to be stored in Signal.
GeopsyCore::MiniSeedTrace::MiniSeedTrace | ( | LibMSeed::MSRecord * | msr | ) |
void GeopsyCore::MiniSeedTrace::addRecord | ( | LibMSeed::MSRecord * | msr, |
off_t | pos | ||
) |
Add new samples from record msr located at position pos in mseed volume.
References TRACE.
Referenced by GeopsyCore::MiniSeedVolume::read().
{ TRACE; Record * rec=new Record; _records.append(rec); LibMSeed::BTime& t=msr->fsdh->start_time; rec->_startTime=QDateTime(QDate( t.year, 1, 1), QTime(t.hour, t.min, t.sec)); rec->_startTime=rec->_startTime.addDays(t.day -1); rec->_t0=t.fract * 0.0001; // Time is stored with a precision of 100 us in seed blocket // t.fract is the fractional second from 0 to 9999 rec->_nSamples=msr->samplecnt; rec->_byteLength=msr->reclen; rec->_pos=pos; /*printf("Adding record to %s_%s:%s\t\t%i\t%i\t%li\t%s\t%lf\n", _network.toAscii().data(), _station.toAscii().data(), _channel.toAscii().data(), rec->_nSamples, rec->_byteLength, rec->_pos, rec->_startTime.toString("yyyy-MM-dd hh:mm:ss").toAscii().data(), rec->_t0);*/ }
bool GeopsyCore::MiniSeedTrace::belongsTo | ( | LibMSeed::MSRecord * | msr | ) |
QString GeopsyCore::MiniSeedTrace::channel | ( | ) | const [inline] |
{return _channel;}
QString GeopsyCore::MiniSeedTrace::location | ( | ) | const [inline] |
{return _location;}
QString GeopsyCore::MiniSeedTrace::network | ( | ) | const [inline] |
{return _network;}
int GeopsyCore::MiniSeedTrace::nSamples | ( | ) | const |
References GeopsyCore::MiniSeedRecords::add(), and TRACE.
{ TRACE; int n=_records.count(); MiniSeedRecords recs; for(int i=0; i<n; i++) { const Record& r=*_records.at(i); recs.add(r._pos, r._byteLength); } return recs; }
double GeopsyCore::MiniSeedTrace::samplingFrequency | ( | ) | const [inline] |
{return _samplingFrequency;}
Slit non-continuous trace, does nothing except sorting records by increasing time if the trace is continous.
References TRACE.
Referenced by GeopsyCore::MiniSeedVolume::read().
{ TRACE; if(!_sorted) { qSort(_records.begin(), _records.end(), Record::lessThan); _sorted=true; } int n=_records.count(); Record * last=_records.at(0); for(int i=1; i<n;i++) { Record * current=_records.at(i); double elapsed=last->_startTime.secsTo(current->_startTime)-last->_t0+current->_t0; /*printf("Checking continuity of %s_%s:%s\t\t%i\t%lf\t%s\t%lf\n", _network.toAscii().data(), _station.toAscii().data(), _channel.toAscii().data(), current->_nSamples, fabs(nElapsed - last->_nSamples), current->_startTime.toString("yyyy-MM-dd hh:mm:ss").toAscii().data(), current->_t0);*/ double duration=_deltaT*last->_nSamples; if(fabs(elapsed-duration)>=0.0001) { // MiniSeed has a 100 us presicion on times if(elapsed>duration) { MiniSeedTrace * sig=new MiniSeedTrace(*this); // Move all remaining records including the current to the new trace for(int j=i; j<n; j++) { sig->_records.append(_records.at(j)); } for(int j=i; j<n; j++) { _records.removeLast(); } return sig; } else { // overlaping records: look for matching records further in the list MiniSeedTrace * sig=new MiniSeedTrace(*this); splitOverlapping(i, sig); /*printf("After split overlapping new sig[%i] starts at %s %lf and ends at %s %lf\n", sig->nSamples(), sig->_records.first()->_startTime.toString("yyyy-MM-dd hh:mm:ss").toAscii().data(), sig->_records.first()->_t0, sig->_records.last()->_startTime.toString("yyyy-MM-dd hh:mm:ss").toAscii().data(), sig->_records.last()->_t0); printf("After split overlapping this sig[%i] starts at %s %lf and ends at %s %lf\n", nSamples(), _records.first()->_startTime.toString("yyyy-MM-dd hh:mm:ss").toAscii().data(), _records.first()->_t0, _records.last()->_startTime.toString("yyyy-MM-dd hh:mm:ss").toAscii().data(), _records.last()->_t0);*/ return sig; } } else { last=current; } } return 0; }
QDateTime GeopsyCore::MiniSeedTrace::startTime | ( | ) | const [inline] |
{return _records.first()->_startTime;}
QString GeopsyCore::MiniSeedTrace::station | ( | ) | const [inline] |
{return _station;}
double GeopsyCore::MiniSeedTrace::t0 | ( | ) | const [inline] |
{return _records.first()->_t0;}