lair.geo.gridcell_area_from_latlon#

lair.geo.gridcell_area_from_latlon(lat, lon, R=None)[source]#

Calculate the area of each grid cell in a lat-lon grid.

Parameters:
  • lat (ArrayLike) – Latitude array

  • lon (ArrayLike) – Longitude array

  • R (float, optional) – Radius of a sphere in kilometers to use instead of the WGS84 ellipsoid, by default None (see gridcell_area()).

Returns:

np.ndarray – Grid-cell area in square-kilometers, shape (len(lat), len(lon))

Return type:

ndarray

See also

gridcell_area

The same for gridded xarray data.

Examples

>>> from lair.geo import gridcell_area_from_latlon
>>> gridcell_area_from_latlon([40.65, 40.75, 40.85], [-111.95, -111.85]).round(3)
array([[93.922, 93.922],
       [93.783, 93.783],
       [93.644, 93.644]])