Fills gaps by linear interpolation between observations. This function provides the option to define the minimum window under which gaps should be filled, using linear interpolation.
gap.fill(input, max.gap = 60, decimals = 10, df = FALSE)
an is.trex
-compliant object.
Numeric value providing the maximum size of a gap in minutes, which can be filled by performing a linear interpolation.
Integer value defining the number of decimals of the output (default = 10).
Logical; if TRUE
, output is provided in a data.frame
format with a timestamp and a value (\(\Delta T\) or \(\Delta V\)) column.
If FALSE
, output is provided as a zoo
object (default = FALSE).
A zoo
object or data.frame
in the appropriate format for further processing.
if (FALSE) {
# fill two hour gaps
raw <- example.data(type = "doy")
input <-
is.trex(
raw,
tz = "GMT",
time.format = "%H:%M",
solar.time = TRUE,
long.deg = 7.7459,
ref.add = FALSE,
df = FALSE)
# create gaps in data
input[which(input < 0.4 | input > 0.82)] <- NA
fill_120 <- gap.fill(
input = input,
max.gap = 120,
decimals = 10,
df = FALSE)
fill_15 <- gap.fill(
input = input,
max.gap = 15,
decimals = 10,
df = FALSE)
}