I have a 3d with about 8e6 elements, and i need to change all of the elements. I want to do something like this
def func(x, index):
....
flat = array.reshape(-1)
flat[flat == 9999] = 0
flat[flat >= 0.2 and flat < 0.7] = func(flat, 0)
flat[flat >= 0.7 and flat < 1.5] = func(flat, 1)
flat[flat >= 0.7 and flat < 1.5] = func(flat, 2)
....
...
This code doesnt work. I've tried np.nditer but it wouldnt let me retrieve the value per index, it seems to be retrieving the whole array. in short of looping w/ a for loop per dimension and read and write each value, is there another way i can do this?
Thanks