Read HDF5 data with numpy axis order with Julia HDF5 -
i have hdf5 file containing arrays saved python/numpy. when read them julia using hdf5.jl, axes in reverse of order in appear in python. reduce mental gymnastics involved in moving between python , julia codebases, reverse axis order when read data julia. have written own function this:
function reversedims(ary::array) permutedims(ary, [ ndims(ary):-1:1 ]) end data = hdf5.read(someh5file, somekey) |> reversedims
this not ideal because (1) have import reversedims use this; (2) have remember each array
read. wondering if possible either:
- instruct hdf5.jl read in arrays numpy-style axis order, either through keyword argument or kind of global configuration parameter
- use builtin single argument function reverse axes
the best approach create h5py.jl package, modeled on mat.jl (which reads , writes .mat files created matlab). see https://github.com/timholy/hdf5.jl/issues/180.
Comments
Post a Comment