-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.R
241 lines (193 loc) · 10.1 KB
/
ui.R
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
library(shiny)
library(ggplot2)
library(shinyWidgets)
library(shinythemes)
library(plotly)
library(data.table)
library(shinycssloaders)
library(leaflet)
library(viridis)
library(shinyBS)
library(shinyjs)
library(cicerone)
library(DT)
library(stringr)
variables <- c("Air temperature", "Surface temperature", "Soil temperature (1 m deep)", "Radiation", "Wind speed", "Precipitation", "Relative humidity", "Soil moisture", "Snow Depth")
variablesTable <- c("Air temperature" = "AirTemp",
"Surface temperature" = "SurfTemp",
"Soil temperature" = "SoilTemp",
"Radiation",
"Wind speed" = "Wind",
"Precipitation",
"Relative humidity" = "Humidity",
"Soil moisture" = "SoilMoist",
"Snow Depth" = "Snow")
variables2 <- c("Air temperature", "Surface temperature", "Radiation")
#"Average soil temperature (1 m deep)" = "Soil temperature (1 m deep)", "Daily average radiation" = "Radiation", "Average wind speed" = "Wind speed")
shinyUI <- fluidPage(id = "page",
use_cicerone(),
useShinyjs(),
theme = shinytheme("united"),
setBackgroundColor(color = "#C7DAE0"),
title = "Microclimate data selection",
titlePanel("TrEnCh Project Microclimate Data Selection Tool"),
hr(),
includeHTML("intro.html"),
hr(),
div(
id = "viz-wrapper",
tabsetPanel(
tabPanel("Data selection",
br(),
fluidRow(
column(2, radioButtons("spaCov", "Area of interest", choices = c("US", "Outside of US"), selected = "US")),
column(2, tipify(numericInput("tempCov_start", "Beginning of temporal coverage", min = 1979, max = 2021, value = 2017),
"Enter the first year for which you need data.")),
column(2, tipify(numericInput("tempCov_end", "End of temporal coverage", min = 1979, max = 2021, value = 2017),
"Enter the last year for which you need data.")),
# column(6, sliderInput("tempCov", "Temporal coverage", min = 1979, max = 2021, value = c(2017, 2017))),
column(2, tipify(awesomeCheckboxGroup("tempRes", "Temporal resolution", choices = c("Monthly", "Daily", "6-hourly", "3-hourly", "Hourly", "Other" = "One day each month"), selected = c("Daily", "3-hourly", "Hourly", "One day each month", "6-hourly","Monthly")),
"This is temporal how frequently the data are collected")),
column(3, tipify(pickerInput("varTable", "Variables of interest", choices = variablesTable, multiple = T, selected = NA, options = list(title = "Select variables",
style = "btn-danger")),
"Select all the climatic variables you want from the dataset.", placement = "top"))
),
p(strong("Suitable datasets")),
# htmlOutput("datasetOutput"),
DT::dataTableOutput("mytable")
),
tabPanel("Temporal comparison",
sidebarLayout(
sidebarPanel(
h4("Temporal comparison"),
p("Select a climatic variable of interest and some datasets to compare for a given season and location.
The time series plot depicts how much the data differ temporally and you can specify two datasets to statistically compare."),
actionBttn(
inputId = "reset1",
label = "Reset",
style = "material-flat",
color = "danger",
size = "xs"
),
bsTooltip("reset1", "If you have already changed the selections, reset them to default here before starting the tour."),
actionBttn(
inputId = "tour1",
label = "Take a tour!",
style = "material-flat",
color = "success",
size = "xs"
),
hr(),
div(
id = "var-wrapper",
pickerInput("var", "Variable", choices = variables,
options = list(style = "btn-success"), multiple = F),
),
uiOutput("datasetsOutputTemp1"),
uiOutput("datasetsOutputTemp2"),
div(
id = "sealoc-wrapper",
radioGroupButtons("season", "Season", choices = c("Summer" = 7, "Winter" = 1), selected = 7, status = "danger", size = "sm"),
radioGroupButtons("loc", "Location", choices = c("Oregon" = "OR", "Colorado" = "CO", "Hawaii" = "HI"), selected = "OR", status = "danger", size = "sm"),
),
br(),
htmlOutput("info"),
leafletOutput("minimap")
),
mainPanel(
div(
id = "plot-wrapper",
plotlyOutput("plot") %>% withSpinner(type = 7)
),
br(),
hr(),
div(
id = "stats-wrapper",
h4("Statistics"),
uiOutput("datasetComparison"),
htmlOutput("stats"),
uiOutput("statsTable")
# uiOutput("coeftable")
),
hr(),
includeHTML("stats.html")
)
)
),
tabPanel("Spatial comparison",
sidebarLayout(
sidebarPanel(
h4("Spatial comparison"),
p("Select a climatic variable of interest and a dataset that contains that variable.
The map will display the bias, root mean squared error, and Pearson correlation coefficient between the data from the chosen dataset and USCRN data for each station in the US."),
actionBttn(
inputId = "reset2",
label = "Reset",
style = "material-flat",
color = "danger",
size = "xs"
),
bsTooltip("reset2", "If you have already changed the selections, reset them to default here before starting the tour."),
actionBttn(
inputId = "tour2",
label = "Take a tour!",
style = "material-flat",
color = "success",
size = "xs"
),
hr(),
div(
id = "var2-wrapper",
pickerInput("mapVar", "Variable", choices = variables2,
options = list(style = "btn-success")),
),
div(id = "mondate-wrapper",
radioGroupButtons("month", "Month", choices = c("Summer" = 7, "Winter" = 1), selected = 7, status = "danger", size = "sm")
),
div(
id = "datasets-wrapper",
uiOutput("mapDatasetsOutput")
)
),
mainPanel(
div(
id = "map-wrapper",
leafletOutput("mymap") %>% withSpinner(type = 7)
)
)
)
),
tabPanel("Operative temperature comparison",
sidebarLayout(
sidebarPanel(
h4("Operative temperature comparison"),
p("These plots predict operative temperature for an ectotherm based on the
environmental conditions specified by the selected dataset(s). Operative temperatures are the predicted equilibrium body temperature of the specified ectotherm in the selected location and season.
We assume the ectotherm is a ", em("Sceloporus")," lizard with a mass of 8.9g.
Available operative temperature estimation models are the Tb_Gates(),
Tb_NormanCampbell, and Tb_lizard functions in the TrenchR package. Green shading highlight datasets with sub-hourly temporal resolution."),
uiOutput("datasetsOutput3"),
uiOutput("datasetsOutput30"),
div(
id = "sealoc-wrapper3",
radioGroupButtons("season3", "Season", choices = c("Summer" = 7, "Winter" = 1), selected = 7, status = "danger", size = "sm"),
radioGroupButtons("loc3", "Location", choices = c("Oregon" = "OR", "Colorado" = "CO", "Hawaii" = "HI"), selected = "OR", status = "danger", size = "sm"),
uiOutput("op3"),
),
br(),
htmlOutput("info3"),
leafletOutput("minimap3")
),
mainPanel(
div(
id = "plot-wrapper3",
plotlyOutput("plot3") %>% withSpinner(type = 7),
br(),
htmlOutput("stats3"),
plotlyOutput("statsmap")
)
))
)
)
)
)