Skip to content

Estonia#113

Open
thiagovmdon wants to merge 4 commits intomainfrom
estonia
Open

Estonia#113
thiagovmdon wants to merge 4 commits intomainfrom
estonia

Conversation

@thiagovmdon
Copy link
Copy Markdown
Collaborator

Summary

Related to issue #74

This PR updates the Estonia fetcher to better match the upstream hydrodownloadR approach while keeping the additional metadata we want in RivRetrieve.

What changed

  • rebased estonia onto the current main
  • replaced the old EstModel + WISKI fuzzy metadata merge with an official EstModel JSON + GeoJSON merge by gauge_id
  • kept the extra area-related metadata fields from the Estonia station payload
  • regenerated the cached Estonia metadata CSV from the live official source
  • added Estonia unit tests with real raw payloads in tests/test_data/
  • added an Estonia example script in examples/
  • tightened the Estonia fetcher docstring so the rendered Sphinx page matches the Germany Berlin structure:
    • Data source
    • Supported variables
    • Data description and API
    • Terms of use
    • detailed get_data() method docs with Parameters, Returns, Return type, and Raises
  • added pytest discovery config so pytest runs the real tests/ suite instead of collecting examples/test_*.py demo scripts as tests

Implementation notes

The main design change is in metadata handling.

Before:

  • metadata came from EstModel plus a separate WISKI endpoint
  • coordinates were attached via fuzzy station-name matching

Now:

  • metadata comes from EstModel station JSON
  • coordinates come from EstModel GeoJSON
  • the two are merged directly by station code / gauge ID

This is closer to hydrodownloadR, simpler, and less brittle, while still preserving the useful area, overlapArea, countryArea, calculationArea, and distance fields.

Result

  • get_metadata() and get_cached_metadata() now agree structurally
  • the Estonia cache now reflects the current live official hydrological station list
  • the rendered Estonia API page is much cleaner and follows the requested documentation structure

Verification

  • ./.venv/bin/python -m pytest
  • ./.venv/bin/python -m ruff check .
  • ./.venv/bin/python -m ruff format --check .
  • ./.venv/bin/python -m sphinx -M html docs docs/_build -j auto

Reference

This PR was implemented on top of the rebased estonia branch and pushed after validation.
Latest commit: d818a2b

@thiagovmdon thiagovmdon requested a review from kratzert as a code owner March 27, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant