I want to create an empty 3D matrix of dimensions (1024,1024,360).
When I do np.zeros((1024,1024,360))
, I get the following error :
ValueError: array is too big.
What should I do?
I want to create an empty 3D matrix of dimensions (1024,1024,360).
When I do np.zeros((1024,1024,360))
, I get the following error :
ValueError: array is too big.
What should I do?
np.zeros, as you're using it, will return a float array, where each element is 8 bytes. You are trying to store 1024 x 1024 x 360 x 8 bytes, which is roughly 3 gigabytes according to Google.
Do you have 3GB available? Or rather, do you need floats, or could you get by with another dtype (e.g. uint8 for image data, which instead lands you at ~0.38 GB).
Edit:
If memory isn't your strongpoint, consider a memory mapped array: http://docs.scipy.org/doc/numpy/reference/generated/numpy.memmap.html