I have object d connected to h5 dataset:
>>> data = d[:, :, 0].astype(np.float32)
>>> data.shape
(17201, 10801)
>>> data[data==-32768] = data[data>0].min()
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
MemoryError
Can I do some other slicing trick to avoid this error?
=in the last line as a==. Your code is perfectly clear and should not need more explanation. My bad! Apparently, you're running into memory bounds. Can you evaluate the expressiondata[data>0].min()individually to determine the minimal number?(17201*10801*32)/1024./1024./1000.=5.669799835205078Gbof disk space just to hold this array section.np.float32) but checking equality with an integer:data==-32768. This can work, but you need to be extremely careful due to inaccuracies with floating point arithmetic (which you may already be aware of -- In which case, think of this as a warning to others who might stumble upon this post).