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)
| 1422 | |
| 1423 | |
| 1424 | def getmaskarray(arr): |
| 1425 | """ |
| 1426 | Return the mask of a masked array, or full boolean array of False. |
| 1427 | |
| 1428 | Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and |
| 1429 | the mask is not `nomask`, else return a full boolean array of False of |
| 1430 | the same shape as `arr`. |
| 1431 | |
| 1432 | Parameters |
| 1433 | ---------- |
| 1434 | arr : array_like |
| 1435 | Input `MaskedArray` for which the mask is required. |
| 1436 | |
| 1437 | See Also |
| 1438 | -------- |
| 1439 | getmask : Return the mask of a masked array, or nomask. |
| 1440 | getdata : Return the data of a masked array as an ndarray. |
| 1441 | |
| 1442 | Examples |
| 1443 | -------- |
| 1444 | >>> import numpy.ma as ma |
| 1445 | >>> a = ma.masked_equal([[1,2],[3,4]], 2) |
| 1446 | >>> a |
| 1447 | masked_array( |
| 1448 | data=[[1, --], |
| 1449 | [3, 4]], |
| 1450 | mask=[[False, True], |
| 1451 | [False, False]], |
| 1452 | fill_value=2) |
| 1453 | >>> ma.getmaskarray(a) |
| 1454 | array([[False, True], |
| 1455 | [False, False]]) |
| 1456 | |
| 1457 | Result when mask == ``nomask`` |
| 1458 | |
| 1459 | >>> b = ma.masked_array([[1,2],[3,4]]) |
| 1460 | >>> b |
| 1461 | masked_array( |
| 1462 | data=[[1, 2], |
| 1463 | [3, 4]], |
| 1464 | mask=False, |
| 1465 | fill_value=999999) |
| 1466 | >>> ma.getmaskarray(b) |
| 1467 | array([[False, False], |
| 1468 | [False, False]]) |
| 1469 | |
| 1470 | """ |
| 1471 | mask = getmask(arr) |
| 1472 | if mask is nomask: |
| 1473 | mask = make_mask_none(np.shape(arr), getattr(arr, 'dtype', None)) |
| 1474 | return mask |
| 1475 | |
| 1476 | |
| 1477 | def is_mask(m): |