Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TerranonvaEBV
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lq39quba
TerranonvaEBV
Commits
9b62365c
Commit
9b62365c
authored
2 years ago
by
lq39quba
Browse files
Options
Downloads
Patches
Plain Diff
implement irregular timesteps
parent
d3793294
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ebv_metadata_app.R
+73
-30
73 additions, 30 deletions
ebv_metadata_app.R
with
73 additions
and
30 deletions
ebv_metadata_app.R
+
73
−
30
View file @
9b62365c
...
...
@@ -98,14 +98,14 @@ ui <- fluidPage(
column
(
6
,
textInput
(
'project_name'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Project Name'
),
width
=
'80%'
,
value
=
'TERRANOVA - The European Landscape Learning Initiative'
,
placeholder
=
'The name(s) of the Project principally responsible for originating this data. Several values should be sep
e
rated by comma.'
),
placeholder
=
'The name(s) of the Project principally responsible for originating this data. Several values should be sep
a
rated by comma.'
),
#span(textOutput("title_desc"), style="font-size:14px")
),
#project url
column
(
6
,
textInput
(
'project_url'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Project URL'
),
width
=
'80%'
,
value
=
"https://www.terranova-itn.eu"
,
placeholder
=
'The URL from the project(s) website. Several values should be sep
e
rated by comma.'
)
placeholder
=
'The URL from the project(s) website. Several values should be sep
a
rated by comma.'
)
)
),
...
...
@@ -291,12 +291,16 @@ ui <- fluidPage(
"weekly"
=
"P0000-00-07"
,
"daily"
=
"P0000-00-01"
,
'one timestep'
=
"P0000-00-00"
,
"irregular"
=
"Irregular"
,
"other"
=
"other"
),
width
=
'80%'
),
#other temporal resolution
uiOutput
(
'temporal_resoultion_other'
),
#irregular temporal resolution
uiOutput
(
'temporal_resoultion_irregular'
),
#temporal extent
uiOutput
(
'temporal_extent'
),
...
...
@@ -546,6 +550,15 @@ server <- function(input, output) {
return
(
list
(
t
,
s
))
}
})
output
$
temporal_resoultion_irregular
<-
renderUI
({
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, ...'
)
return
(
list
(
t
,
s
))
}
})
#check variables
to_do_list
<-
c
()
...
...
@@ -553,43 +566,45 @@ server <- function(input, output) {
#temporal extent----
output
$
temporal_extent
<-
renderUI
({
if
(
input
$
temporal_resolution
==
'other'
){
#user defined temporal resolution
if
(
grepl
(
'^P{1}\\d{4}-00-00'
,
input
$
temp_res_txt
)){
if
(
input
$
temporal_resolution
!=
'Irregular'
){
if
(
input
$
temporal_resolution
==
'other'
){
#user defined temporal resolution
if
(
grepl
(
'^P{1}\\d{4}-00-00'
,
input
$
temp_res_txt
)){
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"yyyy"
)
}
else
if
(
grepl
(
'^P{1}\\d{4}-\\d{2}-00$'
,
input
$
temp_res_txt
)){
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"mm-yyyy"
)
}
else
if
(
grepl
(
'^P{1}\\d{4}-\\d{2}-\\d{2}$'
,
input
$
temp_res_txt
)){
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"dd-mm-yyyy"
)
}
else
{
create
<-
FALSE
to_do_list
<-
c
(
to_do_list
,
'Your temporal resolution does not match the ISO duration format.'
)
}
}
else
if
(
input
$
temporal_resolution
==
'P0000-00-00'
){
#one timestep only
dateInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Date of the dataset*'
),
width
=
'80%'
,
startview
=
'year'
)
}
else
if
(
grepl
(
'^P{1}\\d{4}-00-00$'
,
input
$
temporal_resolution
)){
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"yyyy"
)
}
else
if
(
grepl
(
'^P{1}\\d{4}-\\d{2}-00$'
,
input
$
temp
_res_txt
)){
}
else
if
(
grepl
(
'^P{1}\\d{4}-\\d{2}-00$'
,
input
$
temp
oral_resolution
)){
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"mm-yyyy"
)
}
else
if
(
grepl
(
'^P{1}\\d{4}-\\d{2}-\\d{2}$'
,
input
$
temp_res_txt
))
{
}
else
{
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"dd-mm-yyyy"
)
}
else
{
create
<-
FALSE
to_do_list
<-
c
(
to_do_list
,
'Your temporal resolution does not match the ISO duration format.'
)
}
}
else
if
(
input
$
temporal_resolution
==
'P0000-00-00'
){
#one timestep only
dateInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Date of the dataset*'
),
width
=
'80%'
,
startview
=
'year'
)
}
else
if
(
grepl
(
'^P{1}\\d{4}-00-00$'
,
input
$
temporal_resolution
)){
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"yyyy"
)
}
else
if
(
grepl
(
'^P{1}\\d{4}-\\d{2}-00$'
,
input
$
temporal_resolution
)){
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"mm-yyyy"
)
}
else
{
dateRangeInput
(
'temporal_extent_input'
,
tags
$
span
(
style
=
"font-size: 18px; font-weight: bold"
,
'Start and end date of the dataset*'
),
format
=
"dd-mm-yyyy"
)
}
})
...
...
@@ -893,14 +908,41 @@ server <- function(input, output) {
}
}
#check the input of the irregulare timesteps
if
(
input
$
temporal_resolution
==
'Irregular'
){
timestep_list
<-
stringr
::
str_split
(
input
$
temp_res_irr
,
','
)[[
1
]]
ts_irr_wrong
<-
FALSE
for
(
ts
in
timestep_list
){
if
(
grepl
(
'^\\d{4}-\\d{2}-\\d{2}$'
,
ts
)
|
grepl
(
'^\\d{4}$'
,
ts
)){
#pass
}
else
{
ts_irr_wrong
<-
TRUE
}
}
if
(
ts_irr_wrong
){
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
}
}
#temporal extent
if
(
input
$
temporal_resolution
==
'P0000-00-00'
){
if
(
input
$
temporal_resolution
==
'Irregular'
){
timestep_list
<-
stringr
::
str_split
(
input
$
temp_res_irr
,
','
)[[
1
]]
ts_last
<-
length
(
timestep_list
)
t_start
<-
timestep_list
[
1
]
t_end
<-
timestep_list
[
ts_last
]
#last
timesteps_irr
<-
paste0
(
'"'
,
paste0
(
timestep_list
,
collapse
=
'", "'
),
'"'
)
}
else
if
(
input
$
temporal_resolution
==
'P0000-00-00'
){
t_start
<-
input
$
temporal_extent_input
t_end
<-
input
$
temporal_extent_input
}
else
{
t_start
<-
input
$
temporal_extent_input
[
1
]
t_end
<-
input
$
temporal_extent_input
[
2
]
}
if
(
input
$
temporal_resolution
!=
'Irregular'
){
timesteps_irr
<-
'"N/A"'
}
#check terranova type
...
...
@@ -1015,6 +1057,7 @@ server <- function(input, output) {
"ebv_domain": [\n\t\t\t\t"'
,
paste0
(
ebv_domain_value
,
collapse
=
'",\n\t\t\t\t"'
),
'"\n\t\t\t],
"comment": "'
,
comment
,
'",
"terranova_type": "'
,
input
$
terranova_type
,
'"
"timesteps": [\n\t\t\t\t'
,
timesteps_irr
,
'\n\t\t\t]
}
]
}'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment