I have an HDF5 file containing arrays that are saved using Python / numpy. When I read them in Julia using HDF5.jl, the axes are in the reverse order in which they appear in Python. To reduce the mental gymnastics associated with the transition between Python and Julia code codes, I reverse the axis order when I read data in Julia. I wrote my own function for this:
function reversedims(ary::Array) permutedims(ary, [ ndims(ary):-1:1 ]) end data = HDF5.read(someh5file, somekey) |> reversedims
This is not ideal, because (1) I always need to import callbacks in order to use this; (2) I have to keep this in mind for every Array I read. I am wondering if this is possible:
- instruct HDF5.jl to read in arrays with axis order in numpy order, either through a keyword argument, or some kind of global configuration parameter
- use the built-in function of one argument to change the axes
source share