| CST_AreaWeighted | R Documentation |
This function computes a spatial area-weighted average of n-dimensional arrays given a spatial mask containing the area (e.g. in m^2) for each grid box.
CST_AreaWeighted(
data,
area,
lon_dim = "lon",
lat_dim = "lat",
ncores = NULL,
extra_info = NULL
)
data |
An object of class |
area |
A multidimensional array with named dimensions (at least lon_dim
and lat_dim) containing area of each grid box. The resolution, length and
order of the lon_dim and lat_dim dimensions should be identical as for
|
lon_dim |
A character string indicating the name of the longitudinal dimension. The default value is 'lon'. |
lat_dim |
A character string indicating the name of the latitudinal dimension. The default value is 'lat'. |
ncores |
An integer indicating the number of cores to use for parallel computation. The default value is NULL. |
extra_info |
A named list with additional metadata to add to the s2dv_cube. There can be one entry for each dimension in 'area' that is not also present in 'data'. |
An object of class s2dv_cube with same dimensions as in object
data, except with lon_dim and lat_dim removed. Any extra
dimensions in area not present in data are preserved in the output (e.g.,
region dimension).
data <- array(data = 1:10, dim = c(year = 10, lon = 5, lat = 3))
coords <- list(lat = 1:3, lon = 1:5)
data <- list(data = data, coords = coords)
attr(data, 'class') <- 's2dv_cube'
area <- array(data = 1:10, dim = c(lon = 5, lat = 3))
CST_AreaWeighted(data, area)
# With extra region dimension
area <- array(data = 1:10, dim = c(lon = 5, lat = 3, region = 4))
CST_AreaWeighted(data, area)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.