2

I am working with 4d Arrays (shaped as for example (5, 1116, 256, 256)), for each outer most iteration n in (n,x,x,x) I want the inner 3d array (x,x,x) to be stored as a dataset.

For example: in this case (5, 1116, 256, 256), there should be 5 seperate datasets stored under 1 file.

Is there an easy way to do it ?

Is it possible to create subsets of Numpy Array file and store them under one .npy file ? or should I move towards Hdf5?

Mike
  • 51
  • 1
  • 6
  • Exactly how are you getting five "datasets" out of a four-element 1D array? – 3Dave Jan 08 '20 at 14:51
  • `np.save` handles 4d arrays just fine; no need for any fancy stuff. That `5` is just another dimension. You could, alternatively, split that array into a list of 5 3d arrays, and use `savez` to save them to a `zip` archive, with each 3d as a separate `npy` file. – hpaulj Jan 08 '20 at 17:24

0 Answers0