Skip to content

Commit

Permalink
Initial origin input implementation
Browse files Browse the repository at this point in the history
Adds origin input to scfinder.
Default delay warning threshold changed from 3s to 5s.
  • Loading branch information
FMassin committed Nov 30, 2023
1 parent fab1036 commit f14fccf
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 11 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@

* Adds configuration for env. filter corner freq.: debug.filterCornerFreq

* Adds origin input to scfinder.

* Default delay warning threshold changed from 3s to 5s.

* sceewenv:

* Removing envelope delay filter as proven to be problematic in scfinder.

* Adds configuration for env. filter corner freq.: eewenv.vsfndr.filterCornerFreq
* Adds configuration for env. filter corner freq.: eewenv.vsfndr.filterCornerFreq.

* Default delay warning threshold changed from 3s to 5s

* sceewlog

Expand Down
2 changes: 1 addition & 1 deletion apps/eew/sceewenv/descriptions/sceewenv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
default is 30s.
</description>
</parameter>
<parameter name="maxDelay" type="double" default="3" unit="s">
<parameter name="maxDelay" type="double" default="5" unit="s">
<description>
Sets the maximum absolute value of packet delay before issuing a warning. That
parameter does not configure buffers as such but only a threshold (in seconds
Expand Down
8 changes: 7 additions & 1 deletion apps/eew/scfinder/descriptions/scfinder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
Messaging group to send strong motion objects to.
</description>
</parameter>
<parameter name="processOrigins" type="boolean" default="false">
<description>
Enables processing of input origins, by adding artificial epicentral
PGA at the origin epicenter.
</description>
</parameter>
<parameter name="envelopeBufferSize" type="double" default="120" unit="s">
<description>
Size of envelope buffer in seconds. This value should be set
Expand Down Expand Up @@ -114,7 +120,7 @@
</parameter>
</group>
<group name="debug">
<parameter name="maxDelay" type="double" default="3" unit="s">
<parameter name="maxDelay" type="double" default="5" unit="s">
<description>
Sets the maximum absolute value of packet delay before issuing a warning. That
parameter does not configure buffers as such but only a threshold (in seconds
Expand Down
69 changes: 68 additions & 1 deletion apps/eew/scfinder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
using namespace Seiscomp;
using namespace Seiscomp::DataModel;
using namespace FiniteFault;
using namespace Seiscomp::Core;


namespace {
Expand Down Expand Up @@ -209,13 +210,15 @@ class App : public Client::StreamApplication {
setLoadConfigModuleEnabled(false);

setRecordDatatype(Array::FLOAT);
addMessagingSubscription("LOCATION");
setPrimaryMessagingGroup("LOCATION");
_magnitudeGroup = "MAGNITUDE";
_strongMotionGroup = "LOCATION";

_sentMessagesTotal = 0;
_testMode = false;
_playbackMode = false;
_processOrigins = false;

_bufferLength = Core::TimeSpan(120,0);
_bufDefaultLen = Core::TimeSpan(60,0);
Expand Down Expand Up @@ -323,6 +326,12 @@ class App : public Client::StreamApplication {
}
catch ( ... ) {}

try {
_processOrigins = configGetBool("finder.processOrigins");
_inputOrgs = addInputObjectLog("origin");
}
catch ( ... ) {}

try {
_bufferLength = configGetDouble("finder.envelopeBufferSize");
}
Expand Down Expand Up @@ -363,7 +372,7 @@ class App : public Client::StreamApplication {
}
catch ( ... ) {}

eewCfg.maxDelay = 3.0;
eewCfg.maxDelay = 5.0;
try {
eewCfg.maxDelay = configGetDouble("debug.maxDelay");
}
Expand Down Expand Up @@ -480,6 +489,61 @@ class App : public Client::StreamApplication {
return true;
}

void handleMessage(Core::Message* msg) {
Application::handleMessage(msg);

DataMessage *dm = DataMessage::Cast(msg);
if ( dm == NULL ) return;

for ( DataMessage::iterator it = dm->begin(); it != dm->end(); ++it ) {
Origin *org = Origin::Cast(it->get());
if ( org )
addObject("", org);
}
}

void addObject(const std::string &parentID, Object *obj) {

Origin *org = Origin::Cast(obj);
if ( org ) {
logObject(_inputOrgs, Core::Time::GMT());

try {

// Scan data
scanFinderData();

SEISCOMP_DEBUG("Received origin (lat: %f km lon:%f km dep: %f) wrapped in origin: %s",
org->latitude().value(),
org->longitude().value(),
org->depth().value(),
org->publicID().c_str());

_latestMaxPGAs.push_back(
PGA_Data(
"EPIC",//it->second->meta->station()->code(),
"X",//it->second->meta->station()->network()->code(),
"XXX",//it->second->maxPGA.channel.c_str(),
"XX",//it->second->meta->code().empty()?"--":it->second->meta->code().c_str(),
org->latitude().value(),org->longitude().value(),//Coordinate(it->second->meta->latitude(), it->second->meta->longitude()),
9999.9,//it->second->maxPGA.value*100,
org->time().value() //it->second->maxPGA.timestamp
)
);

if ( _processOrigins ) {
// Call Finder
processFinder();
}
}
catch ( std::exception &e ) {
SEISCOMP_ERROR("processing of origin '%s' failed", org->publicID().c_str());
SEISCOMP_ERROR("%s: %s", org->publicID().c_str(), e.what());
return;
}
return;
}
}

bool run() {
if ( commandline().hasOption("dump-config") ) {
Expand Down Expand Up @@ -1074,6 +1138,7 @@ class App : public Client::StreamApplication {

bool _testMode;
bool _playbackMode;
bool _processOrigins;
std::string _strTs;
std::string _strTe;
std::string _magnitudeGroup;
Expand Down Expand Up @@ -1105,6 +1170,8 @@ class App : public Client::StreamApplication {
LocationLookup _locationLookup;
Finder_List _finderList;
PGA_Data_List _latestMaxPGAs;

ObjectLog *_inputOrgs;
};


Expand Down
3 changes: 1 addition & 2 deletions libs/seiscomp/processing/eewamps/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ Config::Config() {

horizontalBufferSize = Core::TimeSpan(60,0);
horizontalMaxDelay = Core::TimeSpan(30,0);
maxDelay = Core::TimeSpan(3,0);
skipDataOlderThan = Core::TimeSpan(30,0);
maxDelay = Core::TimeSpan(5,0);

// ----------------------------------------------------------------------
// VS and FinDer configuration
Expand Down
6 changes: 1 addition & 5 deletions libs/seiscomp/processing/eewamps/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ struct SC_LIBEEWAMPS_API Config {
*/
Core::TimeSpan maxDelay;

/**
* Sets the maximum tolerated package delay before skipping data.
* The default is 60s.
*/
Core::TimeSpan skipDataOlderThan;



// ----------------------------------------------------------------------
Expand Down

0 comments on commit f14fccf

Please sign in to comment.