[scautoloc] Add location-dependent depth lookup (Slab2 backend)#126
[scautoloc] Add location-dependent depth lookup (Slab2 backend)#126comoglu wants to merge 11 commits into
Conversation
Replace fixed locator.defaultDepth and autoloc.maxDepth with a
geographic DepthLookup system compiled directly into scautoloc.
No plugin loader, no Client::Application dependency — safe to use
from standalone code and Python scripts.
Backends (selected via autoloc.depthLookup):
Constant (default) — uses existing defaultDepth/maxDepth config
values unchanged; zero behaviour change for
existing deployments
Slab2 — USGS Slab2.0 depth-footprint contours; depth
and maxDepth vary by geographic location
Config:
autoloc.depthLookup = Constant | Slab2
autoloc.slab2.directory = path to BNA contour files
- Add 531 USGS Slab2.0 depth-contour BNA files (35 depth levels, 27 slab zones) installed to share/scautoloc/slabs/ - Update config.cpp dump() to show depthLookup type and slabDir - Update scautoloc.xml with depthLookup and slab2.directory params
- Fix feature name to match BNA header format: 'zone depth km' - Initialize _depthLookup in constructor to prevent null dereference if init() is bypassed or fails early - Use Environment::absolutePath(configGetString()) for slabDir, consistent with gridConfigFile/staConfFile pattern
Use Environment::shareDir() in catch block so the default slabs path is correctly resolved even when autoloc.slab2.directory is not explicitly configured.
Two bugs fixed: - BNA files had negative vertex counts (-N) which SC's GeoFeature treats as open polygons (closedPolygon=false), making contains() always return false. Changed to positive counts so polygons are loaded as closed and contains() works correctly. - _lookupDepth/_fetchMaxDepth: check all sub-polygons per zone level (some zones have multiple sub-polygons with the same name).
- Rename _dd → dd and _maxDep → maxDep (leading underscore is for class members only, not local variables) - Fix typo: "objects(s)" → "object(s)"
Adds fetchCandidateDepths() to the DepthLookup interface (default wraps
fetch(), returns single depth — existing behaviour unchanged).
Slab2 backend overrides it: inside a slab zone returns {slabDepth,
fallbackDepth} so both the deep slab seed and the shallow crustal seed
are evaluated. Outside all zones returns {fallbackDepth} as before.
_setDefaultDepth() now iterates all candidates and keeps the
best-scoring relocation, enabling correct depth assignment in regions
with dual seismicity (e.g. Tonga: 140 km slab vs 10 km crustal).
| AutolocInternal::OriginVector _origins; | ||
| AutolocConfig _config; | ||
| AutolocInternal::StationConfig _stationConfig; | ||
| DepthLookupPtr _depthLookup; |
There was a problem hiding this comment.
There is one DepthLookup. That would mean that scautoloc can use either DepthLookupPolygon or Slab2DepthLookup, right? But what if it needs to use both? The common use case is: Slabs in subduction zones but also regions which only have induced seismicity where I need to fix the depth to a regional default no matter what. Or think of ocean ridges and transform faults, where the value DepthLookupPolygon would be that I can specify explicitly "for this region fix the depth and don't try different depths". Currently there is a default depth but scautoloc always performs some tests to see if an event could be deeper. And occasionally the result is wrong, e.g. if an event at a mid-ocean ridge is located at 120 km depth. DepthLookupPolygon can prevent that very effectively. But ideally not at the expense of Slab2DepthLookup.
Summary
Adds location-dependent
defaultDepthandmaxDepthto scautoloc via asmall abstract
DepthLookupinterface compiled directly into the binary.Two backends ship:
autoloc.defaultDepth/autoloc.maxDepth. This is the default; existing behaviour is unchanged.(BNA, 27 slab zones, 35 depth levels at 20 km intervals, 000–680 km).
The implementation is intentionally self-contained: no plugin loader, no
Client::Applicationdependency. Safe for standalone use and Python scripts.New config keys
New files
apps/processing/scautoloc/depthlookup.happs/processing/scautoloc/depthlookup.cppapps/processing/scautoloc/share/slabs/Integration points in autoloc.cpp
All
_config.defaultDepthcall sites replaced by_depthLookup->fetch(lat, lon);all
_config.maxDepthchecks replaced by_depthLookup->fetchMaxDepth(lat, lon).Test results (4 pick files, 2026-06-05)
With
Slab2vsConstant:Relationship to seiscomp/common PR #199
SeisComP/common#199 (
Seiscomp::Seismology::DepthLookup) provides anabstract factory interface for other SC modules. This PR is independent —
scautoloc's interface lives in
Seiscomp::Processingand has no dependencyon the common factory system. The two can coexist; a Slab2 plugin for the
common interface can be added separately if desired.