Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
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/05_Unstructured_Grid_generation.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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"cell_type": "code",
"execution_count": null,
"id": "b263fdce",
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"import this"
Expand All @@ -32,6 +34,32 @@
"Also, by importing `this`, it actually executed some code (printing out the Zen of Python). This means Python knew where to find a module called `this` and executed it upon import."
]
},
{
"cell_type": "markdown",
"id": "dea36f8c-3ec4-49e4-996c-46657360b45f",
"metadata": {},
"source": [
"Let's try another easter egg, just for fun."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c4ef38cd-5dfc-496c-b4be-eac49eab1bed",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "aa2aca2a-c965-41ac-8ae1-e339ed74041f",
"metadata": {},
"source": [
"The goal of this notebook is to provide students with the skills needed to create resuable functions, objects, and python moduldes. \n",
"\n",
"By the end of this notebook the student will have the skills required to create a complex object in a seperate python script, import it's functionality into this notebook, and be able to work with it here."
]
},
{
"cell_type": "markdown",
"id": "ccff90ef",
Expand Down Expand Up @@ -183,10 +211,10 @@
"source": [
"a=[1.0, 2.0, 3.5, 4.9]\n",
"print (f'{a=}')\n",
"b=a\n",
"b = a\n",
"print (f'{b=}')\n",
"print ('_'*15)\n",
"b[2]=999\n",
"b[2] = 999\n",
"print (f'{a=}')\n",
"print (f'{b=}')"
]
Expand Down Expand Up @@ -486,31 +514,39 @@
"id": "a0ba121a",
"metadata": {},
"outputs": [],
"source": []
"source": [
"# attrs"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "efbd4d86",
"metadata": {},
"outputs": [],
"source": []
"source": [
"# in a list"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b0a41016",
"metadata": {},
"outputs": [],
"source": []
"source": [
"# attrs in list"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cde66e11",
"metadata": {},
"outputs": [],
"source": []
"source": [
"# loop"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -857,8 +893,7 @@
"metadata": {},
"outputs": [],
"source": [
"rr.length = 100\n",
"rr.__dict__"
"# what happens when we change the length?"
]
},
{
Expand Down Expand Up @@ -932,7 +967,7 @@
"source": [
"### Test your skills!!!\n",
"\n",
"build a `Rectangle` class that includes an `area` and `perimiter_length` property method.\n"
"build an even better `Rectangle` class that includes an `area` and `perimiter_length` property method.\n"
]
},
{
Expand Down Expand Up @@ -1086,7 +1121,7 @@
"metadata": {},
"outputs": [],
"source": [
" print(rect)"
"print(rect)"
]
},
{
Expand All @@ -1096,7 +1131,9 @@
"source": [
"We can even overload other operators like `__add__` which will control what happens when this object is added to another.\n",
"\n",
"A complete list of which special methods and operators can be overloaded is found [here](https://docs.python.org/3.9/reference/datamodel.html#special-method-names)."
"A complete list of which special methods and operators can be overloaded is found [here](https://docs.python.org/3.9/reference/datamodel.html#special-method-names). \n",
"\n",
"A short list of standard operators for mathematical functions can be found [here](https://docs.python.org/3/library/operator.html)."
]
},
{
Expand Down Expand Up @@ -1386,7 +1423,7 @@
" err = abs(i1 - i0)\n",
" i0 = i1\n",
" \n",
" print (f'my complicated function estimates sqrt as--> {i1}!')\n"
" print (f'my complicated function estimates sqrt as--> {i1}')\n"
]
},
{
Expand Down Expand Up @@ -1556,7 +1593,8 @@
"\n",
"Open the python file \"circle_module.py\" in an IDE or text editor and create a class called `Circle`. Inputs to circle should be a radius and ID. Include in the `Circle` class a way to the calculate area and the circumference. After building the class, try importing into this notebook and using it.\n",
"\n",
"**Bonus exercise:** Find a way to make the `Circle` objects divisible and compare the difference in area between a 12\" and 16\" pizza.\n"
"**Bonus exercise:** Find a way to make the `Circle` objects divisible and compare the difference in area between a 12\" and 16\" pizza. \n",
"**Bonus exercise 2:** Add additonal functionality to compare the price per square inch of the two pizzas. Ian's pizza in Madison, WI lists sizes and prices on their website which could be used as a reference."
]
},
{
Expand Down Expand Up @@ -1605,6 +1643,18 @@
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Loading
Loading