[python] Add scoriginquality: automatic A/B/C/D origin quality grading#117
[python] Add scoriginquality: automatic A/B/C/D origin quality grading#117comoglu wants to merge 6 commits intoSeisComP:mainfrom
Conversation
…ity grading Subscribes to LOCATION messages and assigns a quality grade (A/B/C/D) to each incoming origin using a worst-of rule on OriginQuality fields: azimuthal gap, secondary azimuthal gap, RMS, used station count, and minimum distance. The grade is written back as an origin Comment so it is visible in scolv and other GUIs without additional configuration. All thresholds are configurable via the SeisComP config system.
--event <id> grades the preferred origin of a single event from the
database and writes the comment back via messaging, then
exits. Uses loadObject() to resolve both event and origin
by publicID, and syncOutbox() to flush before disconnect.
--ep <file> grades all origins in a SeisComP XML file.
Also enables database by default so batch modes have a DB connection,
and consolidates the config/threshold loop to reduce repetition.
Comment text is now multi-line: grade on line 1, one parameter per line after (e.g. "Az. Gap: 76.3° → A"). The GUI splits on the first newline — label shows the grade letter, tooltip shows the full breakdown.
Incorporates direct locator output alongside network geometry proxies: - maxHorizontalUncertainty (semi-major axis, km) from OriginUncertainty - depthUncertainty (km) from OriginUncertainty - groundTruthLevel (GT0-GT25) from OriginQuality, populated by iLoc Default thresholds: horizUnc A≤5/B≤10/C≤20 km, depUnc A≤5/B≤15/C≤30 km. GT0/GT1→A, GT2/GT5→B, GT10/GT25→C. All configurable. Updates XML description with new parameters and clarifies that grading combines both network geometry proxies and direct locator quality output.
|
Hi @comoglu, I don't think that we will merge this new application which assigns a quality which is specific to your particular needs. I think that such a module is better suited for a private repository which you can use in your particular setup. Maybe other users can also test it and if that could be defined as kind of standard, we can think about adding that to SeisComP. What do you think? |
|
The contribution by @comoglu is highly appreciated but I second @gempa-jabe's view that (at this point) this is too specific to be included in main. How about some (offline) brainstorming in the forum and/or via email? I am sure there are others with broadly similar requirements for summary quality ratings and a discussion might result in a more generic module. |
|
Hi @gempa-jabe, A few points worth considering: It's not network-specific. All thresholds are configurable via the SeisComP config system (quality.A., quality.B., quality.C.*), and the grade labels themselves are also configurable — users could substitute numbers, roman numerals, or any custom scheme if preferred. Parameters that the locator doesn't populate are silently skipped, so it degrades gracefully with LOCSAT, iLoc, or stdloc, or any implementation through LocExt. There's a companion GUI PR (SeisComP/common#194) that adds quality grade display with tooltip breakdown to both the scolv Location tab and the scesv hypocenter panel, no config required. I think it can be useful for anyone who would like to use it. As it is still in progress, I'd like to finalise both PRs together before asking for a proper review. I'll update once ready and would welcome feedback at that point on whether the approach could be considered more broadly. |
|
OK, I will sit and wait until the draft flag has been removed. As we do not get so many PRs, it is OK right now to keep yours active here. But imagine the situation with many PRs which are all draft but active. I get notifications all the time and I am alert to do something although it is not required at this stage. So it would make sense to me if you tell us where you are implementing something interesting (a branch in your repo) and we could comment. Once you are satisfied and ready with your implementation, you can issue the PR to let us check after discussions have happened.
As this is fully generic, it adds optional functionality not tight to a particular method. As it is in draft state as well, I stay silent ;). |
|
Hi @jsaul @gempa-jabe , One thing I'd like to understand: how should quality information like this be displayed in scolv and scesv if this feature is outside of the main branch? I imagine once the actual product is ready I can create a separate PR for that specific feature. |
Isn't that part of SeisComP/common#194? The changes in |
|
Yes, exactly! |
Summary
Adds
scoriginquality, a new SeisComP Python module that automatically assignsan A/B/C/D quality grade to each origin using a worst-of rule, and writes the
result back as an origin Comment visible in scolv and scesv without any
additional configuration.
Grading inputs
Two categories of information are combined:
Network geometry (statistical proxies for constraint quality):
Direct locator output (from
OriginQuality/OriginUncertainty):standardError)maxHorizontalUncertainty, populated by LOCSAT, iLoc)depthUncertainty, populated by iLoc, stdloc)GT0–GT25(groundTruthLevel)Parameters not present in the data are silently skipped, so the module
degrades gracefully when a locator does not populate all fields.
Default thresholds
All thresholds are fully configurable via the SeisComP config system
(
quality.A.*,quality.B.*,quality.C.*).Comment format
The comment text is multi-line — grade letter on line 1, one parameter
breakdown per line after:
The GUI splits on the first
\n: the label shows the grade letter, thetooltip shows the full breakdown on hover. This requires the companion PR
in
common(feature/eventsummaryview-quality).Modes of operation
--event <id>--ep <file>--allThe
--allmode is useful for backfilling grades after deployment or afterchanging thresholds.
Related PRs
comoglu/common:feature/eventsummaryview-qualityTest plan
scoriginqualityin live mode; locate an event; confirm grade appears in scesv hypocenter panelscoriginquality --event <id>; confirm comment written to DBscoriginquality --all; confirm all events regraded (finished — graded N, skipped 0)scoriginquality --ep file.xml; confirm grades written