Skip to content

[scautoloc] Add location-dependent depth lookup (Slab2 backend)#126

Open
comoglu wants to merge 11 commits into
SeisComP:mainfrom
comoglu:feature/depthlookup-v2
Open

[scautoloc] Add location-dependent depth lookup (Slab2 backend)#126
comoglu wants to merge 11 commits into
SeisComP:mainfrom
comoglu:feature/depthlookup-v2

Conversation

@comoglu

@comoglu comoglu commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds location-dependent defaultDepth and maxDepth to scautoloc via a
small abstract DepthLookup interface compiled directly into the binary.

Two backends ship:

  • Constant — returns fixed values from autoloc.defaultDepth /
    autoloc.maxDepth. This is the default; existing behaviour is unchanged.
  • Slab2 — looks up depth from USGS Slab2.0 depth-footprint contour files
    (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::Application dependency. Safe for standalone use and Python scripts.

New config keys

autoloc.depthLookup = Constant          # default — existing behaviour
autoloc.depthLookup = Slab2             # geographic lookup
# autoloc.slab2.directory auto-resolves to share/scautoloc/slabs/

New files

Path Description
apps/processing/scautoloc/depthlookup.h Abstract interface + backend declarations
apps/processing/scautoloc/depthlookup.cpp Constant and Slab2 implementations
apps/processing/scautoloc/share/slabs/ 531 USGS Slab2.0 BNA files

Integration points in autoloc.cpp

All _config.defaultDepth call sites replaced by _depthLookup->fetch(lat, lon);
all _config.maxDepth checks replaced by _depthLookup->fetchMaxDepth(lat, lon).

Test results (4 pick files, 2026-06-05)

With Slab2 vs Constant:

Location Constant Slab2
Tonga (−22.3°S, −176.9°W) 10 km 140 km
New Zealand (−41.6°S, 173.2°E) 10 km 325 km
Central America (13.4°N, −87.5°W) 10 km 82 km
Honduras deep zone no solution 504–544 km solutions found

Relationship to seiscomp/common PR #199

SeisComP/common#199 (Seiscomp::Seismology::DepthLookup) provides an
abstract factory interface for other SC modules. This PR is independent —
scautoloc's interface lives in Seiscomp::Processing and has no dependency
on the common factory system. The two can coexist; a Slab2 plugin for the
common interface can be added separately if desired.

comoglu added 10 commits June 4, 2026 21:43
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)"
@cla-bot cla-bot Bot added the cla-signed The CLA has been signed by all contributors label Jul 9, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed by all contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant