ts_raster: Assemble/interpolate a raster time series

Description Usage Arguments Value Author(s) Examples

View source: R/ts_raster.R

Description

This function assembles a raster time series by assigning or interpolating input rasters to a target time series.

Usage

1
2
3
4
5
6
7
8
ts_raster(
  r_list,
  r_times,
  out_times = NA,
  fade_raster = FALSE,
  ...,
  verbose = TRUE
)

Arguments

r_list

a list of raster objects.

r_times

POSIXct, a vector of times corresponding to the elements of r_list.

out_times

POSIXct, a vector of times for which output rasters will be created.

fade_raster

(Optional) logical. If TRUE performs a linear interpolation to calculate the values for the output raster. Otherwise uses a nearest temporal neighbor approach. Default is FALSE.

...

additional arguments.

verbose

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

Value

a list of raster objects.

Author(s)

Jakob Schwalb-Willmann, Johannes Mast

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#Setup

 library(rtsVis)
 # Load example dataset at a greatly increased interval
x_list <- MODIS_SI_ds[seq(1,length(MODIS_SI_ds),30)]
x_dates <- do.call(c, lapply(MODIS_SI_ds,attr,"time") )[seq(1,length(MODIS_SI_ds),30)]

#Fill NAs
x_list_filled <- ts_fill_na(x_list)

#Make a sequence of output dates, double the length of input dates
out_dates <-seq.POSIXt(from = x_dates[1],
                       to = x_dates[length(x_dates)],length.out = length(x_dates)*2 )

#For each output date, interpolate a raster image from the input files
r_list_out <- ts_raster(r_list = x_list_filled,
                        r_times = x_dates,
                        out_times = out_dates,
                        fade_raster = TRUE)

rtsVis documentation built on May 26, 2021, 5:07 p.m.