# dask.array.ma.masked_array

### dask.array.ma.masked_array(data, mask=np.False_, fill_value=None, \*\*kwargs)

An array class with possibly masked values.

This docstring was copied from numpy.ma.masked_array.

Some inconsistencies with the Dask version may exist.

Masked values of True exclude the corresponding element from any
computation.

Construction:

```default
x = MaskedArray(data, mask=nomask, dtype=None, copy=False, subok=True,
                ndmin=0, fill_value=None, keep_mask=True, hard_mask=None,
                shrink=True, order=None)
```

* **Parameters:**
  **data**
  : Input data.

  **mask**
  : Mask. Must be convertible to an array of booleans with the same
    shape as data. True indicates a masked (i.e. invalid) data.

  **dtype**
  : Data type of the output.
    If dtype is None, the type of the data argument (`data.dtype`)
    is used. If dtype is not None and different from `data.dtype`,
    a copy is performed.

  **copy**
  : Whether to copy the input data (True), or to use a reference instead.
    Default is False.

  **subok**
  : Whether to return a subclass of MaskedArray if possible (True) or a
    plain MaskedArray. Default is True.

  **ndmin**
  : Minimum number of dimensions. Default is 0.

  **fill_value**
  : Value used to fill in the masked values when necessary.
    If None, a default based on the data-type is used.

  **keep_mask**
  : Whether to combine mask with the mask of the input data, if any
    (True), or to use only mask for the output (False). Default is True.

  **hard_mask**
  : Whether to use a hard mask or not. With a hard mask, masked values
    cannot be unmasked. Default is False.

  **shrink**
  : Whether to force compression of an empty mask. Default is True.

  **order**
  : Specify the order of the array.  If order is ‘C’, then the array
    will be in C-contiguous order (last-index varies the fastest).
    If order is ‘F’, then the returned array will be in
    Fortran-contiguous order (first-index varies the fastest).
    If order is ‘A’ (default), then the returned array may be
    in any order (either C-, Fortran-contiguous, or even discontiguous),
    unless a copy is required, in which case it will be C-contiguous.

### Examples

```pycon
>>> import numpy as np
```

The `mask` can be initialized with an array of boolean values
with the same shape as `data`.

```pycon
>>> data = np.arange(6).reshape((2, 3))
>>> np.ma.MaskedArray(data, mask=[[False, True, False],
...                               [False, False, True]])
masked_array(
  data=[[0, --, 2],
        [3, 4, --]],
  mask=[[False,  True, False],
        [False, False,  True]],
  fill_value=999999)
```

Alternatively, the `mask` can be initialized to homogeneous boolean
array with the same shape as `data` by passing in a scalar
boolean value:

```pycon
>>> np.ma.MaskedArray(data, mask=False)
masked_array(
  data=[[0, 1, 2],
        [3, 4, 5]],
  mask=[[False, False, False],
        [False, False, False]],
  fill_value=999999)
```

```pycon
>>> np.ma.MaskedArray(data, mask=True)
masked_array(
  data=[[--, --, --],
        [--, --, --]],
  mask=[[ True,  True,  True],
        [ True,  True,  True]],
  fill_value=999999,
  dtype=int64)
```

#### NOTE
The recommended practice for initializing `mask` with a scalar
boolean value is to use `True`/`False` rather than
`np.True_`/`np.False_`. The reason is `nomask`
is represented internally as `np.False_`.

```pycon
>>> np.False_ is np.ma.nomask
True
```

<!-- !! processed by numpydoc !! -->
