@@ -2064,17 +2064,28 @@ def test_write_inconsistent_chunks(self) -> None:
2064
2064
def test_roundtrip_cftime_bnds (self ):
2065
2065
# Regression test for issue #7794
2066
2066
import cftime
2067
- original = xr .Dataset (
2068
- {"foo" : ("time" , [0. ]),
2069
- "time_bnds" : (("time" ,"bnds" ), [[cftime .Datetime360Day (2005 , 12 , 1 , 0 , 0 , 0 , 0 ),
2070
- cftime .Datetime360Day (2005 , 12 , 2 , 0 , 0 , 0 , 0 )]])},
2071
- {"time" : [cftime .Datetime360Day (2005 , 12 , 1 , 12 , 0 , 0 , 0 )]})
2072
2067
2068
+ original = xr .Dataset (
2069
+ {
2070
+ "foo" : ("time" , [0.0 ]),
2071
+ "time_bnds" : (
2072
+ ("time" , "bnds" ),
2073
+ [
2074
+ [
2075
+ cftime .Datetime360Day (2005 , 12 , 1 , 0 , 0 , 0 , 0 ),
2076
+ cftime .Datetime360Day (2005 , 12 , 2 , 0 , 0 , 0 , 0 ),
2077
+ ]
2078
+ ],
2079
+ ),
2080
+ },
2081
+ {"time" : [cftime .Datetime360Day (2005 , 12 , 1 , 12 , 0 , 0 , 0 )]},
2082
+ )
2073
2083
2074
2084
with create_tmp_file () as tmp_file :
2075
2085
original .to_netcdf (tmp_file )
2076
2086
with open_dataset (tmp_file ) as actual :
2077
- tb = actual .time_bnds .values
2087
+ # Needed to load time_bnds into memory
2088
+ assert actual .time_bnds .values == original .time_bnds
2078
2089
chunked = actual .chunk (time = 1 )
2079
2090
with create_tmp_file () as tmp_file_chunked :
2080
2091
chunked .to_netcdf (tmp_file_chunked )
0 commit comments