@@ -134,7 +134,8 @@ def handle_rollback_action(self, *args):
134134 def test_to_zarr (self ):
135135 ds = make_test_dataset (
136136 shape = (1 , 50 , 100 ),
137- chunks = (2 , 50 , 50 )
137+ chunks = (2 , 50 , 50 ),
138+ crs = "epsg:4326"
138139 )
139140 ds .time .encoding .update (chunks = (10 ,))
140141 ds .chl .encoding .update (chunks = (2 , 50 , 50 ))
@@ -147,6 +148,7 @@ def test_to_zarr(self):
147148 self .assert_dataset_ok (
148149 {'x' : 100 , 'y' : 50 , 'time' : 1 },
149150 {
151+ 'crs' : (),
150152 'x' : (100 ,), 'y' : (50 ,), 'time' : (10 ,),
151153 'chl' : (2 , 50 , 50 ),
152154 'tsm' : (2 , 50 , 50 ),
@@ -167,6 +169,9 @@ def test_to_zarr(self):
167169 ('delete_file' , 'time/.zarray' ),
168170 ('delete_file' , 'time/.zattrs' ),
169171 ('delete_file' , 'time/0' ),
172+ ('delete_file' , 'crs/.zarray' ),
173+ ('delete_file' , 'crs/.zattrs' ),
174+ ('delete_file' , 'crs/0' ),
170175 ('delete_file' , 'chl/.zarray' ),
171176 ('delete_file' , 'chl/.zattrs' ),
172177 ('delete_file' , 'chl/0.0.0' ),
@@ -188,7 +193,8 @@ def test_to_zarr(self):
188193 chunks = (1 , 50 , 50 )
189194 )
190195 # drop variables w.o. "time" dim
191- slice_1 = slice_1 .drop_vars (["x" , "y" ])
196+ slice_1 = slice_1 .drop_vars ([k for k , v in slice_1 .variables .items ()
197+ if "time" not in v .dims ])
192198 slice_1 .attrs = {}
193199 for k , v in slice_1 .variables .items ():
194200 v .encoding = {}
@@ -205,6 +211,7 @@ def test_to_zarr(self):
205211 )
206212 self .assert_dataset_ok ({'x' : 100 , 'y' : 50 , 'time' : 2 },
207213 {
214+ 'crs' : (),
208215 'x' : (100 ,), 'y' : (50 ,), 'time' : (10 ,),
209216 'chl' : (2 , 50 , 50 ),
210217 'tsm' : (2 , 50 , 50 ),
@@ -234,7 +241,8 @@ def test_to_zarr(self):
234241 chunks = (1 , 50 , 50 )
235242 )
236243 # drop variables w.o. "time" dim
237- slice_2 = slice_2 .drop_vars (["x" , "y" ])
244+ slice_2 = slice_2 .drop_vars ([k for k , v in slice_2 .variables .items ()
245+ if "time" not in v .dims ])
238246 for k , v in slice_2 .variables .items ():
239247 v .encoding = {}
240248 v .attrs = {}
@@ -250,6 +258,7 @@ def test_to_zarr(self):
250258 )
251259 self .assert_dataset_ok ({'x' : 100 , 'y' : 50 , 'time' : 3 },
252260 {
261+ 'crs' : (),
253262 'x' : (100 ,), 'y' : (50 ,), 'time' : (10 ,),
254263 'chl' : (2 , 50 , 50 ),
255264 'tsm' : (2 , 50 , 50 ),
0 commit comments