5151OUTPUT_DIR_TSTORE = "large-tree-store.b2z"
5252OUTPUT_FILE_H5PY = "large-h5py-store.h5"
5353OUTPUT_DIR_ZARR = "large-zarr-store.zarr"
54- MIN_SIZE_MB = 0.1 # Minimum array size in MB
55- MAX_SIZE_MB = 32 # Maximum array size in MB
54+ MIN_SIZE_MB = 0 # Minimum array size in MB
55+ MAX_SIZE_MB = PEAK_SIZE_MB * 10 # Maximum array size in MB
5656CHECK_VALUES = True # Set to False to disable value checking (it is fast anyway)
5757
5858
@@ -77,7 +77,8 @@ def create_test_arrays(sizes_elements):
7777
7878 for i , size in enumerate (sizes_elements ):
7979 # Create linearly spaced array from 0 to i
80- arr = np .linspace (0 , i , size , dtype = np .float64 )
80+ # arr = np.linspace(0, i, size, dtype=np.float64)
81+ arr = blosc2 .linspace (0 , i , size , dtype = np .float64 )
8182 arrays .append (arr )
8283
8384 # if (i + 1) % 10 == 0:
@@ -108,7 +109,7 @@ def store_arrays_in_treestore(arrays, output_dir):
108109 # Distribute arrays evenly across NGROUPS_MAX subdirectories
109110 group_id = i % NGROUPS_MAX
110111 key = f"/group_{ group_id :02d} /array_{ i :04d} "
111- tstore [key ] = arr
112+ tstore [key ] = arr [:]
112113
113114 # if (i + 1) % 10 == 0:
114115 # elapsed = time.time() - start_time
@@ -154,11 +155,12 @@ def store_arrays_in_h5py(arrays, output_file):
154155 grp = f [group_name ]
155156
156157 # Store array with compression
157- grp .create_dataset (dataset_name , data = arr ,
158+ grp .create_dataset (dataset_name , data = arr [:] ,
158159 # compression="gzip", shuffle=True,
159160 # To compare apples with apples, use Blosc2 compression with Zstd compression
160161 compression = hdf5plugin .Blosc2 (cname = 'zstd' , clevel = 5 ,
161- filters = hdf5plugin .Blosc2 .SHUFFLE )
162+ filters = hdf5plugin .Blosc2 .SHUFFLE ),
163+ chunks = arr .blocks ,
162164 )
163165
164166 # if (i + 1) % 10 == 0:
@@ -215,15 +217,17 @@ def store_arrays_in_zarr(arrays, output_dir):
215217 if zarr .__version__ >= "3" :
216218 grp .create_array (
217219 name = dataset_name ,
218- data = arr ,
220+ data = arr [:] ,
219221 compressors = zarr .codecs .BloscCodec (
220222 cname = "zstd" , clevel = 5 , shuffle = zarr .codecs .BloscShuffle .shuffle ),
223+ chunks = arr .blocks ,
221224 )
222225 else :
223226 grp .create_dataset (
224227 name = dataset_name ,
225- data = arr ,
226- compressor = zarr .Blosc (cname = 'zstd' , clevel = 5 , shuffle = zarr .Blosc .SHUFFLE ),
228+ data = arr [:],
229+ compressor = zarr .Blosc (cname = "zstd" , clevel = 5 , shuffle = zarr .Blosc .SHUFFLE ),
230+ chunks = arr .blocks ,
227231 )
228232
229233 # if (i + 1) % 10 == 0:
0 commit comments