Add source parameter to CONUS hydrology + arctic hydrology endpoints#720
Open
Add source parameter to CONUS hydrology + arctic hydrology endpoints#720
Conversation
…oggle between datasets
… add notes about future work
…w choice of source for that endpoint; add notes to variable metadata indicating source
This was referenced Apr 29, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CONUS hydrology API to support a new Rasdaman “source” dimension by exposing it as a ?source= query parameter, while simplifying hydroviz logic by moving Maurer-adjustment math out of inline endpoint code and into shared processing.
Changes:
- Add
?source=support for/conus_hydrology/stats/{stream_id}and/conus_hydrology/modeled_climatology/{stream_id}(withgcm_diff_applied_to_maureras default). - Update Rasdaman stats coverage wiring to
conus_hydro_segments_stats_combinedand add WCS subsetting for the source axis. - Add “source notes” into JSON variable descriptions and CSV metadata output; remove client-side
ma99derivation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/documentation/conus_hydrology.html | Documents ?source= options for stats and modeled climatology endpoints. |
| routes/conus_hydrology.py | Implements source handling, updates stats coverage, adds Maurer adjustment helper, and simplifies hydroviz aggregation. |
| generate_requests.py | Adds optional SUBSET=source(...) to CONUS hydrology WCS request generation. |
| csv_functions.py | Adds source-specific notes to CSV metadata and adds None-skipping in CSV row construction. |
| application.py | Adds global marshmallow validation for source query parameter values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ua-snap/data-api/sessions/3db7f7c2-1e57-4578-a221-88bb2156d8ec Co-authored-by: Joshdpaul <99696041+Joshdpaul@users.noreply.github.com>
…t mirroring conus hydrology endpoint structure; add source dimension support; Cheng-baseline delta adjustment for GCM models (PGW models ignored, use original_gcm values); add source notes to CSV output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both the CONUS hydrology and arctic hydrology stats coverages in Rasdaman have been updated (
conus_hydro_segments_stats_combinedandak_hydro_segments_stats_combined) to include a source dimension encoding three variants of the data. This branch wires up that new dimension as a?source=query parameter and simplifies theconus_hydrology/stats/{stream_id}andarctic_hydrology/stats/{stream_id}endpoints by moving the historical baseline adjustment math out of inline application code and into the coverage itself.Changes:
?source=parameter on/conus_hydrology/stats/{stream_id},arctic_hydrology/stats/{stream_id},/conus_hydrology/modeled_climatology/{stream_id}, and/arctic_hydrology/modeled_climatology/{stream_id}. Accepted values are:/conus_hydrology/hydroviz/{stream_id}and/arctic_hydrology/hydroviz/{stream_id}endpoints are simplified: the historical baseline adjustment calculation previously done inline is now handled bycalculate_and_apply_gcm_diffs_to_maurer_climatology()orcalculate_and_apply_gcm_diffs_to_cheng_climatology(), and is called from the modeled climatology endpoint when source is "gcm_diff_applied_to_maurer" (the conus default) or "gcm_diff_applied_to_cheng" (the arctic default). Note that this math is now optional depending on the choice of source: the user can get an un-adjusted hydrograph too by using source="original_gcm", if that's what they want.ma99removed from client-side calculation: annual mean flow is now stored in the coverage, socalculate_and_populate_annual_mean_flow()is deleted.?source=values are validated via marshmallow inapplication.py.?source=options and parameter chaining documented for both endpoints.Note that the source notes (in variable metadata descriptions and CSV headers) and their documentation wording are first drafts. The language describing what each source mode means should be revised if there is a better way to clearly communicate the data provenance. Any ideas here are welcome, or we could workshop it with the rest of the team later.
XREF: ua-snap/hydroviz#184
XREF: ua-snap/rasdaman-ingest#157
XREF: ua-snap/arctic_rivers#4
XREF: ua-snap/rasdaman-ingest#158