Skip to content

Conversation

@megies
Copy link
Member

@megies megies commented Mar 26, 2025

What does this PR do?

This is a prototype to showcase how the current Stats object could be modified to internally have a switch between NSLC and SourceID system. This is an alternative approach with trying to have a minimal amount of outward facing class/hierarchy changes, in comparison to changing the class structure/hierarchy like prototyped in #3550

>>> from obspy.core import Stats
>>> header_sid = {'namespace': 'FDSN', 'network': 'BW', 'station': 'MANZ', 'location': '', 'band': 'B', 'source': 'H', 'subsource': 'Z'}
>>> stats = Stats(header=header_sid)
>>> print(stats)
       namespace: FDSN
         network: BW
         station: MANZ
        location: 
            band: B
          source: H
       subsource: Z
            type: SID
       starttime: 1970-01-01T00:00:00.000000Z
         endtime: 1970-01-01T00:00:00.000000Z
   sampling_rate: 1.0
           delta: 1.0
            npts: 0
           calib: 1.0
>>> print(type(stats))
<class 'obspy.core.trace.Stats'>
>>> stats.to_NSLC()
>>> print(stats)
         network: BW
         station: MANZ
        location: 
         channel: BHZ
            type: NSLC
       starttime: 1970-01-01T00:00:00.000000Z
         endtime: 1970-01-01T00:00:00.000000Z
   sampling_rate: 1.0
           delta: 1.0
            npts: 0
           calib: 1.0
>>> print(type(stats))
<class 'obspy.core.trace.Stats'>

Why was it initiated? Any relevant Issues?

MiniSEED v3 uses the newly introduced FDSN Source Identifier which differs from the "traditional" NSLC (net/sta/loc/cha) way to label data.

Compare #3550

PR Checklist

  • Correct base branch selected? master for new features, maintenance_... for bug fixes
  • This PR is not directly related to an existing issue (which has no PR yet).
  • While the PR is still work-in-progress, the no_ci label can be added to skip CI builds
  • If the PR is making changes to documentation, docs pages can be built automatically.
    Just add the build_docs tag to this PR.
    Docs will be served at docs.obspy.org/pr/{branch_name} (do not use master branch).
    Please post a link to the relevant piece of documentation.
  • If all tests including network modules (e.g. clients.fdsn) should be tested for the PR,
    just add the test_network tag to this PR.
  • All tests still pass.
  • Any new features or fixed regressions are covered via new tests.
  • Any new or changed features are fully documented.
  • Significant changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .
  • If the changes affect any plotting functions you have checked that the plots
    from all the CI builds look correct. Add the "upload_plots" tag so that plotting
    outputs are attached as artifacts.
  • New modules, add the module to CODEOWNERS with your github handle
  • Add the yellow ready for review label when you are ready for the PR to be reviewed.

@megies megies added the .core issues affecting our functionality at the very core label Mar 26, 2025
@megies megies added this to the 1.5.0 milestone Mar 26, 2025
@megies megies force-pushed the stats_type_extension branch from 7e2057e to 17d0b1c Compare March 26, 2025 15:56
@ThomasLecocq ThomasLecocq modified the milestones: 1.5.0, 1.6.0 Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.core issues affecting our functionality at the very core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants