-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.R
More file actions
305 lines (273 loc) · 15.3 KB
/
ui.R
File metadata and controls
305 lines (273 loc) · 15.3 KB
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library("shiny")
library("leaflet")
# TODO: update token section
# Read in API Key for Mesowest --------------------------------------------
# if(!file.exists("~/.mesowesttoken")){
# print("Token not found.", quote = F)
#
# fileName <- 'api_key.txt'
# api_key <- readChar(fileName, file.info(fileName)$size)
#
# mesowest::requestToken(apikey = api_key)
# }
# tweaks, a list object to set up multicols for checkboxGroupInput
tweaks <-
list(tags$head(tags$style(HTML("
.multicol {
height: 150px;
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
-moz-column-fill: balanced;
-column-fill: balanced;
-margin-top: 0px !important;
-webkit-margin-after: 0px !important;
}
.checkbox{
margin-top: 0px !important;
-margin-left: 0px;
-webkit-margin-after: 0px !important;
}
.checkbox-inline {margin-left: 0px;
-margin-top: 0px !important;
-margin: 0 !important;
-webkit-margin-after: 0px !important; }
"))
))
controls <-
list(strong("Wind Direction(s):"),
tags$div(align = 'left',
class = 'multicol',
checkboxGroupInput(inputId = 'wind_directions',
label = "",
choices = windDirList,
selected = "E",
inline = FALSE)))
navbarPage("Fire Weather Explorer", id = "tabs",
tabPanel("Station Selection",
sidebarLayout(
sidebarPanel(
includeMarkdown("includedText/mainPageText.md"),
selectInput('State',
label = "Select State",
choices = State_List,
selected = "CO"),
uiOutput('County'),
uiOutput('station'),
uiOutput('POR'),
actionButton("pickStations", "Download Station Data")
),
mainPanel(
# fluidRow(htmlOutput("metadataTitle")),
leafletOutput("station_location", height = "600")
# fluidRow(htmlOutput("metadata"))
)
)
),
tabPanel(title = "Data Quality Plots", value = "Diagnostic",
sidebarLayout(
#
# This section adds a series of radio buttons that define
# which plots to show in the data quality check plots.
#
sidebarPanel(
radioButtons(inputId = "diagnosticType",
label = "Choose plot type:",
choiceNames = c("Relative Humidity", "Temperature", "Wind Speed", "1 Hr Fuel Moisture","10 hr Fuel Moisture", "Hourly Precipitation","Growing Season Index"),
choiceValues = c("RH","Temp","Wind_Speed","FMC1","FMC10","HourlyPrecip","GSI"),
selected = "RH"),
#
# Include diagnostic plot verbiage by importing a markdown file.
#
includeMarkdown("includedText/diagnosticPlots.md")
),
mainPanel(
#
# This section adds a series of panels that are responsive to
# radio buttons (above). They also check to see if the wx data are
# available for plotting.
#
tabsetPanel(
tabPanel("Data Quality Plots",
conditionalPanel("input.diagnosticType == 'RH'",
plotOutput("rh_ts_plot")),
conditionalPanel("input.diagnosticType == 'Temp'",
plotOutput("temp_ts_plot")),
conditionalPanel("input.diagnosticType == 'Wind_Speed'",
plotOutput("wind_ts_plot")),
conditionalPanel("input.diagnosticType == 'FMC1'",
plotOutput("fmc1_ts_plot")),
conditionalPanel("input.diagnosticType == 'FMC10'",
plotOutput("fmc10_ts_plot")),
conditionalPanel("input.diagnosticType == 'HourlyPrecip'",
plotOutput("precip_ts_plot")),
conditionalPanel("input.diagnosticType == 'GSI'",
plotOutput("gsi_ts_plot"))
),
tabPanel("Data",
div(DT::dataTableOutput("totalPlot"), style = "font-size: 75%; width: 500px"),
downloadButton(outputId = "downloadWxData", "Download CSV of Data"))
)
)
)
),
tabPanel(title = "Station Summary Data", value = "Summary",
sidebarLayout(
#
# This section adds a series of radio buttons that define
# which plots to show in the station data check plots.
#
sidebarPanel(
radioButtons(inputId = "summaryType",
label = "Choose plot type:",
choiceNames = c("Relative Humidity", "Temperature", "Wind Speed"),
choiceValues = c("RH","Temp","Wind_Speed"),
selected = "RH")#,
# radioButtons(inputId = "hourlyType",
# label = "Choose hourly plot type:",
# choiceNames = c("Relative Humidity", "Temperature", "Wind Speed"),
# choiceValues = c("RH","Temp","Wind_Speed"),
# selected = "RH")#,
#
# Include diagnostic plot verbiage by importing a markdown file.
#
#includeMarkdown("includedText/diagnosticPlots.md")
),
mainPanel(
#
# This section adds a series of panels that are responsive to
# radio buttons (above). They also check to see if the wx data are
# available for plotting.
#
# tags$div(class="header", checked = NA,
# tags$h1("Station Summary Plots")),
tabsetPanel(
tabPanel("Monthly Plots",
conditionalPanel("input.summaryType == 'RH'",
plotOutput("month_rh")),
conditionalPanel("input.summaryType == 'Temp'",
plotOutput("month_temp")),
conditionalPanel("input.summaryType == 'Wind_Speed'",
plotOutput("month_wind"))),
tabPanel("Hourly Plots",
conditionalPanel("input.summaryType == 'RH'",
plotOutput("hour_rh")),
conditionalPanel("input.summaryType == 'Temp'",
plotOutput("hour_temp")),
conditionalPanel("input.summaryType == 'Wind_Speed'",
plotOutput("hour_wind"))
)
)
)
)
),
tabPanel("Prescription Plots", id = "Subset",
sidebarLayout(
sidebarPanel(
includeMarkdown("includedText/subsetPlots.md"),
tabsetPanel(
tabPanel(title = "Time",
# Month Sliders
sliderInput(inputId = "months",
label = "Months to use:",
min = 1,
max = 12, value = c(9,12)),
# Hour Sliders
sliderInput(inputId = "hours",
label = "Hours to use:",
min = 1,
max = 24, value = c(8,18))
),
tabPanel(title = "Fuel Moisture",
# RH Sliders
sliderInput(inputId = "rh",
label = "Relative Humidity:",
min = 1,
max = 100,
value = c(15,35)),
# Temp Sliders
sliderInput(inputId = "temp",
label = "Temperature (F):",
min = -15,
max = 110,
value = c(15,75)),
# FM1 Slides
sliderInput(inputId = "FMC1",
label = "1 Hr Fuel Moisture (%):",
min = 0,
max = 30,
value = c(0,30)),
# FM10 Slides
sliderInput(inputId = "FMC10",
label = "10 Hr Fuel Moisture (%)",
min = 0,
max = 60,
value = c(0,60)),
# FM10 Slides
sliderInput(inputId = "FMC100",
label = "100 Hr Fuel Moisture (%)",
min = 0,
max = 40,
value = c(0,40))
),
tabPanel(title = "Wind",tweaks,
# Wind Sliders
sliderInput("wind",
"Wind speeds (mph, 20 ft):",
min = 0,
max = 50, value = c(8,25)),
# Wind Direction Check Boxes
controls,
# checkboxGroupInput("wind_directions", "Wind Directions:",windDirList,
# selected = "E"),
actionLink("selectall","Select All")
)
)
),
# Main Panel Ouput
mainPanel(#tags$div(class="header", checked = NA,
# tags$h1("Prescription Plots")),
tabsetPanel(
tabPanel("Hours in Prescription",
plotOutput("rh_ts_sub_plot", height = "500px")),
tabPanel("Months in Prescription",
plotOutput("rhplot")),
tabPanel("Calendar",
plotOutput("calendarPlot")),
tabPanel("Table",
div(DT::dataTableOutput("prescriptionTable"), style = "font-size: 75%; width: 500px"))
)
)
)
),
tabPanel(title = "Generate Reports", value = "Reports",
sidebarLayout(
sidebarPanel(includeMarkdown("includedText/reportInfo.md")),
mainPanel(textInput(inputId = "ProjectTitle",
label = "Enter Project Title"),
downloadButton(outputId = "downloadReport",
label = "Download Report")
)
)
),
navbarMenu("About",
tabPanel("Fire Weather Explorer", id = "About",
mainPanel(
includeMarkdown("includedText/about.md")
)
),
tabPanel("Help", id = "Help",
mainPanel(
includeMarkdown("includedText/help.md")
)
)
)
)