View source: R/climatologyVariogram.R
climatologyVariogram | R Documentation |
Calculate (and draw) the empirical semivariogram of a climatological grid
climatologyVariogram(clim, n.classes = 20, do.log = FALSE)
clim |
A climatological grid (see |
n.classes |
The number of distance classes used to compute the variogram |
do.log |
Logical. Should the variable be log-transformed prior to variogram calculation? Default to |
The x-axis of the variogram is tyically truncated at half the maximum distance of the dataset, so this is the default behaviour.
Note that the empirical semivariogram is used under the assumption of normality. Thus, the
do.log
option may be activated for non-gaussian fields.
Plots a semivariogram and invisibly returns the data used to construct it (semivariance, distance class and number of pairs of points per distance class).
J Bedia
require(climate4R.datasets)
data("EOBS_Iberia_pr")
# We compute the mean annual DJF precipitation
aggr.fun <- list(FUN = "sum")
annual.tp <- aggregateGrid(EOBS_Iberia_pr, aggr.m = aggr.fun, aggr.y = aggr.fun)
# Now the winter precipitation climatology is computed
tp.clim <- climatology(annual.tp)
require(visualizeR)
spatialPlot(tp.clim,
backdrop.theme = "countries",
main = "mean DJF precip (1983-2002)")
# Visual assessment of normality
par(mfrow = c(1,2))
hist(tp.clim$Data, main = "raw field")
hist(log1p(tp.clim$Data), main = "log-transformed")
par(mfrow = c(1,1))
# Log transformation seems advisable
# The empirical variogram:
climatologyVariogram(clim = tp.clim, n.classes = 20, do.log = TRUE)
# The number of paris of points within each distance class is
# indicated by the figures on the line
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.