Skip to content

Commit

Permalink
update notebook 06; add notebook 07
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccreight committed Oct 17, 2024
1 parent 9a63115 commit eed30d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions examples/06_flow_graph_starfit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@
" .rename(\"modeled\")\n",
" .to_dataframe()[\"modeled\"]\n",
")\n",
"obs_all = pyPRMS.Streamflow(domain_dir / \"sf_data\")\n",
"obs_all = pyPRMS.DataFile(domain_dir / \"sf_data\").data_by_variable(\"runoff\")\n",
"wh_poi_obs = np.where(params.parameters[\"poi_gage_segment\"] == 184)\n",
"gage_id = params.parameters[\"poi_gage_id\"][wh_poi_obs][0]\n",
"obs = obs_all.data[gage_id]\n",
"obs = obs_all[f\"runoff_{gage_id}\"]\n",
"obs.rename(\"gage \" + obs.name, inplace=True)\n",
"\n",
"outflow_obs.hvplot() * obs[0 : (365 * 2)].hvplot()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"source": [
"# MMR To MF6 DFW\n",
"\n",
"This notebook performs MF6 diffussive wave routing (DFW) simulaton based on PRMS MMR (Muskingum-Mann Routing) inputs and boundary flows from the PRMS model. We'll compare and contrast the MF6 DFW and PRMS MMR simulations and delve into their differences at the largest gaged flows in the domain (that are not affected by tides). \n",
"This notebook performs 1-D diffussive wave (DFW) routing in MODFLOW 6 using the CHF (channel flow) model. The static and time-varying boundary conditions, come from PRMS. Specifically, PRMS's MMR (Muskingum-Mann Routing) parameters and its channel inflows calculated during a pywatershed run. We'll compare and contrast the MF6 CHF-DFW and PRMS MMR simulations and delve into their differences at the largest gaged flows in the domain (that are not affected by tides). \n",
"\n",
"This notebook requries the develop branch of MF6 and a flopy upto date with this branch by running `python update_flopy.py` in modflow6/autotest. You will also need to add the MF6 executable to your path below. You will also need to have run \n",
"This notebook requries the develop branch of MF6 and a flopy upto date with this branch by running `python update_flopy.py` in modflow6/autotest. You will also need to add the MF6 executable to your path below. \n",
"\n",
"## User configuration"
]
Expand All @@ -21,16 +21,20 @@
"metadata": {},
"outputs": [],
"source": [
"# Set YOUR path to MF6 here\n",
"# Set YOUR path to MF6 in this block\n",
"import pathlib as pl\n",
"\n",
"mf6_bin = pl.Path(\"../../modflow6/bin/mf6\")\n",
"# double check\n",
"msg = \"A build of mf6/develop branch required for DFW simulation\"\n",
"assert mf6_bin.exists, msg\n",
"\n",
"# Rerun MF6 model below or use an existing run?\n",
"rerun_mf6 = True\n",
"rerun_prms = True"
"rerun_prms = True\n",
"\n",
"# Perform the full, 2 year run period or just the first 45 days?\n",
"full_run_period = False"
]
},
{
Expand Down Expand Up @@ -96,7 +100,7 @@
"id": "e6a36353-3a61-4b57-8db5-e48293ffc0d1",
"metadata": {},
"source": [
"## Run PRMS\n",
"## Run PRMS NHM configuration using pywatershed\n",
"Running PRMS gives the boundary conditions for the MF6 DFW run and it also produces its own streamflow simulation with its Muskingum-Mann routing method. "
]
},
Expand All @@ -107,11 +111,9 @@
"metadata": {},
"outputs": [],
"source": [
"%time\n",
"\n",
"prms_run_dir = repo_root_dir / \"examples/mmr_to_mf6_dfw/prms_run\"\n",
"prms_run_dir = repo_root_dir / \"examples/07_mmr_to_mf6_chf_dfw/prms_run\"\n",
"\n",
"if rerun_prms:\n",
"if rerun_prms and prms_run_dir.exists():\n",
" shutil.rmtree(prms_run_dir)\n",
"\n",
"if not prms_run_dir.exists():\n",
Expand Down Expand Up @@ -186,12 +188,10 @@
"control_file = domain_dir / \"nhm.control\"\n",
"control = pws.Control.load_prms(control_file)\n",
"ndays_run = control.n_times\n",
"# Could shorten the run duration\n",
"# Subtract one from ndays_run becase end day/time would be included in the PRMS run\n",
"# ndays_run = 45\n",
"# control.edit_end_time(\n",
"# control.start_time + ((ndays_run - 1) * control.time_step)\n",
"# )"
"\n",
"if not full_run_period:\n",
" ndays_run = 45\n",
" control.edit_n_time_steps(ndays_run)"
]
},
{
Expand Down Expand Up @@ -482,7 +482,10 @@
"metadata": {},
"outputs": [],
"source": [
"tt = 3000\n",
"if ndays_run < 3000:\n",
" tt = ndays_run\n",
"else:\n",
" tt = 3000\n",
"zoom = 1.0\n",
"figsize = (7 * zoom, 10 * zoom)\n",
"dt = tdis_perlen / tdis_nstp\n",
Expand Down

0 comments on commit eed30d3

Please sign in to comment.