Read N-dimensional arrays and write M-dimensional sub-arrays