I've got a numpy array that contains data, but I want to replace some certain values with NA. I don't want to deal with masked data so I don't mask it. Is this possible?
My data is a numpy array with data type uint16:
array([[[1, 1, 1, ..., 1, 1, 1],
[1, 1, 1, ..., 1, 1, 1],
[1, 1, 1, ..., 1, 1, 1],
...,
[1, 1, 1, ..., 1, 1, 1],
[1, 1, 1, ..., 1, 1, 1],
[1, 1, 1, ..., 1, 1, 1]]], dtype=uint16)
I want to replace those "1"s with NA values, I have used the code below, but I'm getting this error:
aa [aa == 1] = np.nan
ValueError: cannot convert float NaN to integer