File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,13 @@ def _json_convert(
116
116
else :
117
117
return o .descr
118
118
if isinstance (o , numcodecs .abc .Codec ):
119
- return o .get_config ()
119
+ codec_config = o .get_config ()
120
+
121
+ # Hotfix for https://github.com/zarr-developers/zarr-python/issues/2647
122
+ if codec_config ["id" ] == "zstd" and not codec_config .get ("checksum" , False ):
123
+ codec_config .pop ("checksum" , None )
124
+
125
+ return codec_config
120
126
if np .isscalar (o ):
121
127
out : Any
122
128
if hasattr (o , "dtype" ) and o .dtype .kind == "M" and hasattr (o , "view" ):
Original file line number Diff line number Diff line change 9
9
import zarr .api .asynchronous
10
10
import zarr .storage
11
11
from zarr .core .buffer import cpu
12
+ from zarr .core .buffer .core import default_buffer_prototype
12
13
from zarr .core .group import ConsolidatedMetadata , GroupMetadata
13
14
from zarr .core .metadata import ArrayV2Metadata
14
15
from zarr .core .metadata .v2 import parse_zarr_format
@@ -282,3 +283,18 @@ def test_from_dict_extra_fields() -> None:
282
283
order = "C" ,
283
284
)
284
285
assert result == expected
286
+
287
+
288
+ def test_zstd_checksum () -> None :
289
+ arr = zarr .create_array (
290
+ {},
291
+ shape = (10 ,),
292
+ chunks = (10 ,),
293
+ dtype = "int32" ,
294
+ compressors = {"id" : "zstd" , "level" : 5 , "checksum" : False },
295
+ zarr_format = 2 ,
296
+ )
297
+ metadata = json .loads (
298
+ arr .metadata .to_buffer_dict (default_buffer_prototype ())[".zarray" ].to_bytes ()
299
+ )
300
+ assert "checksum" not in metadata ["compressor" ]
You can’t perform that action at this time.
0 commit comments