Skip to content
Snippets Groups Projects
Commit b48a6276 authored by lq39quba's avatar lq39quba
Browse files

add paleo date input

parent 6929805c
No related branches found
No related tags found
No related merge requests found
...@@ -292,6 +292,7 @@ ui <- fluidPage( ...@@ -292,6 +292,7 @@ ui <- fluidPage(
"daily" = "P0000-00-01", "daily" = "P0000-00-01",
'one timestep' = "P0000-00-00", 'one timestep' = "P0000-00-00",
"irregular" = "Irregular", "irregular" = "Irregular",
"paleo" = "Paleo",
"other" = "other"), "other" = "other"),
width='80%'), width='80%'),
...@@ -551,11 +552,16 @@ server <- function(input, output) { ...@@ -551,11 +552,16 @@ server <- function(input, output) {
} }
}) })
output$temporal_resoultion_irregular <- renderUI({ output$temporal_resoultion_irregular <- renderUI({
if(input$temporal_resolution=='Irregular'){ if(input$temporal_resolution=='Irregular' | input$temporal_resolution=='Paleo'){
t <- renderText('Provide the definition of your timesteps as a comma-separated list in the format YYYY-MM-DD or short YYYY.') if(input$temporal_resolution=='Irregular'){
t <- renderText('Provide the definition of your timesteps as a comma-separated list in the format YYYY-MM-DD or short YYYY.')
s <- textInput('temp_res_irr', '', width='80%', placeholder='YYYY, YYYY, ...') s <- textInput('temp_res_irr', '', width='80%', placeholder='YYYY, YYYY, ...')
return(list(t,s)) return(list(t,s))
}else{
t <- renderText('Provide the definition of your timesteps as a comma-separated list. The values will represent "kyr B.P.".')
s <- textInput('temp_res_irr', '', width='80%', placeholder='126, 125, ...')
return(list(t,s))
}
} }
}) })
...@@ -566,7 +572,7 @@ server <- function(input, output) { ...@@ -566,7 +572,7 @@ server <- function(input, output) {
#temporal extent---- #temporal extent----
output$temporal_extent <- renderUI({ output$temporal_extent <- renderUI({
if(input$temporal_resolution!='Irregular'){ if(input$temporal_resolution!='Irregular' & input$temporal_resolution!='Paleo'){
if(input$temporal_resolution=='other'){ if(input$temporal_resolution=='other'){
#user defined temporal resolution #user defined temporal resolution
if(grepl('^P{1}\\d{4}-00-00', input$temp_res_txt)){ if(grepl('^P{1}\\d{4}-00-00', input$temp_res_txt)){
...@@ -926,15 +932,27 @@ server <- function(input, output) { ...@@ -926,15 +932,27 @@ server <- function(input, output) {
to_do_list <- c(to_do_list, 'You chose "Irregular" temporal resolution and the input you provided does not match the required form: comma-separated YYYY-MM-DD or comma-separated YYYY. Please check.') to_do_list <- c(to_do_list, 'You chose "Irregular" temporal resolution and the input you provided does not match the required form: comma-separated YYYY-MM-DD or comma-separated YYYY. Please check.')
create <- FALSE create <- FALSE
} }
}
if(input$temporal_resolution=='Paleo'){
timestep_list <- stringr::str_split(input$temp_res_irr, ',')[[1]]
for(ts in timestep_list){
if(is.na(suppressWarnings(as.numeric(ts)))){
to_do_list <- c(to_do_list, paste0('You chose "paleo" temporal resolution. The value "', ts, '" does not seem to be a numeric value. Please check.'))
create <- FALSE
}
}
} }
#temporal extent #temporal extent
if(input$temporal_resolution=='Irregular'){ if(input$temporal_resolution=='Irregular'){
timestep_list <- stringr::str_split(input$temp_res_irr, ',')[[1]] timestep_list <- as.numeric(stringr::str_split(input$temp_res_irr, ',')[[1]])
ts_last <- length(timestep_list) t_start <- min(timestep_list)
t_start <- timestep_list[1] t_end <- max(timestep_list)
t_end <- timestep_list[ts_last]#last timesteps_irr <- paste0('"', paste0(timestep_list, collapse = '", "'), '"')
}else if(input$temporal_resolution=='Paleo'){
timestep_list <- as.numeric(stringr::str_split(input$temp_res_irr, ',')[[1]])
t_start <- max(timestep_list)
t_end <- min(timestep_list)
timesteps_irr <- paste0('"', paste0(timestep_list, collapse = '", "'), '"') timesteps_irr <- paste0('"', paste0(timestep_list, collapse = '", "'), '"')
}else if(input$temporal_resolution=='P0000-00-00'){ }else if(input$temporal_resolution=='P0000-00-00'){
t_start <-input$temporal_extent_input t_start <-input$temporal_extent_input
...@@ -943,7 +961,7 @@ server <- function(input, output) { ...@@ -943,7 +961,7 @@ server <- function(input, output) {
t_start <- input$temporal_extent_input[1] t_start <- input$temporal_extent_input[1]
t_end <- input$temporal_extent_input[2] t_end <- input$temporal_extent_input[2]
} }
if(input$temporal_resolution!='Irregular'){ if(input$temporal_resolution!='Irregular' & input$temporal_resolution!='Paleo'){
timesteps_irr <- '"N/A"' timesteps_irr <- '"N/A"'
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment