xugrid.RelativeOverlapRegridder#
- class xugrid.RelativeOverlapRegridder(source: UgridDataArray, target: UgridDataArray, method: str | Callable = 'first_order_conservative')[source]#
The RelativeOverlapRegridder regrids by computing which target faces overlap with which source faces. It stores the area of overlap, which can be used in multiple ways to aggregate the values associated with the source faces. Unlike the OverlapRegridder, the intersection area is divided by the total area of the source face. This is required for e.g. first-order conserative regridding.
Currently supported aggregation methods are:
"max_overlap"
Custom aggregation functions are also supported, if they can be compiled by Numba. See the User Guide.
- Parameters:
source (Ugrid2d, UgridDataArray)
target (Ugrid2d, UgridDataArray)
method (str, function, optional) – Default value is “first_order_conservative”.
- __init__(source: UgridDataArray, target: UgridDataArray, method: str | Callable = 'first_order_conservative')[source]#
Methods
__init__
(source, target[, method])from_dataset
(dataset)Reconstruct the regridder from a dataset with source, target indices and weights.
from_weights
(weights, target[, method])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