Read and write N-dimensional cubes