Skip to content

Close mdapi sub-resource gaps and fix key-name mismatches #92

@GClunies

Description

@GClunies

What & Why

mdapi coverage is mostly present but has known gaps and two key-name mismatches that silently break data loading for stations with specific features. Closing these makes the mdapi surface complete and removes latent bugs. Part of #89.

Acceptance Criteria

  • supersededdatums is reachable as a Station attribute (or equivalent method). Test cassette exercises a station that has superseded datums.
  • Harmonic constituents load correctly: either the expand param is fixed from harconharmonicConstituents or the response-key read at _metadata.py:123 is fixed to match what NOAA actually returns. Verified against a live API hit.
  • Tide prediction offsets handle the tidepredoffets vs tidepredoffsets mismatch correctly. The expand param currently preserves NOAA's historical typo (_metadata.py:37-38) while the response-read uses the correctly spelled key (_metadata.py:137) — confirm which NOAA actually honors and fix whichever side is wrong.
  • Standalone fetchers exist for the sub-resources that have their own URLs: /stations/{id}/supersededdatums.json, /details.json, /sensors.json, /datums.json, /harcon.json, /floodlevels.json. Callers should be able to refresh a single sub-resource without reconstructing a full Station.
  • Existing Station() construction continues to pass all tests.

Approach

  • Start by reproducing the harcon mismatch against a live mdapi response for a station with tidal constituents (e.g. 8454000 or a similar primary water-level station). Decide which side of the mismatch is wrong before editing — don't guess.
  • Add a single helper (e.g. _fetch_mdapi_subresource(station_id, name)) rather than one method per sub-resource, and expose thin wrappers on Station.
  • Files in play:
    • noaa_coops/_metadata.py (all of it; key-name fixes at :37-38, :123, :137).
    • noaa_coops/_endpoints.py (base URL plumbing for sub-resource fetchers).
    • tests/test_station.py + new VCR cassettes.

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions