Skip to content

N5ChunkWrapper bug with uint8 #3171

Open
@mzouink

Description

@mzouink

Zarr version

v2.18.4

Numcodecs version

0.51.1

Python Version

3.11.11

Operating System

Linux

Installation

conda-forge

Description

encode/decode doesn't work well with uint8, i tested it with multiple type. All works except uint8

Steps to reproduce

import numcodecs
from zarr.n5 import N5ChunkWrapper
import numpy as np

shape = (100, 100, 100)

types = [
    np.float32,
    np.uint8,
    np.int64,
    np.float16
    ]

for t in types:
    try:
        data = np.ones(shape, dtype=t)

        n5_encoder = N5ChunkWrapper(data.dtype, shape, compressor=numcodecs.Zstd())

        encoded_data = n5_encoder.encode(data)
        decoded_data = n5_encoder.decode(encoded_data)
        decoded_data = decoded_data.reshape(shape)

        if not np.array_equal(data, decoded_data):
            print(f"Decoded data does not match original data - {t.__name__}")
    except Exception as e:
        print(f"Error processing data of type {t.__name__}: {e}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions