lair.geo.gridcell_area#

lair.geo.gridcell_area(grid, R=None)[source]#

Calculate the area of each grid cell in a grid.

Note

For lat-lon grids, xesmf.utils.grid_area is used to calculate the area, which requires the radius of the earth in kilometers. If the radius of the earth is not provided, it will be calculated based on the latitude.

Parameters:
  • grid (xr.DataArray | xr.Dataset) – Grid data. rioxarray coords must be set.

  • R (float, optional) – Radius of earth in kilometers, by default calculated based on the latitude.

Returns:

np.ndarray | xr.DataArray – grid-cell area in square-kilometers

Return type:

DataArray