Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feat fdsn identfiers - #3781

Draft
ThomasLecocq wants to merge 6 commits into
masterfrom
feat_FDSN_identfiers
Draft

Feat fdsn identfiers#3781
ThomasLecocq wants to merge 6 commits into
masterfrom
feat_FDSN_identfiers

Conversation

@ThomasLecocq

Copy link
Copy Markdown
Contributor

Make Trace/Stats FDSN Source Identifier–native

⚠️⚠️⚠️⚠️ this PR is heavily AI-generated, the idea is a proof of concept built on the discussion in #3559 in order to nourish our discussions & ideas ⚠️⚠️⚠️⚠️⚠️⚠️

Closes part of #3559.

What this does

Makes the FDSN Source Identifier the internal channel identity of a Trace,
while keeping the SEED channel (and NET.STA.LOC.CHA) fully working. A trace
now carries network, station, location, band, source and subsource
as its stored codes; channel is a derived view over them.

New API

  • stats.band, stats.source, stats.subsource — read/write on every trace.
  • stats.sid and Trace.sid — the full FDSN:… identifier (read/write).
  • Stream.select(band=…, source=…, subsource=…, sid=…) — new selectors (wildcards supported).
  • Stats.from_sid() / Stats.to_sid().
  • Inventory.get_response() / get_channel_metadata() (and the Network equivalents) now accept a full Source Identifier as well as a SEED id.

Backward compatibility

  • stats.channel, stats.component, Trace.id, Stream.select(channel=…) behave exactly as before on all existing data.
  • channel is still present as a normal Stats key, so dict(stats), str.format(**stats), equality against a plain dict, and pickling are unchanged.
  • Old pickles are read correctly (the stored channel is decomposed on load).
  • Non-SEED and "extended" channels (e.g. long codes, multi-character or empty band/source/subsource) now round-trip losslessly, including for miniSEED 3.

Decisions worth noting

  • channel stays present and stored (as a derived mirror), never removed. This keeps stats.channel access working everywhere, which was the main compatibility concern raised in Stats: How to facilitate FDSN Source Identifier? #3559 — and rules out the alternative designs that either drop channel in one mode or change the type of stats.
  • A single-character channel maps to the component (subsource). So channel="Z" still gives component="Z", preserving behaviour for SOH / single-letter channels.
  • Trace.id stays SEED-shaped for compatibility; Trace.sid is the unambiguous identifier.
  • No new validation. Code permissiveness is unchanged; nothing that was accepted before now raises.

Internal changes

  • Reader/writer and processing code that pulled band/source/subsource out of channel by position (channel[0], channel[-1], channel[:-1], …) now uses the named codes, so it is correct for multi-character codes. Migrated: io/sh, io/gcf, io/rg16, io/xseed, signal/polarization, and stream rotation/merging.

Tests

  • New test module for the identifier codes, round-tripping, selection, pickling, and rotation of multi-character channels.
  • Full test suite passes (only the pre-existing network-dependent doctests, which download from examples.obspy.org, fail — unrelated to this change).

Not included / follow-up

  • Event metadata (WaveformStreamID in QuakeML) is not yet Source Identifier–aware. Picks and arrivals still carry only NSLC. This is independent of the waveform side and does not affect anything here; it is left for a follow-up PR.

Feedback wanted

  • Agreement on the two behaviour decisions above (single-character channel → component; Trace.id stays SEED-shaped with Trace.sid added).
  • Whether the follow-up for event metadata should be tracked in a new issue.

AI used?

The Claude was used heavily

PR Checklist

  • Correct base branch selected? master for new features, maintenance_?.?.x for bug fixes
  • Tests: Added new tests for any new features or fixed regressions
  • Changelog: Added a short note in CHANGELOG.txt (only obsolete if fixing a bug introduced after the last release)
  • Add the yellow ready for review label when you the PR is ready to be reviewed

@ThomasLecocq ThomasLecocq added .core issues affecting our functionality at the very core build_docs Docs will be automatically built and deployed in github actions on pushes to the PR labels Aug 24, 2026
@ThomasLecocq
ThomasLecocq marked this pull request as draft August 27, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build_docs Docs will be automatically built and deployed in github actions on pushes to the PR .core issues affecting our functionality at the very core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant