Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion R/functions_corr.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ reversecorr <- function(data_L1, data_L2, reverse, tz) {

# reverse differences
if (grepl("jump", flag_old[rev])) {
val[rev:length(val)] <- val[rev:length(val)] + diff_L1[rev]
# if two or more jumps are consecutive, the difference value is accumulated
# so when undoing / reversing one of the jumps is equivalent to reversing
# altogether. This might have a better fix, but for now let's skip when
# there's more than one jump together. Maybe it happens with outliers too?
if (!(r > 1 && rev == reverse_row[r-1]+1)) { # Check the time instant is not the successor of the previous one. so they are consecutive.
val[rev:length(val)] <- val[rev:length(val)] + diff_L1[rev]
}
}
# restore deleted values
if (grepl("out", flag_old[rev])) {
Expand Down