Return the mask of a masked array, or full boolean array of False. Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and the mask is not `nomask`, else return a full boolean array of False of the same shape as `arr`. Parameters ---------- arr : array_l
(arr)
| 1472 | |
| 1473 | |
| 1474 | def getmaskarray(arr): |
| 1475 | """ |
| 1476 | Return the mask of a masked array, or full boolean array of False. |
| 1477 | |
| 1478 | Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and |
| 1479 | the mask is not `nomask`, else return a full boolean array of False of |
| 1480 | the same shape as `arr`. |
| 1481 | |
| 1482 | Parameters |
| 1483 | ---------- |
| 1484 | arr : array_like |
| 1485 | Input `MaskedArray` for which the mask is required. |
| 1486 | |
| 1487 | See Also |
| 1488 | -------- |
| 1489 | getmask : Return the mask of a masked array, or nomask. |
| 1490 | getdata : Return the data of a masked array as an ndarray. |
| 1491 | |
| 1492 | Examples |
| 1493 | -------- |
| 1494 | >>> import numpy as np |
| 1495 | >>> import numpy.ma as ma |
| 1496 | >>> a = ma.masked_equal([[1,2],[3,4]], 2) |
| 1497 | >>> a |
| 1498 | masked_array( |
| 1499 | data=[[1, --], |
| 1500 | [3, 4]], |
| 1501 | mask=[[False, True], |
| 1502 | [False, False]], |
| 1503 | fill_value=2) |
| 1504 | >>> ma.getmaskarray(a) |
| 1505 | array([[False, True], |
| 1506 | [False, False]]) |
| 1507 | |
| 1508 | Result when mask == ``nomask`` |
| 1509 | |
| 1510 | >>> b = ma.masked_array([[1,2],[3,4]]) |
| 1511 | >>> b |
| 1512 | masked_array( |
| 1513 | data=[[1, 2], |
| 1514 | [3, 4]], |
| 1515 | mask=False, |
| 1516 | fill_value=999999) |
| 1517 | >>> ma.getmaskarray(b) |
| 1518 | array([[False, False], |
| 1519 | [False, False]]) |
| 1520 | |
| 1521 | """ |
| 1522 | mask = getmask(arr) |
| 1523 | if mask is nomask: |
| 1524 | mask = make_mask_none(np.shape(arr), getattr(arr, 'dtype', None)) |
| 1525 | return mask |
| 1526 | |
| 1527 | |
| 1528 | def is_mask(m): |
searching dependent graphs…