-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27044fe
commit 99386d4
Showing
15 changed files
with
1,295 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ docs | |
inst/doc | ||
/doc/ | ||
/Meta/ | ||
.quarto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,18 @@ spWSCcolPal <- list(rev(c("#440154","#462777","#3D4988","#30678D","#25818E","#1 | |
rev(c("#780085","#7F2FD1","#686DF9","#4C9ED9","#3FC29F","#53DA60","#85EB50","#C1EC58","#E4D05C","#F9965B")), | ||
rev(c("#780085","#7F2FD1","#686DF9","#4C9ED9","#3FC29F","#53DA60","#85EB50","#C1EC58","#E4D05C","#F9965B"))) | ||
|
||
spFCSTnames <- c("onset", "cessation") | ||
|
||
nc.att <- c("Institution=Sant’Anna School of Advanced Studies (SSSA)", | ||
"Group=Center of Plant Sciences", | ||
"Project=FOCUSafrica, Food security Case study-03 (CS3)", | ||
"WP5=Develop end-user tailored climate services prototypes", | ||
"Contact-1=Robel Takele [[email protected]]", | ||
"Contact-2=Matteo Dell'Acqua [[email protected]]", | ||
"Source=Generated by the AquaBEHER package (version 0.1.0)", | ||
"Source.Reference=URL: https://github.com/RobelTakele/AquaBEHER", | ||
"BugReports=https://github.com/RobelTakele/AquaBEHER/issues") | ||
|
||
################################################################################################################## | ||
################################################################################################################## | ||
|
||
|
@@ -102,7 +114,14 @@ app_ui <- function(request) { | |
|
||
navbarMenu("Seasonal Calendar", | ||
tabPanel("From Location Data", mod_locWSC_ui("locWSC_1")), | ||
tabPanel("From Gridded Data", mod_spWSC_ui("spWSC_1"))) | ||
tabPanel("From Gridded Data", mod_spWSC_ui("spWSC_1"))), | ||
|
||
navbarMenu("Preparing Data", | ||
tabPanel("CPT to NetCDF", mod_cpt2nc_ui("cpt2nc_1"))), | ||
|
||
navbarMenu("Seasonal Forecast", | ||
tabPanel("From Location Data", mod_locFCST_ui("locFCST_1")), | ||
tabPanel("From Gridded Data", mod_spFCST_ui("spFCST_1"))) | ||
|
||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#' cpt2nc UI Function | ||
#' | ||
#' @description A shiny Module. | ||
#' | ||
#' @param id,input,output,session Internal parameters for {shiny}. | ||
#' | ||
#' @noRd | ||
#' | ||
#' @importFrom shiny NS tagList | ||
mod_cpt2nc_ui <- function(id){ | ||
ns <- NS(id) | ||
tagList( | ||
|
||
|
||
tabPanel(title = " ", | ||
|
||
titlePanel("Convert CPT file to NetCDF"), | ||
|
||
# shinyjs::useShinyjs(), | ||
|
||
sidebarLayout( | ||
sidebarPanel( | ||
title = " ", | ||
|
||
tags$head( | ||
# this changes the size of the popovers | ||
tags$style(".popover{width:500px;height:200px;}") | ||
), | ||
|
||
|
||
fileInput(inputId = "cpt2nc_xlsxInput", | ||
label = h4( span("Select CPT Tercile Probability File to Import: ",), | ||
style = "color: #4d3a7d;" | ||
|
||
), | ||
|
||
accept = ".xlsx", | ||
width = '100%', | ||
buttonLabel = "Browse...", | ||
placeholder = "No file selected", | ||
capture = NULL), | ||
|
||
numericInput(inputId = "LONGlengthInput", | ||
label = "Input the number of longitudes", | ||
value = 152, | ||
min = 1, | ||
max = 10000, | ||
width = '100%'), | ||
|
||
numericInput(inputId = "LATlengthInput", | ||
label = "Input the number of latitudes", | ||
value = 234, | ||
min = 1, | ||
max = 10000, | ||
width = '100%'), | ||
|
||
shinyWidgets::airDatepickerInput( | ||
inputId = "cpt2nc_date", | ||
label = "Forecast Start Date (yyyy-MM-dd):", | ||
separator = " - ", | ||
dateFormat = "yyyy-MM-dd", | ||
autoClose = TRUE, | ||
view = c("days", "months", "years"), | ||
value = Sys.Date() - 7), | ||
|
||
|
||
p(strong("Select NetCDF output directory: ")), | ||
shinyFiles::shinyDirButton(id = "dirCDF", | ||
label = " Please select a folder to save NetCDF data ...", | ||
icon = icon("save", lib = "glyphicon"),, | ||
class = "shinyDirectories btn-default", | ||
title = "Upload ", | ||
type = "button "), | ||
br(), | ||
verbatimTextOutput(outputId = "dirCDF", placeholder = TRUE), | ||
br(), | ||
|
||
shinyWidgets::textInputIcon(inputId = "cdfFilePrefix", | ||
label = "NetCDF data output file name prefix:", | ||
placeholder = "NetCDF", | ||
width = '100%'), | ||
|
||
div(style="position:relative; left:calc(70%);", | ||
|
||
shinyWidgets::actionBttn(inputId = "cpt2nc_runButton", | ||
label = " Convert ", | ||
color = "primary", | ||
size = 'md', | ||
style = "jelly", | ||
# style = "color: #fff; background-color: #27ae60; border-color: #fff;", | ||
icon = icon("play"), | ||
block = FALSE) | ||
) | ||
|
||
), | ||
|
||
mainPanel( | ||
tabsetPanel( | ||
tabPanel( | ||
title = "Data Viewer", | ||
|
||
shinyjs::useShinyjs(), | ||
|
||
fluidPage( | ||
|
||
br(), | ||
|
||
leaflet::leafletOutput(outputId = 'rainTERmap', width = "100%", height = 500), | ||
|
||
br(), | ||
|
||
|
||
) | ||
) | ||
) | ||
) | ||
|
||
) | ||
) | ||
|
||
|
||
|
||
|
||
) | ||
} | ||
|
||
#' cpt2nc Server Functions | ||
#' | ||
#' @noRd | ||
mod_cpt2nc_server <- function(id){ | ||
moduleServer( id, function(input, output, session){ | ||
ns <- session$ns | ||
|
||
}) | ||
} | ||
|
||
## To be copied in the UI | ||
# mod_cpt2nc_ui("cpt2nc_1") | ||
|
||
## To be copied in the server | ||
# mod_cpt2nc_server("cpt2nc_1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
#' locFCST UI Function | ||
#' | ||
#' @description A shiny Module. | ||
#' | ||
#' @param id,input,output,session Internal parameters for {shiny}. | ||
#' | ||
#' @noRd | ||
#' | ||
#' @importFrom shiny NS tagList | ||
mod_locFCST_ui <- function(id){ | ||
ns <- NS(id) | ||
tagList( | ||
|
||
tabPanel(title = " ", | ||
|
||
titlePanel("Seasonal Forecast"), | ||
|
||
# shinyjs::useShinyjs(), | ||
|
||
sidebarLayout( | ||
sidebarPanel( | ||
title = " ", | ||
|
||
tags$head( | ||
# this changes the size of the popovers | ||
tags$style(".popover{width:500px;height:200px;}") | ||
), | ||
|
||
fileInput(inputId = "rainTerc_xlsxInput", | ||
label = h4( span("Select Tercile Probability File to Import: ",), | ||
style = "color: #4d3a7d;" | ||
|
||
), | ||
|
||
accept = ".xlsx", | ||
width = '100%', | ||
buttonLabel = "Browse...", | ||
placeholder = "No file selected", | ||
capture = NULL), | ||
|
||
fileInput(inputId = "sesRain_xlsxInput", | ||
label = h4( span("Select Seasonal Rain File to Import: ",), | ||
style = "color: #4d3a7d;" | ||
|
||
), | ||
|
||
accept = ".xlsx", | ||
width = '100%', | ||
buttonLabel = "Browse...", | ||
placeholder = "No file selected", | ||
capture = NULL), | ||
|
||
fileInput(inputId = "fcstVarDF_xlsxInput", | ||
label = h4( span("Select WSC Variable File to Import: ",), | ||
style = "color: #4d3a7d;" | ||
|
||
), | ||
|
||
accept = ".xlsx", | ||
width = '100%', | ||
buttonLabel = "Browse...", | ||
placeholder = "No file selected", | ||
capture = NULL), | ||
|
||
selectInput("FCSTvar", label = h4("Choose WSC Variable:"), | ||
choices = list("Onset" = "onset", | ||
"Cessation" = "cessation"), | ||
selected = 1), | ||
|
||
div(style="position:relative; left:calc(60%);", | ||
|
||
shinyWidgets::actionBttn(inputId = "FCST_runButton", | ||
label = " Run Forecast", | ||
color = "primary", | ||
size = 'md', | ||
style = "jelly", | ||
# style = "color: #fff; background-color: #27ae60; border-color: #fff;", | ||
icon = icon("play"), | ||
block = FALSE) | ||
) | ||
|
||
), | ||
|
||
mainPanel( | ||
tabsetPanel( | ||
tabPanel( | ||
title = "Data", | ||
|
||
fluidPage( | ||
|
||
DT::dataTableOutput("seasFCSTtable"), | ||
|
||
br(), | ||
|
||
div(style="position:relative; left:calc(5%);", | ||
shinyWidgets::downloadBttn(outputId = 'downloadFCST', | ||
label = "Download Forecast Data", | ||
color = "success", | ||
size = 'md', | ||
style = "jelly", | ||
icon = icon("download"), | ||
block = FALSE) | ||
) | ||
) | ||
), | ||
|
||
tabPanel( | ||
title = "Plot", | ||
|
||
br( ), | ||
|
||
shinyjs::useShinyjs(), | ||
|
||
br( ), | ||
|
||
div(style="position:relative; left:calc(5%);", | ||
|
||
shinyWidgets::actionBttn(inputId = "seasFCST_plotButton", | ||
label = " Plot Forecast", | ||
color = "success", | ||
size = 'lg', | ||
style = "jelly", | ||
# style = "color: #fff; background-color: #27ae60; border-color: #fff;", | ||
icon = icon("chart-line"), | ||
block = FALSE) | ||
), | ||
|
||
br( ), | ||
|
||
plotly::plotlyOutput("seasFCSTplot"), | ||
|
||
br( ), | ||
|
||
) | ||
|
||
) | ||
|
||
) | ||
) | ||
) | ||
|
||
) | ||
} | ||
|
||
#' locFCST Server Functions | ||
#' | ||
#' @noRd | ||
mod_locFCST_server <- function(id){ | ||
moduleServer( id, function(input, output, session){ | ||
ns <- session$ns | ||
|
||
}) | ||
} | ||
|
||
## To be copied in the UI | ||
# mod_locFCST_ui("locFCST_1") | ||
|
||
## To be copied in the server | ||
# mod_locFCST_server("locFCST_1") |
Oops, something went wrong.