Supply source disaggregation, irrigation conveyance, and feature enhancements #77
Merged
Conversation
…mple_data() to work
…ctor tech for example resources subresources etc
… lines from easy_query
…example basin_water withdrawals
… in each grid cell
…pture transnational basins within the USA
…mreader dependencies and adding inputviwer and tests dependencies
…thods changing call signature and add checks in tdmethods
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request expands the Tethys downscaling model with new configuration options and capabilities (notably source disaggregation and irrigation conveyance efficiency), while also modernizing temporal downscaling configuration, updating dependencies, and refreshing docs/CI for improved reproducibility and testing.
Changes:
- Add source disaggregation utilities + model integration and document new YAML options (source disaggregation, irrigation conveyance efficiency).
- Normalize/modernize temporal downscaling configuration and update temporal method call patterns.
- Update packaging/dependencies, installation docs, and GitHub Actions workflows (incl. Python matrix + dev extras for testing).
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
tethys/utils/source_disaggregation.py |
New GCAM-query-based source share calculation and gridded share generation utilities. |
tethys/utils/region_to_id_mapping.py |
Add basin-name mapping dictionaries used for basin/resource normalization. |
tethys/utils/install_supplement.py |
Update data supplement lookup to match the distribution name/versioning. |
tethys/tdmethods/weights.py |
Allow temporal_distribution() to be invoked with a model object / normalized config. |
tethys/tdmethods/irrigation.py |
Same as above for irrigation temporal downscaling. |
tethys/tdmethods/electricity.py |
Same as above for electricity temporal downscaling. |
tethys/tdmethods/domestic.py |
Same as above for domestic/municipal temporal downscaling. |
tethys/model.py |
Add source disaggregation workflow, irrigation efficiency adjustment, and temporal config normalization/path resolution. |
tethys/datareader/regional.py |
Add extract_resource_name() helper for GCAM resource name cleanup. |
tethys/datareader/easy_query.py |
Add replace_filters option to fully override default query filters. |
tethys/__init__.py |
Bump package version to 2.2.0. |
setup.py |
Update authors and dependency pins/extras (incl. pytest/coverage in dev extras). |
requirements.txt |
Update dependency floor versions and include distributed / setuptools<81. |
README.md |
Fix install command to tethys-downscaling. |
docs/source/user_guide.rst |
Document new config options and improve config table formatting. |
docs/source/getting_started.rst |
Fix install command to tethys-downscaling. |
docs/source/conf.py |
Update documentation author list. |
.github/workflows/paper.yml |
Restrict triggers to main and modernize artifact upload action. |
.github/workflows/build.yml |
Add Python 3.9/3.11 matrix and install dev extras for tests/coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…but something like upper_colorado could break Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…/basin/subresource Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
disaggregate_source() currently returns a plain dict of DataArrays, but run_model() initializes self.griddedshares as an xr.Dataset() and then overwrites it with that dict. Converting to an xr.Dataset here keeps the attribute’s type consistent and makes downstream usage (including I/O) less error-prone. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
When temporal_distribution() is called with a Tethys model object, the function rebuilds the call using only a subset of config (tasfile/rfile) and drops other supported kwargs (e.g., tasvar, rvar). Passing through **cfg preserves configurability and keeps behavior consistent between the “model object” and “direct args” call paths. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
When called with a Tethys model object, this wrapper only forwards regionfile and irrfile, silently ignoring other supported kwargs like irrvar. This makes it impossible to configure those options via temporal_config when using the model-object call style (which is used by the test suite). Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
In the model-object call path, the wrapper forwards only a fixed subset of config and drops other supported kwargs (e.g., hddvar, cddvar). Passing through **cfg keeps the function configurable and avoids the model-object path behaving differently from the direct-args path. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
In the model-object call path, this wrapper forwards only weightfile and drops other supported kwargs (e.g., weightvar, regrid_method, prenormalized). This makes temporal_config['Weights']['kwargs'] ineffective for anything beyond weightfile. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
This pull request introduces several new features, dependency updates, and improvements to documentation and CI workflows for the Tethys project. The most significant changes are the addition of source disaggregation and irrigation conveyance efficiency options to the model, enhancements to temporal downscaling configuration, and updates to dependencies and installation instructions. Below are the most important changes, grouped by theme.
New Features and Model Enhancements:
Tethysmodel, with corresponding configuration options and documentation updates. This includes new attributes, logic inrun_model, and YAML config documentation. [1] [2] [3] [4] [5] [6] [7]easy_queryvia a newreplace_filtersargument. [1] [2]extract_resource_namefor cleaning resource names.Dependency and Installation Updates:
setup.py, including pinning specific versions for better reproducibility and updating the install instructions to use the correct package name (tethys-downscaling). [1] [2] [3] [4]setup.pyand documentation. [1] [2]2.2.0.Documentation Improvements:
Continuous Integration and Workflow Updates:
mainbranch for push and pull requests, and updated artifact upload action version. [1] [2]These changes collectively improve the flexibility, reproducibility, and usability of the Tethys package for both users and developers.