Skip to content

Commit f1c3e34

Browse files
committed
revised tutorials
1 parent 164f356 commit f1c3e34

File tree

9 files changed

+1276
-1209
lines changed

9 files changed

+1276
-1209
lines changed

content/tutorials/earthworks/basics.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"id": "8b05bf2d-4a12-459a-9b34-b1ade3769de3",
1111
"metadata": {},
1212
"source": [
13-
"# Basic Earthworks\n",
13+
"# Earthworks: Basics\n",
1414
"\n",
1515
"Brendan Harmon \n",
1616
"2025-07-02\n",
@@ -172,7 +172,7 @@
172172
"[r.earthworks](https://grass.osgeo.org/grass-stable/manuals/addons/r.earthworks.html).\n",
173173
"These coordinates represents a local topographic maxima, i.e. a high\n",
174174
"point. The algorithm will fill locally up to that point, then the slopes\n",
175-
"will falloff at a given rate of decay. Set `coordinates` to a pair of x-\n",
175+
"will fall off at a given rate of decay. Set `coordinates` to a pair of x-\n",
176176
"and y-coordinates. Use the `z` parameter to set a z-coordinate for the\n",
177177
"top of the peak. Optionally use the `flat` parameter to create a plateau\n",
178178
"at the top of the peak. Using the default linear growth and decay\n",

content/tutorials/earthworks/basics.qmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Basic earthworks"
2+
title: "Earthworks: Basics"
33
author: "Brendan Harmon"
44
date: 2025-07-02
55
date-modified: today
@@ -38,7 +38,7 @@ jupyter: python3
3838

3939
Learn the basics of terrain modeling with
4040
{{< meta links.r_earthworks >}}.
41-
This tool uses cut and fill operations to tranform topography.
41+
This tool uses cut and fill operations to transform topography.
4242
Cut operations subtract from a topographic surface,
4343
while fill operations add to the topography.
4444
Transformations are based on proposed local topographic extrema,
@@ -81,6 +81,7 @@ with a Cartesian (XY) coordinate system.
8181
## Command line
8282

8383
```{bash}
84+
grass --tmp-project XY
8485
```
8586

8687
## Python
@@ -180,7 +181,7 @@ with {{< meta links.r_earthworks >}}.
180181
These coordinates represents a local topographic maxima,
181182
i.e. a high point.
182183
The algorithm will fill locally up to that point,
183-
then the slopes will falloff at a given rate of decay.
184+
then the slopes will fall off at a given rate of decay.
184185
Set `coordinates` to a pair of x- and y-coordinates.
185186
Use the `z` parameter to set a z-coordinate for the top of the peak.
186187
Optionally use the `flat` parameter to create a plateau at the top of the peak.

content/tutorials/earthworks/earthworks.qmd

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Terrain modeling with r.earthworks in GRASS"
3-
author: "Brnedan Harmon"
2+
title: "Earthworks"
3+
author: "Brendan Harmon"
44
date: 2025-07-07
55
date-modified: today
66
image: images/earthworks_01.webp
@@ -22,9 +22,7 @@ execute:
2222

2323
![Random fill operation with r.earthworks](images/earthworks_01.webp)
2424

25-
<!-- Replace with new image -->
26-
27-
Learn how model terrain with {{< meta links.r_earthworks >}}. With this tool you can generate new terrain or modify exisiting terrain using cut and fill operations inspired by earthworking. The first tutorial on the basics of terrain modeling introduces key concepts such as cut and fill operations. The subsequent tutorials introduce more advanced concepts such as relative operations and growth and decay functions. These tutorials demonstrate how to generate terrain, model natural landforms, and model anthropogenic landforms - i.e. earthworks - such as roads, dams, and levees. Read our [paper](https://raw.githubusercontent.com/baharmon/r.earthworks/main/paper/paper.pdf) to learn more.
25+
Learn how model terrain with {{< meta links.r_earthworks >}}. With this tool you can generate new terrain or modify existing terrain using cut and fill operations inspired by earthworking. The first tutorial on the basics of terrain modeling introduces key concepts such as cut and fill operations. The subsequent tutorials introduce more advanced concepts such as relative operations and growth and decay functions. These tutorials demonstrate how to generate terrain, model natural landforms, and model anthropogenic landforms - i.e. earthworks - such as roads, dams, and levees. Read our [paper](https://raw.githubusercontent.com/baharmon/r.earthworks/main/paper/paper.pdf) to learn more.
2826

2927
<!-- Update link when paper published -->
3028

@@ -55,7 +53,7 @@ Learn the basics of terrain modeling with r.earthworks.
5553
2. **[Gully modeling](./gullies.qmd)**
5654
Model gullies using relative cut operations.
5755

58-
3. **[Levee improvement & ridge restoration](./levees.qmd)**
56+
3. **[Coastal infrastructure](./levees.qmd)**
5957
Model coastal infrastructure projects including levees and restored alluvial ridges.
6058

6159
4. **[Terrain synthesis](./synthesis.qmd)**

content/tutorials/earthworks/gullies.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"id": "5c102531-d33c-4a5a-94c3-94480ad449c5",
1111
"metadata": {},
1212
"source": [
13-
"# Gully modeling\n",
13+
"# Earthworks: Gully Modeling\n",
1414
"\n",
1515
"Brendan Harmon \n",
1616
"2025-07-02\n",
@@ -28,13 +28,13 @@
2828
"and volumetric change calculations. While absolute operations calculate\n",
2929
"cut and fill based on a vertical datum of zero and can be used to model\n",
3030
"features at a given elevation, relative operations calculate cut and\n",
31-
"fill relative to the exisiting topography and can be used to model\n",
32-
"features that follow the exisiting terrain.\n",
31+
"fill relative to the existing topography and can be used to model\n",
32+
"features that follow the existing terrain.\n",
3333
"\n",
3434
"Use a relative earthworking operation with an exponential function to\n",
3535
"carve deep gullies into a landscape. In this tutorial all of the data\n",
3636
"will be created procedurally including the terrain and the streams.\n",
37-
"Start by generating fractal terrain. Then model flow acculumation\n",
37+
"Start by generating fractal terrain. Then model flow accumulation\n",
3838
"through the fractal terrain and extract its stream network. Finally use\n",
3939
"the vector map of streams as input for a relative cut operation to\n",
4040
"transform valleys into deep gullies. This tutorial covers:\n",

content/tutorials/earthworks/gullies.qmd

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Gully modeling"
2+
title: "Earthworks: Gully Modeling"
33
author: "Brendan Harmon"
44
date: 2025-07-02
55
date-modified: today
@@ -48,9 +48,9 @@ While absolute operations calculate cut and fill
4848
based on a vertical datum of zero
4949
and can be used to model features at a given elevation,
5050
relative operations calculate cut and fill
51-
relative to the exisiting topography
51+
relative to the existing topography
5252
and can be used to model features
53-
that follow the exisiting terrain.
53+
that follow the existing terrain.
5454

5555
Use a relative earthworking operation
5656
with an exponential function to
@@ -59,7 +59,7 @@ In this tutorial
5959
all of the data will be created procedurally
6060
including the terrain and the streams.
6161
Start by generating fractal terrain.
62-
Then model flow acculumation
62+
Then model flow accumulation
6363
through the fractal terrain
6464
and extract its stream network.
6565
Finally use the vector map of streams
@@ -95,6 +95,7 @@ with a Cartesian (XY) coordinate system.
9595
## Command line
9696

9797
```{bash}
98+
grass --tmp-project XY
9899
```
99100

100101
## Python

content/tutorials/earthworks/levees.ipynb

Lines changed: 677 additions & 640 deletions
Large diffs are not rendered by default.

content/tutorials/earthworks/levees.qmd

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Modeling coastal infrastructure"
2+
title: "Earthworks: Modeling Coastal Infrastructure"
33
author: "Brendan Harmon"
44
date: 2025-07-06
55
date-modified: today
@@ -70,13 +70,18 @@ Learn how to work with notebooks in the tutorial
7070

7171
## Project
7272

73-
Start a GRASS session in the Bayou L'Ours project.
73+
Download and unarchive the
74+
[Bayou L'Ours Dataset](https://doi.org/10.5281/zenodo.15870441).
75+
Then start a GRASS session in the Bayou L'Ours project.
76+
Since the dataset is approximately 120MB,
77+
it may take a couple minutes to download.
7478

7579
::: {.panel-tabset group="language"}
7680

7781
## Command line
7882

7983
```{bash}
84+
grass ~/grassdata/bayou_lours/PERMANENT
8085
```
8186

8287
## Python
@@ -87,6 +92,8 @@ import os
8792
import sys
8893
import subprocess
8994
from pathlib import Path
95+
import urllib.request
96+
from zipfile import ZipFile
9097
9198
# Find GRASS Python packages
9299
sys.path.append(
@@ -100,10 +107,26 @@ sys.path.append(
100107
import grass.script as gs
101108
import grass.jupyter as gj
102109
103-
# Download dataset
110+
# Set GRASS database
111+
gisdbase = os.path.join(Path.home(), "grassdata")
104112
105-
# Start GRASS in this project
106-
session = gj.init("~/grassdata/bayou_lours")
113+
# Download dataset
114+
url = "https://zenodo.org/records/15870442/files/bayou_lours.zip?download=1"
115+
filepath = os.path.join(gisdbase, "bayou_lours.zip")
116+
try:
117+
urllib.request.urlretrieve(url, filepath)
118+
except Exception as e:
119+
print(f"Error downloading file: {e}")
120+
121+
# Unarchive dataset
122+
with ZipFile(filepath, 'r') as archive:
123+
archive.extractall(gisdbase)
124+
125+
# Delete archive
126+
os.remove(filepath)
127+
128+
# Start GRASS in Bayou L'Ours project
129+
session = gj.init(Path(gisdbase, "bayou_lours"))
107130
```
108131

109132
:::
@@ -239,7 +262,7 @@ m.save("images/levees_02.webp")
239262

240263
## Flood Simulation
241264

242-
Use {{< meta links.r_lake >}} to model innudation from storm surge.
265+
Use {{< meta links.r_lake >}} to model inundation from storm surge.
243266
Set the water level to one meter and the coordinates to `1109000, 102750`.
244267
The simulation will show that the degraded ridge
245268
would be overtopped by a meter of surge.
@@ -330,17 +353,22 @@ the borrow needed to build it.
330353
The restored ridge should have
331354
a crest elevation of 1.5 meters,
332355
a crest width of 15.2 meters,
333-
and 20% slopes with a ratio of 5H:1V.
356+
and 20% slopes with a ratio of 5H:1V,
357+
i.e. a horizontal run of 5 meters
358+
for a vertical rise of 1 meter.
334359
The soil to rebuild the ridge
335-
should be taken from a borrow area
360+
should be taken onsite
361+
from an adjacent borrow area
336362
that would be offset by 7.6 meters
337363
from the foot of the ridge.
338364

339365
## Borrow Area
340-
341-
Model the borrow area
342-
by offsetting the proposed ridge
343-
and then performing a cut operation.
366+
Start by modeling the borrow area -
367+
an excavation for sourcing material for construction -
368+
needed to restore the ridge.
369+
To model the borrow area,
370+
offset the proposed ridge
371+
and then perform a cut operation.
344372
First use {{< meta links.v_transform >}}
345373
to shift the vector map of the proposed ridgeline
346374
36 meters to the north.
@@ -405,13 +433,12 @@ Set `elevation` to the earthworks raster,
405433
`rate` to 0.2,
406434
and `flat` to 7.6.
407435

408-
409436
::: {.panel-tabset group="language"}
410437

411438
## Command line
412439

413440
```{bash}
414-
r.earthworks elevation=earthworks arthworks=earthworks operation=fill lines=ridges z=1.5 rate=0.2 flat=7.6 --overwrite
441+
r.earthworks elevation=earthworks earthworks=earthworks operation=fill lines=ridges z=1.5 rate=0.2 flat=7.6 --overwrite
415442
d.rast map=earthworks
416443
d.legend raster=earthworks color=white at=5,95,1,3
417444
```
@@ -502,6 +529,9 @@ Use a fill operation with
502529
{{< meta links.r_earthworks >}}
503530
to model gap closures
504531
with sheet pile structures.
532+
These structures are walls
533+
built from rows of interlocking vertical segments
534+
of piles that are driven into the ground.
505535
Set `elevation` to the earthworks raster,
506536
`lines` to the gaps vector,
507537
`z` to -0.6,
@@ -574,7 +604,7 @@ m.save("images/levees_08.webp")
574604

575605
Test proposed coastal infrastructure with simulated storm surge.
576606
Use {{< meta links.r_lake >}}
577-
to model innudation from storm surge over the earthworks raster.
607+
to model inundation from storm surge over the earthworks raster.
578608
Set the water level to one meter and the coordinates to `1109000, 102750`.
579609
The simulation will show that the restored ridge with closed gaps
580610
would be not overtopped by a meter of surge.

content/tutorials/earthworks/synthesis.ipynb

Lines changed: 533 additions & 534 deletions
Large diffs are not rendered by default.

content/tutorials/earthworks/synthesis.qmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Terrain synthesis"
2+
title: "Earthworks: Terrain Synthesis"
33
author: "Brendan Harmon"
44
date: 2025-06-30
55
date-modified: today
@@ -87,6 +87,7 @@ with a Cartesian (XY) coordinate system.
8787
## Command line
8888

8989
```{bash}
90+
grass --tmp-project XY
9091
```
9192

9293
## Python

0 commit comments

Comments
 (0)