def to_array(self, kper=0, mask=False):
    "\n        Convert stress period boundary condition (MfList) data for a\n        specified stress period to a 3-D numpy array\n\n        Parameters\n        ----------\n        kper : int\n            MODFLOW zero-based stress period number to return. (default is zero)\n        mask : boolean\n            return array with np.NaN instead of zero\n        Returns\n        ----------\n        out : dict of numpy.ndarrays\n            Dictionary of 3-D numpy arrays containing the stress period data for\n            a selected stress period. The dictionary keys are the MfList dtype\n            names for the stress period data ('cond', 'flux', 'bhead', etc.).\n\n        See Also\n        --------\n\n        Notes\n        -----\n\n        Examples\n        --------\n        >>> import flopy\n        >>> ml = flopy.modflow.Modflow.load('test.nam')\n        >>> v = ml.wel.stress_period_data.to_array(kper=1)\n\n        "
    i0 = 3
    unstructured = False
    if ('inode' in self.dtype.names):
        raise NotImplementedError()
    if ('node' in self.dtype.names):
        if (('i' not in self.dtype.names) and ('j' not in self.dtype.names)):
            i0 = 1
            unstructured = True
    arrays = {}
    for name in self.dtype.names[i0:]:
        if (not (self.dtype.fields[name][0] == object)):
            if unstructured:
                arr = np.zeros(((self._model.nlay * self._model.ncpl),))
            else:
                arr = np.zeros((self._model.nlay, self._model.nrow, self._model.ncol))
            arrays[name] = arr.copy()
    if (kper not in self.data.keys()):
        kpers = list(self.data.keys())
        kpers.sort()
        if (kper < kpers[0]):
            if mask:
                for (name, arr) in arrays.items():
                    arrays[name][:] = np.NaN
            return arrays
        else:
            kper = self.__find_last_kper(kper)
    sarr = self.data[kper]
    if np.isscalar(sarr):
        if (sarr == 0):
            if mask:
                for (name, arr) in arrays.items():
                    arrays[name][:] = np.NaN
            return arrays
        else:
            raise Exception('MfList: something bad happened')
    for (name, arr) in arrays.items():
        if unstructured:
            cnt = np.zeros(((self._model.nlay * self._model.ncpl),), dtype=np.float)
        else:
            cnt = np.zeros((self._model.nlay, self._model.nrow, self._model.ncol), dtype=np.float)
        for rec in sarr:
            if unstructured:
                arr[rec['node']] += rec[name]
                cnt[rec['node']] += 1.0
            else:
                arr[(rec['k'], rec['i'], rec['j'])] += rec[name]
                cnt[(rec['k'], rec['i'], rec['j'])] += 1.0
        if (name not in ('cond', 'flux')):
            idx = (cnt > 0.0)
            arr[idx] /= cnt[idx]
        if mask:
            arr = np.ma.masked_where((cnt == 0.0), arr)
            arr[(cnt == 0.0)] = np.NaN
        arrays[name] = arr.copy()
    return arrays
Convert stress period boundary condition (MfList) data for a
specified stress period to a 3-D numpy array

Parameters
----------
kper : int
    MODFLOW zero-based stress period number to return. (default is zero)
mask : boolean
    return array with np.NaN instead of zero
Returns
----------
out : dict of numpy.ndarrays
    Dictionary of 3-D numpy arrays containing the stress period data for
    a selected stress period. The dictionary keys are the MfList dtype
    names for the stress period data ('cond', 'flux', 'bhead', etc.).

See Also
--------

Notes
-----

Examples
--------
>>> import flopy
>>> ml = flopy.modflow.Modflow.load('test.nam')
>>> v = ml.wel.stress_period_data.to_array(kper=1)
def to_array(self, kper=0, mask=False):
    "\n        Convert stress period boundary condition (MfList) data for a\n        specified stress period to a 3-D numpy array\n\n        Parameters\n        ----------\n        kper : int\n            MODFLOW zero-based stress period number to return. (default is zero)\n        mask : boolean\n            return array with np.NaN instead of zero\n        Returns\n        ----------\n        out : dict of numpy.ndarrays\n            Dictionary of 3-D numpy arrays containing the stress period data for\n            a selected stress period. The dictionary keys are the MfList dtype\n            names for the stress period data ('cond', 'flux', 'bhead', etc.).\n\n        See Also\n        --------\n\n        Notes\n        -----\n\n        Examples\n        --------\n        >>> import flopy\n        >>> ml = flopy.modflow.Modflow.load('test.nam')\n        >>> v = ml.wel.stress_period_data.to_array(kper=1)\n\n        "
    i0 = 3
    unstructured = False
    if ('inode' in self.dtype.names):
        raise NotImplementedError()
    if ('node' in self.dtype.names):
        if (('i' not in self.dtype.names) and ('j' not in self.dtype.names)):
            i0 = 1
            unstructured = True
    arrays = {}
    for name in self.dtype.names[i0:]:
        if (not (self.dtype.fields[name][0] == object)):
            if unstructured:
                arr = np.zeros(((self._model.nlay * self._model.ncpl),))
            else:
                arr = np.zeros((self._model.nlay, self._model.nrow, self._model.ncol))
            arrays[name] = arr.copy()
    if (kper not in self.data.keys()):
        kpers = list(self.data.keys())
        kpers.sort()
        if (kper < kpers[0]):
            if mask:
                for (name, arr) in arrays.items():
                    arrays[name][:] = np.NaN
            return arrays
        else:
            kper = self.__find_last_kper(kper)
    sarr = self.data[kper]
    if np.isscalar(sarr):
        if (sarr == 0):
            if mask:
                for (name, arr) in arrays.items():
                    arrays[name][:] = np.NaN
            return arrays
        else:
            raise Exception('MfList: something bad happened')
    for (name, arr) in arrays.items():
        if unstructured:
            cnt = np.zeros(((self._model.nlay * self._model.ncpl),), dtype=np.float)
        else:
            cnt = np.zeros((self._model.nlay, self._model.nrow, self._model.ncol), dtype=np.float)
        for rec in sarr:
            if unstructured:
                arr[rec['node']] += rec[name]
                cnt[rec['node']] += 1.0
            else:
                arr[(rec['k'], rec['i'], rec['j'])] += rec[name]
                cnt[(rec['k'], rec['i'], rec['j'])] += 1.0
        if (name not in ('cond', 'flux')):
            idx = (cnt > 0.0)
            arr[idx] /= cnt[idx]
        if mask:
            arr = np.ma.masked_where((cnt == 0.0), arr)
            arr[(cnt == 0.0)] = np.NaN
        arrays[name] = arr.copy()
    return arrays