Skip to content

Commit

Permalink
final update of notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccreight committed Nov 11, 2024
1 parent f5a0b23 commit 593f7b6
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 111 deletions.
9 changes: 6 additions & 3 deletions autotest/test_starfit_flow_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
from pywatershed.parameters import Parameters, StarfitParameters

# NB:
# Here we are comparing a daily starfit against an hourly StarfitNode.
# Here we are comparing a daily offline starfit against an hourly
# StarfitNode. The reference output is the mean value from offline runs run
# from 1995-2001 in the file
# ../test_data/starfit/starfit_mean_output_1995-2001.nc
# We only advance the hourly StarfitNode one substepper day. It's
# resulting flow rates are identical but the change in storage is 1/24
# of the daily value, so we check this. We have to track previous storage
Expand All @@ -29,12 +32,12 @@
# & (parameters_ds.end_time >= np.datetime64("2001-12-31 00:00:00"))
# fmt: off
starfit_inds_test = [
0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13,
0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13,
15, 16, 18, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30,
31, 32, 33, 36, 37, 38, 40, 43, 44, 47, 48, 49, 51,
52, 53, 55, 56, 59, 62, 63, 64, 65, 67, 68, 69, 70,
71, 72, 74, 75, 76, 77, 86, 87, 89, 90, 91, 92, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
107, 108, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
122, 123, 130, 134, 137, 139, 140, 141, 145, 148, 149, 152, 154,
155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166
Expand Down
4 changes: 3 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ New Features
(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/mmr_to_mf6_dfw.ipynb <https://github.com/EC-USGS/pywatershed/blob/develop/examples/mmr_to_mf6_dfw.ipynb>`__.
`examples/07_mmr_to_mf6_chf_dfw.ipynb <https://github.com/EC-USGS/pywatershed/blob/develop/examples/07_mmr_to_mf6_chf_dfw.ipynb>`__.
(:pull:`290`) By `James McCreight <https://github.com/jmccreight>`_.
- The depression storage option for PRMSRunoff is implemented and tested.
(:pull:`279`) By `James McCreight <https://github.com/jmccreight>`_.
Expand Down Expand Up @@ -96,6 +96,8 @@ Internal changes
PRMSGroundwater: 1.0e-8, PRMSGroundwaterNoDprst: 1.0e-8, PRMSChannel: 5.0e-7)
for all test domains.
(:pull:`288`) By `James McCreight <https://github.com/jmccreight>`_.
- Migration to Numpy 2.0+.
(:pull:`310`) By `James McCreight <https://github.com/jmccreight>`_.


.. _whats-new.1.1.0:
Expand Down
4 changes: 3 additions & 1 deletion examples/02_prms_legacy_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@
"metadata": {},
"outputs": [],
"source": [
"control = pws.Control.load_prms(domain_dir / \"nhm.control\", warn_unused_options=False)\n",
"control = pws.Control.load_prms(\n",
" domain_dir / \"nhm.control\", warn_unused_options=False\n",
")\n",
"\n",
"control"
]
Expand Down
202 changes: 99 additions & 103 deletions examples/06_flow_graph_starfit.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/model_loop_custom_output.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@
" \n",
" proc = model.processes[var_proc[var]]\n",
" dim_name = needed_metadata[var][\"dims\"][0]\n",
" dim_len = proc.params.dims[dim_name]\n",
" dim_len = proc._params.dims[dim_name]\n",
" coord_name = dim_coord[dim_name]\n",
" coord_data = proc.params.coords[dim_coord[dim_name]]\n",
" coord_data = proc._params.coords[dim_coord[dim_name]]\n",
" type = needed_metadata[var][\"type\"]\n",
" \n",
" var_meta = {\n",
Expand Down
2 changes: 1 addition & 1 deletion pywatershed/analysis/process_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
# if (self.__seg_poly.crs.name
# == "USA_Contiguous_Albers_Equal_Area_Conic_USGS_version"):
# print("Overriding USGS aea crs with EPSG:5070")
self.seg_gdf.crs = "EPSG:5070"
self.seg_gdf.set_crs("EPSG:5070")

self.seg_geoms_exploded = (
self.seg_gdf.explode(index_parts=True)
Expand Down
6 changes: 6 additions & 0 deletions pywatershed/hydrology/starfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ class StarfitFlowNode(FlowNode):
computed in a :class:`FlowGraph`. The solution has the option for
subtimestep or daily computations.
Daily computations have the same outflows on the substeps of a day and
outflows and storages are calculated on the last subtimestep. On the first
subtimestep, we use the inflow of the first subtimestep as representative
of the mean inflow of the previous day in order to calculate an average
outflow for the first timestep.
The STARFIT reference:
Sean W.D. Turner, Jennie Clarice Steyaert, Laura Condon, Nathalie Voisin,
Expand Down

0 comments on commit 593f7b6

Please sign in to comment.