@@ -988,9 +988,10 @@ def test_cftimeindex_calendar_property(calendar, expected):
988
988
assert index .calendar == expected
989
989
990
990
991
+ @requires_cftime
991
992
def test_cftime_noleap_with_str ():
992
993
# https://github.com/pydata/xarray/issues/9138
993
- time = xr . cftime_range ("2000-01-01" , "2006-01-01" , freq = "D" , calendar = "noleap " )
994
+ time = pd . date_range ("2000-01-01" , "2006-01-01" , freq = "D" )
994
995
temperature = np .ones (len (time ))
995
996
da = xr .DataArray (
996
997
data = temperature ,
@@ -999,30 +1000,8 @@ def test_cftime_noleap_with_str():
999
1000
time = time ,
1000
1001
),
1001
1002
)
1002
- # works if array is built with cftime
1003
- out = da .sel (time = slice ("2001" , "2002" ))
1004
- da1 = da .convert_calendar ("noleap" )
1005
- # works if array is built with cftime and converted
1006
- out1 = da1 .sel (time = slice ("2001" , "2002" ))
1007
-
1008
- time = pd .date_range (
1009
- "2000-01-01" ,
1010
- "2006-01-01" ,
1011
- freq = "D" ,
1012
- )
1013
- temperature = np .ones (len (time ))
1014
- da2 = xr .DataArray (
1015
- data = temperature ,
1016
- dims = ["time" ],
1017
- coords = dict (
1018
- time = time ,
1019
- ),
1020
- )
1021
- # works if array is built with pandas time
1022
- out2 = da2 .sel (time = slice ("2001" , "2002" ))
1023
- da3 = da2 .convert_calendar ("noleap" )
1024
- # fails if array is built with pandas time and convert to noleap
1025
- out3 = da3 .sel (time = slice ("2001" , "2002" ))
1003
+ da_noleap = da .convert_calendar ("noleap" )
1004
+ da_noleap .sel (time = slice ("2001" , "2002" ))
1026
1005
1027
1006
1028
1007
@requires_cftime
0 commit comments