Description Usage Arguments Details Value Examples
View source: R/workerfunctions.R
Fit General Additive Model to correct UKCP18 data
1 | gamcorrect(observed, ukcp, Trace = TRUE, positive = TRUE)
|
observed |
object of class |
ukcp |
object of class |
Trace |
optional logical indicating whether to plot model fit |
positive |
optional logical indicating whether all values are positive (as with e.g. radiation) |
This function ranks the values of observed
and ukcp
and fits
a General Additive Model (GAM) to these data. The area and time period covered by
observed
and ukcp
, and the spatial resolution of the data should be
identical. If the datasets contain more than 10,000 values then 10000 values
spanning the full range of data are selected. If positive
is TRUE, then only
values greater than 0 are selected when fitting the GAM.
an object of class gam
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Takes a few seconds to run
modfit <- radfit(sis_2005)
# Takes a few minutes to run
ukcpsishourly <- hourlysis(sis_ukcpdaily, modfit, 2000)
# Select data for 2005
tme <- ukcpsishourly$times
sel <- which(tme$year + 1900 == 2005)
xx <- ukcpsishourly$arraydata[,,sel]
ukcp_2005 <- list(arraydata = xx, times = tme[sel], crs = ukcpsishourly$crs,
extent = ukcpsishourly$extent, units = ukcpsishourly$array.units,
description = ukcpsishourly$array.description)
class(ukcp_2005) <- "spatialarray"
od_obs <- opticaldepth(sis_2005)
od_pre <- opticaldepth(ukcp_2005)
gam.mod <- gamcorrect(od_obs, od_pre)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.