Skip to content
Snippets Groups Projects
Commit 3e43f357 authored by lucasca's avatar lucasca
Browse files

Added option 'mustInclude'

parent 78fe1606
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,12 @@
groupingInterval to declare an active shot
</description>
</parameter>
<parameter name="mustInclude" type="string">
<description>
Empty or a station ("net.sta.loc") that must be present in a pick group
to consider a valid active shot
</description>
</parameter>
<parameter name="droppingPeriod" type="double" unit="sec">
<description>
For how long to drop picks after an active shot
......
......@@ -236,6 +236,7 @@ private:
Core::TimeSpan _groupingInterval;
Core::TimeSpan _droppingPeriod;
unsigned _minNumPicks;
std::string _mustInclude;
std::string _epFile;
PickBuffer _buf;
struct {
......@@ -275,6 +276,10 @@ protected:
_groupingInterval = configGetDouble("groupingInterval");
_minNumPicks = configGetInt("minNumPicks");
_droppingPeriod = configGetDouble("droppingPeriod");
try {
_mustInclude = configGetString("mustInclude");
} catch (...) {
}
if (!_epFile.empty())
setMessagingEnabled(false);
......@@ -344,8 +349,11 @@ protected:
std::sort(objs.begin(), objs.end());
auto acceptedCb = [&ep](PickPtr pick) { ep->add(pick.get()); };
auto droppedCb =
[this](const deque<PickPtr> &picks) { /* nothing to do */ };
auto droppedCb = [this](const deque<PickPtr> &picks) {
SEISCOMP_INFO("Dropped %zu picks: %s ~ %s", picks.size(),
picks.front()->time().value().iso().c_str(),
picks.back()->time().value().iso().c_str());
};
SEISCOMP_INFO("Processing picks");
......@@ -355,17 +363,16 @@ protected:
_counter.newPicks++;
processPicks(acceptedCb, droppedCb);
}
while (_buf.size() > 0) {
while (_buf.size() > 0) {
Core::msleep(100);
processPicks(acceptedCb, droppedCb);
}
SEISCOMP_INFO("Processed picks %lu", _counter.newPicks);
SEISCOMP_INFO("Accepted picks %lu", _counter.acceptedPicks);
SEISCOMP_INFO(
"Dropped picks %lu (group picks %lu dropping period picks %lu)",
(_counter.droppedGroupPicks + _counter.droppedPeriodPicks),
_counter.droppedGroupPicks, _counter.droppedPeriodPicks);
SEISCOMP_INFO("Dropped picks %lu (group picks %lu after group picks %lu)",
(_counter.droppedGroupPicks + _counter.droppedPeriodPicks),
_counter.droppedGroupPicks, _counter.droppedPeriodPicks);
SEISCOMP_INFO("Dropped pick groups %lu", _counter.droppedGroups);
if (_buf.size() != 0) {
SEISCOMP_WARNING("Unprocessed picks (%lu)", _buf.size());
......@@ -483,15 +490,41 @@ private:
oldestPick->time().value() + _groupingInterval;
deque<PickPtr> group = _buf.getExpiredPicks(notAfter);
if (group.size() >= _minNumPicks - 1) { // group detected
bool groupDetected = false;
if (group.size() >= _minNumPicks - 1) { // possble group detected
if (_mustInclude.empty()) { // no net.sta.loc configured
groupDetected = true;
} else { // check if _mustInclude net.sta.loc is present
string wfid = oldestPick->waveformID().networkCode() + "." +
oldestPick->waveformID().stationCode() + "." +
oldestPick->waveformID().locationCode();
if (wfid == _mustInclude) {
groupDetected = true;
} else {
for (PickPtr pick : group) {
wfid = pick->waveformID().networkCode() + "." +
pick->waveformID().stationCode() + "." +
pick->waveformID().locationCode();
if (wfid == _mustInclude) {
groupDetected = true;
break;
}
}
}
}
}
if (groupDetected) { // group detected
// drop picks
for (PickPtr pick : group) {
if (!_buf.removePick(pick.get())) {
throw Core::GeneralException("Internal logic error");
}
}
group.push_front(oldestPick);
droppedCb(group);
group.push_front(oldestPick); // it was handled by popExpiredPick
_counter.droppedGroupPicks += group.size();
_counter.droppedGroups++;
......@@ -507,10 +540,10 @@ private:
if (!_buf.removePick(oldestPick.get())) {
throw Core::GeneralException("Internal logic error");
}
droppedCb({oldestPick});
group.push_back(oldestPick);
_counter.droppedPeriodPicks++;
}
droppedCb(group);
} else {
// accept the oldest pick
acceptedCb(oldestPick);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment