Skip to content

[scautoloc] Add DepthLookup plugin system (dlslab2 + refactor)#121

Draft
comoglu wants to merge 5 commits into
SeisComP:mainfrom
comoglu:feature/default-depth-setter
Draft

[scautoloc] Add DepthLookup plugin system (dlslab2 + refactor)#121
comoglu wants to merge 5 commits into
SeisComP:mainfrom
comoglu:feature/default-depth-setter

Conversation

@comoglu
Copy link
Copy Markdown
Contributor

@comoglu comoglu commented May 20, 2026

Summary

Replaces the single global locator.defaultDepth with a pluggable
DepthLookup interface. Each backend owns all depth knowledge including
its fallback value; callers pass no fallback.

Three backends:

  • "Constant" (default) — fixed depth from depths.constant.value
  • "Polygon" — per-region depths from BNA/GeoJSON features; configures via depths.polygon.regions + depths.polygon.fallback
  • "Slab2" — USGS Slab2.0 depth-footprint contours (requires dlslab2 plugin); configures via dlslab2.directory + dlslab2.fallback

API:

virtual bool   init(const Config::Config &) = 0;
virtual double fetch(double lat, double lon) const = 0;
virtual double fetchMaxDepth(double lat, double lon) const = 0;

Breaking changes in scautoloc configuration:

  • locator.defaultDepth removed → use depths.constant.value
  • autoloc.maxDepth removed → now owned by each backend
  • autoloc.regionDepth.regions removed → use depths.polygon.regions
  • autoloc.depthLookup is now mandatory; unknown type = startup failure

Depends on: SeisComP/common#199 (DepthLookup interface)

Test plan

  • Build scautoloc and dlslab2 — clean compile, no errors
  • Run scautoloc offline playback — verify no regression in located depths
  • Test Constant backend with depths.constant.value = 15
  • Test Polygon backend with a BNA region carrying defaultDepth attribute
  • Test Slab2 backend with generated BNA files from generate_slab_bna.py
  • Verify startup fails with an unknown autoloc.depthLookup type

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 20, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @gempa-lukas on file. Please follow https://github.com/GEOFON/CLA/blob/master/README.md to get yourself added.

@comoglu comoglu force-pushed the feature/default-depth-setter branch from 0791a64 to 7582839 Compare May 20, 2026 23:23
@cla-bot cla-bot Bot added the cla-signed The CLA has been signed by all contributors label May 20, 2026
comoglu added 2 commits May 21, 2026 20:15
…ntation

Adds the dlslab2 plugin providing DepthLookup::"Slab2" — a region-aware
default and maximum depth lookup backed by USGS Slab2.0 contour polygons.

- Slab2DepthLookup: loads BNA depth-footprint contours from dlslab2.directory
  (default @datadir@/dlslab2/slabs); 30 zones, 20 km intervals (0–680 km)
- Uses a local GeoFeatureSet (not the global singleton) to avoid polluting
  the GUI display layer
- Ships 531 pre-generated BNA files under plugins/depthlookup/slab2/share/slabs/
- tools/generate_slab_bna.py reproduces the BNA dataset from USGS .grd grids
- tools/defaultdepthsetter.py: standalone Python mirror for testing depth logic

Data source: Hayes et al. (2018), Slab2.0 (doi:10.5066/F7PV6JNV)
Replaces the embedded depth-lookup logic with the new DepthLookupFactory
from seiscomp/common.  Adds autoloc.depthLookup config key (default:
"Constant") to select the backend at runtime without recompiling.

- autoloc.depthLookup = Constant  — legacy behaviour, no config change needed
- autoloc.depthLookup = Polygon   — named GeoFeatureSet regions
- autoloc.depthLookup = Slab2     — USGS Slab2.0 contours (requires dlslab2)
@comoglu comoglu force-pushed the feature/default-depth-setter branch from 7582839 to 71c843a Compare May 21, 2026 10:16
…/maxDepth

Update all call sites to fetch(lat,lon) / fetchMaxDepth(lat,lon).
Remove defaultDepth and maxDepth from autoloc Config struct and all
associated config reads (locator.defaultDepth, autoloc.maxDepth,
autoloc.regionDepth.regions). Backend is now mandatory — unknown
type or init failure causes SEISCOMP_ERROR + abort, no silent fallback.
Add depths.constant/polygon groups to scautoloc.xml; add
dlslab2.fallback to dlslab2.xml.
@comoglu comoglu changed the title [scautoloc] Add DefaultDepthSetter plugin system (ddslab2 + refactor) [scautoloc] Add DepthLookup plugin system (dlslab2 + refactor) May 21, 2026
comoglu added 2 commits May 22, 2026 16:10
When an origin falls outside all Slab2.0 zones, the backend now
consults an optional ordered list of polygon regions (from SeisComP's
global GeoFeatureSet) before returning the constant fallback.

Config: dlslab2.polygon.regions = australia_craton, african_craton
Each polygon must carry a defaultDepth attribute (km) and may carry
a maxDepth attribute (km).

Useful for stable cratons, rifts, and other non-subduction areas
where a region-specific default depth is known.
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