Skip to content

Use MATLAB stats and new GS attributes in /arctic_hydrology/stats/ endpoint#723

Open
Joshdpaul wants to merge 10 commits into
mainfrom
add_mhit_stats
Open

Use MATLAB stats and new GS attributes in /arctic_hydrology/stats/ endpoint#723
Joshdpaul wants to merge 10 commits into
mainfrom
add_mhit_stats

Conversation

@Joshdpaul
Copy link
Copy Markdown
Contributor

@Joshdpaul Joshdpaul commented May 29, 2026

This branch upgrades the Arctic hydrology endpoints to use updated GeoServer layer attributes and the new Rasdaman coverage that expose the full MHIT statistics suite. This branch also populates the summary block of pre-computed key statistics for use by the front end data sentences.

Summary of changes

  • All MHIT statistics: The stats endpoint (/arctic_hydrology/stats/<stream_id>) now returns all 50+ MHIT hydrologic statistics via the new ak_hydro_segments_mhit_stats_combined Rasdaman coverage. Previously only ma12–ma23 and ma99 were returned.

  • summary block on stats and hydroviz endpoints: The top-level summary key is populated from the arctic_rivers_segments_stats_simplified GeoServer layer which provides pre-computed statistics for the data sentences section of the app. Previously, there was a placeholder stub dictionary here populated with null values.

  • Additional segment metadata: Stats and climatology responses now include gauge_id (USGS or Canadian gauge ID if available, empty string otherwise), watershed (HUC8 or Yukon watershed ID), and watershed_outlet (boolean). Note that the dictionary keys here vary from the CONUS return because we aren't dealing exclusively with HUC8s in the transboundary dataset.

GeoServer layer updates

  • generate_wfs_arctic_hydrology_url: Updated WFS layer name from hydrology:arctic_segments to hydrology:arctic_rivers_segments_joined_3338_simplified and expanded propertyName to include Gauge_ID, ID_1, ID_2, Name, and outlet.

    • Note that the ID_1, ID_2, and Name fields refer to watersheds.ID_1 matches our GVV ids, which will probably be more useful for the Yukon watersheds. For AK watersheds, ID_2 is identical to ID_1, but for Canadian watersheds its the official Canadian ID, which is not used in the GVV as far as I know.

  • generate_wfs_arctic_hydrology_stats_url (new): Fetches pre-computed summary statistics from hydrology:arctic_rivers_segments_stats_simplified.

Documentation (arctic_hydrology.html)

  • Added ?source= parameter documentation to both endpoint tables (stats: three accepted values; modeled climatology: two accepted values), matching the CONUS hydrology docs.
  • Expanded the Available Streamflow Statistics table from 13 rows (ma12–ma99 only) to all 50 statistics, grouped by category.
  • Updated example JSON output blocks to reflect the current response structure, including the full stats variable set, summary, watershed, watershed_outlet, and gauge_id fields.

CSV output (csv_functions.py)

  • Arctic stats CSV header comments were stale, documenting only ma12–ma99. Updated arctic_hydrology_csv() to document all 50 statistics with descriptions matching the format used by the CONUS hydrology CSV.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Arctic hydrology API to use the new Rasdaman MHIT statistics coverage and updated GeoServer attributes, and to populate a summary block from a dedicated WFS stats layer for frontend “data sentences”.

Changes:

  • Switch /arctic_hydrology/stats/<stream_id> to the new ak_hydro_segments_mhit_stats_combined Rasdaman coverage to expose the full MHIT statistics suite.
  • Add a new WFS URL generator + request path to fetch precomputed “summary” statistics from hydrology:arctic_rivers_segments_stats_simplified, and include additional segment metadata (e.g., gauge/watershed attributes).
  • Expand Arctic hydrology documentation and CSV header metadata to reflect the broader stats set and new ?source= options.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
templates/documentation/arctic_hydrology.html Updates endpoint docs, query params (?source=), and example responses to reflect the new stats/summary/metadata.
routes/arctic_hydrology.py Switches the stats coverage, adds WFS summary fetch + response population, and adds new segment metadata fields.
generate_urls.py Updates Arctic hydrology WFS layer name/attributes and adds a new WFS URL builder for summary stats.
csv_functions.py Updates Arctic stats CSV header comments to enumerate the expanded MHIT statistic set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread routes/arctic_hydrology.py
Comment thread routes/arctic_hydrology.py Outdated
@Joshdpaul Joshdpaul requested a review from cstephen May 29, 2026 21:46
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.

2 participants