-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresent.qmd
224 lines (174 loc) · 10.1 KB
/
present.qmd
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
---
title: "Present"
---
```{r include=FALSE, echo=FALSE, message=FALSE, warning=FALSE}
library(tidyverse)
```
LANDFIRE's [Existing Vegetation Type, Cover and Height](https://landfire.gov/vegetation.php){target="blank"} datasets describe vegetation conditions.
- Existing Vegetation Type (EVT) - represents the current distribution of the terrestrial ecological systems classification, developed by NatureServe for the western hemisphere, through 2016.
- Existing Vegetation Cover (EVC) - represents the vertically projected percent cover of the live canopy layer for a 30-m cell.
- Existing Vegetation Height (EVH) - represents the average height of the dominant vegetation for a 30-m cell.
[Read more about LANDFIRE Vegetation Products](https://landfire.gov/vegetation.php){target="blank"}
## Most Prevalent Existing Vegetation Types
<br>
![](images/evt.jpg){width="100%"}
```{r evt chart, echo=FALSE, message=FALSE, warning=FALSE, fig.width=10, fig.height=8}
evtname <- read.csv(file = "data/evt_aoi_attributes.csv") %>%
group_by(EVT_NAME) %>%
summarize(ACRES = sum(ACRES),
REL_PERCENT = sum(REL_PERCENT)) %>%
arrange(desc(REL_PERCENT)) %>%
top_n(n = 10, wt = REL_PERCENT)
# plot
evtChart <-
ggplot(data = evtname, aes(x = EVT_NAME, y = REL_PERCENT)) +
geom_bar(stat = "identity") +
labs(
title = "Top 10 Existing Vegetation Types",
subtitle = "Represents dominant vegetation systems ca2020",
caption = "\nData from landfire.gov.",
x = "",
y = "Percent of landscape") +
scale_x_discrete(limits = rev(evtname$EVT_NAME),
labels = function(x) str_wrap(x, width = 18)) +
coord_flip() +
theme_bw(base_size = 14)
evtChart
```
<br>
## Existing Vegetation Cover
The Existing Vegetation Cover (EVC) map is a visual representation of EVC classifications across the subregion. The chart below the map provides a breakdown of each vegetation cover classification and their relative distribution across the forest.
![](images/evc.jpg){width="100%"} <br>
<br>
```{r evc chart, echo=FALSE, message=FALSE, warning=FALSE, fig.width=10, fig.height=10}
evcname <- read.csv("data/evc_aoi_attributes.csv")
# create "type" column based on conditions
evcname <- evcname %>% mutate(type = if_else(VALUE %in% 11, "Open Water",
if_else(VALUE %in% 12, "Snow / Ice",
if_else(VALUE %in% c(13:25), "Developed",
if_else(VALUE %in% 31, "Barren",
if_else(VALUE %in% c(60:70), "Agriculture",
if_else(VALUE %in% 32, "Quarries",
if_else(VALUE %in% 100, "Sparse Vegetation",
if_else(VALUE %in% c(101:199), "Tree",
if_else(VALUE %in% c(201:299), "Shrub",
if_else(VALUE %in% c(301:399), "Herb",
"Other")))))))))))
# create reverse substr() function
revSubstr <- function(x, start, stop) {
x <- strsplit(x, "")
sapply(x,
function(x) paste(rev(rev(x)[start:stop]), collapse = ""),
USE.NAMES = FALSE) }
# create cover column based on 2nd and 3rd to last values of classname
# if "Other" type, make 0
evcname <- evcname %>% mutate(cover = as.numeric(if_else(VALUE > 100,
revSubstr(evcname$CLASSNAMES, start = 2, stop = 3),
"0")))
# create bin breaks for grouping
breaks <- seq(0, 100, 10)
# create intervals for grouping and summarize
# also create factor order for "type"
evcgroup <- evcname %>%
mutate(interval = cut(cover,
breaks,
include.lowest = TRUE,
right = T,
labels = c("0-9", "10-19", "20-29", "30-39", "40-49", "50-59", "60-69", "70-79",
"80-89", "90-100")),
type = factor(type, levels = c("Tree", "Shrub", "Herb", "Open Water", "Snow / Ice", "Developed", "Agriculture", "Sparse Vegetation", "Barren", "Quarries", "Other"))) %>%
group_by(type, interval) %>%
summarize(Freq = sum(Freq),
ACRES = sum(ACRES),
REL_PERCENT = sum(REL_PERCENT))
# add label and legend names based on condition
evcgroup <- evcgroup %>% mutate(label = if_else(type %in% c("Tree", "Shrub", "Herb"),
paste0(type, " Cover = ", interval, "%"), as.character(type)),
legend = if_else(type %in% c("Tree", "Shrub", "Herb", "Open Water"),
type, as.factor("Other")))
# turn current label order to factors
evclabel.list <- evcgroup$label
evcgroup <- evcgroup %>% mutate(label = fct_rev(factor(label, evclabel.list)))
# create factor level colors for legend
cols <- c("Tree" = "#196F3D", "Shrub" = "#229954", "Herb" = "#52BE80", "Open Water" = "#7FB3D5",
"Other" = "#808B96")
# plot
evcChart <-
ggplot(data = evcgroup, aes(x = label, y = REL_PERCENT, fill = legend)) +
geom_bar(stat = "identity") +
labs(
title = "Existing Vegetation Cover",
subtitle = "Represents canopy cover per dominant lifeform, ca 2020",
caption = "\nData from landfire.gov.",
x = "",
y = "Percent of landscape") +
scale_fill_manual(values = cols, name = "") +
coord_flip() +
theme_bw(base_size = 14)
evcChart
```
<br>
## Existing Vegetation Height
The Existing Vegetation Height (EVH) map showcases EVH across the forest. The chart below the map provides the percentage of the landscape represented by each EVH height.
![](images/evh.jpg){width="100%"} <br>
```{r evh chart, echo=FALSE, message=FALSE, warning=FALSE, fig.width=10, fig.height=10}
# load evh attribute table
evhname <- read.csv(file = "data/evh_aoi_attributes.csv")
# create "type" column based on conditions
evhname <- evhname %>% mutate(type = if_else(VALUE %in% 11, "Open Water",
if_else(VALUE %in% 12, "Snow / Ice",
if_else(VALUE %in% c(13:25), "Developed",
if_else(VALUE %in% 31, "Barren",
if_else(VALUE %in% c(60:70), "Agriculture",
if_else(VALUE %in% 32, "Quarries",
if_else(VALUE %in% 100, "Sparse Vegetation",
if_else(VALUE %in% c(101:199), "Tree",
if_else(VALUE %in% c(201:299), "Shrub",
if_else(VALUE %in% c(301:399), "Herb",
"Other"))))))))))) %>%
mutate(height_m = if_else(type %in% "Tree", (VALUE -100),
if_else(type %in% "Shrub", ((VALUE - 200) / 10),
if_else(type %in% "Herb", ((VALUE - 300) / 10), 0))) %>%
as.character() %>% as.numeric())
# create bin breaks for grouping
breaks <- c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100)
# create intervals for grouping and summarize
# also create factor order for "type"
evhgroup <- evhname %>%
mutate(interval = cut(height_m,
breaks,
include.lowest = TRUE,
right = F,
labels = c("0", "0.1-0.2", "0.2-0.3", "0.3-0.4" ,"0.4-0.5", "0.5-0.6", "0.6-0.7", "0.7-0.8", "0.8-0.9", "0.9-1.0", "1-5", "5-10", "10-15", "15-20", "20-25", "25-30", "30-35", "35-40", "40-45", "45-50", "50-55", "55-60", "60-65", "65-70", "70-75", "75-80", "80-85", "85-90", "90-95", "95-100")),
type = factor(type, levels = c("Tree", "Shrub", "Herb", "Open Water", "Snow / Ice", "Developed", "Agriculture", "Sparse Vegetation", "Barren", "Quarries", "Other"))) %>%
group_by(type, interval) %>%
summarise(VALUE = sum(VALUE),
ACRES = sum(ACRES),
REL_PERCENT = sum(REL_PERCENT))
# add label and legend names based on condition
evhgroup <- evhgroup %>% mutate(label = if_else(type %in% c("Tree", "Shrub", "Herb"),
paste0(type, " Height = ", interval, " m"), as.character(type)),
legend = if_else(type %in% c("Tree", "Shrub", "Herb", "Open Water"),
type, as.factor("Other")))
# turn current label order to factors
evhlabel.list <- evhgroup$label
evhgroup <- evhgroup %>% mutate(label = fct_rev(factor(label, evhlabel.list)))
# create factor level colors for legend
cols <- c("Tree" = "#196F3D", "Shrub" = "#229954", "Herb" = "#52BE80", "Open Water" = "#7FB3D5",
"Other" = "#808B96")
# plot
evhChart <-
ggplot(data = evhgroup, aes(x = label, y = REL_PERCENT, fill = legend)) +
geom_bar(stat = "identity") +
labs(
title = "Existing Vegetation Height",
subtitle = "Represents canopy height of dominant lifeform ca2020",
caption = "\nData from landfire.gov.",
x = "",
y = "Percent of landscape") +
scale_fill_manual(values = cols, name = "") +
coord_flip() +
theme_bw(base_size = 14)
evhChart
```
<br>