|
1 | 1 | """ |
2 | | -This module provides the compatibility for :py:mod:`numcodecs` in Zarr version 3. |
| 2 | +This module provides compatibility for :py:mod:`numcodecs` in Zarr version 3. |
3 | 3 |
|
4 | | -A compatibility module is required because the codec handling in Zarr version 3 is different from Zarr version 2. |
5 | | -
|
6 | | -You can use codecs from :py:mod:`numcodecs` by constructing codecs from :py:mod:`numcodecs.zarr3` using the same parameters as the original codecs. |
| 4 | +These codecs were previously defined in :py:mod:`numcodecs`, and have now been moved to `zarr`. |
7 | 5 |
|
8 | 6 | >>> import zarr |
9 | | ->>> import numcodecs.zarr3 |
| 7 | +>>> import zarr.codecs.numcodecs as numcodecs |
10 | 8 | >>> |
11 | 9 | >>> array = zarr.create_array( |
12 | 10 | ... store="data.zarr", |
|
19 | 17 |
|
20 | 18 | .. note:: |
21 | 19 |
|
22 | | - Please note that the codecs in :py:mod:`numcodecs.zarr3` are not part of the Zarr version 3 specification. |
23 | | - Using these codecs might cause interoperability issues with other Zarr implementations. |
| 20 | + Please note that the codecs in :py:mod:`zarr.codecs.numcodecs` are not part of the Zarr version |
| 21 | + 3 specification. Using these codecs might cause interoperability issues with other Zarr |
| 22 | + implementations. |
24 | 23 | """ |
25 | 24 |
|
26 | 25 | from __future__ import annotations |
|
40 | 39 | from zarr.core.common import JSON, parse_named_configuration, product |
41 | 40 | from zarr.dtype import UInt8, ZDType, parse_dtype |
42 | 41 | from zarr.errors import ZarrUserWarning |
43 | | -from zarr.registry import get_numcodec, register_codec |
| 42 | +from zarr.registry import get_numcodec |
44 | 43 |
|
45 | 44 | if TYPE_CHECKING: |
46 | 45 | from zarr.abc.numcodec import Numcodec |
@@ -324,51 +323,3 @@ class PCodec(_NumcodecsArrayBytesCodec, codec_name="pcodec"): |
324 | 323 |
|
325 | 324 | class ZFPY(_NumcodecsArrayBytesCodec, codec_name="zfpy"): |
326 | 325 | pass |
327 | | - |
328 | | - |
329 | | -# TODO: move the codec registration outside this module |
330 | | -register_codec("numcodecs.bz2", BZ2) |
331 | | -register_codec("numcodecs.crc32", CRC32) |
332 | | -register_codec("numcodecs.crc32c", CRC32C) |
333 | | -register_codec("numcodecs.lz4", LZ4) |
334 | | -register_codec("numcodecs.lzma", LZMA) |
335 | | -register_codec("numcodecs.zfpy", ZFPY) |
336 | | -register_codec("numcodecs.adler32", Adler32) |
337 | | -register_codec("numcodecs.astype", AsType) |
338 | | -register_codec("numcodecs.bitround", BitRound) |
339 | | -register_codec("numcodecs.blosc", Blosc) |
340 | | -register_codec("numcodecs.delta", Delta) |
341 | | -register_codec("numcodecs.fixedscaleoffset", FixedScaleOffset) |
342 | | -register_codec("numcodecs.fletcher32", Fletcher32) |
343 | | -register_codec("numcodecs.gzip", GZip) |
344 | | -register_codec("numcodecs.jenkins_lookup3", JenkinsLookup3) |
345 | | -register_codec("numcodecs.pcodec", PCodec) |
346 | | -register_codec("numcodecs.packbits", PackBits) |
347 | | -register_codec("numcodecs.quantize", Quantize) |
348 | | -register_codec("numcodecs.shuffle", Shuffle) |
349 | | -register_codec("numcodecs.zlib", Zlib) |
350 | | -register_codec("numcodecs.zstd", Zstd) |
351 | | - |
352 | | -__all__ = [ |
353 | | - "BZ2", |
354 | | - "CRC32", |
355 | | - "CRC32C", |
356 | | - "LZ4", |
357 | | - "LZMA", |
358 | | - "ZFPY", |
359 | | - "Adler32", |
360 | | - "AsType", |
361 | | - "BitRound", |
362 | | - "Blosc", |
363 | | - "Delta", |
364 | | - "FixedScaleOffset", |
365 | | - "Fletcher32", |
366 | | - "GZip", |
367 | | - "JenkinsLookup3", |
368 | | - "PCodec", |
369 | | - "PackBits", |
370 | | - "Quantize", |
371 | | - "Shuffle", |
372 | | - "Zlib", |
373 | | - "Zstd", |
374 | | -] |
0 commit comments