99
1010import xarray as xr
1111from xarray .coding .cftimeindex import _parse_array_of_cftime_strings
12- from xarray .core .types import InterpnOptions , InterpOptions , Interp1dOptions , InterpolantOptions
12+ from xarray .core .types import (
13+ Interp1dOptions ,
14+ InterpnOptions ,
15+ InterpolantOptions ,
16+ InterpOptions ,
17+ )
1318from xarray .tests import (
1419 assert_allclose ,
1520 assert_equal ,
3035
3136ALL_1D = get_args (Interp1dOptions ) + get_args (InterpolantOptions )
3237
38+
3339def get_example_data (case : int ) -> xr .DataArray :
3440 if case == 0 :
3541 # 2D
@@ -282,16 +288,13 @@ def func(obj, dim, new_x, method):
282288 )
283289 assert_allclose (actual , expected .transpose ("z" , "w" , "y" , transpose_coords = True ))
284290
291+
285292@requires_scipy
286- @pytest .mark .parametrize (
287- "method" , get_args (InterpnOptions )
288- )
293+ @pytest .mark .parametrize ("method" , get_args (InterpnOptions ))
289294@pytest .mark .parametrize (
290295 "case" , [pytest .param (3 , id = "no_chunk" ), pytest .param (4 , id = "chunked" )]
291296)
292- def test_interpolate_nd (
293- case : int , method : InterpnOptions , nd_interp_coords
294- ) -> None :
297+ def test_interpolate_nd (case : int , method : InterpnOptions , nd_interp_coords ) -> None :
295298 if not has_dask and case == 4 :
296299 pytest .skip ("dask is not installed in the environment." )
297300
@@ -440,7 +443,7 @@ def func(obj, new_x):
440443 axis = obj .get_axis_num ("x" ),
441444 bounds_error = False ,
442445 fill_value = np .nan ,
443- kind = method
446+ kind = method ,
444447 )(new_x )
445448
446449 coords = {"x" : xdest , "y" : da ["y" ], "x2" : func (da ["x2" ], xdest )}
@@ -857,7 +860,7 @@ def test_3641() -> None:
857860
858861@requires_scipy
859862# cubic, quintic, pchip omitted because not enough points
860- @pytest .mark .parametrize ("method" , ("linear" ,"nearest" ,"slinear" ))
863+ @pytest .mark .parametrize ("method" , ("linear" , "nearest" , "slinear" ))
861864def test_decompose (method : InterpOptions ) -> None :
862865 da = xr .DataArray (
863866 np .arange (6 ).reshape (3 , 2 ),
@@ -880,7 +883,7 @@ def test_decompose(method: InterpOptions) -> None:
880883@requires_dask
881884# omit quintic because not enough points
882885# unknown timeout using pchip
883- @pytest .mark .parametrize ("method" , ("cubic" ,"linear" ,"slinear" ))
886+ @pytest .mark .parametrize ("method" , ("cubic" , "linear" , "slinear" ))
884887@pytest .mark .parametrize ("chunked" , [True , False ])
885888@pytest .mark .parametrize (
886889 "data_ndim,interp_ndim,nscalar" ,
@@ -958,7 +961,7 @@ def test_interpolate_chunk_1d(
958961@requires_scipy
959962@requires_dask
960963# quintic omitted because not enough points
961- @pytest .mark .parametrize ("method" , ("linear" ,"nearest" ,"slinear" ,"cubic" ,"pchip" ))
964+ @pytest .mark .parametrize ("method" , ("linear" , "nearest" , "slinear" , "cubic" , "pchip" ))
962965@pytest .mark .filterwarnings ("ignore:Increasing number of chunks" )
963966def test_interpolate_chunk_advanced (method : InterpOptions ) -> None :
964967 """Interpolate nd array with an nd indexer sharing coordinates."""
0 commit comments