Forgive me if something about what I'm about to ask sounds stupid, I've just started with numpy and multi-dimensional arrays in Python :D
That said, I've got a 3D array of [85 x 235 x 327]. Each position holds a discrete value, and, in most cases, NaN.
First thing I'd like to do is iterate over this array and remove the NaN values, building a new array that contains only valid values.
I've tried this:
for index,value in np.ndenumerate( data ):
print "index value: " + str(index)
print "value: " + str(value)
But this will only execute one pass...not really sure what ndenumerate does.
Also tried this:
indexOne = waves.shape[0]
indexTwo = waves.shape[1]
indexThree = waves.shape[2]
for i in range(indexOne):
for j in range(indexTwo):
for k in range(indexThree):
a = waves[i,j,k]
print a.data
And while this does iterates...taking into account that I have 6531825 points...this is going to take forever...thus, is there any built-in function to remove values from an existing array without having to iterate all the elements?