JuliaIO / Zarr.jl

Other
119 stars 25 forks source link

Big-endian data #63

Open tjdiamandis opened 3 years ago

tjdiamandis commented 3 years ago

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

meggart commented 3 years ago

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.

tjdiamandis commented 3 years ago

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