Skip to content

Commit 4552cd5

Browse files
committed
Add default interpolator mapping
1 parent 39e949b commit 4552cd5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

parcels/field.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ def ZeroInterpolator(
7373
return 0.0
7474

7575

76+
_DEFAULT_INTERPOLATOR_MAPPING = {
77+
XGrid: ZeroInterpolator, # TODO v4: Update these to better defaults
78+
UxGrid: ZeroInterpolator,
79+
}
80+
81+
7682
def _assert_same_function_signature(f: Callable, *, ref: Callable) -> None:
7783
"""Ensures a function `f` has the same signature as the reference function `ref`."""
7884
sig_ref = inspect.signature(ref)
@@ -173,7 +179,7 @@ def __init__(
173179

174180
# Setting the interpolation method dynamically
175181
if interp_method is None:
176-
self._interp_method = ZeroInterpolator # Default to method that returns 0 always
182+
self._interp_method = _DEFAULT_INTERPOLATOR_MAPPING[type(self.grid)]
177183
else:
178184
_assert_same_function_signature(interp_method, ref=ZeroInterpolator)
179185
self._interp_method = interp_method

0 commit comments

Comments
 (0)