I have the foll. masked array in numpy called arr with shape (50, 360, 720):
masked_array(data =
[[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
...,
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]
[-- -- -- ..., -- -- --]],
mask =
[[ True True True ..., True True True]
[ True True True ..., True True True]
[ True True True ..., True True True]
...,
[ True True True ..., True True True]
[ True True True ..., True True True]
[ True True True ..., True True True]],
fill_value = 1e+20)
It has the foll. data in arr[0]:
arr[0].data
array([[-999., -999., -999., ..., -999., -999., -999.],
[-999., -999., -999., ..., -999., -999., -999.],
[-999., -999., -999., ..., -999., -999., -999.],
...,
[-999., -999., -999., ..., -999., -999., -999.],
[-999., -999., -999., ..., -999., -999., -999.],
[-999., -999., -999., ..., -999., -999., -999.]])
-999. is the missing_value and I want to replace it by 0.0. I do this:
arr[arr == -999.] = 0.0
However, arr remains the same even after this operation. How to fix this?