Closed manuelaghito closed 2 years ago
Ah, yes! In fact, we should aim to remove masked arrays completely from OpenDrift.
now it should be ok, hopefully :-) was very eager when I found the problem :-)
by the way if we don't need all values to be masked then we can remove the line self.history[:] = np.ma.masked then it is even faster. But at least like it is proposed now the initially allocated self.history should be exactly the same as before, as far as I can see, all zeros, all masked
just noticed that I didn't pull the latest master with the recent commit https://github.com/OpenDrift/opendrift/commit/1d1df93aad71d111f313af34f763001e3bf7ef86 before I worked on this
this should be ready to merge. I confirm that the bottlneck was using mask=[True] when allocating masked array. Tried slicing also, that didn't give any further improvement. I think there were problems with PPI on wednesday and that was everything was still slow
for some reason numpy.ma.array allocation is extremely slow when mask=True is passed