Recent Releases of pywatershed
pywatershed - pywatershed 3.0.0
Overview
In pywatershed version 3.0.0, the primary new capabilities introduced are stream temperature simulation following the PRMS methodology and the simulation of irrigated agriculture based on GSFLOW. See the v3.0.0 extended release notes for a fuller narrative.
Stream Temperature
The new PRMSStreamTemp and PRMSStreamTempHumidityCBH classes simulate stream temperature using the PRMS stream temperature methodology, computing water temperatures based on energy balance in stream segments, with optional tracking and budgeting of 11 energy flux components. The stream temperature classes take a stream shade class on initialization, either PRMSStreamShadeConstant or PRMSStreamShadeDynamic, and require one of PRMSHydraulicGeometryFull or PRMSHydraulicGeometryWidthOnly as an upstream process. These capabilities are demonstrated as part of the NHM configuration in notebooks 01_multi-process_models.ipynb and 02_prms_legacy_models.ipynb. In the course of this work, several bugs were found and corrected in the stream temperature code of PRMS 5.2.1.1; the PRMS source contained in the pywatershed repository was corrected and pywatershed matches the corrected code.
Agricultural Water Use
New agricultural water use classes enable simulation of irrigated agriculture based on GSFLOW. PRMSRunoffAg extends PRMSRunoff to calculate infiltration separately for pervious and agricultural areas. PRMSSoilzoneAgObsET provides dual-area soil moisture accounting with iterative adjustment of irrigation to match observed actual evapotranspiration, and PRMSSoilzoneAg is a simplified version for when ET observations are not available. These capabilities are demonstrated in a new example notebook, 10_ag_irrigation_use.ipynb.
Energy Budgets
The ConservativeProcess class now supports both mass and energy budgets. The new mass_budget and energy_budget properties provide explicit access to each budget type. The legacy budget property is deprecated; use mass_budget instead.
Transpiration and Frost
PRMSAtmosphereTranspFrost implements the transp_frost module of PRMS. PRMSAtmosphereTranspFrostDynamic extends it to accept dynamic (time-varying) fall and spring frost dates from PRMS dynamic parameter files.
Output Collection and Statistics
The new Output class provides flexible output collection and statistical analysis for models, supporting HRUs of interest, segments/nodes of interest, and monthly accumulations, with Zarr chunked output for efficient large-scale data writing. See the new example notebook 09_model_output.ipynb.
Model Restart
The Process class and its subclasses have a new restart capability, allowing runs to be split and continued. See the new example notebook 08_restart_streamflow.ipynb.
Additional FlowGraph and Model Functionality
A new SourceSinkFlowNode class adds or removes flow above some minimum flow parameter as specified by an input data file, and StarfitSourceSinkFlowNode allows sources and sinks to interact with storage of a Starfit reservoir.
The FlowGraph class has a new method plot to show an abstract plot of the FlowGraph.
The new staticmethod Model.solve_inputs determines where each process input comes from — another process or a file — from a process list or model dictionary, without instantiating a Model.
The Model class can read all inputs from a single NetCDF file as an alternative to a directory of NetCDF files, and PrmsParameters.load supports multiple parameter files treated as addenda to the first.
Breaking Changes
The budget_type parameter has been renamed to imbalance_behavior in ConservativeProcess and all its subclasses, in FlowGraph, and in control options. Budget NetCDF output filenames now include the quantity type: mass budgets are named ProcessName_mass_budget.nc instead of ProcessName_budget.nc, and energy budgets use ProcessName_energy_budget.nc.
Detailed Change Log
For additional details, see the What's New Documentation:
New Features
Stream temperature simulation: PRMSStreamTemp and PRMSStreamTempHumidityCBH, with stream shade classes PRMSStreamShadeConstant and PRMSStreamShadeDynamic and hydraulic geometry classes PRMSHydraulicGeometryFull and PRMSHydraulicGeometryWidthOnly; optional energy flux tracking and budgeting of 11 flux components.
Agricultural water use based on GSFLOW: PRMSRunoffAg, PRMSSoilzoneAgObsET, and PRMSSoilzoneAg, demonstrated in notebook 10_ag_irrigation_use.ipynb.
ConservativeProcess supports both mass and energy budgets with new mass_budget and energy_budget properties; the budget property is deprecated.
PRMSAtmosphereTranspFrost implements the PRMS transp_frost module; PRMSAtmosphereTranspFrostDynamic adds dynamic frost dates from PRMS dynamic parameter files.
The Output class for flexible output collection and statistics, including Zarr chunked output; notebook 09_model_output.ipynb.
Restart capability for processes; notebook 08_restart_streamflow.ipynb.
SourceSinkFlowNode and StarfitSourceSinkFlowNode for adding/removing flows in a FlowGraph; FlowGraph.plot.
Model.solve_inputs staticmethod to determine input sources without instantiating a Model.
Model can read all inputs from a single NetCDF file; PrmsParameters.load accepts multiple parameter files as addenda; Control.set_init_start_times manages changing initial/start times.
Corrections to PRMS 5.2.1.1 stream temperature (humidity CBH handling and seg_humid accumulation); pywatershed matches the corrected PRMS source in this repository.
A pre-commit security review hook and a weekly dependency security scan in CI.
Breaking Changes
budget_type renamed to imbalance_behavior in ConservativeProcess and subclasses, FlowGraph, and control options.
Budget NetCDF output filenames include the quantity type (ProcessName_mass_budget.nc, ProcessName_energy_budget.nc).
Bug fixes
utils.PrmsDynamicParameter now forward-fills from the most recent dynamic parameter date at or before the run start; previously runs starting between dynamic parameter dates saw fill values.
The PRMSRunoffAg mass budget did not balance on canopy-changeover days: the changeover budget input term was never set and depression storage inflow was missing changeover water. The budget now closes to machine precision.
PRMS 5.2.1.1 stream temperature repeated division by HRU area; corrected in the PRMS source contained in this repository.
Internal changes
Release procedures revamped: step-by-step release guide, guarded release automation (checks, package build/publish, frozen conda environment exports per platform), and a shared local/CI preflight script.
CI provides gfortran from the conda environment; flopy is temporarily installed from its develop branch pending the next flopy release.
The autotests require an explicit --domain option (the silent default was removed).
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] 2 days ago
pywatershed - pywatershed 2.0.4
This is a release to fix the release process to pypi.
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] 5 months ago
pywatershed - pywatershed 2.0.3
This is a data release for the upcoming major release. New data will be an asset on this
release.
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] 5 months ago
pywatershed - pywatershed 2.0.2
This patch addresses a few things that are somewhat related and became problematic:
- fixes editable install issues that were occurring with continued deprecations in the pythonverse.
- deprecates fortran code in pywatershed as part of install issues (these were redundant and rarely used, so no minor version increment).
- fixes a race condition in CI that caused testing to fail.
- gets pyPRMS from pypi.
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] over 1 year ago
pywatershed - pywatershed 2.0.1
This release makes only non-code changes to 2.0.0:
- The disclaimer on the top-level README.md was modified to use the disclaimer for approved releases.
- The environments yaml files were cleaned up but not substantially changed.
- The RELEASE.md and release.yaml were amended and corrected.
Please see the version 2.0.0 release for additional details on the functionalities in this version.
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] over 1 year ago
pywatershed - pywatershed 2.0.0
Overview
This section looks at some highlights of this version. The following section gives a (somewhat redundant though) more detailed change log.
FlowGraph
The primary new capability introduced is the FlowGraph and its related classes. The FlowGraph allows users to combine different kinds flow solutions on FlowNodes in arbitrary order. In the figure below, a node of class B is inserted into the original graph. Class B may have a different flow solution than the class A nodes in the original graph, but FlowGraph will handle new FlowNodes wherever you want to put them. This allows users to mix and match various flow solutions, or introduce new flow solutions at new locations. The figure below links to the FlowGraph documentation for further details.
While FlowGraphs may be constructed from scratch, a common use case (demonstrated in a new example notebook,
06_flow_graph_starfit.ipynb) is to add a reservoir representation into an existing FlowGraph which is equivalent to PRMSChannel, using PRMSChannelFlowNode. The STARFIT reservoir representation is implemented as StarfitFlowNode which can be added into the FlowGraph. Other FlowNodes implemented are PassThroughFlowNode and ObsInFlowNode. The second reproduces the "obsin" capabilities present in PRMS. Please see the FlowGraph documentation (linked throughout above) for additional details.
Additional PRMS Functionality
- Subclasses of PRMSRunoff, PRMSSoilzone, and PRMSGroundwater are available
which do not include depression storage: PRMSRunoffNoDprst, PRMSSoilzoneNoDprst, and PRMSGroundwaterNoDprst. - Dunnian flow is implemented in PRMSSoilzone and is 2-way coupled to PRMSRunoff.
- Preferential flow is implemented in PRMSSoilzone.
MmrToMf6Dfw
The MmrToMf6Dfw class builds a MF6 1-D channel (CHF) simulation using diffusive wave (DFW) routing from PRMS NHM input files and a few simple assumptions. The lateral (to-channel) fluxes from a PRMS run are used as time varying boundary conditions. A new example notebook (07_mmr_to_mf6_chf_dfw.ipynb) runs the Delaware River Basin using MF6 CFH-DFW based on PRMS input files.
Breaking Changes
The parameter pref_flow_infil_frac is now a required parameter input for PRMSSoilzone. The NHM values assumed previously are zeros on all HRUs.
Detailed Change Log
For additional details, see the What's New Documentation:
New Features
- The
FlowGraphcapabilities are introduced. These allow users to combine different kinds flow solutions in arbitrary order on a "flow graph". The accompanying base classesFlowNodeandFlowNodeMakerare introduced along with their subclasses for modelingPassThroughFlowNodes,ObsInFlowNodes (flow replacement by observations with sink and source tracking in mass balance),PRMSChannelFlowNodes, andStarfitFlowNodes. A new example notebook, examples/06_flow_graph_starfit.ipynb demonstrates adding STARFIT reservoir nodes into a FlowGraph otherwise simulatingPRMSChanneland highlights helper functions for this use case. - The
MmrToMf6Dfwclass builds a MF6 simulation with Diffusive Wave (DFW) routing from PRMS NHM input files and a few simple assumptions. The lateral (to-channel) fluxes from a PRMS are used as time varying boundary conditions. A new notebook runs the Delaware River Basin using MF6 DFW: examples/07_mmr_to_mf6_chf_dfw.ipynb. - No depression storage subclasses are available for PRMSRunoff, PRMSSoilzone, and PRMSGroundwater by adding "NoDprst" to the end of the names. Depression storage is switched off in sagehen_5yr and in new nhm_no_dprst configurations.
- Dunnian flow is implemented (in PRMSSoilzone) and tested for sagehen_5yr.
- Preferential flow is implemented (in PRMSSoilzone) and tested for sagehen_5yr.
- Control instances have a diff method to compare with other instances.
- Feature to standardize subsetting input data (parameters and forcings) in space and time either from file (
utils.netcdf_utils.subset_netcdf_file) or in memory (utils.netcdf_utils.subset_xr).
Breaking Changes
- pref_flow_infil_frac now a required parameter input for PRMSSoilzone. The NHM values assumed previously are zeros on all HRUs.
Bug fixes
- Fixed calculation of the variable transp_on was incorrectly calculated in certain situations not covered by NHM configuratons but covered by sagehen_5yr.
- Fixed calculation of variable dprst_area_open which was not being checked but was affecting no other variables.
- The variable pptmix was incorrectly calculated in certain situations not covered by the NHM configurations.
Internal changes
- Testing system refactor to handle pairs of domains and control files allowing much more flexibility in configuration/control testing.
- New testing domain "sagehen_5yr" is added to test_data directory with configuration sagehen_no_cascades. This domain introduces multiple PRMS capabilities (noted indvidually in this PR) not used in the NHM configuration and provides a test for these.
- Tests are now marked as "domain" or "domainless" to avoid redundant runs of domainless tests across test domains.
- New tests test_prms_above_snow and test_prms_below_snow replace test_model and are extremely close to PRMS (PRMSSolarGeometry: 1.0e-8, PRMSAtmosphere: 1.0e-5, PRMSCanopy: 1.0e-6, PRMSRunoff: 1.0e-8, PRMSRunoffNoDprst: 1.0e-8, PRMSSoilzone: 1.0e-8, PRMSSoilzoneNoDprst: 1.0e-8, PRMSGroundwater: 1.0e-8, PRMSGroundwaterNoDprst: 1.0e-8, PRMSChannel: 5.0e-7) for all test domains.
- Migration to Numpy 2.0+.
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] over 1 year ago
pywatershed - pywatershed 1.1.0
This release cleans up some minor issues but mainly serves as a pre-release of data to support an upcoming major release.
What's Changed
- data release with minor changes by @jmccreight in https://github.com/EC-USGS/pywatershed/pull/296
- ci(release): remove changelog automation by @wpbonelli in https://github.com/EC-USGS/pywatershed/pull/297
- Release 1.1.0 by @github-actions in https://github.com/EC-USGS/pywatershed/pull/298
- ci(release): remove unnecessary step by @wpbonelli in https://github.com/EC-USGS/pywatershed/pull/299
- Release 1.1.0 by @github-actions in https://github.com/EC-USGS/pywatershed/pull/300
Full Changelog: https://github.com/EC-USGS/pywatershed/compare/1.0.0...1.1.0
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] about 2 years ago
pywatershed - pywatershed 1.0.0
pywatershed version 1.0.0
With pywatershed version 1.0.0, we have faithfully reproduced the Precipitation-Runoff Modeling System (PRMS, Markstrom et al., 2015) process representations used in the USGS National Hydrological Model (NHM, Regan et al., 2018). For more information, see the extended release notes for version 1.0.0.
Links
USGS Homepage... forthcoming
Documentation
Extended release notes
"What's new" changelog
ASV benchmarks
Frozen Conda Environments for Python 3.10 (also in assets)
Windows
MacOS Intel
MacOS Apple Silicon
References
- Markstrom, S. L., Regan, R. S., Hay, L. E., Viger, R. J., Webb, R. M., Payn, R. A., & LaFontaine, J. H. (2015). PRMS-IV, the precipitation-runoff modeling system, version 4 (No. 6-B7). US Geological Survey.
- Regan, R. S., Markstrom, S. L., Hay, L. E., Viger, R. J., Norton, P. A., Driscoll, J. M., & LaFontaine, J. H. (2018). Description of the national hydrologic model for use with the precipitation-runoff modeling system (prms) (No. 6-B9). US Geological Survey.
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] over 2 years ago
pywatershed - pywatershed 0.2.1
- ci: handle empty changelog in release automation
- touch up envs, drop jupyter_contrib_nbextensions
- fix package data installation
- touch up README.md and RELEASE.md
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] almost 3 years ago
pywatershed - pywatershed 0.2.0
Forthcoming: Performance Regression Benchmarks using Airspeed Velocity
Frozen mamba/conda environments:
pws_env_w_jupyter_osx-arm_19_july_2023.txt
pws_env_w_jupyter_osx-intel_19_july_2023.txt
pws_env_w_jupyter_windows64_19_july_2023.txt
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by github-actions[bot] almost 3 years ago
pywatershed - pywatershed version 0.1.1
Initial release of pywatershed
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by jdhughes-usgs about 3 years ago
pywatershed - Introduction to usage
This release release is made to disseminate GIS files not code. The code of this release cant work with these files as their URL is TBD. But subsequent commits to main should handle the release artifacts.
Hydrosphere - Freshwater and Hydrology
- Fortran
Published by jmccreight almost 4 years ago