View source: R/calc_cellarea.R
calc_cellarea | R Documentation |
Calculate the cell area of LPJmL cells based on an LPJmLData
object or latitude coordinates and grid resolution.
Uses a spherical representation of the Earth.
calc_cellarea(
x,
cellsize_lon = 0.5,
cellsize_lat = cellsize_lon,
earth_radius = 6371000.785,
return_unit = "m2"
)
x |
|
cellsize_lon |
Grid resolution in longitude direction in degrees
(default: |
cellsize_lat |
Grid resolution in latitude direction in degrees (default:
same as |
earth_radius |
Radius of the sphere (in |
return_unit |
Character string describing the area unit of the returned
cell areas. Defaults to |
A vector or array matching the space dimension(s) of x
if x
is an
LPJmLData object. A vector of the same length as x
if x
is a vector of
latitude coordinates. Cell areas are returned in the unit return_unit
.
grid <- matrix(
data = c(-179.75, 89.75, -0.25, 0.25, 0.25, -0.25, 179.75, -89.75),
ncol = 2,
byrow = TRUE,
dimnames = list(NULL, c("lon", "lat"))
)
gridarea <- calc_cellarea(grid[,"lat"])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.