| 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.
AreaWeighted(data, area, lon_dim = "lon", lat_dim = "lat", ncores = NULL)
data |
A multidimensional array with named dimensions (at least lon_dim and lat_dim) containing climate data. |
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. |
An array with the same dimensions as 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))
area <- array(data = 1:10, dim = c(lon = 5, lat = 3))
AreaWeighted(data, area)
# With extra region dimension
area <- array(data = 1:10, dim = c(lon = 5, lat = 3, region = 4))
AreaWeighted(data, area)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.