# xarray.DataArray.to_masked_array

#### DataArray.to_masked_array(copy=True)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L4184-L4200)

Convert this array into a numpy.ma.MaskedArray

* **Parameters:**
  **copy** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`True`](https://docs.python.org/3/builtins/constants.html#True)) – If True make a copy of the array in the result. If False,
  a MaskedArray view of DataArray.values is returned.
* **Returns:**
  **result** ([`MaskedArray`](https://numpy.org/doc/stable/reference/maskedarray.baseclass.html#numpy.ma.MaskedArray)) – Masked where invalid values (nan or inf) occur.
