[installation] Change to nightly
This commit is contained in:
@ -133,30 +133,32 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor : public TimeWindowProcessor {
|
||||
// The noise and signal time window expressions. Those
|
||||
// might depend on origin or travel time information
|
||||
// and are only evaluated during setEnvironment.
|
||||
SignalTime noiseBegin;
|
||||
SignalTime noiseEnd;
|
||||
SignalTime signalBegin;
|
||||
SignalTime signalEnd;
|
||||
SignalTime noiseBegin{-35};
|
||||
SignalTime noiseEnd{-5};
|
||||
SignalTime signalBegin{-5};
|
||||
SignalTime signalEnd{30};
|
||||
|
||||
std::string ttInterface;
|
||||
std::string ttModel;
|
||||
|
||||
double snrMin; /* default: 3 */
|
||||
double snrMin{3}; /* default: 3 */
|
||||
double minimumPeriod{-1}; /* default: -1 */
|
||||
double maximumPeriod{-1}; /* default: -1 */
|
||||
|
||||
double minimumDistance; /* default: 0 */
|
||||
double maximumDistance; /* default: 180 */
|
||||
double minimumDepth; /* default: 0 */
|
||||
double maximumDepth; /* default: 700 */
|
||||
double minimumDistance{0}; /* default: 0 */
|
||||
double maximumDistance{180}; /* default: 180 */
|
||||
double minimumDepth{-1E6}; /* default: -1E6 */
|
||||
double maximumDepth{1E6}; /* default: 1E6 */
|
||||
|
||||
double respTaper;
|
||||
double respMinFreq;
|
||||
double respMaxFreq;
|
||||
double respTaper{5.0};
|
||||
double respMinFreq{0.00833333};
|
||||
double respMaxFreq{0};
|
||||
|
||||
Math::SeismometerResponse::WoodAnderson::Config woodAndersonResponse;
|
||||
|
||||
// If true, compute amplitudes according to the recommendations of the
|
||||
// IASPEI CoSOI Magnitude Working Group. Currently only affects mb.
|
||||
bool iaspeiAmplitudes;
|
||||
bool iaspeiAmplitudes{false};
|
||||
};
|
||||
|
||||
struct Locale : Config {
|
||||
@ -253,6 +255,12 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor : public TimeWindowProcessor {
|
||||
|
||||
void setMinSNR(double snr) { _config.snrMin = snr; }
|
||||
|
||||
//! Sets the minimum measured period required
|
||||
void setMinPeriod(double period) { _config.minimumPeriod = period; }
|
||||
|
||||
//! Sets the maximum measured period required
|
||||
void setMaxPeriod(double period) { _config.maximumPeriod = period; }
|
||||
|
||||
//! Sets the minimum distance to calculate amplitudes for
|
||||
void setMinDist(double dist) { _config.minimumDistance = dist; }
|
||||
|
||||
@ -337,6 +345,10 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor : public TimeWindowProcessor {
|
||||
//! The default implementation returns always false.
|
||||
virtual bool setParameter(Capability cap, const std::string &value);
|
||||
|
||||
//! Returns the configured value associated with a given capability.
|
||||
//! The default implementation returns an empty string.
|
||||
virtual std::string parameter(Capability cap) const;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Public Interface
|
||||
@ -365,7 +377,7 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor : public TimeWindowProcessor {
|
||||
//! Sets the trigger used to compute the timewindow to calculate
|
||||
//! the amplitude
|
||||
//! Once a trigger has been set all succeeding calls will fail.
|
||||
virtual void setTrigger(const Core::Time& trigger);
|
||||
virtual void setTrigger(const Core::Time &trigger);
|
||||
|
||||
Core::Time trigger() const;
|
||||
|
||||
@ -408,9 +420,11 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor : public TimeWindowProcessor {
|
||||
|
||||
virtual void process(const Record *record);
|
||||
|
||||
virtual bool handleGap(Filter *filter, const Core::TimeSpan&,
|
||||
double lastSample, double nextSample,
|
||||
size_t missingSamples) override;
|
||||
void initFilter(double fsamp) override;
|
||||
|
||||
bool handleGap(Filter *filter, const Core::TimeSpan&,
|
||||
double lastSample, double nextSample,
|
||||
size_t missingSamples) override;
|
||||
|
||||
//! Method to prepare the available data just before the noise
|
||||
//! and amplitude calculation takes place. This method can be
|
||||
@ -487,28 +501,27 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor : public TimeWindowProcessor {
|
||||
// Protected Members
|
||||
// ----------------------------------------------------------------------
|
||||
protected:
|
||||
Core::Time _trigger;
|
||||
OPT(Core::Time) _trigger;
|
||||
|
||||
// User defined amplitude search window
|
||||
OPT(double) _searchBegin, _searchEnd;
|
||||
OPT(double) _searchBegin, _searchEnd;
|
||||
|
||||
// pre-arrival offset and rms
|
||||
OPT(double) _noiseOffset, _noiseAmplitude, _lastAmplitude;
|
||||
OPT(double) _noiseOffset, _noiseAmplitude, _lastAmplitude;
|
||||
|
||||
double _snrMax, _snrRMS;
|
||||
bool _enableUpdates;
|
||||
bool _enableResponses;
|
||||
bool _enableUpdates;
|
||||
bool _enableResponses;
|
||||
|
||||
// config
|
||||
Config _config;
|
||||
Environment _environment;
|
||||
Config _config;
|
||||
Environment _environment;
|
||||
|
||||
std::string _type;
|
||||
std::string _unit;
|
||||
std::string _type;
|
||||
std::string _unit;
|
||||
|
||||
std::string _pickID;
|
||||
std::string _pickID;
|
||||
|
||||
bool _responseApplied;
|
||||
bool _responseApplied;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@ -39,12 +39,13 @@ class SC_SYSTEM_CLIENT_API AbstractAmplitudeProcessor_ML : public AmplitudeProce
|
||||
int capabilities() const override;
|
||||
IDList capabilityParameters(Capability cap) const override;
|
||||
bool setParameter(Capability cap, const std::string &value) override;
|
||||
std::string parameter(Capability cap) const override;
|
||||
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
|
||||
protected:
|
||||
void setDefaultConfiguration();
|
||||
virtual void setDefaultConfiguration();
|
||||
|
||||
bool deconvolveData(Response *resp, DoubleArray &data, int numberOfIntegrations) override;
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor_MLc2h : public AmplitudeProcessor
|
||||
int capabilities() const override;
|
||||
IDList capabilityParameters(Capability cap) const override;
|
||||
bool setParameter(Capability cap, const std::string &value) override;
|
||||
std::string parameter(Capability cap) const override;
|
||||
|
||||
void reset() override;
|
||||
bool setup(const Settings &settings) override;
|
||||
@ -86,6 +87,7 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor_MLc2h : public AmplitudeProcessor
|
||||
AmplitudeValue value;
|
||||
AmplitudeTime time;
|
||||
double snr;
|
||||
double period;
|
||||
};
|
||||
|
||||
enum CombinerProc {
|
||||
@ -96,9 +98,9 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor_MLc2h : public AmplitudeProcessor
|
||||
};
|
||||
|
||||
mutable AmplitudeProcessor_MLc _ampE, _ampN;
|
||||
CombinerProc _combiner{TakeMax};
|
||||
CombinerProc _combiner;
|
||||
OPT(ComponentResult) _results[2];
|
||||
double _amplitudeScale{1.0};
|
||||
double _amplitudeScale;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor_ML2h : public AmplitudeProcessor {
|
||||
int capabilities() const override;
|
||||
IDList capabilityParameters(Capability cap) const override;
|
||||
bool setParameter(Capability cap, const std::string &value) override;
|
||||
std::string parameter(Capability cap) const override;
|
||||
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
@ -90,6 +91,7 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor_ML2h : public AmplitudeProcessor {
|
||||
AmplitudeValue value;
|
||||
AmplitudeTime time;
|
||||
double snr;
|
||||
double period;
|
||||
};
|
||||
|
||||
enum CombinerProc {
|
||||
|
||||
@ -40,6 +40,9 @@ class SC_SYSTEM_CLIENT_API AmplitudeProcessor_MLv : public AbstractAmplitudeProc
|
||||
double offset,
|
||||
AmplitudeIndex *dt, AmplitudeValue *amplitude,
|
||||
double *period, double *snr) override;
|
||||
|
||||
protected:
|
||||
void setDefaultConfiguration() override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ class SC_SYSTEM_CLIENT_API Application : public Client::StreamApplication {
|
||||
const std::string& channelCode,
|
||||
WaveformProcessor *wp);
|
||||
void addProcessor(const DataModel::WaveformStreamID &wfid,
|
||||
WaveformProcessor *wp);
|
||||
WaveformProcessor *wp);
|
||||
|
||||
void addProcessor(const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
@ -69,7 +69,7 @@ class SC_SYSTEM_CLIENT_API Application : public Client::StreamApplication {
|
||||
const std::string& channelCode,
|
||||
TimeWindowProcessor *twp);
|
||||
void addProcessor(const DataModel::WaveformStreamID &wfid,
|
||||
TimeWindowProcessor *twp);
|
||||
TimeWindowProcessor *twp);
|
||||
|
||||
void removeProcessors(const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
@ -111,7 +111,7 @@ class SC_SYSTEM_CLIENT_API Application : public Client::StreamApplication {
|
||||
const std::string& channelCode,
|
||||
WaveformProcessor *wp);
|
||||
void registerProcessor(const DataModel::WaveformStreamID &wfid,
|
||||
WaveformProcessor *twp);
|
||||
WaveformProcessor *twp);
|
||||
|
||||
void registerProcessor(const std::string& networkCode,
|
||||
const std::string& stationCode,
|
||||
@ -119,7 +119,7 @@ class SC_SYSTEM_CLIENT_API Application : public Client::StreamApplication {
|
||||
const std::string& channelCode,
|
||||
TimeWindowProcessor *twp);
|
||||
void registerProcessor(const DataModel::WaveformStreamID &wfid,
|
||||
TimeWindowProcessor *twp);
|
||||
TimeWindowProcessor *twp);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@ -135,15 +135,15 @@ class SC_SYSTEM_CLIENT_API Application : public Client::StreamApplication {
|
||||
typedef std::list<WaveformProcessorPtr> WaveformProcessorRemovalQueue;
|
||||
typedef std::list<TimeWindowProcessorItem> TimeWindowProcessorQueue;
|
||||
|
||||
ProcessorMap _processors;
|
||||
StationProcessors _stationProcessors;
|
||||
ProcessorMap _processors;
|
||||
StationProcessors _stationProcessors;
|
||||
|
||||
StreamBuffer _waveformBuffer;
|
||||
StreamBuffer _waveformBuffer;
|
||||
|
||||
WaveformProcessorQueue _waveformProcessorQueue;
|
||||
WaveformProcessorRemovalQueue _waveformProcessorRemovalQueue;
|
||||
TimeWindowProcessorQueue _timeWindowProcessorQueue;
|
||||
bool _registrationBlocked;
|
||||
WaveformProcessorQueue _waveformProcessorQueue;
|
||||
WaveformProcessorRemovalQueue _waveformProcessorRemovalQueue;
|
||||
TimeWindowProcessorQueue _timeWindowProcessorQueue;
|
||||
bool _registrationBlocked;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -120,10 +120,10 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor : public Processor {
|
||||
SourceReceiverPath
|
||||
};
|
||||
|
||||
OPT(double) minimumDistance;
|
||||
OPT(double) maximumDistance;
|
||||
OPT(double) minimumDepth;
|
||||
OPT(double) maximumDepth;
|
||||
OPT(double) minimumDistanceDeg;
|
||||
OPT(double) maximumDistanceDeg;
|
||||
OPT(double) minimumDepthKm;
|
||||
OPT(double) maximumDepthKm;
|
||||
double multiplier;
|
||||
double offset;
|
||||
|
||||
@ -161,10 +161,21 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor : public Processor {
|
||||
* Returns the amplitude type used as input for this magnitude
|
||||
* processor.
|
||||
* The default implementation returns type()
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
virtual std::string amplitudeType() const;
|
||||
|
||||
/**
|
||||
* @brief Sets default parameters.
|
||||
*
|
||||
* This method is called as first in the setup() call to reset
|
||||
* the configuration to default.
|
||||
*
|
||||
* The distance, depth, period and SNR limits are set to Core::None
|
||||
* before this call.
|
||||
*/
|
||||
virtual void setDefaults() = 0;
|
||||
|
||||
virtual bool setup(const Settings &settings) override;
|
||||
|
||||
/**
|
||||
@ -316,8 +327,17 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor : public Processor {
|
||||
std::string _amplitudeType;
|
||||
std::string _networkCode;
|
||||
std::string _stationCode;
|
||||
std::string _locationCode;
|
||||
bool _treatAsValidMagnitude;
|
||||
Correction _corrections;
|
||||
Correction::A _defaultCorrection;
|
||||
OPT(double) _minimumDistanceDeg;
|
||||
OPT(double) _maximumDistanceDeg;
|
||||
OPT(double) _minimumDepthKm;
|
||||
OPT(double) _maximumDepthKm;
|
||||
OPT(double) _minimumSNR;
|
||||
OPT(double) _minimumPeriod;
|
||||
OPT(double) _maximumPeriod;
|
||||
|
||||
friend class MagnitudeProcessorAliasFactory;
|
||||
};
|
||||
|
||||
@ -31,17 +31,14 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_ML : public MagnitudeProcessor {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_ML);
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_ML();
|
||||
|
||||
|
||||
public:
|
||||
void setDefaults() override;
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
std::string amplitudeType() const override;
|
||||
|
||||
|
||||
protected:
|
||||
bool initLocale(Locale *locale, const Settings &settings,
|
||||
@ -59,7 +56,6 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_ML : public MagnitudeProcessor {
|
||||
|
||||
private:
|
||||
LogA0 _logA0;
|
||||
double _maxDistanceKm;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -37,10 +37,9 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_MLc : public MagnitudeProcessor {
|
||||
|
||||
|
||||
public:
|
||||
void setDefaults() override;
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
std::string amplitudeType() const override;
|
||||
|
||||
|
||||
protected:
|
||||
Status computeMagnitude(double amplitude, const std::string &unit,
|
||||
@ -57,9 +56,6 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_MLc : public MagnitudeProcessor {
|
||||
const std::string &configPrefix) override;
|
||||
|
||||
private:
|
||||
double _minDistanceKm{-1.0};
|
||||
double _maxDistanceKm{8.0 * KM_OF_DEGREE};
|
||||
double _maxDepth{80.0};
|
||||
std::string _distanceMode{"hypocentral"};
|
||||
std::string _calibrationType{"parametric"};
|
||||
// parameters for parametric magnitude calibration
|
||||
@ -69,6 +65,10 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_MLc : public MagnitudeProcessor {
|
||||
double _c3{1.11};
|
||||
double _c4{0.0};
|
||||
double _c5{1.0};
|
||||
double _c6{0.0};
|
||||
double _c7{0.0};
|
||||
double _c8{0.0};
|
||||
double _H{40.0};
|
||||
// parameters for non-parametric magnitude calibration
|
||||
LogA0 _logA0;
|
||||
};
|
||||
|
||||
@ -33,13 +33,12 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_MLv : public MagnitudeProcessor {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_MLv);
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_MLv();
|
||||
|
||||
|
||||
public:
|
||||
void setDefaults() override;
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
|
||||
@ -60,7 +59,6 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_MLv : public MagnitudeProcessor {
|
||||
|
||||
private:
|
||||
LogA0 _logA0;
|
||||
double _maxDistanceKm;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_Mjma : public MagnitudeProcessor {
|
||||
MagnitudeProcessor_Mjma();
|
||||
|
||||
protected:
|
||||
void setDefaults() override {}
|
||||
Status computeMagnitude(double amplitude, const std::string &unit,
|
||||
double period, double snr,
|
||||
double delta, double depth,
|
||||
|
||||
@ -30,12 +30,11 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_ms20 : public MagnitudeProcessor {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_ms20);
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_ms20();
|
||||
|
||||
bool setup(const Settings &settings) override;
|
||||
public:
|
||||
void setDefaults() override;
|
||||
|
||||
protected:
|
||||
Status computeMagnitude(double amplitude, const std::string &unit,
|
||||
@ -46,13 +45,6 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_ms20 : public MagnitudeProcessor {
|
||||
const DataModel::Amplitude *,
|
||||
const Locale *,
|
||||
double &value) override;
|
||||
|
||||
private:
|
||||
double lowPer;
|
||||
double upPer;
|
||||
double minDistanceDeg;
|
||||
double maxDistanceDeg;
|
||||
double maxDepthKm;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -30,11 +30,11 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_Mwp : public MagnitudeProcessor {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_Mwp);
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_Mwp();
|
||||
|
||||
public:
|
||||
void setDefaults() override {}
|
||||
Status computeMagnitude(double amplitude, const std::string &unit,
|
||||
double period, double snr,
|
||||
double delta, double depth,
|
||||
|
||||
@ -30,11 +30,11 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_mBc : public MagnitudeProcessor_mB {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_mBc)
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_mBc();
|
||||
|
||||
public:
|
||||
void setDefaults() override {}
|
||||
Status estimateMw(const Config::Config *config,
|
||||
double magnitude, double &Mw_estimate,
|
||||
double &Mw_stdError) override;
|
||||
|
||||
@ -30,13 +30,12 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_mB : public MagnitudeProcessor {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_mB)
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_mB();
|
||||
MagnitudeProcessor_mB(const std::string& type);
|
||||
|
||||
MagnitudeProcessor_mB(const std::string &type);
|
||||
|
||||
public:
|
||||
void setDefaults() override;
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
Status computeMagnitude(double amplitude, const std::string &unit,
|
||||
@ -51,10 +50,6 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_mB : public MagnitudeProcessor {
|
||||
Status estimateMw(const Config::Config *config,
|
||||
double magnitude, double &Mw_estimate,
|
||||
double &Mw_stdError) override;
|
||||
|
||||
private:
|
||||
double minDistanceDeg;
|
||||
double maxDistanceDeg;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -30,13 +30,13 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_mb : public MagnitudeProcessor {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_mb)
|
||||
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_mb();
|
||||
|
||||
public:
|
||||
void setDefaults() override;
|
||||
bool setup(const Settings &settings) override;
|
||||
|
||||
protected:
|
||||
Status computeMagnitude(double amplitude, const std::string &unit,
|
||||
double period, double snr,
|
||||
@ -46,10 +46,6 @@ class SC_SYSTEM_CLIENT_API MagnitudeProcessor_mb : public MagnitudeProcessor {
|
||||
const DataModel::Amplitude *,
|
||||
const Locale *,
|
||||
double &value) override;
|
||||
|
||||
private:
|
||||
double minDistanceDeg;
|
||||
double maxDistanceDeg;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -30,12 +30,11 @@ namespace Processing {
|
||||
|
||||
|
||||
class SC_SYSTEM_CLIENT_API MagnitudeProcessor_msbb : public MagnitudeProcessor {
|
||||
DECLARE_SC_CLASS(MagnitudeProcessor_msbb);
|
||||
|
||||
public:
|
||||
MagnitudeProcessor_msbb();
|
||||
|
||||
protected:
|
||||
void setDefaults() override {}
|
||||
Status computeMagnitude(double amplitude, const std::string &unit,
|
||||
double period, double snr,
|
||||
double delta, double depth,
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
#include <seiscomp/processing/waveformoperator.h>
|
||||
#include <seiscomp/core/genericrecord.h>
|
||||
#include <seiscomp/core/optional.h>
|
||||
#include <seiscomp/core/recordsequence.h>
|
||||
|
||||
|
||||
@ -54,8 +55,8 @@ class NCompsOperator : public WaveformOperator {
|
||||
public:
|
||||
NCompsOperator(const PROC &proc) : _proc(proc), _processing(false) {}
|
||||
|
||||
WaveformProcessor::Status feed(const Record *record);
|
||||
void reset();
|
||||
WaveformProcessor::Status feed(const Record *record) override;
|
||||
void reset() override;
|
||||
|
||||
// Returns the RingBuffer of each component.
|
||||
const Seiscomp::RingBuffer &buffer(int i) const {
|
||||
@ -72,8 +73,8 @@ class NCompsOperator : public WaveformOperator {
|
||||
protected:
|
||||
struct State {
|
||||
State() : buffer(BSIZE) {}
|
||||
RingBuffer buffer;
|
||||
Core::Time endTime;
|
||||
RingBuffer buffer;
|
||||
OPT(Core::Time) endTime;
|
||||
};
|
||||
|
||||
// Stores the N channel codes and the according record buffer
|
||||
@ -94,12 +95,17 @@ template <typename T, template <typename,int> class PROC>
|
||||
class CodeWrapper<T,2,PROC> {
|
||||
public:
|
||||
CodeWrapper(const std::string &code1, const std::string &code2,
|
||||
const PROC<T,2> &proc) : _proc(proc) {}
|
||||
const PROC<T,2> &proc)
|
||||
: _proc(proc), _code1(code1), _code2(code2) {}
|
||||
|
||||
void operator()(const Record *rec, T *data[2], int n, const Core::Time &stime, double sfreq) const { _proc(rec, data, n, stime, sfreq); }
|
||||
bool publish(int c) const { return _proc.publish(c); }
|
||||
|
||||
int compIndex(const std::string &code) const { return -1; }
|
||||
int compIndex(const std::string &code) const {
|
||||
if ( code == _code1 ) return 0;
|
||||
else if ( code == _code2 ) return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const std::string &translateChannelCode(int c, const std::string &code) { return code; }
|
||||
|
||||
|
||||
@ -39,9 +39,9 @@ struct ScopedUnsetFlag {
|
||||
|
||||
template <typename T, int N, class PROC, int BSIZE>
|
||||
WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Record *rec) {
|
||||
Core::Time minStartTime;
|
||||
Core::Time maxStartTime;
|
||||
Core::Time minEndTime;
|
||||
OPT(Core::Time) minStartTime;
|
||||
OPT(Core::Time) maxStartTime;
|
||||
OPT(Core::Time) minEndTime;
|
||||
WaveformProcessor::Status status;
|
||||
|
||||
status = WaveformProcessor::WaitingForData;
|
||||
@ -51,9 +51,10 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
|
||||
for ( int i = 0; i < N; ++i ) {
|
||||
// Not all traces available, nothing to do
|
||||
if ( _states[i].endTime.valid() ) {
|
||||
if ( _states[i].endTime > minStartTime )
|
||||
minStartTime = _states[i].endTime;
|
||||
if ( _states[i].endTime ) {
|
||||
if ( !minStartTime || (*_states[i].endTime > *minStartTime) ) {
|
||||
minStartTime = *_states[i].endTime;
|
||||
}
|
||||
}
|
||||
|
||||
if ( _states[i].buffer.empty() ) {
|
||||
@ -69,8 +70,9 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
double samplingFrequency, timeTolerance;
|
||||
|
||||
// Initialize iterators for each component
|
||||
for ( int i = 0; i < N; ++i )
|
||||
for ( int i = 0; i < N; ++i ) {
|
||||
it[i] = _states[i].buffer.begin();
|
||||
}
|
||||
|
||||
// Store sampling frequency of first record of first component
|
||||
// All records must match this sampling frequency
|
||||
@ -81,15 +83,18 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
if ( minStartTime ) {
|
||||
for ( int i = 0; i < N; ++i ) {
|
||||
while ( it[i] != _states[i].buffer.end() ) {
|
||||
if ( (*it[i])->endTime() <= minStartTime )
|
||||
if ( (*it[i])->endTime() <= *minStartTime ) {
|
||||
it[i] = _states[i].buffer.erase(it[i]);
|
||||
else
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// End of stream?
|
||||
if ( it[i] == _states[i].buffer.end() )
|
||||
if ( it[i] == _states[i].buffer.end() ) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,11 +148,14 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
const Record *rec = it_end[i]->get();
|
||||
|
||||
// Skip records with wrong sampling frequency
|
||||
if ( rec->samplingFrequency() != samplingFrequency )
|
||||
if ( rec->samplingFrequency() != samplingFrequency ) {
|
||||
return WaveformProcessor::InvalidSamplingFreq;
|
||||
}
|
||||
|
||||
double diff = (double)(rec->startTime()-(*tmp)->endTime());
|
||||
if ( fabs(diff) > timeTolerance ) break;
|
||||
if ( fabs(diff) > timeTolerance ) {
|
||||
break;
|
||||
}
|
||||
|
||||
tmp = it_end[i];
|
||||
++it_end[i];
|
||||
@ -158,11 +166,12 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
|
||||
// Find minimum end time of all three records
|
||||
for ( int i = 0; i < N; ++i ) {
|
||||
if ( !i || minEndTime > (*it_end[i])->endTime() )
|
||||
if ( !i || minEndTime > (*it_end[i])->endTime() ) {
|
||||
minEndTime = (*it_end[i])->endTime();
|
||||
}
|
||||
}
|
||||
|
||||
typedef typename Core::SmartPointer< NumericArray<T> >::Impl DataArrayPtr;
|
||||
using DataArrayPtr = Core::SmartPointer< NumericArray<T> >;
|
||||
|
||||
DataArrayPtr data[N];
|
||||
GenericRecordPtr comps[N];
|
||||
@ -170,8 +179,9 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
int minLen = 0;
|
||||
|
||||
// Clip maxStartTime to minStartTime
|
||||
if ( maxStartTime < minStartTime )
|
||||
if ( maxStartTime < minStartTime ) {
|
||||
maxStartTime = minStartTime;
|
||||
}
|
||||
|
||||
BitSetPtr clipMask;
|
||||
|
||||
@ -180,26 +190,28 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
float tq = 0;
|
||||
int tqCount = 0;
|
||||
|
||||
if ( _proc.publish(i) )
|
||||
if ( _proc.publish(i) ) {
|
||||
comps[i] = new GenericRecord((*it[i])->networkCode(),
|
||||
(*it[i])->stationCode(),
|
||||
(*it[i])->locationCode(),
|
||||
_proc.translateChannelCode(i, (*it[i])->channelCode()),
|
||||
maxStartTime, samplingFrequency);
|
||||
*maxStartTime, samplingFrequency);
|
||||
}
|
||||
|
||||
data[i] = new NumericArray<T>;
|
||||
RecordSequence::iterator seq_end = it_end[i];
|
||||
++seq_end;
|
||||
|
||||
for ( RecordSequence::iterator rec_it = it[i]; rec_it != seq_end; ) {
|
||||
for ( auto rec_it = it[i]; rec_it != seq_end; ) {
|
||||
const Array *rec_data = (*rec_it)->data();
|
||||
if ( (*rec_it)->startTime() > minEndTime )
|
||||
if ( (*rec_it)->startTime() > minEndTime ) {
|
||||
break;
|
||||
}
|
||||
|
||||
++it[i];
|
||||
|
||||
const NumericArray<T> *srcData = NumericArray<T>::ConstCast(rec_data);
|
||||
typename Core::SmartPointer< NumericArray<T> >::Impl tmp;
|
||||
Core::SmartPointer<NumericArray<T>> tmp;
|
||||
if ( srcData == nullptr ) {
|
||||
tmp = (NumericArray<T>*)rec_data->copy(NumericArray<T>::ArrayType);
|
||||
srcData = tmp.get();
|
||||
@ -208,11 +220,13 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
int startIndex = 0;
|
||||
int endIndex = srcData->size();
|
||||
|
||||
if ( (*rec_it)->startTime() < maxStartTime )
|
||||
startIndex += (int)(double(maxStartTime-(*rec_it)->startTime())*(*rec_it)->samplingFrequency()+0.5);
|
||||
if ( (*rec_it)->startTime() < *maxStartTime ) {
|
||||
startIndex += (int)(double(*maxStartTime - (*rec_it)->startTime()) * (*rec_it)->samplingFrequency() + 0.5);
|
||||
}
|
||||
|
||||
if ( (*rec_it)->endTime() > minEndTime )
|
||||
endIndex -= (int)(double((*rec_it)->endTime()-minEndTime)*(*rec_it)->samplingFrequency());
|
||||
if ( (*rec_it)->endTime() > *minEndTime ) {
|
||||
endIndex -= (int)(double((*rec_it)->endTime() - *minEndTime) * (*rec_it)->samplingFrequency());
|
||||
}
|
||||
|
||||
int len = endIndex-startIndex;
|
||||
// Skip empty records
|
||||
@ -231,13 +245,16 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
if ( (recClipMask != nullptr) && recClipMask->any() ) {
|
||||
int ofs = data[i]->size();
|
||||
int nBits = data[i]->size() + len;
|
||||
if ( !clipMask )
|
||||
if ( !clipMask ) {
|
||||
clipMask = new BitSet(nBits);
|
||||
else if ( (int)clipMask->size() < nBits )
|
||||
}
|
||||
else if ( (int)clipMask->size() < nBits ) {
|
||||
clipMask->resize(nBits, false);
|
||||
}
|
||||
|
||||
for ( int i = startIndex; i < len; ++i, ++ofs )
|
||||
for ( int i = startIndex; i < len; ++i, ++ofs ) {
|
||||
clipMask->set(ofs, clipMask->test(ofs) || recClipMask->test(i));
|
||||
}
|
||||
}
|
||||
|
||||
data[i]->append(len, srcData->typedData()+startIndex);
|
||||
@ -245,21 +262,27 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
++rec_it;
|
||||
}
|
||||
|
||||
if ( comps[i] && (tqCount > 0) )
|
||||
if ( comps[i] && (tqCount > 0) ) {
|
||||
comps[i]->setTimingQuality((int)(tq / tqCount));
|
||||
}
|
||||
|
||||
minLen = i==0?data[i]->size():std::min(minLen, data[i]->size());
|
||||
|
||||
if ( comps[i] ) comps[i]->setData(data[i].get());
|
||||
if ( comps[i] ) {
|
||||
comps[i]->setData(data[i].get());
|
||||
}
|
||||
}
|
||||
|
||||
// Trim clip mask to sample array size
|
||||
if ( clipMask ) {
|
||||
if ( (int)clipMask->size() > minLen )
|
||||
if ( (int)clipMask->size() > minLen ) {
|
||||
clipMask->resize(minLen);
|
||||
}
|
||||
|
||||
// Destroy clip mask if no bit is set
|
||||
if ( !clipMask->any() )
|
||||
if ( !clipMask->any() ) {
|
||||
clipMask = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
T *data_samples[N];
|
||||
@ -268,16 +291,17 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
NumericArray<T> *ar = data[i].get();
|
||||
if ( ar->size() > minLen ) {
|
||||
ar->resize(minLen);
|
||||
if ( comps[i] ) comps[i]->dataUpdated();
|
||||
if ( comps[i] ) {
|
||||
comps[i]->dataUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
data_samples[i] = data[i]->typedData();
|
||||
|
||||
Core::Time endTime = maxStartTime + Core::TimeSpan(data[i]->size() / rec->samplingFrequency());
|
||||
Core::Time endTime = *maxStartTime + Core::TimeSpan(data[i]->size() / rec->samplingFrequency());
|
||||
|
||||
// Set last transformed end time of component
|
||||
if ( !_states[i].endTime.valid() ||
|
||||
_states[i].endTime < endTime ) {
|
||||
if ( !_states[i].endTime || *_states[i].endTime < endTime ) {
|
||||
_states[i].endTime = endTime;
|
||||
}
|
||||
}
|
||||
@ -285,7 +309,7 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
if ( minLen > 0 ) {
|
||||
// Process finally
|
||||
try {
|
||||
_proc(rec, data_samples, minLen, maxStartTime, rec->samplingFrequency());
|
||||
_proc(rec, data_samples, minLen, *maxStartTime, rec->samplingFrequency());
|
||||
}
|
||||
catch ( ... ) {
|
||||
return WaveformProcessor::Error;
|
||||
@ -293,8 +317,9 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
|
||||
for ( int i = 0; i < N; ++i ) {
|
||||
if ( comps[i] ) {
|
||||
if ( clipMask )
|
||||
if ( clipMask ) {
|
||||
comps[i]->setClipMask(clipMask.get());
|
||||
}
|
||||
store(comps[i].get());
|
||||
}
|
||||
}
|
||||
@ -315,7 +340,9 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::process(int, const Rec
|
||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
template <typename T, int N, class PROC, int BSIZE>
|
||||
WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::feed(const Record *rec) {
|
||||
if ( rec->data() == nullptr ) return WaveformProcessor::WaitingForData;
|
||||
if ( !rec->data() ) {
|
||||
return WaveformProcessor::WaitingForData;
|
||||
}
|
||||
|
||||
int i = _proc.compIndex(rec->channelCode());
|
||||
if ( i >= 0 ) {
|
||||
@ -334,7 +361,9 @@ WaveformProcessor::Status NCompsOperator<T,N,PROC,BSIZE>::feed(const Record *rec
|
||||
template <typename T, int N, class PROC, int BSIZE>
|
||||
void NCompsOperator<T,N,PROC,BSIZE>::reset() {
|
||||
// No reset while in processing
|
||||
if ( _processing ) return;
|
||||
if ( _processing ) {
|
||||
return;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < N; ++i ) {
|
||||
_states[i] = State();
|
||||
|
||||
@ -36,8 +36,8 @@ class PipeOperator : public WaveformOperator {
|
||||
public:
|
||||
PipeOperator(WaveformOperator *op1, WaveformOperator *op2);
|
||||
|
||||
WaveformProcessor::Status feed(const Record *record);
|
||||
void reset();
|
||||
WaveformProcessor::Status feed(const Record *record) override;
|
||||
void reset() override;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -52,7 +52,7 @@ class SC_SYSTEM_CLIENT_API SAICPicker : public SecondaryPicker {
|
||||
Core::Time pick;
|
||||
double snr;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// X'truction
|
||||
// ----------------------------------------------------------------------
|
||||
@ -79,7 +79,7 @@ class SC_SYSTEM_CLIENT_API SAICPicker : public SecondaryPicker {
|
||||
const AICConfig &aicConfig() const { return _aicConfig; }
|
||||
|
||||
const State &state() const { return _state; }
|
||||
const Result &result() const { return _result; }
|
||||
const Result &result() const { return *_result; }
|
||||
|
||||
//! Returns detection data from noiseBegin if setSaveIntermediate
|
||||
//! has been enabled before processing started.
|
||||
@ -92,14 +92,14 @@ class SC_SYSTEM_CLIENT_API SAICPicker : public SecondaryPicker {
|
||||
void process(const Record *rec, const DoubleArray &filteredData) override;
|
||||
|
||||
private:
|
||||
bool _initialized;
|
||||
AICConfig _aicConfig;
|
||||
State _state;
|
||||
Result _result;
|
||||
Filter *_compFilter;
|
||||
bool _saveIntermediate;
|
||||
DoubleArray _detectionTrace;
|
||||
const std::string _methodID;
|
||||
bool _initialized;
|
||||
AICConfig _aicConfig;
|
||||
State _state;
|
||||
OPT(Result) _result;
|
||||
Filter *_compFilter;
|
||||
bool _saveIntermediate;
|
||||
DoubleArray _detectionTrace;
|
||||
const std::string _methodID;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -78,13 +78,13 @@ class SC_SYSTEM_CLIENT_API Stream : public Core::BaseObject {
|
||||
|
||||
|
||||
public:
|
||||
Core::TimeWindow epoch;
|
||||
Core::OpenTimeWindow epoch;
|
||||
|
||||
double gain;
|
||||
OPT(double) gainFrequency;
|
||||
std::string gainUnit;
|
||||
double azimuth;
|
||||
double dip;
|
||||
double gain;
|
||||
OPT(double) gainFrequency;
|
||||
std::string gainUnit;
|
||||
double azimuth;
|
||||
double dip;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@ -119,11 +119,11 @@ class SC_SYSTEM_CLIENT_API WaveformProcessor : public Processor {
|
||||
//! No associated value yet (error code?)
|
||||
Error,
|
||||
// -- The following enumerations were added with API 12 ---
|
||||
//! No distance hint set
|
||||
//! No distance hint set
|
||||
MissingDistance,
|
||||
//! No depth hint set
|
||||
//! No depth hint set
|
||||
MissingDepth,
|
||||
//! No time hint set
|
||||
//! No time hint set
|
||||
MissingTime,
|
||||
//! No hypocenter (Origin) given
|
||||
MissingHypocenter,
|
||||
@ -146,7 +146,10 @@ class SC_SYSTEM_CLIENT_API WaveformProcessor : public Processor {
|
||||
//! Arrival has not been found
|
||||
ArrivalNotFound,
|
||||
//! Configuration error
|
||||
ConfigurationError
|
||||
ConfigurationError,
|
||||
// -- The following enumerations were added with API 17 ---
|
||||
//! Period out of range
|
||||
PeriodOutOfRange
|
||||
),
|
||||
ENAMES(
|
||||
"waiting for data",
|
||||
@ -177,7 +180,8 @@ class SC_SYSTEM_CLIENT_API WaveformProcessor : public Processor {
|
||||
"ray path out of regions",
|
||||
"travel time estimate failed",
|
||||
"arrival not found",
|
||||
"configuration error"
|
||||
"configuration error",
|
||||
"period out of range"
|
||||
)
|
||||
);
|
||||
|
||||
@ -187,8 +191,8 @@ class SC_SYSTEM_CLIENT_API WaveformProcessor : public Processor {
|
||||
// ----------------------------------------------------------------------
|
||||
public:
|
||||
//! C'tor
|
||||
WaveformProcessor(const Core::TimeSpan &initTime=0.0,
|
||||
const Core::TimeSpan &gapThreshold=0.1);
|
||||
WaveformProcessor(const Core::TimeSpan &initTime = Core::TimeSpan(0, 0),
|
||||
const Core::TimeSpan &gapThreshold = Core::TimeSpan(0, 100000));
|
||||
|
||||
//! D'tor
|
||||
virtual ~WaveformProcessor();
|
||||
|
||||
Reference in New Issue
Block a user