Zarr.jl icon indicating copy to clipboard operation
Zarr.jl copied to clipboard

Big-endian data

Open tjdiamandis opened this issue 3 years ago • 2 comments

Hello,

How difficult is it to add Big-endian functionality for zopen? Happy to work on this if some guidance is provided.

Thank you!

https://github.com/meggart/Zarr.jl/blob/3aaf6d0555b0a69a585da5c69334eedef6ee2b51/src/metadata.jl#L90

tjdiamandis avatar Aug 02 '21 20:08 tjdiamandis

Thanks a lot for offering help here.

The first step to support big-endian data would be to first remove the exception so that arrrays can be opened. Then I would try to hook into the readchunk! and writechunk! functions (defined in ZArray.jl), because every array access passes through these functions. So it should be sufficient to add a check in readchunk! that tests for endianness in the array's metadata and applies ntoh to the output array a in-place if necessary. The same could be done for writechunk! as well.

Let me know if that already helps or if you need more details.

meggart avatar Aug 03 '21 08:08 meggart

Makes sense. Thank you very much! I'll take a look soon.

tjdiamandis avatar Aug 04 '21 13:08 tjdiamandis