File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11import os .path
22import sys
33
4- import numpy as np
54import xarray as xr
65
76from test .cli .helpers import CliTest
@@ -25,12 +24,24 @@ class PruneDataTest(CliTest):
2524 def setUp (self ) -> None :
2625 rimraf (self .TEST_CUBE )
2726 cube = new_cube (time_periods = 3 ,
28- variables = dict (precipitation = np . nan ,
29- temperature = np . nan )) \
27+ variables = dict (precipitation = 1.0 ,
28+ temperature = 1.0 )) \
3029 .chunk (dict (time = 1 , lat = 90 , lon = 90 ))
3130
3231 write_cube (cube , self .TEST_CUBE , "zarr" , cube_asserted = True )
3332
33+ # we need to manually edit the fill values, otherwise, as of zarr 2.11,
34+ # empty chunks are not written
35+ import json
36+ with open (f'{ self .TEST_CUBE } /.zmetadata' ) as metadata :
37+ metadata_dict = json .load (metadata )
38+ metadata_dict ['metadata' ]['precipitation/.zarray' ]['fill_value' ] \
39+ = 1.0
40+ metadata_dict ['metadata' ]['temperature/.zarray' ]['fill_value' ] \
41+ = 1.0
42+ with open (f'{ self .TEST_CUBE } /.zmetadata' , 'w' ) as metadata :
43+ json .dump (metadata_dict , metadata )
44+
3445 def tearDown (self ) -> None :
3546 rimraf (self .TEST_CUBE )
3647
You can’t perform that action at this time.
0 commit comments