lair.geo.BaseGrid.gridcell_area#

property BaseGrid.gridcell_area: DataArray#

Calculate the grid cell area in km^2.

Returns:

xr.DataArray – The grid cell area, on the WGS84 ellipsoid for a lat-lon grid.

See also

gridcell_area

How each cell’s area is computed.

Examples

Two rows of 0.1 degree cells near Salt Lake City:

>>> from lair.geo import BaseGrid, generate_regular_grid
>>> data = generate_regular_grid(
...     -112.0, -111.8, 0.1, 40.6, 40.8, 0.1, x_label="lon", y_label="lat"
... ).rio.set_spatial_dims(x_dim="lon", y_dim="lat")
>>> BaseGrid(data, "EPSG:4326").gridcell_area.values.round(3)
array([[93.922, 93.922],
       [93.783, 93.783]])