@@ -195,6 +195,7 @@ shinyServer(function(input, output, session) {
195
195
swd = sapWoodDepth())
196
196
}
197
197
)
198
+
198
199
if (is.character(out )){
199
200
return (NULL )
200
201
} else {
@@ -326,6 +327,7 @@ shinyServer(function(input, output, session) {
326
327
data = rawData()
327
328
positions = get.positionsFromRawData(dataSource = data ,
328
329
input = input )
330
+
329
331
if (input $ inputType == " HFD_raw" ){
330
332
d = get.delta.from.temp(data , positions )
331
333
}
@@ -376,16 +378,26 @@ shinyServer(function(input, output, session) {
376
378
# ' Button to load filter options
377
379
# ' Assigns unfiltered, long-format data as reactive
378
380
# ' value 'deltaTempLong'
379
- observeEvent(input $ LoadFilter , {
380
- values $ deltaTempLong <- deltaTempLongNoFilter()
381
+ observeEvent(input $ LoadFilter , {
382
+ if (input $ inputType == " HFD_processed_read" ){
383
+ showNotification(" Read-only modus. Filter can't be applied." ,
384
+ type = " warning" )
385
+ } else {
386
+ values $ deltaTempLong <- deltaTempLongNoFilter()
387
+ }
381
388
})
382
389
383
390
# ' Button to apply filter
384
391
# ' Assigns filterd, long-format data as reactive
385
392
# ' value 'deltaTempLong'
386
393
observeEvent(input $ FilterApply , {
387
- values $ deltaTempLong <- get.filteredData(data = values $ deltaTempLong ,
388
- ui.input = input )
394
+ if (input $ inputType == " HFD_processed_read" ){
395
+ showNotification(" Read-only modus. Filter can't be applied." ,
396
+ type = " warning" )
397
+ } else {
398
+ values $ deltaTempLong <- get.filteredData(data = values $ deltaTempLong ,
399
+ ui.input = input )
400
+ }
389
401
})
390
402
391
403
# ' Button to delete filter
@@ -719,14 +731,19 @@ shinyServer(function(input, output, session) {
719
731
if (click == 1 ){
720
732
emptyKvalues()
721
733
}
722
- if (input $ kMethod == " regression" ){
723
- method_name = method_name_reg(ui.input = input )
734
+ if (input $ inputType == " HFD_processed_read" ){
735
+ showNotification(" Read-only modus. K can't be modified." ,
736
+ type = " warning" )
724
737
} else {
725
- method_name = gsub(" ." , " -" , input $ kMethod , fixed = TRUE )
738
+ if (input $ kMethod == " regression" ){
739
+ method_name = method_name_reg(ui.input = input )
740
+ } else {
741
+ method_name = gsub(" ." , " -" , input $ kMethod , fixed = TRUE )
742
+ }
743
+ values $ kvalues [values $ kvalues $ position == input $ kPositionSelect , 2 : 3 ] <- cbind(
744
+ method = as.character(method_name ),
745
+ k = kValue())
726
746
}
727
- values $ kvalues [values $ kvalues $ position == input $ kPositionSelect , 2 : 3 ] <- cbind(
728
- method = as.character(method_name ),
729
- k = kValue())
730
747
})
731
748
732
749
# ' Eventlistener to store k-values from csv upload
@@ -959,14 +976,18 @@ shinyServer(function(input, output, session) {
959
976
# ' Reactive variable holding daily tree water
960
977
# ' use in kg per h and kg per day
961
978
# ' for selected method
962
- treeWaterUse <- reactive({
963
- if (all(is.na(values $ kvalues $ k ))){
964
- return (tab.with.message(message.no.k ))
965
- } else if (get.sapFlowSum() == 0 ){
966
- tab.with.message(message.no.sapflow )
967
- } else {
968
- get.treeWaterUseByMethod(data = sapFlow(),
969
- ui.input = input )
979
+ treeWaterUse <- reactive({
980
+ if (all(is.na(values $ kvalues $ k ))) {
981
+ return (tab.with.message(message.no.k ))
982
+ } else if (get.sapFlowSum() == 0 ) {
983
+ if (input $ inputType == " HFD_processed_read" ) {
984
+ tab.with.message(" Metric not available for uploaded file." )
985
+ } else {
986
+ tab.with.message(message.no.sapflow )
987
+ }
988
+ } else {
989
+ get.treeWaterUseByMethod(data = sapFlow(),
990
+ ui.input = input )
970
991
}
971
992
})
972
993
@@ -1113,13 +1134,26 @@ shinyServer(function(input, output, session) {
1113
1134
1114
1135
1115
1136
# #### Sap Flow Rate #####
1137
+
1138
+ get.sfplot.empty = reactive({
1139
+ if (input $ inputType == " HFD_processed_read" ){
1140
+ return (plot.emptyMessage(message = " Metric not available for uploaded file." ))
1141
+ } else {
1142
+ return (plot.emptyMessage(message = message.no.sapflow ))
1143
+ }
1144
+ })
1145
+
1116
1146
# ##### Diurnal Pattern ######
1117
1147
1118
1148
get.sapFlowSum = reactive({
1119
1149
if (click() > 0 ){
1120
1150
groups = get.selectedMethods(input )
1121
1151
sapFlow = sapFlow()
1122
- return (sum(sapFlow [, groups ], na.rm = T ))
1152
+ if (any(groups %in% colnames(sapFlow ))) {
1153
+ return (sum(sapFlow [, groups ], na.rm = T ))
1154
+ } else {
1155
+ return (0 )
1156
+ }
1123
1157
} else {
1124
1158
return (0 )
1125
1159
}
@@ -1129,16 +1163,16 @@ shinyServer(function(input, output, session) {
1129
1163
# ' Reactive variable holding figure of sap flow rate
1130
1164
# ' for selected methods
1131
1165
sapFlowTreePlot <- reactive({
1132
- if (all(is.na(values $ kvalues $ k ))){
1133
- plot.emptyMessage(message = message.no.k )
1134
- } else {
1135
- if (get.sapFlowSum() == 0 ){
1136
- plot.emptyMessage( message = message.no.sapflow )
1137
- } else {
1138
- plot.sapFlowRate(data = sapFlow(),
1139
- ui.input = input )
1140
- }
1141
- }
1166
+ if (all(is.na(values $ kvalues $ k ))) {
1167
+ plot.emptyMessage(message = message.no.k )
1168
+ } else {
1169
+ if (get.sapFlowSum() == 0 ) {
1170
+ get.sfplot.empty( )
1171
+ } else {
1172
+ plot.sapFlowRate(data = sapFlow(),
1173
+ ui.input = input )
1174
+ }
1175
+ }
1142
1176
})
1143
1177
1144
1178
# ' Eventlistener to show figure of sap flow rate
@@ -1170,15 +1204,15 @@ shinyServer(function(input, output, session) {
1170
1204
# ' Reactive variable holding figure of daily water balance
1171
1205
# ' for selected methods
1172
1206
TWUbarplot <- reactive({
1173
- if (all(is.na(values $ kvalues $ k ))){
1174
- plot.emptyMessage(message = message.no.k )
1175
- } else {
1176
- if (get.sapFlowSum() == 0 ){
1177
- plot.emptyMessage( message = message.no.sapflow )
1178
- } else {
1179
- plot.sapFlowDay(data = sapFlow(),
1180
- ui.input = input )
1181
- }
1207
+ if (all(is.na(values $ kvalues $ k ))) {
1208
+ plot.emptyMessage(message = message.no.k )
1209
+ } else {
1210
+ if (get.sapFlowSum() == 0 ) {
1211
+ get.sfplot.empty( )
1212
+ } else {
1213
+ plot.sapFlowDay(data = sapFlow(),
1214
+ ui.input = input )
1215
+ }
1182
1216
}
1183
1217
})
1184
1218
@@ -1202,15 +1236,17 @@ shinyServer(function(input, output, session) {
1202
1236
# ' Reactive variable holding figure of daily water balance
1203
1237
# ' for selected methods
1204
1238
TWUradialprofilePlot <- reactive({
1205
- if (all(is.na(values $ kvalues $ k ))){
1206
- plot.emptyMessage(message = message.no.k )
1207
- } else {
1208
- if (get.sapFlowSum() == 0 ){
1209
- plot.emptyMessage(message = message.no.sapflow )
1210
- } else {
1211
- plot.twu.radialprofile(data = sapFlow(),
1212
- ui.input = input )
1213
- }
1239
+ if (all(is.na(values $ kvalues $ k ))) {
1240
+ plot.emptyMessage(message = message.no.k )
1241
+ } else {
1242
+ if (get.sapFlowSum() == 0 ) {
1243
+ get.sfplot.empty()
1244
+ } else if (input $ treeScaleSimple1 | input $ treeScaleSimple3 ) {
1245
+ plot.twu.radialprofile(data = sapFlow(),
1246
+ ui.input = input )
1247
+ } else {
1248
+ plot.emptyMessage(message = " Radial profile not available for method 2." )
1249
+ }
1214
1250
}
1215
1251
})
1216
1252
0 commit comments