def to_table(self):
        """
        Convert an ArrayWrapper with shape (D1, ..., DN) and attributes
        T1, ..., TN which are list of tags of lenghts D1, ... DN into
        a table with rows (tag1, ... tagN, value) of maximum length
        D1 * ... * DN. Zero values are discarded.

        >>> from pprint import pprint
        >>> dic = dict(tagnames=['taxonomy', 'occupancy'],
        ...            taxonomy=['?', 'RC', 'WOOD'],
        ...            occupancy=['?', 'RES', 'IND', 'COM'])
        >>> arr = numpy.zeros((2, 3))
        >>> arr[0, 0] = 2000
        >>> arr[0, 1] = 5000
        >>> arr[1, 0] = 500
        >>> pprint(ArrayWrapper(arr, dic).to_table())
        [['taxonomy', 'occupancy', 'value'],
         ['RC', 'RES', 2000.0],
         ['RC', 'IND', 5000.0],
         ['WOOD', 'RES', 500.0]]
        """
        shape = self.shape
        # the tagnames are bytestrings so they must be decoded
        tagnames = decode_array(self.tagnames)
        if len(shape) == len(tagnames):
            return [tagnames + ['value']] + self._to_table()
        elif len(shape) == len(tagnames) + 1:  # there is an extra field
            tbl = [tagnames + [self.extra[0], 'value']]
            return tbl + self._to_table(self.extra[1:])
        else:
            raise TypeError(
                'There are %d dimensions but only %d tagnames' %
                (len(shape), len(tagnames)))
Convert an ArrayWrapper with shape (D1, ..., DN) and attributes
        T1, ..., TN which are list of tags of lenghts D1, ... DN into
        a table with rows (tag1, ... tagN, value) of maximum length
        D1 * ... * DN. Zero values are discarded.

        >>> from pprint import pprint
        >>> dic = dict(tagnames=['taxonomy', 'occupancy'],
        ...            taxonomy=['?', 'RC', 'WOOD'],
        ...            occupancy=['?', 'RES', 'IND', 'COM'])
        >>> arr = numpy.zeros((2, 3))
        >>> arr[0, 0] = 2000
        >>> arr[0, 1] = 5000
        >>> arr[1, 0] = 500
        >>> pprint(ArrayWrapper(arr, dic).to_table())
        [['taxonomy', 'occupancy', 'value'],
         ['RC', 'RES', 2000.0],
         ['RC', 'IND', 5000.0],
         ['WOOD', 'RES', 500.0]]