Skip to content

Commit

Permalink
Merge pull request #128 from aleaf/main
Browse files Browse the repository at this point in the history
Peer review revisions; fix some markdown headers for the doc menus; clear output in all notebooks except 10: MODPATH
  • Loading branch information
mnfienen authored Mar 18, 2024
2 parents 79537e6 + d364b6d commit f658558
Show file tree
Hide file tree
Showing 21 changed files with 1,007 additions and 288,931 deletions.
4 changes: 3 additions & 1 deletion docs/docs-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ dependencies:
- geos
- geojson
- geopandas
- vtk
- xarray
- rioxarray
- uxarray
- pyyaml
- rtree
- pyvista
- vtk
- imageio
- requests
- pytest
- statsmodels
Expand Down
7 changes: 5 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,19 @@
source_path / 'part0_python_intro/solutions/07a_Theis-exercise-solution.ipynb',
source_path / 'part0_python_intro/07b_VSCode.md',
source_path / 'part0_python_intro/solutions/08_pandas.ipynb',
source_path / 'part0_python_intro/data/pandas',
source_path / 'part0_python_intro/data/',
source_path / 'part0_python_intro/09_Geopandas.ipynb',
source_path / 'part0_python_intro/data/geopandas',
source_path / 'part0_python_intro/solutions/09_Geopandas__solutions.ipynb',
source_path / 'part0_python_intro/10_Rasterio.ipynb',
source_path / 'part0_python_intro/11_xarray_mt_rainier_precip.ipynb',
source_path / 'part1_flopy/solutions/02-Building-Post-Processing-MODFLOW6__solutions.ipynb',
source_path / 'part1_flopy/data/',
source_path / 'part1_flopy/data_project/',
source_path / 'part1_flopy/solutions/03_Loading_and_visualizing_models-solutions.ipynb',
source_path / 'part1_flopy/solutions/04_Modelgrid_and_intersection_solution.ipynb',
source_path / 'part1_flopy/05-unstructured-grids.ipynb',
source_path / 'part1_flopy/basin.py',
source_path / 'part1_flopy/solutions/06-Project-quadtree.ipynb',
source_path / 'part1_flopy/solutions/06-Project-structured_completed.ipynb',
source_path / 'part1_flopy/solutions/06-Project-voronoi.ipynb',
Expand All @@ -292,7 +295,7 @@
dest_f = dest_path / f.relative_to(source_path)
dest_f.parent.mkdir(exist_ok=True, parents=True)
if f.is_dir():
shutil.copytree(f, dest_f)
shutil.copytree(f, dest_f, dirs_exist_ok=True)
else:
shutil.copy(f, dest_f)
print(f"copied {f} to {dest_f}")
Expand Down
2 changes: 0 additions & 2 deletions installation/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies:
- geos
- geojson
- geopandas
- vtk
- xarray
- rioxarray
- uxarray
Expand All @@ -46,6 +45,5 @@ dependencies:
- flopy
- gis-utils
- sfrmaker
- imageio
- modflow-export
- modflow-setup
14 changes: 7 additions & 7 deletions notebooks/clear_all_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
# all solutions are still not being cleared

skip_notebooks = [
'10_Rasterio.ipynb',
'11_xarray_mt_rainier_precip.ipynb',
'09_Geopandas_ABQ.ipynb',
#'10_Rasterio.ipynb',
#'11_xarray_mt_rainier_precip.ipynb',
#'09_Geopandas_ABQ.ipynb',
#'03_Loading_and_visualizing_models-solutions.ipynb',
'05-unstructured-grids.ipynb',
'07-stream_capture_voronoi.ipynb',
'08_Modflow-setup-demo.ipynb',
'09-gwt-voronoi-demo.ipynb',
#'05-unstructured-grids.ipynb',
#'07-stream_capture_voronoi.ipynb',
#'08_Modflow-setup-demo.ipynb',
#'09-gwt-voronoi-demo.ipynb',
'10_modpath-demo.ipynb'
]

Expand Down
74 changes: 65 additions & 9 deletions notebooks/part0_python_intro/03_useful-std-library-modules.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
"\n",
"\n",
"#### Topics covered:\n",
"* **``pathlib``**:\n",
"* **pathlib**:\n",
" * listing files\n",
" * creating, moving and deleting files\n",
" * absolute vs relative paths\n",
" * useful path object attributes\n",
"* **``shutil``**: \n",
"* **shutil**: \n",
" * copying, moving and deleting files AND folders\n",
"* **``sys``**: \n",
"* **sys**: \n",
" * python and platform information\n",
" * command line arguments\n",
" * modifying the python path to import code from other locations\n",
"* **``os``**:\n",
"* **os**:\n",
" * changing the working directory\n",
" * recursive iteration through folder structures\n",
" * accessing environmental variables\n",
"* **``subprocess``**: \n",
"* **subprocess**: \n",
" * running system commands and checking the results\n",
"* **``zipfile``**:\n",
"* **zipfile**:\n",
" * creating and extracting from zip archives"
]
},
Expand Down Expand Up @@ -528,7 +528,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Delete the file"
"Move the file"
]
},
{
Expand All @@ -537,7 +537,8 @@
"metadata": {},
"outputs": [],
"source": [
"fname.unlink()"
"fname2 = Path('new_file2.txt')\n",
"fname.rename(fname2)"
]
},
{
Expand All @@ -549,6 +550,31 @@
"fname.exists()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Delete the file"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fname2.unlink()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fname2.exists()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -920,6 +946,22 @@
"print(subprocess.run(['ls', '-l'], shell=True))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the `cwd` argument, we can control the working directory for the command. Here we list the files in the parent directory."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(subprocess.run(['ls', '-l'], shell=True, cwd='..'))"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1206,8 +1248,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "pyclass",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
1,182 changes: 27 additions & 1,155 deletions notebooks/part0_python_intro/09_Geopandas_ABQ.ipynb

Large diffs are not rendered by default.

1,590 changes: 73 additions & 1,517 deletions notebooks/part0_python_intro/10_Rasterio.ipynb

Large diffs are not rendered by default.

5,569 changes: 188 additions & 5,381 deletions notebooks/part0_python_intro/11_xarray_mt_rainier_precip.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 03: Solutions to Useful standard library modules exercises"
"# 03: Solutions to Useful standard library modules exercises"
]
},
{
Expand Down
127 changes: 17 additions & 110 deletions notebooks/part0_python_intro/solutions/07a_Theis-exercise-solution.ipynb

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions notebooks/part1_flopy/02-Building-Post-Processing-MODFLOW6.ipynb
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import flopy\n",
"from flopy.plot import styles"
]
},
{
"attachments": {
"ex01a.png": {
Expand All @@ -28,12 +16,29 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Building and post-processing a MODFLOW 6 model\n",
"# 02: 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. will `delr` and `delc`. The top of the model should be set to 400 and the bottom of the three layers should be set to 220, 200, and 0. The model has one steady-state stress period. \n",
"\n",
"The model domain will be discretized into 3 layers, 21 rows, and 20 columns. A constant value of 500. will `delr` and `delc`. The top of the model should be set to 400 and the bottom of the three layers should be set to 220, 200, and 0. The model has one steady-state stress period. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import flopy\n",
"from flopy.plot import styles"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Create a simulation object, a time discretization object, and a iterative model solution object using `flopy.mf6.MFSimulation()`, `flopy.mf6.ModflowTdis()`, and `flopy.mf6.ModflowIms()`, respectively. Use default values for all iterative model solution variables.\n",
"\n",
"Before creating the simulation object you should define the simulation workspace (`sim_ws`) where the model files are, the simulation name (`name`), and the name and path of the model executable (`exe_name`). The `sim_ws` should be set to `'data/ex01b'`, `name` should be set to `ex01b`, and `exe_name` should be set to `bin/mf6`."
Expand All @@ -45,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"ws = \"./temp/ex01b\"\n",
"ws = \"./temp/ex01b\" \n",
"name = \"ex01b\"\n",
"exe_name = \"mf6\""
]
Expand Down
Loading

0 comments on commit f658558

Please sign in to comment.