-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.qmd
121 lines (82 loc) · 3.23 KB
/
index.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
---
title: "EMMA Report"
description: Modeling vegetation postfire recovery data
editor_options:
chunk_output_type: console
output:
html_document:
toc: true
toc_depth: 2
---
Page last updated at `r lubridate::now()`.
```{r, echo=F, message=F,include=F, results="hide"}
library(targets)
library(tidyverse)
library(doParallel)
library(raster)
library(lubridate)
library(sf)
library(plotly)
library(leaflet)
library(gt)
# load data saved in the pipeline
#tar_load(c(envdata, stan_data, model_results, spatial_outputs,model_prediction))
```
# Model Overview
We estimate the age of a site by calculating the years since the last fire. We then fit a curve to model the recovery of vegetation (measured using NDVI) as a function of it's age. An additional level models the parameters of the negative exponential curve as a function of environmental variables. This means that sites with similar environmental conditions should have similar recovery curves. More details are available <a href=https://adamwilsonlab.github.io/emma_report/model_summary.html>here.</a>
# Park Information
```{r prep_parks,echo=FALSE,warning=FALSE,message=FALSE}
#tar_load(parks) #This apparently is no longer allowed per a new update of targets
parks <- read_rds("_targets/objects/parks")
# need to merge each complex into a single geometry
cn <- parks$cape_nature%>%
group_by(COMPLEX)%>%
summarise() %>%
rename(Park = COMPLEX)
np <- parks$national_parks%>%
group_by(CUR_NME)%>%
summarise() %>%
rename(Park = CUR_NME)
parks_sf <- bind_rows(cn,np)
rm(np,cn)
base_url <- "https://adamwilsonlab.github.io/emma_report/reports/"
reports <-
data.frame(report = list.files("reports/")) %>%
mutate(url = paste(base_url,report,sep = ""),
park_name = gsub(pattern = "report.",replacement = "",x = report),
park_name = gsub(pattern = ".html",replacement = "",x = park_name),
park_name = gsub(pattern = "_",replacement = " ",x = park_name)) %>%
mutate(
park = glue::glue("[{park_name}]({url})"),
park = map(park, gt::md))
parks_sf <-
parks_sf %>%
inner_join(y = reports,
by = c("Park"="park_name"))%>%
st_transform(crs = st_crs(4326))%>%
mutate(tag = paste0("Park: <a href=", url,">",Park , "</a>"))
bbox <- st_bbox(parks_sf) %>%
as.vector()
```
```{r park_map,, fig.width = 10, fig.height = 7, echo = FALSE, warning = FALSE, message = FALSE}
leaflet(data = parks_sf) %>%
addProviderTiles("Esri.NatGeoWorldMap", group = "NatGeo") %>%
#addProviderTiles("NASAGIBS.ModisTerraTrueColorCR", group = "True Colors") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "World Imagery") %>%
addPolygons(color = "black",
stroke = TRUE,
fill = TRUE,
group = "Park",
popup = ~tag) %>%
addLayersControl(
baseGroups = c("NatGeo","World Imagery"),
options = layersControlOptions(collapsed = FALSE),position = "topright") %>%
fitBounds(bbox[1], bbox[2], bbox[3], bbox[4])
```
```{r park_table,echo=FALSE,warning=FALSE,message=FALSE,fig.align = 'right'}
reports%>%
dplyr::select(park)%>%
rename(Park = park)%>%
gt()%>%
cols_align(align = "left")
```