uxarray.Grid.neighborhood#
- Grid.neighborhood(r=1.0, on='face centers')#
Finds the grid elements within
rdegrees of every element ofon, returning a reusableNeighborhood.The radius query behind this dominates the cost of a neighborhood reduction, so building this once and reducing several times over it is substantially cheaper than calling
UxDataArray.neighborhood()repeatedly, which rebuilds it on every call.Unlike
UxDataArray.neighborhood(), the result is not bound to any data, so its reduction methods take the data to reduce as an argument. That is what lets several variables share one query.- Parameters:
- Return type:
Examples
>>> import uxarray as ux >>> uxds = ux.tutorial.open_dataset("outCSne30-vortex") >>> nb = uxds.uxgrid.neighborhood(r=5.0) >>> smooth = nb.mean(uxds["psi"]) >>> p90 = nb.percentile(uxds["psi"], q=90)
See also
NeighborhoodThe reductions available on the returned object.
UxDataArray.neighborhoodNeighborhood bound to a single variable.
UxDataset.neighborhoodNeighborhood across every variable in a dataset.