climatologyVariogram: Empirical variogram of a climatology

View source: R/climatologyVariogram.R

climatologyVariogramR Documentation

Empirical variogram of a climatology

Description

Calculate (and draw) the empirical semivariogram of a climatological grid

Usage

climatologyVariogram(clim, n.classes = 20, do.log = FALSE)

Arguments

clim

A climatological grid (see climatology)

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 FALSE. Otherwise log1p is used.

Details

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.

Value

Plots a semivariogram and invisibly returns the data used to construct it (semivariance, distance class and number of pairs of points per distance class).

Author(s)

J Bedia

Examples


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


SantanderMetGroup/transformeR documentation built on Oct. 28, 2023, 5:26 a.m.