@@ -3548,6 +3548,10 @@ def test_to_masked_array(self) -> None:
3548
3548
ma = da .to_masked_array ()
3549
3549
assert len (ma .mask ) == N
3550
3550
3551
+ @pytest .mark .skipif (
3552
+ Version (np .__version__ ) > Version ("1.24" ) or sys .version_info [:2 ] > (3 , 10 ),
3553
+ reason = "cdms2 is unmaintained and does not support newer `numpy` or python versions" ,
3554
+ )
3551
3555
def test_to_and_from_cdms2_classic (self ) -> None :
3552
3556
"""Classic with 1D axes"""
3553
3557
pytest .importorskip ("cdms2" )
@@ -3565,7 +3569,8 @@ def test_to_and_from_cdms2_classic(self) -> None:
3565
3569
IndexVariable ("distance" , [- 2 , 2 ]),
3566
3570
IndexVariable ("time" , [0 , 1 , 2 ]),
3567
3571
]
3568
- actual = original .to_cdms2 ()
3572
+ with pytest .deprecated_call (match = ".*cdms2" ):
3573
+ actual = original .to_cdms2 ()
3569
3574
assert_array_equal (actual .asma (), original )
3570
3575
assert actual .id == original .name
3571
3576
assert tuple (actual .getAxisIds ()) == original .dims
@@ -3578,7 +3583,8 @@ def test_to_and_from_cdms2_classic(self) -> None:
3578
3583
assert len (component_times ) == 3
3579
3584
assert str (component_times [0 ]) == "2000-1-1 0:0:0.0"
3580
3585
3581
- roundtripped = DataArray .from_cdms2 (actual )
3586
+ with pytest .deprecated_call (match = ".*cdms2" ):
3587
+ roundtripped = DataArray .from_cdms2 (actual )
3582
3588
assert_identical (original , roundtripped )
3583
3589
3584
3590
back = from_cdms2 (actual )
@@ -3587,6 +3593,10 @@ def test_to_and_from_cdms2_classic(self) -> None:
3587
3593
for coord_name in original .coords .keys ():
3588
3594
assert_array_equal (original .coords [coord_name ], back .coords [coord_name ])
3589
3595
3596
+ @pytest .mark .skipif (
3597
+ Version (np .__version__ ) > Version ("1.24" ) or sys .version_info [:2 ] > (3 , 10 ),
3598
+ reason = "cdms2 is unmaintained and does not support newer `numpy` or python versions" ,
3599
+ )
3590
3600
def test_to_and_from_cdms2_sgrid (self ) -> None :
3591
3601
"""Curvilinear (structured) grid
3592
3602
@@ -3605,7 +3615,8 @@ def test_to_and_from_cdms2_sgrid(self) -> None:
3605
3615
coords = dict (x = x , y = y , lon = lon , lat = lat ),
3606
3616
name = "sst" ,
3607
3617
)
3608
- actual = original .to_cdms2 ()
3618
+ with pytest .deprecated_call ():
3619
+ actual = original .to_cdms2 ()
3609
3620
assert tuple (actual .getAxisIds ()) == original .dims
3610
3621
assert_array_equal (original .coords ["lon" ], actual .getLongitude ().asma ())
3611
3622
assert_array_equal (original .coords ["lat" ], actual .getLatitude ().asma ())
@@ -3616,6 +3627,10 @@ def test_to_and_from_cdms2_sgrid(self) -> None:
3616
3627
assert_array_equal (original .coords ["lat" ], back .coords ["lat" ])
3617
3628
assert_array_equal (original .coords ["lon" ], back .coords ["lon" ])
3618
3629
3630
+ @pytest .mark .skipif (
3631
+ Version (np .__version__ ) > Version ("1.24" ) or sys .version_info [:2 ] > (3 , 10 ),
3632
+ reason = "cdms2 is unmaintained and does not support newer `numpy` or python versions" ,
3633
+ )
3619
3634
def test_to_and_from_cdms2_ugrid (self ) -> None :
3620
3635
"""Unstructured grid"""
3621
3636
pytest .importorskip ("cdms2" )
@@ -3626,7 +3641,8 @@ def test_to_and_from_cdms2_ugrid(self) -> None:
3626
3641
original = DataArray (
3627
3642
np .arange (5 ), dims = ["cell" ], coords = {"lon" : lon , "lat" : lat , "cell" : cell }
3628
3643
)
3629
- actual = original .to_cdms2 ()
3644
+ with pytest .deprecated_call (match = ".*cdms2" ):
3645
+ actual = original .to_cdms2 ()
3630
3646
assert tuple (actual .getAxisIds ()) == original .dims
3631
3647
assert_array_equal (original .coords ["lon" ], actual .getLongitude ().getValue ())
3632
3648
assert_array_equal (original .coords ["lat" ], actual .getLatitude ().getValue ())
0 commit comments