deltametrics.plan.compute_land_area¶
- deltametrics.plan.compute_land_area(land_mask)¶
Compute land (delta) area.
Computes the land area for a LandMask as:
\[\sum_{i=1}^L \sum_{j=1}^W A_{ij}\]where \(L\) and \(W\) are the mask dimensions, and \(A_{ij}\) is the area of each cell where \(A_{ij} =dx^2\) if the mask is True, otherwise \(A_{ij} = 0\).
Will return area with the same base units as the spatial coordinates of input array (i.e., for a
Mask
or xarray.DataArray). In the case of a numpy array without coordinates, a unit dimension is assumed for each cell.Note
In implementation, this is a simple 1-liner summation over the mask. It is implemented as a function here for convenience and consistency in the api:
land_area = np.sum(land_mask.integer_mask) * dx * dx
- Parameters:
land_mask (
LandMask
,ndarray
) – Land mask. Can be aLandMask
object, or a binarized array.- Returns:
land_area – Land area, computed as described above.
- Return type:
float
Examples
(
Source code
,png
,hires.png
)