-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
114 lines (90 loc) · 3.92 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
output:
rmarkdown::github_document:
html_preview: no
---
<!--- README.md is generated from README.Rmd. Please edit that file -->
# Digital elevation model (100 m global)
[![lifecycle](https://img.shields.io/badge/Lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.5719982-blue.svg)](https://doi.org/10.5281/zenodo.5719982)
```{r, include = FALSE}
knitr::opts_chunk$set(fig.path = "figures/README-", fig.align = "center")
```
This repository contains code to generate a global digital elevation model (based on Robinson *et al.* 2014). Specifically, elevation data are downloaded from the [EarthEnv project](https://www.earthenv.org/DEM.html). Next, the data are combined into a single raster (GeoTIFF) file containing the elevation data (90 m resolution; [EPSG:4326 coordinate reference system](https://epsg.io/4326)). Finally, the data are projected to the World Behrmann coordinate reference system using (100 m resolution; [ESRI:4326 coordinate reference system](https://epsg.io/54017)). A processed version of the data can be downloaded from the [Zenodo Digital Repository](https://doi.org/10.5281/zenodo.5719982). **All credit should go to Robinson *et al.* (2014), please cite their work if you use this dataset.**
```{r "map", echo = FALSE, message = FALSE, warning = FALSE, fig.height = 2.5, fig.width = 7.0, dpi = 250}
# load packages
library(terra)
library(ggplot2)
library(viridis)
# load raster
x <- terra::rast("results/dem-100m-esri54017.tif")
# extract data to plot
plot_raster <- terra::spatSample(
x, size = 400000, method = "regular", as.raster = TRUE
)
plot_data <- as.data.frame(plot_raster, xy = TRUE)
names(plot_data)[3] <- "value"
plot_data$title <- "Global elevation (100 m)"
plot_data$subtitle <- "dem-100m-esri54017.tif"
# make plot
p <-
ggplot() +
geom_tile(
data = plot_data,
mapping = aes(x = x, y = y, fill = value),
height = yres(plot_raster),
width = xres(plot_raster),
) +
scale_fill_viridis(name = "Elevation (m)") +
coord_fixed(expand = FALSE) +
facet_wrap(~ title + subtitle) +
theme(
legend.pos = "right",
axis.ticks = element_blank(),
axis.text = element_blank(),
axis.title = element_blank(),
axis.line = element_blank(),
axis.ticks.length = unit(0, "null"),
axis.ticks.margin = unit(0, "null"),
panel.border = element_blank(),
panel.background = element_blank(),
panel.grid = element_blank(),
legend.text = element_text(size = 8),
legend.margin = unit(0, "null"),
plot.margin = unit(c(0.001, 0.001, 0.001, 0.01), "pt"),
strip.background = ggplot2::element_rect(color = "black", fill = "black"),
strip.text = ggplot2::element_text(color = "white")
)
# render plot
print(p)
```
## Metadata
The raster (GeoTIFF) file is `dem-100m-esri54017.tif` (see below for details).
```{r, echo = FALSE, comment = NA}
withr::with_dir("results", {
cat(
system("gdalinfo dem-100m-esri54017.tif", intern = TRUE),
sep = "\n"
)
})
```
## Usage
You can run the code to produce the dataset using the system command `make clean all`. After processing has successfully completed, the code will produce a raster (GeoTIFF) file named `dem-100m-esri54017.tif` in the `results` directory.
## Software requirements
Operating system
* Ubuntu (21.10) (300 Gb disk space available)
Software
* GNU make (version 4.1)
* GDAL (version 3.2.2)
* R (version 4.1.1)
System packages
* `gdal-bin`
* `libudunits2-dev`
* `libgdal-dev`
* `libgeos-dev`
* `libproj-dev`
* `libxml2-dev`
* `libssl-dev`
## Citation
This dataset was derived from Robinson *et al.* (2014). If you use this dataset, you should cite their work - they deserve all the credit!
> Robinson N, Regetz J, & Guralnick RP (2014) EarthEnv-DEM90: A nearly-global, void-free, multi-scale smoothed, 90m digital elevation model from fused ASTER and SRTM data. *ISPRS Journal of Photogrammetry and Remote Sensing*, **87**: 57--67.