Skip to content

Commit

Permalink
Add image to all notebooks and add a notebook template (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhughes-usgs authored Aug 29, 2024
1 parent 81726b5 commit 5012b76
Show file tree
Hide file tree
Showing 11 changed files with 307 additions and 80 deletions.
9 changes: 9 additions & 0 deletions .scripts/fix_format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import subprocess

cmd = ("ruff", "format", "../")
proc = subprocess.run(cmd)
assert proc.returncode == 0, f"Error running command: {' '.join(cmd)}"

cmd = ("ruff", "check", "../", "--fix")
proc = subprocess.run(cmd)
assert proc.returncode == 0, f"Error running command: {' '.join(cmd)}"
43 changes: 26 additions & 17 deletions base/watershed/build_base_watershed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Build the watershed model"
"# U.S. Geological Survey Class GW3099\n",
"Advanced Modeling of Groundwater Flow (GW3099)\\\n",
"Boise, Idaho\\\n",
"September 16 - 20, 2024\n",
"\n",
"![title](../../images/ClassLocation.jpg)\n",
"\n",
"## Build the watershed model"
]
},
{
Expand Down Expand Up @@ -66,7 +73,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load the topology"
"### Develop the data for the watershed model\n",
"\n",
"#### Load the topology"
]
},
{
Expand Down Expand Up @@ -94,7 +103,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Structured grid parameters"
"#### Structured grid parameters"
]
},
{
Expand All @@ -119,7 +128,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Read in boundary data\n",
"#### Read in boundary data\n",
"\n",
"Load the boundary data from `defaults.py` and plot"
]
Expand Down Expand Up @@ -158,7 +167,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create a structured grid"
"#### Create a structured grid"
]
},
{
Expand All @@ -185,7 +194,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Sample the raw topographic data"
"#### Sample the raw topographic data"
]
},
{
Expand All @@ -206,7 +215,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Intersect river segments with grid"
"#### Intersect river segments with grid"
]
},
{
Expand All @@ -222,7 +231,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Plot the river intersection"
"#### Plot the river intersection"
]
},
{
Expand Down Expand Up @@ -267,7 +276,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Set the idomain value to 2 where the river intersects the grid"
"#### Set the idomain value to 2 where the river intersects the grid"
]
},
{
Expand All @@ -288,7 +297,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Define the number of layers and the thickness of layer 1"
"#### Define the number of layers and the thickness of layer 1"
]
},
{
Expand All @@ -305,7 +314,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create the drain data for the river segments"
"#### Create the drain data for the river segments"
]
},
{
Expand All @@ -329,7 +338,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create the groundwater discharge drain data"
"#### Create the groundwater discharge drain data"
]
},
{
Expand All @@ -350,7 +359,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create the top and bottom arrays.\n",
"#### Create the top and bottom arrays.\n",
"\n",
"Top array is not used by the model."
]
Expand Down Expand Up @@ -393,7 +402,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create idomain and starting head data"
"#### Create idomain and starting head data"
]
},
{
Expand All @@ -410,7 +419,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Build the model files using FloPy\n",
"### Build the model files using FloPy\n",
"Note that the CSV solver output is enabled. We will use that in one of the other notebooks."
]
},
Expand Down Expand Up @@ -502,7 +511,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Count the number of active cells"
"#### Count the number of active cells"
]
},
{
Expand All @@ -519,7 +528,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Write the model files"
"#### Write the model files"
]
},
{
Expand Down
20 changes: 17 additions & 3 deletions exercises-completed/flopy/flopy_getting_started.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# U.S. Geological Survey Class GW3099\n",
"Advanced Modeling of Groundwater Flow (GW3099)\\\n",
"Boise, Idaho\\\n",
"September 16 - 20, 2024\n",
"\n",
"![title](../../images/ClassLocation.jpg)\n",
"\n",
"## Building and post-processing a MODFLOW 6 model"
]
},
{
"attachments": {
"ex01a.png": {
Expand All @@ -16,8 +30,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Building and post-processing a MODFLOW 6 model\n",
"\n",
"A MODFLOW 6 model will be developed of the domain shown above. This model simulation is based on example 1 in [Pollock, D.W., 2016, User guide for MODPATH Version 7—A particle-tracking model for MODFLOW: U.S. Geological Survey Open-File Report 2016–1086, 35 p., http://dx.doi.org/10.3133/ofr20161086](https://doi.org/10.3133/ofr20161086).\n",
"\n",
"The model domain will be discretized into 3 layers, 21 rows, and 20 columns. A constant value of 500 ft will be specified for `delr` and `delc`. The top (`TOP`) of the model should be set to 400 ft and the bottom of the three layers (`BOTM`) should be set to 220 ft, 200 ft, and 0 ft, respectively. The model has one steady-state stress period. \n",
Expand Down Expand Up @@ -112,6 +124,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Build the model\n",
"\n",
"Create a simulation object, a temporal discretization object, and a iterative model solution object using `flopy.mf6.MFSimulation()`, `flopy.mf6.ModflowTdis()`, and `flopy.mf6.ModflowIms()`, respectively. Set the `sim_name` to `name` and `sim_ws` to `ws` in the simulation object. Use default values for all temporal discretization and iterative model solution variables. Make sure to include the simulation object (`sim`) as the first variable in the temporal discretization and iterative model solution objects."
]
},
Expand Down Expand Up @@ -440,7 +454,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Post-process the results\n",
"### Post-process the results\n",
"\n",
"Load the heads and face flows from the hds and cbc files. The head file can be loaded with the `gwf.output.head()` method. The cell-by-cell file can be loaded with the `gwf.output.budget()` method. \n",
"\n",
Expand Down
12 changes: 12 additions & 0 deletions exercises-completed/gwt/ex1.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# U.S. Geological Survey Class GW3099\n",
"Advanced Modeling of Groundwater Flow (GW3099)\\\n",
"Boise, Idaho\\\n",
"September 16 - 20, 2024\n",
"\n",
"![title](../../images/ClassLocation.jpg)"
]
},
{
"attachments": {
"image.png": {
Expand Down
41 changes: 23 additions & 18 deletions exercises-completed/netcdf/step0_netcdf_output.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "eb8afb07-3737-4c0d-9c58-528be7dcbade",
"metadata": {},
"source": [
"# U.S. Geological Survey Class GW3099\n",
"Advanced Modeling of Groundwater Flow (GW3099)\\\n",
"Boise, Idaho\\\n",
"September 16 - 20, 2024\n",
"\n",
"![title](../../images/ClassLocation.jpg)\n",
"\n",
"# NetCDF Output"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -20,7 +35,7 @@
"id": "da70620c-e003-40cd-8d78-7c70eb83dc3e",
"metadata": {},
"source": [
"# Load the base watershed model\n",
"## Load the base watershed model\n",
"\n",
"We will use the base watershed model to demonstrate MODFLOW NetCDF output functionality. "
]
Expand All @@ -38,22 +53,12 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "053b01cc-1e53-435f-9b0a-3fc30abd7874",
"metadata": {},
"outputs": [],
"source": [
"!which mf6"
]
},
{
"cell_type": "markdown",
"id": "9fc6cdca-3668-4bd8-a901-91a3651a94c2",
"metadata": {},
"source": [
"# Modify the model to save NetCDF output\n",
"## Modify the model to save structured NetCDF output\n",
"\n",
"We need to set the `start_date_time` variable in the TDIS file and define the `export_netcdf` variable in the groundwater flow model `name_file`. We will create `structured` NetCDF output first. "
]
Expand Down Expand Up @@ -84,7 +89,7 @@
"id": "69932909-d442-411c-a9ab-c2795038ccb4",
"metadata": {},
"source": [
"# Change the simulation workspace, write the model files, and run the model"
"### Change the simulation workspace, write the model files, and run the model"
]
},
{
Expand Down Expand Up @@ -123,7 +128,7 @@
"id": "82c2eba0-5d6b-49b4-9f10-51e140529b58",
"metadata": {},
"source": [
"# Load the structured NetCDF file with `xarray` and plot the results"
"### Load the structured NetCDF file with `xarray` and plot the results"
]
},
{
Expand Down Expand Up @@ -173,7 +178,7 @@
"id": "d74dcd66-4763-43c2-a1ec-700cc1ecd71b",
"metadata": {},
"source": [
"# Modify the model to save mesh NetCDF output\n",
"## Modify the model to save mesh NetCDF output\n",
"\n",
"We need modufy the `export_netcdf` variable in the groundwater flow model `name_file` to `ugrid` to create mesh NetCDF output."
]
Expand All @@ -193,7 +198,7 @@
"id": "334eb752-77a6-4bf7-b877-772aa19b1f54",
"metadata": {},
"source": [
"# Change the simulation workspace, write the model files, and run the model"
"### Change the simulation workspace, write the model files, and run the model"
]
},
{
Expand Down Expand Up @@ -232,7 +237,7 @@
"id": "ad61cea1-384a-4245-9cbd-3b66b8c7cae9",
"metadata": {},
"source": [
"# Load the mesh NetCDF file with `xugrid` and plot the results"
"### Load the mesh NetCDF file with `xugrid` and plot the results"
]
},
{
Expand Down Expand Up @@ -272,7 +277,7 @@
"id": "c01f168d-5019-4c49-b30b-76fc3e4343a3",
"metadata": {},
"source": [
"# Create cross-sections using `xugrid`\n",
"### Create cross-sections using `xugrid`\n",
"\n",
"First, we will create a cross-section along a column (y-direction)."
]
Expand Down
Loading

0 comments on commit 5012b76

Please sign in to comment.