xugrid.BarycentricInterpolator#
- class xugrid.BarycentricInterpolator(source: UgridDataArray, target: UgridDataArray, tolerance: float | None = None)[source]#
The BaryCentricInterpolator searches the centroid of every face of the target grid in the source grid. It finds by which source faces the centroid is surrounded (via its centroidal voronoi tesselation), and computes barycentric weights which can be used for to interpolate smoothly between the values associated with the source faces.
- Parameters:
source (Ugrid2d, UgridDataArray) – Source grid to regrid from.
target (Ugrid2d, UgridDataArray) – Target grid to regrid to.
tolerance (float, optional) – The tolerance used to determine whether a point is on an edge. This accounts for the inherent inexactness of floating point calculations. If None, an appropriate tolerance is automatically estimated based on the geometry size. Consider adjusting this value if edge detection results are unsatisfactory.
- __init__(source: UgridDataArray, target: UgridDataArray, tolerance: float | None = None)[source]#
Methods
__init__
(source, target[, tolerance])from_dataset
(dataset)Reconstruct the regridder from a dataset with source, target indices and weights.
from_weights
(weights, target)regrid
(data)Regrid the data from a DataArray from its old grid topology to the new target topology.
regrid_dataarray
(source, source_dims)to_dataset
()Store the computed weights and target in a dataset for re-use.
weights_as_dataframe
()Return the weights as a three column dataframe:
Attributes
weights