<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_masked_array(self, copy=True):
 """Convert this array into a numpy.ma.MaskedArray Parameters copy : bool If True (default) make a copy of the array in the result. If False, a MaskedArray view of DataArray.values is returned. Returns ------- result : MaskedArray Masked where invalid values (nan or inf) occur. """

        isnull = pd.isnull(self.values)
        return np.ma.MaskedArray(data=self.values, mask=isnull, copy=copy)