Skip to content

Commit 72f5eb1

Browse files
committed
Add interpolators and mir interface
1 parent 2d7ec32 commit 72f5eb1

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

docs/guide/interpolate.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Interpolation
22
==============
33

4-
.. py:function:: interpolate(values, in_grid=None, out_grid=None, matrix_source=None, method='linear', backend=None, **kwargs)
4+
.. py:function:: interpolate(values, in_grid=None, out_grid=None, matrix_source=None, method='linear', interpolator=None, **kwargs)
55
66
Interpolate the ``values`` from the ``in_grid`` onto the ``out_grid``.
77

@@ -13,8 +13,8 @@ Interpolation
1313
:type out_grid: dict
1414
:param method: the interpolation method. Possible values are ``linear`` and ``nearest-neighbour``. For ``nearest-neighbour`` the following aliases are also supported: ``nn``, ``nearest-neighbor``.
1515
:type method: str
16-
:backend: the backend to use for the interpolation. When it is None, the backends specified by the ``backend-order`` :ref:`config <configs>` option tried in the given order.
17-
:type backend: str, list of str, None
16+
:interpolator: the interpolator to use for the interpolation. When it is None, the interpolator specified by the ``interpolator-order`` :ref:`config <configs>` option tried in the given order.
17+
:type interpolator: str, list of str, None
1818
:return: The same type of data as ``values`` containing the interpolated values.
1919
:rtype: ndarray, :xref:`fieldlist`
2020
:raises ValueError: if a pre-generated interpolation matrix is not available
File renamed without changes.

src/earthkit/regrid/interpolators/mir.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ class MirInterpolator(Interpolator):
1414
name = "mir"
1515

1616
def interpolate(self, values, in_grid, out_grid, method, **kwargs):
17-
try:
18-
import mir
19-
except ImportError:
20-
self.enabled = False
21-
raise ImportError("The 'mir' package is required for this operation")
17+
raise NotImplementedError("This method is not implemented yet")
2218

23-
return mir.interpolate(values, in_grid, out_grid, method, **kwargs)
19+
# TODO: Implement the interpolation using the 'mir' package.
20+
# The code below is a placeholder and should be replaced with the actual implementation.
21+
# try:
22+
# import pymir
23+
# except ImportError:
24+
# self.enabled = False
25+
# raise ImportError("The 'mir' package is required for this operation")
26+
27+
# return pymir.interpolate(values, in_grid, out_grid, method, **kwargs)
2428

2529

2630
interpolator = MirInterpolator

0 commit comments

Comments
 (0)