cordex.cell_area

Contents

cordex.cell_area#

cell_area(ds, R=6371000, attrs=True)[source]#

Compute cell areas for a regular spherical grid.

Parameters:
  • ds (str) – Dataset containing a regular grid with longitude and latitude coordinates that can be understood by cf_xarray.

  • R (float) – Earth radius in units [m]. Defaults to 6371000 meters.

  • attrs (logical or str) – If True, add attributes for grid-cell area. If "CF", add CF attributes for atmospheric grid-cell area.

Returns:

Cell area (xr.DataArray) – DataArray containg the size of each grid cell in units [m2]

Notes

The solid angle differential of the sphere is computed as

\[d\Omega = \sin\theta\,d\theta\,d\phi\]

with the surface element

\[dA = R^2 d\Omega\]

References

https://en.wikipedia.org/wiki/Solid_angle