@@ -79,45 +79,25 @@ def data_2d():
7979 return create_interpolation_data ().isel (depth = 0 ).values
8080
8181
82- @pytest .fixture
83- def data_3d ():
84- """Reference data used for testing interpolation."""
85- return create_interpolation_data ().values
86-
87-
88- class TestInterpolationMethods :
82+ @pytest .mark .parametrize (
83+ "func, eta, xsi, expected" ,
84+ [
85+ pytest .param (interpolation ._nearest_2d , 0.49 , 0.49 , 3.0 , id = "nearest_2d-1" ),
86+ pytest .param (interpolation ._nearest_2d , 0.49 , 0.51 , 4.0 , id = "nearest_2d-2" ),
87+ pytest .param (interpolation ._nearest_2d , 0.51 , 0.49 , 5.0 , id = "nearest_2d-3" ),
88+ pytest .param (interpolation ._nearest_2d , 0.51 , 0.51 , 6.0 , id = "nearest_2d-4" ),
89+ pytest .param (interpolation ._tracer_2d , None , None , 6.0 , id = "tracer_2d" ),
90+ ],
91+ )
92+ def test_raw_2d_interpolation (data_2d , func , eta , xsi , expected ):
93+ """Test the 2D interpolation functions on the raw arrays.
94+
95+ Interpolation via the other interpolation methods are tested in `test_scipy_vs_jit`.
96+ """
8997 ti = 0
90- zi , yi , xi = 1 , 1 , 1
91-
92- @pytest .mark .parametrize (
93- "func, eta, xsi, expected" ,
94- [
95- pytest .param (interpolation ._nearest_2d , 0.49 , 0.49 , 3.0 , id = "nearest_2d-1" ),
96- pytest .param (interpolation ._nearest_2d , 0.49 , 0.51 , 4.0 , id = "nearest_2d-2" ),
97- pytest .param (interpolation ._nearest_2d , 0.51 , 0.49 , 5.0 , id = "nearest_2d-3" ),
98- pytest .param (interpolation ._nearest_2d , 0.51 , 0.51 , 6.0 , id = "nearest_2d-4" ),
99- pytest .param (interpolation ._tracer_2d , None , None , 6.0 , id = "tracer_2d" ),
100- # pytest.param(interpolation._linear_2d, ...),
101- # pytest.param(interpolation._linear_invdist_land_tracer_2d, ...),
102- ],
103- )
104- def test_2d (self , data_2d , func , eta , xsi , expected ):
105- ctx = interpolation .InterpolationContext2D (data_2d , eta , xsi , self .ti , self .yi , self .xi )
106- assert func (ctx ) == expected
107-
108- @pytest .mark .parametrize (
109- "func, eta, xsi, expected" ,
110- [
111- # pytest.param(interpolation._nearest_3d, ...),
112- # pytest.param(interpolation._cgrid_velocity_3d, ...),
113- # pytest.param(interpolation._linear_invdist_land_tracer_3d, ...),
114- # pytest.param(interpolation._linear_3d, ...),
115- # pytest.param(interpolation._tracer_3d, ...),
116- ],
117- )
118- def test_3d (self , data_3d , func , zeta , eta , xsi , expected ):
119- ctx = interpolation .InterpolationContext3D (data_3d , zeta , eta , xsi , self .ti , self .zi , self .yi , self .xi )
120- assert func (ctx ) == expected
98+ yi , xi = 1 , 1
99+ ctx = interpolation .InterpolationContext2D (data_2d , eta , xsi , ti , yi , xi )
100+ assert func (ctx ) == expected
121101
122102
123103@pytest .mark .usefixtures ("tmp_interpolator_registry" )
0 commit comments