uxarray.grid.neighbors.DataArrayNeighborhood

uxarray.grid.neighbors.DataArrayNeighborhood#

class uxarray.grid.neighbors.DataArrayNeighborhood(neighborhood, uxda)#

Neighborhood of radius r around the elements of one data variable, ready to be reduced over.

Carries the same reduction methods as Neighborhood, with the data already supplied, so they take only the parameters of the reduction itself. The underlying neighbor query is built once and reused by every reduction called on this object.

Returned by UxDataArray.neighborhood(); not constructed directly.

Examples

>>> import uxarray as ux
>>> uxds = ux.tutorial.open_dataset("outCSne30-vortex")  
>>> nb = uxds["psi"].neighborhood(r=5.0)  
>>> smooth, spread = nb.mean(), nb.std(ddof=1)  

See also

Neighborhood

The unbound neighborhood this wraps.

__init__(neighborhood, uxda)#

Methods

__init__(neighborhood, uxda)

max()

Largest value in each neighborhood.

mean()

Mean of each neighborhood.

median()

Median of each neighborhood.

min()

Smallest value in each neighborhood.

percentile(q)

Percentile q (between 0 and 100) of each neighborhood.

ptp()

Peak-to-peak spread (max - min) of each neighborhood.

quantile(q)

Quantile q (between 0 and 1) of each neighborhood.

reduce(func)

Reduces each neighborhood with an arbitrary callable.

std([ddof])

Standard deviation of each neighborhood, with ddof delta degrees of freedom.

sum()

Sum of each neighborhood.

var([ddof])

Variance of each neighborhood, with ddof delta degrees of freedom.

Attributes

grid

Grid the neighborhood was built from.

grid_dim

Name of the grid dimension this reduces over.

n_neighbors

Number of elements in each neighborhood.

neighborhood

The unbound Neighborhood these reductions run on.

on

Grid location the neighborhood is centered on.

r

Neighborhood radius, in degrees.