You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to do hydro-flattening of a DEM.
16
16
engine: knitr
17
17
execute:
@@ -29,6 +29,8 @@ The result is a DEM with unnatural ripples or slopes on water surfaces, which no
29
29
Hydro-flattening addresses this by incorporating breaklines that enforce flat, level water surfaces and preserve topographic realism.
30
30
Read more [at USGS website](https://www.usgs.gov/ngp-standards-and-specifications/lidar-base-specification-appendix-2-hydro-flattening-reference).
31
31
32
+

33
+
32
34
In this tutorial, you’ll learn how to use GRASS to apply hydro-flattening techniques to lidar-derived DEMs
33
35
using [r.hydro.flatten](https://grass.osgeo.org/grass-stable/manuals/addons/r.hydro.flatten.html) addon
34
36
following these steps:
@@ -41,7 +43,7 @@ following these steps:
41
43
- Create automatic river transects
42
44
- Create hydro-flattened river raster data for inclusion in a DEM
43
45
- Create a filled DEM layer combining the mean ground data, hydro-flattened data, and other interpolated data.
44
-
- Export the resulting data from a GRASS project to a TIF file.
46
+
- Export the resulting data from a GRASS project to a GeoTIFF file.
45
47
46
48
## Getting ready
47
49
@@ -51,10 +53,12 @@ To get ready for the analysis, we will need to download lidar data, orthoimagery
51
53
If you are not sure how to download and get started with GRASS using its graphical user interface or using Python, checkout the tutorials [Get started with GRASS GUI](../get_started/fast_track.qmd) and [Get started with GRASS & Python in Jupyter Notebooks](../get_started/fast_track_grass_and_python.qmd).
52
54
:::
53
55
56
+
To create a raster surface from LiDAR point cloud data, GRASS must be compiled with the [PDAL libraries](https://pdal.io/en/stable/). This capability is currently only available on Linux and OSX platforms and will be available on Windows when GRASS switches to the cmake-based build system (in development). In the meantime, the mean ground raster surface needed for the hydroflattening portion of the tutorial can be created on Windows using the [QGIS point cloud tools](https://docs.qgis.org/3.40/en/docs/user_manual/processing_algs/qgis/pointcloudconversion.html) (selecting classes 2,10,13 and setting the output resolution to 3.2808 ft).
57
+
54
58
### Download data
55
59
56
60
We will download lidar dataset from [USGS website](https://apps.nationalmap.gov/downloader/).
57
-
Search for _Lake Logan, North Carolina_ or use this bounding box:
61
+
Search for *Lake Logan, North Carolina* or use this bounding box:
58
62
59
63
-82.933790°, 35.423316°
60
64
-82.922031°, 35.407718°
@@ -78,12 +82,16 @@ We will use this file later on.
78
82
79
83
### Start GRASS and create a new project
80
84
85
+
::::::::: {.panel-tabset group="language"}
86
+
87
+
#### GUI
88
+
81
89
If this is the first time you have opened GRASS you will see the default startup
82
90
screen with a WGS84 world project. Click on the Create new project button on the left
83
91
or look for 
84
92
on the upper left.
85
93
86
-

94
+

87
95
88
96
This will open a wizard where you:
89
97
@@ -93,6 +101,20 @@ This will open a wizard where you:
93
101
4. select default datum transformation, click _Next_
94
102
5. see summary and click _Finish_
95
103
104
+
#### Command line
105
+
106
+
```{bash}
107
+
grass -c EPSG:6543 /path/to/nc6543
108
+
```
109
+
110
+
#### Python
111
+
112
+
```{python}
113
+
gs.create_project("/path/to/nc6543", epsg="6543")
114
+
```
115
+
116
+
:::::::::
117
+
96
118
### Import data
97
119
98
120
The next step is to import the ground point data from the 6 lidar
@@ -168,6 +190,8 @@ The most current data set for this location is from 2023.
For longer river segments you can use [v.centerline](https://grass.osgeo.org/grass-devel/manuals/addons/v.centerline.html)
339
367
for automated centerline generation.
@@ -411,7 +439,7 @@ approximately the downstream edge of the plunge pool below the dam. It’s proba
411
439
a break line at the base of the dam as well.
412
440
Digitize the line along where you see the dam structure meet the water and save it.
413
441
414
-

442
+

415
443
416
444
## Hydro-flattening with break lines
417
445
@@ -479,19 +507,33 @@ with [r.fillnulls](https://grass.osgeo.org/grass-devel/manuals/r.fillnulls.html)
479
507
#### GUI
480
508
481
509
Re-run the r.hydro.flatten with parameter **max_stddev=5** to avoid flattening
482
-
areas with standard deviation > 5.
510
+
areas with standard deviation greater than 5.
511
+
Name the resulting layer *lake_logan_1m_filled_DEM_null_above_5_stddev*.
483
512
484
-
Then call r.fillnulls with input layer *lake_logan_1m_filled_DEM*
485
-
and output *lake_logan_1m_filled_DEM_fillnulls* and default values.
513
+
::::: grid
514
+
515
+
::: g-col-6
516
+
517
+
Then find [r.fillnulls](https://grass.osgeo.org/grass-devel/manuals/r.fillnulls.html) tool
518
+
in menu *Raster → Interpolate surfaces → Fill NULL cells*
519
+
and call r.fillnulls with input layer *lake_logan_1m_filled_DEM*, output layer *lake_logan_1m_filled_DEM_fillnulls* and keep the rest with the default values.

567
+

526
568
527
569
:::
528
570
529
-
::: g-col-6
571
+
::: g-col-4
572
+
573
+

574
+
575
+
:::
576
+
577
+
::: g-col-4
530
578
531
579

532
580
533
581
:::
534
582
::::::
535
583
584
+
## Export to GeoTIFF
585
+
586
+
The last step is to export the filled DEM to the open standard GeoTIFF file format.
587
+
588
+
::::::::: {.panel-tabset group="language"}
589
+
590
+
#### GUI
591
+
592
+
Right click on the filled DEM layer (*lake_logan_1m_filled_DEM_final*) and select *Export*.
593
+
This will bring up the [r.out.gdal](https://grass.osgeo.org/grass-devel/manuals/r.out.gdal.html) dialog.
594
+
595
+
Click on the browse button next to the *Name for output raster file* option
596
+
to browse to the directory where you want the geotiff file to be written.
597
+
Keep the default file format as GTiff (GeoTIFF).
598
+
599
+

600
+
601
+
Click on the *Creation* tab. On this tab you can select the *Data type* and compression level for the output image. From the Data type drop-down select *Float64*.
602
+
603
+
Then go to the *Creation option(s) to pass to the output format driver* section.
604
+
The different options for writing out a GeoTIFF raster can be found at the
605
+
[GDAL GeoTiff format description page](https://gdal.org/en/latest/drivers/raster/gtiff.html).
606
+
Type in "compress=deflate,predictor=3". Click Run.
::: {.callout-note title="Compression and large datasets"}
630
+
Deflate compression is the most recognized lossless compression for GeoTIFFs. It is supported by other software and is relatively fast for reads. The predictor option allows the deflate compression to be more efficient. You can leave the GeoTIFFs uncompressed, but the file size will be about 4 times larger than the deflate compressed version. This difference adds up as you scale this process up to larger data sets.
631
+
632
+
For GeoTIFFs larger than 4GB, you will need to use the BIGTIFF=YES option to successfully write an output raster. You may want to also add the num_threads=4 to enable the multi-threaded writing option as well.
633
+
:::
634
+
635
+

636
+
637
+
Congratulations! You have completed this tutorial! {{< fa rocket >}}
536
638
537
639
***
538
640
539
641
:::{.smaller}
540
642
The development of this tutorial was in part funded by the US
541
643
[National Science Foundation (NSF)](https://www.nsf.gov/),
542
644
award [2303651](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2303651).
0 commit comments