ts_fill_na: Fill NA values in a raster time series

View source: R/ts_fill_na.R

ts_fill_naR Documentation

Fill NA values in a raster time series

Description

Fill NA values in a raster time series

Usage

ts_fill_na(x_list_fill, maskvalues = NULL, verbose = FALSE, rule = 2, ...)

Arguments

x_list_fill

a list of raster objects.

maskvalues

numeric, a vector of values to be set to NA before the masking.

verbose

(Optional) logical. If TRUE outputs progress. Default is FALSE.

rule

for the interpolation in first and last images. If rule is 1 then NAs are returned for such points and if it is 2, the value at the closest data extreme is used. Use, e.g., rule = 2:1, if the left and right side extrapolation should differ. See approxNA. Default is 2.

...

additional arguments to be passed on to approxNA. Of particular interest is the rule argument which defines how first and last cells are dealt with.

Details

Loads all layers of a specific bands into a stack and uses approxNA to fill the NAs if possible. Note that the procedure requires the entire list of raster layery for each band to be be stacked. It is therefore very memory intensive and likely to fail for very large time series.

Value

A list of rasters with NAs filled.

Author(s)

Johannes Mast

Examples



#Setup
 library(rtsVis)
x_list <- MODIS_SI_ds[seq(1,length(MODIS_SI_ds),15)]   #A list of raster objects

#Fill NAs
x_list_filled <- ts_fill_na(x_list) 


JohMast/rtsVis documentation built on Oct. 24, 2023, 8:31 p.m.