finam_regrid.RegridMethod#
- class finam_regrid.RegridMethod(value, names=None, module=None, type=None, start=1)[source]#
Bases:
IntEnum
Specify which interpolation method to use during regridding.
- BILINEAR = <RegridMethod.BILINEAR: 0>#
Bilinear interpolation. Destination value is a linear combination of the source values in the cell which contains the destination point. The weights for the linear combination are based on the distance of destination point from each source value.
- CONSERVE = <RegridMethod.CONSERVE: 2>#
First-order conservative interpolation. The main purpose of this method is to preserve the integral of the field across the interpolation from source to destination. In this method the value across each source cell is treated as a constant, so it will typically have a larger interpolation error than the bilinear or patch methods. The value of a destination cell is calculated as the weighted sum of the values of the source cells that it overlaps. The weights are determined by the amount the source cell overlaps the destination cell. This method requires corner coordinate values to be provided in the
Grid
. It currently only works forFields <esmpy.api.field.Field>`s created on the :class:`~esmpy.api.grid.Grid
center stagger or theMesh
element location.
- CONSERVE_2ND = <RegridMethod.CONSERVE_2ND: 5>#
Second-order conservative interpolation. This method’s main purpose is to preserve the integral of the field across the interpolation from source to destination. The difference between the first and second-order conservative methods is that the second-order takes the source gradient into account, so it yields a smoother destination field that typically better matches the source field. This difference between the first and second-order methods is particularly apparent when going from a coarse source grid to a finer destination grid. Another difference is that the second-order method does not guarantee that after regridding the range of values in the destination field is within the range of values in the source field. For example, if the mininum value in the source field is 0.0, then it’s possible that after regridding with the second-order method, the destination field will contain values less than 0.0. This method requires corner coordinate values to be provided in the
Grid
. It currently only works forFields <esmpy.api.field.Field>`s created on the :class:`~esmpy.api.grid.Grid
center stagger or theMesh
element location.
- NEAREST_DTOS = <RegridMethod.NEAREST_DTOS: 4>#
In this version of nearest neighbor interpolation each source point is mapped to the closest destination point. A given destination point may receive input from multiple source points, but no source point will go to more than one destination point.
- NEAREST_STOD = <RegridMethod.NEAREST_STOD: 3>#
In this version of nearest neighbor interpolation each destination point is mapped to the closest source point. A given source point may go to multiple destination points, but no destination point will receive input from more than one source point.
- PATCH = <RegridMethod.PATCH: 1>#
Higher-order patch recovery interpolation. Destination value is a weighted average of 2D polynomial patches constructed from cells surrounding the source cell which contains the destination point. This method typically results in better approximations to values and derivatives than bilinear. However, because of its larger stencil, it also results in a much larger interpolation matrix (and thus routeHandle) than the bilinear.