Fix the order of dimensions when exporting 3D arrays to python.