| 
7 | 7 | 
 
  | 
8 | 8 | from __future__ import annotations  | 
9 | 9 | 
 
  | 
10 |  | -from enum import IntEnum  | 
11 | 10 | from enum import StrEnum  | 
12 | 11 | 
 
  | 
13 | 12 | from pydantic import Field  | 
14 | 13 | from pydantic import model_validator  | 
 | 14 | +from zarr.codecs import BloscCname  | 
 | 15 | +from zarr.codecs import BloscShuffle  | 
15 | 16 | 
 
  | 
16 | 17 | from mdio.schemas.core import CamelCaseStrictModel  | 
17 | 18 | 
 
  | 
18 | 19 | 
 
  | 
19 |  | -class BloscAlgorithm(StrEnum):  | 
20 |  | -    """Enum for Blosc algorithm options."""  | 
21 |  | - | 
22 |  | -    BLOSCLZ = "blosclz"  | 
23 |  | -    LZ4 = "lz4"  | 
24 |  | -    LZ4HC = "lz4hc"  | 
25 |  | -    ZLIB = "zlib"  | 
26 |  | -    ZSTD = "zstd"  | 
27 |  | - | 
28 |  | - | 
29 |  | -class BloscShuffle(IntEnum):  | 
30 |  | -    """Enum for Blosc shuffle options."""  | 
31 |  | - | 
32 |  | -    NOSHUFFLE = 0  | 
33 |  | -    SHUFFLE = 1  | 
34 |  | -    BITSHUFFLE = 2  | 
35 |  | -    AUTOSHUFFLE = -1  | 
36 |  | - | 
37 |  | - | 
38 | 20 | class Blosc(CamelCaseStrictModel):  | 
39 | 21 |     """Data Model for Blosc options."""  | 
40 | 22 | 
 
  | 
41 | 23 |     name: str = Field(default="blosc", description="Name of the compressor.")  | 
42 |  | -    algorithm: BloscAlgorithm = Field(  | 
43 |  | -        default=BloscAlgorithm.LZ4,  | 
44 |  | -        description="The Blosc compression algorithm to be used.",  | 
45 |  | -    )  | 
46 |  | -    level: int = Field(default=5, ge=0, le=9, description="The compression level.")  | 
47 |  | -    shuffle: BloscShuffle = Field(  | 
48 |  | -        default=BloscShuffle.SHUFFLE,  | 
49 |  | -        description="The shuffle strategy to be applied before compression.",  | 
50 |  | -    )  | 
51 |  | -    blocksize: int = Field(  | 
52 |  | -        default=0,  | 
53 |  | -        description="The size of the block to be used for compression.",  | 
54 |  | -    )  | 
 | 24 | +    cname: BloscCname = Field(default=BloscCname.zstd, description="Compression algorithm name.")  | 
 | 25 | +    clevel: int = Field(default=5, ge=0, le=9, description="Compression level (integer 0–9)")  | 
 | 26 | +    shuffle: BloscShuffle | None = Field(default=None, description="Shuffling mode before compression.")  | 
 | 27 | +    typesize: int | None = Field(default=None, description="The size in bytes that the shuffle is performed over.")  | 
 | 28 | +    blocksize: int = Field(default=0, description="The size (in bytes) of blocks to divide data before compression.")  | 
55 | 29 | 
 
  | 
56 | 30 | 
 
  | 
57 | 31 | zfp_mode_map = {  | 
 | 
0 commit comments