Skip to content

Commit

Permalink
Merge pull request #58 from jdhughes-usgs/pws_deps
Browse files Browse the repository at this point in the history
more pywatershed updates
  • Loading branch information
jmccreight authored Sep 19, 2024
2 parents 10a8e5f + 6baadde commit 1341198
Show file tree
Hide file tree
Showing 12 changed files with 2,036 additions and 624 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,11 @@ jobs:
cache-environment: true
cache-downloads: true

# - name: Install miniconda
# uses: conda-incubator/setup-miniconda@v3
# with:
# python-version: ${{ matrix.python-version }}
# environment-file: "environment-pywatershed.yml"
# activate-environment: "gw3099pws"
# auto-activate-base: false

- name: Install pywatershed
working-directory: exercises/pywatershed
run: |
git clone https://github.com/EC-USGS/pywatershed.git
cd pywatershed
git clone https://github.com/EC-USGS/pywatershed.git pywatershed_repo
cd pywatershed_repo
git checkout feat_gw3099
pip install -e .
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ exercises-completed/gwt/ex*/
exercises-completed/gwe/gwe-ex0-stallman/
exercises-completed/parallel/base/
exercises-completed/parallel/parallel/
exercises/pywatershed/pywatershed/
exercises/pywatershed/pywatershed_repo
exercises/pywatershed/step1_processes/
exercises/pywatershed/step2_multi-process_models/
exercises-completed/pywatershed/step1_processes/
exercises-completed/pywatershed/step2_multi-process_models/
exercises/pywatershed/step3_mf6_api/
exercises/pywatershed/step4_flow_graph/
exercises-working/

# presentations
Expand Down
2 changes: 1 addition & 1 deletion .scripts/test_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
pl.Path("../exercises/modflowapi/").resolve(),
pl.Path("../exercises-completed/modflowapi/").resolve(),
pl.Path("../exercises/parallel/").resolve(),
pl.Path("../exercises-completed/pywatershed/").resolve(),
pl.Path("../exercises/netcdf/").resolve(),
pl.Path("../exercises/PEST/notebooks").resolve(),
pl.Path("../exercises/pywatershed").resolve(),
Expand All @@ -28,6 +27,7 @@
"step0_netcdf_output": ("win32",),
"step1_netcdf_input": ("win32",),
"step2_netcdf_ncf": ("win32",),
"step3_mf6_api": ("win32"),
}

GIT_RESET_DIRS = (
Expand Down
Binary file added exercises/pywatershed/gsflow_schematic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions exercises/pywatershed/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pathlib as pl

from IPython.core.magic import register_cell_magic


@register_cell_magic
def do_not_run_this_cell(line, cell):
return


def read_yaml(yaml_file: pl.Path) -> dict:
import yaml

with pl.Path(yaml_file).open("r") as file_stream:
yaml_dict = yaml.load(file_stream, Loader=yaml.Loader)
return yaml_dict


def write_yaml(yaml_dict: dict, yaml_file: pl.Path):
import yaml

with open(yaml_file, "w") as file:
_ = yaml.dump(yaml_dict, file)
return None


def help_head(what, n=22):
"""Equivalent to help() but we get the multiline string and just look the first n lines."""
import pydoc

the_help = pydoc.render_doc(what, "Help on %s")
print("\n".join(the_help.splitlines()[0:n]))
return
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/pywatershed/sagehen_schematic_pws.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions exercises/pywatershed/step0_intro_to_pywatershed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@
"\n",
"```\n",
"cd <path_to>/GW3099-2024/exercises/pywatershed\n",
"git clone https://github.com/EC-USGS/pywatershed.git\n",
"cd pywatershed\n",
"git clone https://github.com/EC-USGS/pywatershed.git pywatershed_repo\n",
"cd pywatershed_repo\n",
"git checkout feat_gw3099\n",
"pip install -e .\n",
"```\n",
"\n",
"When you see that version 3.0 is available at [https://github.com/EC-USGS/pywatershed/releases](https://github.com/EC-USGS/pywatershed/releases), please delete the repository at `<path_to>/GW3099-2024/exercises/pywatershed/pywatershed` and repeat the above steps but checking out `git checkout v3.0.0` instead of what is listed above. Or, at that time, you can also simply `conda install pywatershed`. \n",
"When you see that version 3.0 is available at [https://github.com/EC-USGS/pywatershed/releases](https://github.com/EC-USGS/pywatershed/releases), please delete the repository at `<path_to>/GW3099-2024/exercises/pywatershed/pywatershed_repo` and repeat the above steps but checking out `git checkout v3.0.0` instead of what is listed above. Or, at that time, you can also simply `conda install pywatershed`. \n",
"\n",
"## Learn more about pywatershed\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"\n",
"![title](../../images/ClassLocation.jpg)\n",
"\n",
"# Physical process models in pywatershed"
"# Physical process models in pywatershed\n",
"*(Note that this notebook follows nearly identically to the notebook in the pywatershed repository [examples/00_processes.ipynb](https://github.com/EC-USGS/pywatershed/blob/develop/examples/00_processes.ipynb))*"
]
},
{
Expand Down Expand Up @@ -61,14 +62,14 @@
"outputs": [],
"source": [
"import pathlib as pl\n",
"import pydoc\n",
"from pprint import pprint\n",
"\n",
"import hvplot.xarray # noqa\n",
"import jupyter_black\n",
"import numpy as np\n",
"import pywatershed as pws\n",
"import xarray as xr\n",
"from helpers import help_head\n",
"from pywatershed.utils import gis_files\n",
"from tqdm.notebook import tqdm\n",
"\n",
Expand Down Expand Up @@ -96,10 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"# this is equivalent to help() but we get the multiline string and just look at part of it\n",
"prms_gw_help = pydoc.render_doc(pws.PRMSGroundwater, \"Help on %s\")\n",
"# the first 22 lines of help(pws.PRMSGroundwater)\n",
"print(\"\\n\".join(prms_gw_help.splitlines()[0:22]))"
"help_head(pws.PRMSGroundwater, n=22)"
]
},
{
Expand Down
Loading

0 comments on commit 1341198

Please sign in to comment.