Skip to content

Commit d0983a0

Browse files
authored
Earthwork tutorials: update for compatibility with new version of r.earthworks (#90)
1 parent 602735c commit d0983a0

File tree

9 files changed

+61
-57
lines changed

9 files changed

+61
-57
lines changed

content/tutorials/earthworks/basics.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@
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",
179-
"function $z = z_0 - r \\sqrt{\\Delta x^2 + \\Delta y^2}$, set the `rate` to\n",
179+
"function $z = z_0 - r \\sqrt{\\Delta x^2 + \\Delta y^2}$, \n",
180+
"set the `linear` slope parameter to\n",
180181
"0.5 to model a 50 percent slope."
181182
]
182183
},
@@ -196,7 +197,7 @@
196197
" coordinates=[400, 100],\n",
197198
" z=25,\n",
198199
" flat=25,\n",
199-
" rate=0.5\n",
200+
" linear=0.5\n",
200201
" )\n",
201202
"\n",
202203
"# Visualize\n",
@@ -248,7 +249,7 @@
248249
" coordinates=[400, 100],\n",
249250
" z=-25,\n",
250251
" flat=25,\n",
251-
" rate=0.5\n",
252+
" linear=0.5\n",
252253
" )\n",
253254
"\n",
254255
"# Visualize\n",
@@ -298,7 +299,7 @@
298299
" coordinates=[350, 100, 450, 100],\n",
299300
" z=[-25, 25],\n",
300301
" flat=25,\n",
301-
" rate=0.5\n",
302+
" linear=0.5\n",
302303
" )\n",
303304
"\n",
304305
"# Visualize\n",
@@ -365,7 +366,7 @@
365366
" earthworks=\"earthworks\",\n",
366367
" operation=\"fill\",\n",
367368
" raster=\"random\",\n",
368-
" rate=0.25,\n",
369+
" linear=0.25,\n",
369370
" flat=25\n",
370371
" )\n",
371372
"\n",

content/tutorials/earthworks/basics.qmd

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,15 @@ Use the `z` parameter to set a z-coordinate for the top of the peak.
187187
Optionally use the `flat` parameter to create a plateau at the top of the peak.
188188
Using the default linear growth and decay function
189189
$z = z_0 - r \sqrt{\Delta x^2 + \Delta y^2}$,
190-
set the `rate` to 0.5 to model a 50 percent slope.
190+
set the `linear` slope parameter to 0.5
191+
to model a 50 percent slope.
191192

192193
::: {.panel-tabset group="language"}
193194

194195
## Command line
195196

196197
```{bash}
197-
r.earthworks elevation=elevation earthworks=peak operation=fill coordinates=400,100 z=25 flat=25 rate=0.5
198+
r.earthworks elevation=elevation earthworks=peak operation=fill function=linear linear=0.5 coordinates=400,100 z=25 flat=25
198199
```
199200

200201
## Python
@@ -206,10 +207,11 @@ gs.run_command(
206207
elevation="elevation",
207208
earthworks="peak",
208209
operation="fill",
210+
function="linear",
211+
linear=0.5,
209212
coordinates=[400, 100],
210213
z=25,
211-
flat=25,
212-
rate=0.5
214+
flat=25
213215
)
214216
215217
# Visualize
@@ -239,7 +241,7 @@ then the slopes will climb at a given rate of growth.
239241
## Command line
240242

241243
```{bash}
242-
r.earthworks elevation=elevation earthworks=pit operation=cut coordinates=400,100 z=-25 flat=25 rate=0.5
244+
r.earthworks elevation=elevation earthworks=pit operation=cut function=linear linear=0.5 coordinates=400,100 z=-25 flat=25
243245
```
244246

245247
## Python
@@ -251,10 +253,11 @@ gs.run_command(
251253
elevation="elevation",
252254
earthworks="pit",
253255
operation="cut",
256+
function="linear",
257+
linear=0.5,
254258
coordinates=[400, 100],
255259
z=-25,
256-
flat=25,
257-
rate=0.5
260+
flat=25
258261
)
259262
260263
# Visualize
@@ -281,7 +284,7 @@ and another z-coordinate for the top of the peak.
281284
## Command line
282285

283286
```{bash}
284-
r.earthworks elevation=elevation earthworks=pit_and_peak operation=cutfill coordinates=350,100,450,100 z=-25,25 flat=25 rate=0.5
287+
r.earthworks elevation=elevation earthworks=pit_and_peak operation=cutfill function=linear linear=0.5 coordinates=350,100,450,100 z=-25,25 flat=25
285288
```
286289

287290
## Python
@@ -293,10 +296,11 @@ gs.run_command(
293296
elevation="elevation",
294297
earthworks="pit_and_peak",
295298
operation="cutfill",
299+
function="linear",
300+
linear=0.5,
296301
coordinates=[350, 100, 450, 100],
297302
z=[-25, 25],
298-
flat=25,
299-
rate=0.5
303+
flat=25
300304
)
301305
302306
# Visualize
@@ -335,7 +339,7 @@ Set input raster to the random cells.
335339
```{bash}
336340
r.surf.random out=surface min=0 max=25 seed=2
337341
r.random input=surface npoints=50 raster=random seed=7
338-
r.earthworks elevation=elevation earthworks=earthworks operation=fill raster=random rate=0.25 flat=25
342+
r.earthworks elevation=elevation earthworks=earthworks operation=fill raster=random function=linear linear=0.25 flat=25
339343
```
340344

341345
## Python
@@ -360,7 +364,8 @@ gs.run_command(
360364
earthworks="earthworks",
361365
operation="fill",
362366
raster="random",
363-
rate=0.25,
367+
function="linear",
368+
linear=0.25,
364369
flat=25
365370
)
366371
@@ -401,4 +406,4 @@ m.show()
401406

402407
:::
403408

404-
![Contours](images/basics_06.webp)
409+
![Contours](images/basics_06.webp)

content/tutorials/earthworks/earthworks.qmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ execute:
2222

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

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.
26-
27-
<!-- Update link when paper published -->
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
## Installation
3028

content/tutorials/earthworks/gullies.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
"and decay function $z = z_0 e^{-\\lambda \\sqrt{\\Delta x^2 + \\Delta y^2}}$\n",
286286
"to model the steep slopes of the gullies. Set `mode` to relative,\n",
287287
"`operation` to cut, `function` to exponential, `raster` to the raster\n",
288-
"map of gullies, `z` to a negative value, and `rate` $\\lambda$ to a value\n",
288+
"map of gullies, `z` to a negative value, and `exponential` $\\lambda$ to a value\n",
289289
"such as 0.1. Save an output `volume` raster to visualize volumetric\n",
290290
"change. This may take a minute to run. For faster results, try setting a\n",
291291
"lower resolution with\n",
@@ -309,7 +309,7 @@
309309
" operation=\"cut\",\n",
310310
" function=\"exponential\",\n",
311311
" raster=\"gullies\",\n",
312-
" rate=0.1\n",
312+
" exponential=0.1\n",
313313
" )\n",
314314
"gs.run_command(\"r.colors\", map=\"volume\", color=\"inferno\")\n",
315315
"\n",

content/tutorials/earthworks/gullies.qmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Set `mode` to relative,
305305
`operation` to cut,
306306
`function` to exponential,
307307
`raster` to the raster map of gullies,
308-
and `rate` $\lambda$ to a value such as 0.1.
308+
and `exponential` $\lambda$ to a value such as 0.1.
309309
Save an output `volume` raster
310310
to visualize volumetric change.
311311
This may take a minute to run.
@@ -317,7 +317,7 @@ with {{< meta links.g_region >}}.
317317
## Command line
318318

319319
```{bash}
320-
r.earthworks elevation=fractal earthworks=gullies volume=volume mode=relative operation=cut function=exponential raster=gullies rate=0.1 --overwrite
320+
r.earthworks elevation=fractal earthworks=gullies volume=volume mode=relative operation=cut function=exponential raster=gullies exponential=0.1 --overwrite
321321
r.colors map=volume color=inferno
322322
```
323323

@@ -334,7 +334,7 @@ gs.run_command(
334334
operation="cut",
335335
function="exponential",
336336
raster="gullies",
337-
rate=0.1
337+
exponential=0.1
338338
)
339339
gs.run_command("r.colors", map="volume", color="inferno")
340340
@@ -355,4 +355,4 @@ m.show()
355355

356356
![Gullies](images/gullies_03.webp)
357357

358-
![Volumetric change](images/gullies_04.webp)
358+
![Volumetric change](images/gullies_04.webp)

content/tutorials/earthworks/levees.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@
376376
"north. Then use a cut operation with\n",
377377
"[r.earthworks](https://grass.osgeo.org/grass-stable/manuals/addons/r.earthworks.html)\n",
378378
"to model the borrow area. Set `elevation` to the elevation raster,\n",
379-
"`lines` to the borrow vector, `z` to -1.5, `rate` to 0.2, and `flat` to\n",
379+
"`lines` to the borrow vector, `z` to -1.5, `linear` to 0.2, and `flat` to\n",
380380
"7.6."
381381
]
382382
},
@@ -398,7 +398,7 @@
398398
" operation=\"cut\",\n",
399399
" lines=\"borrow\",\n",
400400
" z=[-1.5],\n",
401-
" rate=0.2,\n",
401+
" linear=0.2,\n",
402402
" flat=7.6\n",
403403
" )\n",
404404
"\n",
@@ -430,7 +430,7 @@
430430
"Use a fill operation with\n",
431431
"[r.earthworks](https://grass.osgeo.org/grass-stable/manuals/addons/r.earthworks.html)\n",
432432
"to model the restored ridge. Set `elevation` to the earthworks raster,\n",
433-
"`lines` to the ridge vector, `z` to 1.5, `rate` to 0.2, and `flat` to\n",
433+
"`lines` to the ridge vector, `z` to 1.5, `linear` to 0.2, and `flat` to\n",
434434
"7.6."
435435
]
436436
},
@@ -449,7 +449,7 @@
449449
" operation=\"fill\",\n",
450450
" lines=\"ridges\",\n",
451451
" z=1.5,\n",
452-
" rate=0.2,\n",
452+
" linear=0.2,\n",
453453
" flat=7.6\n",
454454
" )\n",
455455
"\n",
@@ -485,7 +485,7 @@
485485
"with a ratio of 10H:1V. For\n",
486486
"[r.earthworks](https://grass.osgeo.org/grass-stable/manuals/addons/r.earthworks.html)\n",
487487
"set `elevation` to the earthworks raster, `lines` to the levee vector,\n",
488-
"`z` to 5.5, `rate` to 0.1, and `flat` to 1.5."
488+
"`z` to 5.5, `linear` to 0.1, and `flat` to 1.5."
489489
]
490490
},
491491
{
@@ -503,7 +503,7 @@
503503
" operation=\"fill\",\n",
504504
" lines=\"levees\",\n",
505505
" z=5.5,\n",
506-
" rate=0.1,\n",
506+
" linear=0.1,\n",
507507
" flat=1.5\n",
508508
" )\n",
509509
"\n",
@@ -539,7 +539,7 @@
539539
"built from rows of interlocking vertical segments \n",
540540
"of piles that are driven into the ground. \n",
541541
"Set `elevation` to the\n",
542-
"earthworks raster, `lines` to the gaps vector, `z` to -0.6, `rate` to 1,\n",
542+
"earthworks raster, `lines` to the gaps vector, `z` to -0.6, `linear` to 1,\n",
543543
"and `flat` to 10. The radius of flats should be set to the region\n",
544544
"resolution to ensure that the gaps are fully closed because we test our\n",
545545
"design with a flood simulation. To better visualize the results, use\n",
@@ -563,7 +563,7 @@
563563
" operation=\"cutfill\",\n",
564564
" lines=\"gaps\",\n",
565565
" z=-0.6,\n",
566-
" rate=1,\n",
566+
" linear=1,\n",
567567
" flat=10\n",
568568
" )\n",
569569
"\n",
@@ -575,7 +575,7 @@
575575
" operation=\"cutfill\",\n",
576576
" lines=\"closures\",\n",
577577
" z=1.37,\n",
578-
" rate=1,\n",
578+
" linear=1,\n",
579579
" flat=5\n",
580580
" )\n",
581581
"\n",

0 commit comments

Comments
 (0)