-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
152 lines (106 loc) · 5.88 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
library(raadfiles)
path_to_rema <- file.path(rema_200m_rock_files()$root[1], "aad.gov.au/rema")
```
# rema.proc
<!-- badges: start -->
<!-- badges: end -->
The goal of rema.proc is to process the [Reference Elevation Model of Antarctica (REMA)](https://www.pgc.umn.edu/data/rema/) to provide surface properties slope, aspect, rugosity, and rock surface at various resolutions.
We produce *filled* versions of the 100m and 8m tiles, internally filled with the 200m product and externally with a
geoid height. This ensures derived properties do not suffer severe edge effects and the boundaries of the coast or water bodies, or where data gaps exist. When tiles are processed they are *super cropped*, by including an extra margin of pixels for the 3x3 kernel used for derived properties.
We used [GDAL 3.2.1](https://gdal.org/), with various tools in [R](https://www.r-project.org/) to handle tile logic and generating calls to the GDAL warp library.
Current version uses [Release 1.1](https://www.pgc.umn.edu/data/rema/).
## Logical steps
The following steps are carried out.
- process 1km file, filled with geoid and 200m, with a single-pixel margin extra
- process 200m and 100m to tiles matching 8m, with a single-pixel margin extra
- calculate rock coverage from the ADD classification at 8m, 100m, 200m
- fill 200m tiles with geoid, then source 200m DEM (the 200m is filled inside the coast)
- fill 100m tiles with geoid, then source 200m fill, then source DEM
- calculate DEM variables slope, aspect, rugosity
- index processed tiles, create VRT generators, use GDAL-read for regions, tiles, warping, decimation
All processed files written to `data_local/aad.gov.au/rema/processing/v1.1/`. These contain sub dirs 100m, 200m, 8m as required, and each has its two-part grid directory. These may contain
1. `rock` layer (rendered at 8m originally to filter high-res tiles)
2. `filled_geoid` (filled with geoid, then 200m REMA, then 100m REMA as needed)
3. `slope` slope in degrees (by GDAL [gdaldem slope](https://gdal.org/programs/gdaldem.html#slope))
4. `aspect` aspect in degrees (by GDAL [gdaldem aspect](https://gdal.org/programs/gdaldem.html#aspect))
5. `rugosity` rugosity index (by GDAL [gdaldem TRI](https://gdal.org/programs/gdaldem.html#tri))
## Complete file output
We maintain tile versions of the processing, but also produce complete GeoTIFFs for the 100m and 200m sets. These are
* REMA_100m_dem_geoid.tif
* REMA_100m_slope.tif
* REMA_100m_aspect.tif
* REMA_100m_rugosity.tif
* REMA_100m_rock.tif
* REMA_200m_dem_geoid.tif
* REMA_200m_slope.tif
* REMA_200m_aspect.tif
* REMA_200m_rugosity.tif
* REMA_200m_rock.tif
* REMA_1km_dem_geoid.tif
* REMA_1km_slope.tif
* REMA_1km_aspect.tif
* REMA_1km_rugosity.tif
* REMA_1km_rock.tif
File sizes vary due to the impact of compression (LZW) and the differences in coverage (rock is very sparse). The GeoTIFFs
are tiled with blocksize 256x256. No overviews are present, but may be added with [gdaladdo](https://gdal.org/programs/gdaladdo.html) and this may be important for raster i/o performance.
These Geotiff files include *overviews*, at levels 2, 4, 8, 16 - these are pyramid copies of the base grid at lower resolution. This can improve extraction and rendering performance (it's a bit obscure but we working on helpers).
We illustrate with some plots.
```{r illustrate}
## alltiles is the tile index from REMA shapefile
alltiles <- raadtools::read_rema_tiles()
places <- tibble::tibble(name = c("vestfold", "dry", "rockest", "peninsula"),
lon = c(78.25, 162.516667, 78.02387, -56.04094),
lat = c(-68.55, -77.466667, -74.5663, -63.28911),
tile = c("35_54", "17_35", "18_34", "47_06"))
tiles0 <- alltiles[match(places$tile, alltiles$tile), ]
library(raster)
dem_file <- file.path(path_to_rema, "processing/v1.1/untiled/REMA_200m_dem_geoid.tif")
plot(raster(dem_file), col = grey.colors(64))
plot(tiles0, add = TRUE, col = scales::alpha("firebrick", 0.2))
op <- par(mfrow = c(2, 2))
for (i in seq_len(nrow(tiles0))) {
plot(crop(raster(dem_file), tiles0[i, ]), col = grey.colors(64), main = tiles0$tile[i])
}
par(op)
slp_file <- file.path(path_to_rema, "processing/v1.1/untiled/REMA_200m_slope.tif")
plot(raster(slp_file), col = grey.colors(64))
plot(tiles0, add = TRUE, col = scales::alpha("firebrick", 0.2))
op <- par(mfrow = c(2, 2))
for (i in seq_len(nrow(tiles0))) {
plot(crop(raster(slp_file), tiles0[i, ]), col = grey.colors(64), main = tiles0$tile[i])
}
par(op)
```
## 01_ Rock classification
These files are created by rendering the polygon rock layer for each 8m, 100m, and 200m tile (no file created if no rock).
Generated with the [Medium resolution vector polygons of Antarctic rock outcrop version 7.3](https://data.bas.ac.uk/download/fe90d6aec-b53e-40c1-ad52-c05e03a58c1d).
Files can be accessed with [raadfiles]() functions `rema_8m_rock_files()`, `rema_100m_rock_files()`, and
`rema_200m_rock_files()`.
```{r rock-files}
files <- raadfiles::rema_8m_rock_files()
base_n <- function(x, n = 5) {
spl <- fs::path_split(x)
l <- lengths(spl)
sprintf(" .. %s", unlist(lapply(seq_along(spl), function(i) fs::path_join(tail(spl[[i]], l[i] - n)))))
}
dplyr::transmute(files, file = base_n(fullname))
```
## 02_ Geoid fill
This is a global geoid model on a longlat grid at 0.0416 resolution.
Files in this location are bundled into a VRT, see `02_geoid_height/geoid_vrt.R`.
```
"earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008/.*w001001.adf$"
```
## Code of Conduct
Please note that the rema.proc project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.