arrayspline: Applies a spline function to an array of values

Description Usage Arguments Details Value Examples

View source: R/othertools.R

Description

arrayspline is used to derive e.g. hourly climate data from e.g. daily values.

Usage

1
arrayspline(a, tme, nfact = 24, out = NA)

Arguments

a

a three-dimensional array (row, column, time)

tme

an object of class POSIXct of times for a. I.e. length(tme) = dim(a)[3]

nfact

indicates the time interval for which outputs are required. E.g to derive hourly from daily data nfact = 24, or derive six-hourly from daily data nfact = 4

out

an optional character vector indicating the time for which the output is required. Format must be as for tme.

Details

arrayspline uses the Forsythe, Malcolm and Moler method of splining, as specified by "fmm" in spline(). If a[i, j, ] is a vector of NAs, then tthe corresponding vector in the output array is also a vector of NAs. It is assumed that all spatial data within a have equivelent times. I.e. the time of both a[1, 1, 1] and a[1000, 1000, 1] is identical and equal to tme[1].

Value

If out is unspecified, a three dimensional array of size c(a[1], a[2], (length(tme) - 1) * nfact + 1) is returned. If out is specified, a three dimensional array of size c(a[1], a[2], length(out)) is returned.

Examples

1
2
3
4
5
library(raster)
tme <- as.POSIXct(c(0:364) * 24 * 3600, origin="2010-01-01", tz = "GMT")
h <- arrayspline(huss, tme, out = "2010-05-01 11:00")
plot(raster(h, template = dtm1km),
     main = "Specific humidity 2010-05-01 11:00")

ilyamaclean/microclima documentation built on Dec. 7, 2018, 8:57 a.m.