Skip to content

Commit

Permalink
sync hidden notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Jan 25, 2024
1 parent 150f090 commit 424d198
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 28 deletions.
50 changes: 46 additions & 4 deletions lessons/landlab/landlab/01-intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,21 @@
"Now see if you can do something similar with a `HexModelGrid`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# Create a hex grid that has 5 rows and 4 colums of nodes."
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -226,7 +241,6 @@
" <summary>👉 <b>click to see solution</b></summary>\n",
"\n",
"```python\n",
"# Create a hex grid that has 5 rows and 4 colums of nodes.\n",
"grid = HexModelGrid((5, 4))\n",
"plot_graph(grid, at=\"node\")\n",
"```\n",
Expand All @@ -241,6 +255,21 @@
"the correct signature to use."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# create a radial grid instance"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -253,7 +282,6 @@
" <summary>👉 <b>click to see solution</b></summary>\n",
"\n",
"```python\n",
"# create a radial grid instance\n",
"grid = RadialModelGrid(5, 4)\n",
"plot_graph(grid, at=\"node\")\n",
"```\n",
Expand All @@ -268,6 +296,21 @@
"interior *nodes* have been offset be a random amount."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# Create a framed voronoi grid with 4 rows and 5 columns of nodes."
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -280,7 +323,6 @@
" <summary>👉 <b>click to see solution</b></summary>\n",
"\n",
"```python\n",
"# Create a framed voronoi grid with 4 rows and 5 columns of nodes.\n",
"grid = FramedVoronoiGrid((4, 5))\n",
"plot_graph(grid, at=\"node\")\n",
"```\n",
Expand Down Expand Up @@ -316,7 +358,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
50 changes: 46 additions & 4 deletions lessons/landlab/landlab/02-data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"<a href=\"http://landlab.github.io\"><img style=\"float: left\" src=\"https://raw.githubusercontent.com/landlab/tutorials/release/landlab_header.png\"></a>"
]
Expand Down Expand Up @@ -81,9 +87,28 @@
"grid.at_node[\"foo\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# Get the values for the field names, \"bar\""
]
},
{
"cell_type": "markdown",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"solution"
]
Expand All @@ -93,7 +118,6 @@
" <summary>👉 <b>click to see solution</b></summary>\n",
"\n",
"```python\n",
"# Get the values for the field names, \"bar\"\n",
"grid.at_node[\"bar\"]\n",
"```\n",
"</details>"
Expand Down Expand Up @@ -146,9 +170,28 @@
"* What are the maximum and minimum elevation values?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# Write your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"solution"
]
Expand All @@ -158,7 +201,6 @@
" <summary>👉 <b>click to see solution</b></summary>\n",
"\n",
"```python\n",
"# Write your code here\n",
"print(f\"Number of points = {grid.number_of_nodes}\")\n",
"print(f\"Number of rows and columns = {grid.shape}\")\n",
"print(f\"Resolution = {grid.spacing}\")\n",
Expand Down Expand Up @@ -474,7 +516,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
103 changes: 92 additions & 11 deletions lessons/landlab/landlab/03-links-cells.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"<a href=\"http://landlab.github.io\"><img style=\"float: left\" src=\"https://raw.githubusercontent.com/landlab/tutorials/release/landlab_header.png\"></a>"
]
Expand Down Expand Up @@ -34,7 +40,13 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"from landlab import RasterModelGrid\n",
Expand All @@ -56,7 +68,13 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"grid.nodes_at_link"
Expand All @@ -65,7 +83,13 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"grid.node_at_link_tail, grid.node_at_link_head"
Expand All @@ -82,15 +106,27 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"grid.links_at_node"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"This data structure demonstrates a couple conventions used by *Landlab* data structures of grid elements.\n",
"\n",
Expand Down Expand Up @@ -119,21 +155,66 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"grid = RasterModelGrid((4, 5), xy_spacing=(1, 0.5))\n",
"plot_graph(grid, at=\"node,link\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"Plot the cells of the grid you just created."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"grid = RasterModelGrid((4, 5), xy_spacing=(1, 0.5))\n",
"plot_graph(grid, at=\"cell\")"
"# Plot the cells"
]
},
{
"cell_type": "markdown",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"solution"
]
},
"source": [
"<details>\n",
" <summary>👉 <b>click to see solution</b></summary>\n",
"\n",
"```python\n",
"plot_graph(grid, at=\"cell\")\n",
"```\n",
"</details>"
]
},
{
Expand Down Expand Up @@ -162,7 +243,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 424d198

Please sign in to comment.