Skip to content

Commit 351981d

Browse files
authored
Merge pull request #223 from jmccreight/bugfix_v0.2.1
polishes
2 parents e808451 + b949be6 commit 351981d

File tree

4 files changed

+100
-57
lines changed

4 files changed

+100
-57
lines changed

.github/RELEASE.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,21 @@ To release a new version:
4747
remote: `git push -u upstream vx.y.z`. This starts a job to:
4848

4949
- Check out the release branch Update version number in `version.txt` and
50-
- `pywatershed/version.py` to match the version in the branch name Build and
51-
- check the Python package Generate a changelog since the last release
52-
- Prepend the changelog to the cumulative `HISTORY.md` Upload the package
53-
- and changelog as artifacts Draft a PR against `main` with the updated
54-
- version files and cumulative changelog. The cumulative `HISTORY.md` is
55-
- version-controlled, release changelogs are not.
50+
`pywatershed/version.py` to match the version in the branch name
51+
- Build and check the Python package Generate a changelog since the last
52+
release
53+
- Prepend the changelog to the cumulative `HISTORY.md`. The cumulative
54+
`HISTORY.md` is version-controlled, release changelogs are not.
55+
- Upload the package and changelog as artifacts Draft a PR against `main`
56+
with the updated version files and cumulative changelog.
5657

5758
1. On all platforms, pull the release from upstream and perform ASV performance
58-
benchmarks against previous release , e.g., ``` asv continuous --verbose
59-
--show-stderr --factor 1.3 previous_release this_release ``` Collect
60-
performance reports from various machines into a single report and use `asv
61-
publish` to generate the static webpages to be included with the release as
62-
artifacts in that step below.
59+
benchmarks against previous release , e.g., ```asv run --verbose
60+
--show-stderr HASHFILE:pws_refs_for_asv.txt``` after editing the file to
61+
contain the previous and current release. Collect performance results from
62+
various machines into a single report and use `asv publish` to generate
63+
the static webpages to be included with the release as artifacts in that
64+
step below.
6365

6466
1. Inspect the package and changelog. If they look good, merge the PR to `main`.
6567

README.md

Lines changed: 67 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,56 +38,80 @@ The following motivations are taken from our [AGU poster from December
3838
which provides additional details on motivations, project status, and current
3939
directions of this project as of approximately January 2023.
4040

41-
Goals of the USGS Enterprise Capacity (EC) project include: * A sustainable
42-
integrated, hydrologic modeling framework for the U.S. Geological Survey (USGS)
43-
* Interoperable modeling across the USGS, partner agencies, and academia
44-
45-
Goals for EC Watershed Modeling: * Couple the Precipitation-Runoff Modeling
46-
System (PRMS, e.g. Regan et al, 2018)  with MODFLOW 6 (MF6, e.g. Langevin et al,
47-
2017) in a sustainable way * Redesign PRMS to be more modern and flexible *
48-
Prioritize process representations in the current National Hydrological Model
49-
(NHM) based on PRMS 5.2.1
50-
51-
Prototype an EC watershed model: "pywatershed" * Redesign PRMS quickly in python
52-
* Couple to MF6 via BMI/XMI interface (Hughes et al, 2021; Hutton et al, 2020) *
53-
Establish a prototyping ground for EC codes that couples to the compiled
54-
framework: low cost proof of concepts (at the price of potentially less
55-
computational performance) * Enable process representation hypothesis testing *
56-
Use cutting-edge techniques and technologies to improve models * Machine
57-
learning, automatic differentiation * Address challenges of modeling across
58-
space and time scales * Transition prototype watershed model to compiled EC code
41+
Goals of the USGS Enterprise Capacity (EC) project include:
5942

60-
## Installation
43+
* A sustainable integrated, hydrologic modeling framework for the U.S.
44+
Geological Survey (USGS)
45+
* Interoperable modeling across the USGS, partner agencies, and academia
46+
47+
Goals for EC Watershed Modeling:
6148

62-
To install the software you will need Python 3.9 or 3.10.
49+
* Couple the Precipitation-Runoff Modeling System (PRMS, e.g. Regan et al,
50+
2018)  with MODFLOW 6 (MF6, e.g. Langevin et al, 2017) in a sustainable
51+
way
52+
* Redesign PRMS to be more modern and flexible
53+
* Prioritize process representations in the current National Hydrological
54+
Model (NHM) based on PRMS 5.2.1
6355

64-
We currently recommend dependencies be installed with
65-
[Mamba](https://mamba.readthedocs.io/en/latest/) which will be much faster than
66-
Ananconda (but the conda command can also be used). An environment containing
67-
all core and optional dependencies can be created from the project root with:
56+
Prototype an EC watershed model: "pywatershed"
6857

69-
```mamba env create -f environment_w_jupyter.yml```
58+
* Redesign PRMS quickly in python
59+
* Couple to MF6 via BMI/XMI interface (Hughes et al, 2021; Hutton et al, 2020)
60+
* Establish a prototyping ground for EC codes that couples to the compiled
61+
framework: low cost proof of concepts (at the price of potentially less
62+
computational performance) * Enable process representation hypothesis testing
63+
* Use cutting-edge techniques and technologies to improve models
64+
* Machine learning, automatic differentiation
65+
* Address challenges of modeling across space and time scales
66+
* Transition prototype watershed model to compiled EC code
7067

71-
(The environment `environment.yml` does not contain jupyter or jupyterlab
72-
in order to not interfere with installation in WholeTale, see Example
73-
Notebooks seection below.)
68+
69+
## Installation
70+
71+
`pywatershed` uses Python 3.9 or 3.10.
7472

7573
The `pywatershed` package is [available on
76-
PyPI](https://pypi.org/project/pywatershed/). At the moment, the installation
77-
may not be reliable on all platforms and we are working to fix this.
74+
PyPI](https://pypi.org/project/pywatershed/) but installation of dependencies
75+
may not be reliable on all platforms.
7876

79-
Using PyPI (with the above caveat), `pywatershed` can be installed with:
77+
We recommend dependencies be first installed with
78+
[Mamba](https://mamba.readthedocs.io/en/latest/). This will be much faster than
79+
Ananconda (but the conda command could also be used). We hope to provide
80+
`pywatershed` installation with all its dependencies on conda-forge in the
81+
near future.
8082

81-
``` pip install pywatershed ```
83+
If you wish to use the stable release, you will use `main` in place of
84+
`<branch>` in the following commands. If you want to follow developemnt, you'll
85+
use `develop` instead.
8286

83-
A number of extra dependencies are needed to run the example notebooks. These
84-
can be installed with pip with
87+
Without using `git` (directly), you may:
88+
```
89+
curl -L -O https://raw.githubusercontent.com/EC-USGS/pywatershed/<branch>/environment_w_jupyter.yml
90+
mamba env create -f environment_w_jupyter.yml
91+
conda activate pws
92+
pip install git+https://github.com/EC-USGS/pywatershed.git@<branch>
93+
```
8594

86-
``` pip install "pywatershed[optional]" ```
95+
Or to use `git` and to be able to develop:
8796

88-
These installation steps are suitable for `pywatershed` end users. See the
89-
[developer documentation](./DEVELOPER.md) for detailed instructions on
90-
configuring a development environment.
97+
```
98+
git clone https://github.com/EC-USGS/pywatershed.git
99+
cd pywatershed
100+
mamba env create -f environment_w_jupyter.yml
101+
activate pws
102+
pip install -e .
103+
```
104+
105+
(If you want to name the environment other than the default `pws`, use the
106+
command
107+
`mamba env update --name your_env_name --file environment_w_jupyter.yml --prune`
108+
you will also need to activate this environment by name.)
109+
110+
111+
We install the `environment_w_jupyter.yml` to provide all known dependencies
112+
including those for running the eample notebooks. (The `environment.yml`
113+
does not contain jupyter or jupyterlab because this interferes with installation
114+
on WholeTale, see Example Notebooks seection below.)
91115

92116
## Contributing
93117

@@ -116,10 +140,11 @@ to register.
116140
There are containers for both the `main` and `develop` branches.
117141

118142
[![WholeTale](https://raw.githubusercontent.com/whole-tale/wt-design-docs/master/badges/wholetale-explore.svg)](https://dashboard.wholetale.org)
119-
* [WholeTale container for latest release (main
120-
branch)](https://dashboard.wholetale.org/run/64ae29e8a887f48b9f173678?tab=metadata)
121-
* [WholeTale container for develop
122-
branch](https://dashboard.wholetale.org/run/64ae25c3a887f48b9f1735c8?tab=metadata)
143+
144+
* [WholeTale container for latest release (main
145+
branch)](https://dashboard.wholetale.org/run/64ae29e8a887f48b9f173678?tab=metadata)
146+
* [WholeTale container for develop
147+
branch](https://dashboard.wholetale.org/run/64ae25c3a887f48b9f1735c8?tab=metadata)
123148

124149
WholeTale will give you a jupyter-lab running in the root of this
125150
repository. You can navigate to `examples/` and then open and run the notebooks

asv_benchmarks/benchmarks/prms.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ def setup(self, *args):
8585
else:
8686
self.params = pws.PrmsParameters.load(self.parameter_file)
8787

88-
# backwards compatability
88+
# backwards compatability pre 0.2.0
8989
try:
90+
self.ge_v0_2_0 = False
9091
self.control = pws.Control.load(
9192
self.control_file, params=self.params
9293
)
93-
self.ge_v0_2_0 = False
9494
except:
95-
self.control = pws.Control.load(self.control_file)
9695
self.ge_v0_2_0 = True
9796

98-
self.control.edit_n_time_steps(n_time_steps)
97+
if hasattr(self, "control"):
98+
del self.control
9999

100100
# setup input_dir with symlinked prms inputs and outputs
101101
self.domain_dir = pl.Path(f"PRMSModels_{self.domain}")
@@ -119,17 +119,28 @@ def model_setup_run(
119119
processes: tuple = None,
120120
write_output: Union[bool, Literal["separate", "together"]] = None,
121121
):
122+
# seem to need to load control inside the model setup run bc
123+
# results are strange/inconsistent
124+
122125
if self.ge_v0_2_0:
126+
self.control = pws.Control.load(self.control_file)
123127
self.control.options["input_dir"] = self.tag_input_dir
124128
self.control.options["budget_type"] = "warn"
125129
self.control.options["calc_method"] = "numba"
130+
self.control.edit_n_time_steps(n_time_steps)
126131

127132
model = pws.Model(
128133
self.processes,
129134
control=self.control,
130135
parameters=self.params,
131136
)
137+
132138
else:
139+
self.control = pws.Control.load(
140+
self.control_file, params=self.params
141+
)
142+
self.control.edit_n_time_steps(n_time_steps)
143+
133144
model = pws.Model(
134145
*self.processes,
135146
control=self.control,
@@ -143,6 +154,8 @@ def model_setup_run(
143154
self.tag_dir, separate_files=(write_output == "separate")
144155
)
145156
model.run(finalize=True)
157+
del model
158+
del self.control
146159

147160
@parameterized(
148161
["domain", "processes", "output"],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
0.1.1
2+
0.2.0
3+

0 commit comments

Comments
 (0)