<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div><span style="background-color: rgba(255, 255, 255, 0);">The sample case of the issue ( <a href="https://github.com/numpy/numpy/issues/5558">https://github.com/numpy/numpy/issues/5558</a> ) is shown below. A proposal to address this behavior can be found here ( <a href="https://github.com/numpy/numpy/pull/5580">https://github.com/numpy/numpy/pull/5580</a> ). Please give me your feedback.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><br></div><div>I tried to change the mask of `a` through a subindexed view, but was unable. Using this setup I can reproduce this in the 1.9.1 version of NumPy.</div><div><br></div><div>    import numpy as np</div><div><br></div><div>    a = np.arange(6).reshape(2,3)</div><div>    a = np.ma.masked_array(a, mask=np.ma.getmaskarray(a), shrink=False)</div><div><br></div><div>    b = a[1:2,1:2]</div><div><br></div><div>    c = np.zeros(b.shape, b.dtype)</div><div>    c = np.ma.masked_array(c, mask=np.ma.getmaskarray(c), shrink=False)</div><div>    c[:] = np.ma.masked</div><div><br></div><div>This yields what one would expect for `a`, `b`, and `c` (seen below).</div><div><br></div><div>     masked_array(data =</div><div>       [[0 1 2]</div><div>        [3 4 5]],</div><div>                  mask =</div><div>       [[False False False]</div><div>        [False False False]],</div><div>             fill_value = 999999)</div><div><br></div><div>     masked_array(data =</div><div>       [[4]],</div><div>                  mask =</div><div>       [[False]],</div><div>             fill_value = 999999)</div><div><br></div><div>     masked_array(data =</div><div>       [[--]],</div><div>                  mask =</div><div>       [[ True]],</div><div>             fill_value = 999999)</div><div><br></div><div>Now, it would seem reasonable that to copy data into `b` from `c` one can use `__setitem__` (seen below).</div><div><br></div><div>     b[:] = c</div><div><br></div><div>This results in new data and mask for `b`.</div><div><br></div><div>     masked_array(data =</div><div>       [[--]],</div><div>                  mask =</div><div>       [[ True]],</div><div>             fill_value = 999999)</div><div><br></div><div>This should, in turn, change `a`. However, the mask of `a` remains unchanged (seen below).</div><div><br></div><div>     masked_array(data =</div><div>       [[0 1 2]</div><div>        [3 0 5]],</div><div>                  mask =</div><div>       [[False False False]</div><div>        [False False False]],</div><div>             fill_value = 999999)</div></div><div><br></div><div><br></div><div><br>Best,<div>John</div></div></body></html>