Skip to content

Commit

Permalink
feature: new notebook 01_multi-process_models
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccreight committed Jun 30, 2023
1 parent 0b18d69 commit f53a5a9
Show file tree
Hide file tree
Showing 26 changed files with 232,220 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ examples/0*/
examples/pynhm_gis
examples/pywatershed_gis
examples/model_loop_custom_output
pywatershed/data/pynhm_gis
pywatershed/data/pywatershed_gis

# graphics
*.png
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ repos:
rev: v0.3.8
hooks:
- id: blackdoc
Exclude:
32 changes: 10 additions & 22 deletions examples/00_processes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"metadata": {},
"outputs": [],
"source": [
"# this is equivalent to help() but we get the multiline string\n",
"# 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",
"print(\"\\n\".join(prms_gw_help.splitlines()[0:22])) # the first 22 lines of help"
]
Expand Down Expand Up @@ -133,7 +133,7 @@
"source": [
"# todo: bring data into pywatershed/data\n",
"pws_root = pws.constants.__pywatershed_root__\n",
"domain_dir = pws_root / \"../test_data/drb_2yr\"\n",
"domain_dir = pws_root / \"data/drb_2yr\"\n",
"\n",
"dis_file = domain_dir / \"parameters_dis_hru.nc\"\n",
"assert dis_file.exists()\n",
Expand Down Expand Up @@ -196,9 +196,9 @@
" control=control,\n",
" discretization=dis,\n",
" parameters=params,\n",
" soil_to_gw=domain_dir / \"output/soil_to_gw.nc\",\n",
" ssr_to_gw=domain_dir / \"output/ssr_to_gw.nc\",\n",
" dprst_seep_hru=domain_dir / \"output/dprst_seep_hru.nc\",\n",
" soil_to_gw=domain_dir / \"soil_to_gw.nc\",\n",
" ssr_to_gw=domain_dir / \"ssr_to_gw.nc\",\n",
" dprst_seep_hru=domain_dir / \"dprst_seep_hru.nc\",\n",
" budget_type=\"error\",\n",
" calc_method=\"numpy\",\n",
" verbose=False,\n",
Expand Down Expand Up @@ -313,7 +313,7 @@
"metadata": {},
"outputs": [],
"source": [
"budget_ds = xr.open_dataset('00_processes/PRMSGroundwater_budget.nc')\n",
"budget_ds = xr.open_dataset(\"00_processes/PRMSGroundwater_budget.nc\")\n",
"display(budget_ds)"
]
},
Expand Down Expand Up @@ -398,11 +398,9 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3d8bc392-a1d5-4d09-913d-cc930a00a9ec",
"cell_type": "markdown",
"id": "b4483704-a539-4fed-bb03-5dcbeb42ed86",
"metadata": {},
"outputs": [],
"source": [
"Moreover, all public variables are required to have metadata. Parameters also have metadata"
]
Expand All @@ -418,11 +416,9 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1902614b-5900-411e-85e3-b53f0bb7fc83",
"cell_type": "markdown",
"id": "80858d70-fb6f-4d19-bd58-67a61f99c029",
"metadata": {},
"outputs": [],
"source": [
"When put all these functionalities together, we get the following function:"
]
Expand All @@ -444,14 +440,6 @@
"source": [
"These self-describing capabilities help both the programmer and the code navigate itself when things get more complicated with multiple processes."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3faed369-6d4f-4ccf-9dd7-5a21cd71532d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading

0 comments on commit f53a5a9

Please sign in to comment.