Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 3 additions & 9 deletions apps/processing/scautoloc/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ void App::createCommandLineDescription() {
"logging picks even when disabled by configuration.",
&_config.pickLogFile, false);

commandline().addOption("Settings", "default-depth",
"Default depth for locating",
&_config.defaultDepth);
commandline().addOption("Settings", "default-depth-stickiness",
"",
&_config.defaultDepthStickiness);
Expand Down Expand Up @@ -358,9 +355,6 @@ bool App::initConfiguration() {
try { _config.cleanupInterval = configGetDouble("buffer.cleanupInterval"); }
catch (...) {}

try { _config.defaultDepth = configGetDouble("locator.defaultDepth"); }
catch (...) {}

try { _config.defaultDepthStickiness = configGetDouble("autoloc.defaultDepthStickiness"); }
catch (...) {}

Expand All @@ -379,9 +373,6 @@ bool App::initConfiguration() {
try { _config.maxRMS = configGetDouble("autoloc.maxRMS"); }
catch (...) {}

try { _config.maxDepth = configGetDouble("autoloc.maxDepth"); }
catch (...) {}

try { _config.maxResidualUse = configGetDouble("autoloc.maxResidual"); }
catch (...) {}

Expand Down Expand Up @@ -435,6 +426,9 @@ bool App::initConfiguration() {
try { _config.xxlDeadTime = configGetDouble("autoloc.xxl.deadTime"); }
catch (...) {}

try { _config.depthLookupType = configGetString("autoloc.depthLookup"); }
catch (...) {}

try { _config.minPickSNR = configGetDouble("autoloc.minPickSNR"); }
catch (...) {}

Expand Down
64 changes: 45 additions & 19 deletions apps/processing/scautoloc/autoloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ bool Autoloc3::init()
SEISCOMP_DEBUG("Setting configured locator profile: %s", _config.locatorProfile.c_str());
setLocatorProfile(_config.locatorProfile);

_depthLookup = Seiscomp::Seismology::DepthLookupFactory::Create(
_config.depthLookupType.c_str());
if ( !_depthLookup ) {
SEISCOMP_ERROR("DepthLookup: unknown type '%s' — cannot start",
_config.depthLookupType.c_str());
return false;
}
if ( _config.scconfig ) {
if ( !_depthLookup->init(*_config.scconfig) ) {
SEISCOMP_ERROR("DepthLookup '%s' failed to initialise — cannot start",
_config.depthLookupType.c_str());
return false;
}
}

return true; // ready to start processing
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Expand Down Expand Up @@ -1040,7 +1055,7 @@ OriginPtr Autoloc3::_xxlPreliminaryOrigin(const Pick *newPick)
// loop over several trial depths, which are multiples of the default depth
std::vector<double> trialDepths;
for (int i=0; dep <= _config.xxlMaxDepth; i++) {
dep = _config.defaultDepth*(1+i);
dep = _depthLookup->fetch(lat, lon)*(1+i);
trialDepths.push_back(dep);

// in case of "sticky" default depth, we don't need any more trial depths
Expand Down Expand Up @@ -1547,7 +1562,9 @@ bool Autoloc3::_setDefaultDepth(Origin *origin)
{
OriginPtr test = new Origin(*origin);

_relocator.setFixedDepth(_config.defaultDepth);
double defaultDepth = _depthLookup->fetch(
origin->hypocenter.lat, origin->hypocenter.lon);
_relocator.setFixedDepth(defaultDepth);
_relocator.useFixedDepth(true);
OriginPtr relo = _relocator.relocate(test.get());
if ( ! relo) {
Expand Down Expand Up @@ -1587,7 +1604,9 @@ bool Autoloc3::_setTheRightDepth(Origin *origin)
return false;
}

double radius = 5*(relo->hypocenter.dep >= _config.defaultDepth ? relo->hypocenter.dep : _config.defaultDepth)/111.2;
double defaultDepth = _depthLookup->fetch(
origin->hypocenter.lat, origin->hypocenter.lon);
double radius = 5*(relo->hypocenter.dep >= defaultDepth ? relo->hypocenter.dep : defaultDepth)/111.2;

// XXX This is a hack, but better than nothing:
// if there are at least 2 stations within 5 times the source depth, we assume sufficient depth resolution.
Expand Down Expand Up @@ -1771,7 +1790,8 @@ bool Autoloc3::_rework(Origin *origin) {
}

if ( enforceDefaultDepth ) {
_relocator.setFixedDepth(_config.defaultDepth);
_relocator.setFixedDepth(_depthLookup->fetch(
origin->hypocenter.lat, origin->hypocenter.lon));
}

bool keepDepth = adoptManualDepth || enforceDefaultDepth;
Expand Down Expand Up @@ -1820,7 +1840,8 @@ bool Autoloc3::_rework(Origin *origin) {
_excludeDistantStations(origin);
_excludePKP(origin);

if (origin->hypocenter.dep != _config.defaultDepth && origin->depthType == Origin::DepthDefault)
if (origin->hypocenter.dep != _depthLookup->fetch(origin->hypocenter.lat, origin->hypocenter.lon)
&& origin->depthType == Origin::DepthDefault)
origin->depthType = Origin::DepthFree;

// once more (see also above)
Expand Down Expand Up @@ -1950,11 +1971,6 @@ bool Autoloc3::_passedFinalCheck(const Origin *origin)
{
// Do not execute the check here. It may result in missing origins which are
// correct after relocation, move the check to: Autoloc3::_publishable
// if (origin->hypocenter.dep > _config.maxDepth) {
// SEISCOMP_DEBUG("Ignore origin %ld: depth %.3f km > maxDepth %.3f km",
// origin->id, origin->hypocenter.dep, _config.maxDepth);
// return false;
// }

if ( ! origin->preliminary &&
origin->definingPhaseCount() < _config.minPhaseCount)
Expand Down Expand Up @@ -2050,10 +2066,14 @@ bool Autoloc3::_publishable(const Origin *origin) const
}


if (origin->hypocenter.dep > _config.maxDepth) {
SEISCOMP_INFO("Origin %ld too deep: %.1f km > %.1f km (maxDepth)",
origin->id, origin->hypocenter.dep, _config.maxDepth);
return false;
{
double maxDepth = _depthLookup->fetchMaxDepth(
origin->hypocenter.lat, origin->hypocenter.lon);
if (origin->hypocenter.dep > maxDepth) {
SEISCOMP_INFO("Origin %ld too deep: %.1f km > %.1f km (maxDepth)",
origin->id, origin->hypocenter.dep, maxDepth);
return false;
}
}

return true;
Expand Down Expand Up @@ -2101,7 +2121,7 @@ bool Autoloc3::_store(Origin *origin)
origin->preliminary = false;

if (origin->depthType == Origin::DepthDefault &&
origin->hypocenter.dep != _config.defaultDepth)
origin->hypocenter.dep != _depthLookup->fetch(origin->hypocenter.lat, origin->hypocenter.lon))
origin->depthType = Origin::DepthFree;

if ( ! _newOrigins.find(origin))
Expand Down Expand Up @@ -2188,7 +2208,8 @@ bool Autoloc3::_associate(Origin *origin, const Pick *pick, const std::string &p
bool fixed = false;
if (_config.defaultDepthStickiness > 0.9) {
fixed = true;
_relocator.setFixedDepth(_config.defaultDepth);
_relocator.setFixedDepth(_depthLookup->fetch(
origin->hypocenter.lat, origin->hypocenter.lon));
}

// else if (origin->depthType == Origin::DepthManuallyFixed || origin->depthType == Origin::DepthPhases) {
Expand Down Expand Up @@ -3095,8 +3116,12 @@ bool Autoloc3::_depthIsResolvable(Origin *origin)
// return true;
// }

if (origin->depthType == Origin::DepthDefault && origin->hypocenter.dep != _config.defaultDepth)
origin->depthType = Origin::DepthFree;
{
double defaultDepth = _depthLookup->fetch(
origin->hypocenter.lat, origin->hypocenter.lon);
if (origin->depthType == Origin::DepthDefault && origin->hypocenter.dep != defaultDepth)
origin->depthType = Origin::DepthFree;
}

OriginPtr test = new Origin(*origin);
_relocator.useFixedDepth(false);
Expand All @@ -3114,7 +3139,8 @@ bool Autoloc3::_depthIsResolvable(Origin *origin)
}

test = new Origin(*origin);
test->hypocenter.dep = _config.defaultDepth;
test->hypocenter.dep = _depthLookup->fetch(
origin->hypocenter.lat, origin->hypocenter.lon);
_relocator.useFixedDepth(true);
relo = _relocator.relocate(test.get());
if ( ! relo) {
Expand Down
13 changes: 8 additions & 5 deletions apps/processing/scautoloc/autoloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#include <string>
#include <map>
#include <set>
#include <vector>

#include <seiscomp/seismology/depthlookup.h>

#include "datamodel.h"
#include "nucleator.h"
Expand Down Expand Up @@ -88,8 +91,6 @@ class Autoloc3 {
// maxResidualUse = 2*maxRMS


// Use this depth if there is no depth resolution
double defaultDepth{10.0}; // unit: km
double defaultDepthStickiness{0.5}; // 0...1

// Try to relocate an origin using the configured default depth.
Expand All @@ -102,9 +103,6 @@ class Autoloc3 {
// Minimum depth in case there is depth resolution
double minimumDepth{5.0}; // uni: 5 km

// maximum depth of origin, checked before sending
double maxDepth{1000.0};

// Max. secondary azimuthal gap
double maxAziGapSecondary{360.0};

Expand Down Expand Up @@ -222,6 +220,10 @@ class Autoloc3 {
double xxlMaxStaDist{10.0}; // unit: degrees
double xxlMaxDepth{100}; // unit: km

// DepthLookup implementation to use.
// "Constant" (default), "Polygon", or "Slab2" (dlslab2 plugin).
std::string depthLookupType{"Constant"};

const Seiscomp::Config::Config* scconfig{nullptr};

public:
Expand Down Expand Up @@ -514,6 +516,7 @@ class Autoloc3 {
OriginVector _origins;
Config _config;
StationConfig _stationConfig;
Seiscomp::Seismology::DepthLookupPtr _depthLookup;
};


Expand Down
21 changes: 11 additions & 10 deletions apps/processing/scautoloc/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ void Autoloc3::Config::dump() const {
SEISCOMP_INFO("Configuration:");
SEISCOMP_INFO(" locator");
SEISCOMP_INFO(" profile %s", locatorProfile.c_str());
SEISCOMP_INFO(" defaultDepth %g km", defaultDepth);
SEISCOMP_INFO(" minimumDepth %g km", minimumDepth);
SEISCOMP_INFO(" buffer");
SEISCOMP_INFO(" pickKeep %.0f s", maxAge);
Expand All @@ -112,7 +111,6 @@ void Autoloc3::Config::dump() const {
SEISCOMP_INFO(" maxResidual %.1f s", maxResidualUse);
SEISCOMP_INFO(" maxResidual for keeping picks %.1f s", maxResidualKeep);
SEISCOMP_INFO(" minPhaseCount %d", minPhaseCount);
SEISCOMP_INFO(" maxDepth %.1f km", maxDepth);
SEISCOMP_INFO(" minStaCountIgnorePKP %d", minStaCountIgnorePKP);
SEISCOMP_INFO(" defaultDepthStickiness %g", defaultDepthStickiness);
SEISCOMP_INFO(" tryDefaultDepth %s", tryDefaultDepth ? "true":"false");
Expand All @@ -135,16 +133,19 @@ void Autoloc3::Config::dump() const {
// This isn't used still so we don't want to confuse the user....
// SEISCOMP_INFO("useImportedOrigins %s", useImportedOrigins ? "true":"false");

if ( ! xxlEnabled) {
if ( ! xxlEnabled ) {
SEISCOMP_INFO(" XXL feature is not enabled");
return;
}
SEISCOMP_INFO(" XXL feature is enabled");
SEISCOMP_INFO(" xxl.minPhaseCount %d", xxlMinPhaseCount);
SEISCOMP_INFO(" xxl.minAmplitude %g", xxlMinAmplitude);
SEISCOMP_INFO(" xxl.maxStationDistance %.1f deg", xxlMaxStaDist);
SEISCOMP_INFO(" xxl.maxDepth %g km", xxlMaxDepth);
SEISCOMP_INFO(" xxl.deadTime %g s", xxlDeadTime);
else {
SEISCOMP_INFO(" XXL feature is enabled");
SEISCOMP_INFO(" xxl.minPhaseCount %d", xxlMinPhaseCount);
SEISCOMP_INFO(" xxl.minAmplitude %g", xxlMinAmplitude);
SEISCOMP_INFO(" xxl.maxStationDistance %.1f deg", xxlMaxStaDist);
SEISCOMP_INFO(" xxl.maxDepth %g km", xxlMaxDepth);
SEISCOMP_INFO(" xxl.deadTime %g s", xxlDeadTime);
}

SEISCOMP_INFO(" depthLookup type: %s", depthLookupType.c_str());
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Expand Down
81 changes: 62 additions & 19 deletions apps/processing/scautoloc/descriptions/scautoloc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
The locator profile to use.
</description>
</parameter>
<parameter name="defaultDepth" type="double" default="10" unit="km">
<description>
For each location, scautoloc performs checks to test if the
depth estimate is reliable. If the same location quality
(e.g. pick RMS) can be achieved while fixing the depth to
the default depth, the latter is used. This is most often
the case for shallow events with essentially no depth
resolution.
</description>
</parameter>
<parameter name="minimumDepth" type="double" default="5" unit="km">
<description>
The locator might converge at a depth of 0 or even negative
Expand Down Expand Up @@ -74,11 +64,6 @@
Minimum number of phases for reporting origins.
</description>
</parameter>
<parameter name="maxDepth" type="double" default="1000" unit="km">
<description>
Maximum permissible depth for reporting origins.
</description>
</parameter>
<parameter name="maxSGAP" type="double" default="360" unit="deg">
<description>
Maximum secondary azimuthal gap for an origin to be reported by.
Expand Down Expand Up @@ -152,8 +137,8 @@
</parameter>
<parameter name="adoptManualDepth" type="boolean" default="true">
<description>
Adopt the depth from manual origins. Otherwise the default depth
in locator.defaultDepth is considered.
Adopt the depth from manual origins. Otherwise the configured
default depth from the active DepthLookup backend is used.
</description>
</parameter>
<parameter name="authors" type="list:string">
Expand All @@ -165,8 +150,9 @@
</parameter>
<parameter name="tryDefaultDepth" type="boolean" default="true">
<description>
Compare located origin with the origin at the depth given by
locator.defaultDepth. The origin with lower RMS is reported.
Compare located origin with the origin at the default depth
returned by the active DepthLookup backend. The origin with
lower RMS is reported.
</description>
</parameter>
<parameter name="publicationIntervalTimeSlope" type="double" unit="s/count" default="0.5">
Expand Down Expand Up @@ -239,6 +225,63 @@
</description>
</parameter>
</group>

<parameter name="depthLookup" type="string" default="Constant">
<description>
DepthLookup backend to use for region- and slab-based depth
lookup. Each backend owns its own configuration namespace.
Available values:

- "Constant" (default): returns the fixed depth set in
depths.constant.value. No plugin required.
- "Polygon": looks up the origin against named polygon
features loaded by SeisComP's GeoFeatureSet.
Configure depths.polygon.regions and
depths.polygon.fallback.
- "Slab2": uses USGS Slab2.0 depth-footprint contours.
Requires the dlslab2 plugin (core.plugins = dlslab2).
Configure dlslab2.directory and dlslab2.fallback.

The selected backend is mandatory — scautoloc will not start
if the backend type is unknown or fails to initialise.

Example for Slab2:
core.plugins = dlslab2
autoloc.depthLookup = Slab2
</description>
</parameter>

<group name="depths">
<group name="constant">
<parameter name="value" type="double" default="10" unit="km">
<description>
Constant default depth returned by the "Constant"
DepthLookup backend for any location.
</description>
</parameter>
</group>
<group name="polygon">
<parameter name="regions" type="list:string" default="">
<description>
Ordered, comma-separated list of polygon feature names
(from BNA or GeoJSON files in @DATADIR@/spatial/vector/)
used when autoloc.depthLookup = Polygon. Each feature
must carry a "defaultDepth" attribute (km) and may carry
a "maxDepth" attribute (km). The first polygon containing
the origin location is used.

Example:
depths.polygon.regions = sumatra_slab, stable_craton
</description>
</parameter>
<parameter name="fallback" type="double" default="10" unit="km">
<description>
Depth returned by the "Polygon" backend when the origin
is outside all configured polygon regions.
</description>
</parameter>
</group>
</group>
</group>
</configuration>
<command-line>
Expand Down
Loading