oocgcm.core.grids.generic_2d_grid.integrate_dxdy

generic_2d_grid.integrate_dxdy(array, where=None, grid_location=None, normalize=False)

Return the horizontal integral of array in regions where where is True.

Parameters:

array : xarray.DataArray

a dataarray with an additonal attribute specifying the grid_location. The dimension of array should include ‘x’ and ‘y’. The shape of array should match the shape of the grid.

where: boolean xarray.DataArray

dataarray with value = True where the integration should be applied. The dimension of where should be a subset of the dimension of array. For each dimension, the size should be equal to the corresponding size of array dataarray. if where is None, the function return the integral in all the domain defined by the grid object.

grid_location : str

string describing the grid location : eg ‘u’,’v’,’t’,’f’...
  • if grid_location is not None
    check compatibility with array.attrs.grid_location
  • if grid_location is None
    use array.attrs.grid_location by default

normalize : boolean

boolean stating whether of not the integral should be normalized by the area of the region over which the integration is performed.

Returns:

integral: xarray.DataArray

a dataarray with reduced dimension defining the integral of array in the region of interest.

See also

spatial_average_xy
averaging over a region