anomaly: anomaly

View source: R/anomaly.R

anomalyR Documentation

anomaly

Description

This function calculates the anomaly (number of standard deviations from the mean climatology) of a forecast layer.

Usage

anomaly(r, b, asEFFIS = FALSE)

Arguments

r

is the RasterLayer to compare to the climatology.

b

RasterBrick/Stack containing the historical observations or a proxy (typically a reanalysis) that is used to derive the climatological information.

asEFFIS

Logical, if TRUE the anomalies are categorised as in EFFIS. If FALSE (default), the returned anomalies are continuous variables.

Details

The objects r and b should be comparable: same resolution and extent. More information on anomaly is available here: https://bit.ly/2Qvekz4. To estimate fire climatology one can use hindcast or reanalysis data. Examples of the latter are available from Zenodo: https://zenodo.org/communities/wildfire.

Value

The function returns a RasterLayer with extent, resolution and land-sea mask matching those of r. Values are the number standard deviations from the historical mean values.

Examples

## Not run: 
  # Generate dummy RasterLayer
  r <- raster(nrows = 1, ncols = 1,
              xmn = 0, xmx = 360, ymn = -90, ymx = 90, vals = 0.3)
  raster::setZ(r) <- as.Date("2018-01-01")
  # Generate dummy RasterBrick
  b <- raster::brick(lapply(1:(365 * 3),
                  function(i) raster::setValues(r, runif(raster::ncell(r)))))
  raster::setZ(b) <- seq.Date(from = as.Date("1993-01-01"),
                       to = as.Date("1995-12-31"),
                       by = "day")
  # Compute anomaly
  x <- anomaly(r, b)

  # This plots nicely using rasterVis::levelplot(), see example on GWIS
  # (\url{https://gwis.jrc.ec.europa.eu}
  rasterVis::levelplot(x, col.regions = colorRamps::matlab.like(n = 11))

## End(Not run)


ecmwf/caliver documentation built on March 25, 2022, 6:59 a.m.