2023 CSDMS meeting-020

From CSDMS



(if you haven't already)




Log in (or create account for non-CSDMS members)
Forgot username? Search or email:CSDMSweb@colorado.edu


Browse  abstracts


pywatershed: A Python package for developing and prototyping hydrologic process representations


James McCreight, UCAR & USGS Boulder Colorado, United States. jmccreight@usgs.gov
Joseph Hughes, USGS Chicago Illinois, United States. jdhughes@usgs.gov
Christian Langevin, USGS Minneapolis Minnesota, United States. langevin@usgs.gov



The U.S. Geological Survey is tasked with developing sustainable integrated hydrologic models that are interoperable with models from partner agencies and academia.

As a steppingstone towards integrating hydrologic models in a compiled code framework, we have developed a Python package for hydrologic process development and prototyping. This code base, named “pywatershed”, can seamlessly interact with our compiled code framework (MODFLOW 6) via its BMI interface. One can obtain numerically identical results from a model enhancement prototyped in Python or implemented in compiled code.

The advantages of code prototyped in Python are lower cost (person*hours) and greater approachability (less specialized programming knowledge required). The drawback of prototype code is that it may be slower to run for certain applications. A prototyping approach supports proof-of-concept development and model hypothesis testing, particularly for domain experts who may be more comfortable in Python and who bring new approaches or novel data to integrated model applications. The prototyping approach supports a cost-benefit analysis for making decisions to implement certain hydrologic process representations within the compiled code base.

The current state of this evolving Python package will be described, including: 1) the modular, self-describing design based on control volumes and conservation of mass and energy, 2) numerical performance based on the numpy Python package, the numba Python package (just in time compiling), and compiled Fortran modules called from python, 3) goals and challenges of developing flexibility in the space and time representation of hydrologic processes and the management of fluxes and states between process representations, and 4) the current and upcoming set of hydrologic process representations.

Example notebooks will demonstrate many features of pywatershed. Planned developments will be described and community participation is welcomed.