'Assign values to :attr:`layers` based on :attr:`levels`,
adding extended layers as needed if contours are filled.
For line contours, layers simply coincide with levels;
a line is a thin layer.  No extended levels are needed
with line contours.'

def _process_levels(self):

    self._vmin = np.min(self.levels)
    self._vmax = np.max(self.levels)
    self._levels = list(self.levels)
    if (self.extend in (u'both', u'min')):
        self._levels.insert(0, (min(self.levels[0], self.zmin) - 1))
    if (self.extend in (u'both', u'max')):
        self._levels.append((max(self.levels[(-1)], self.zmax) + 1))
    self._levels = np.asarray(self._levels)
    if (not self.filled):
        self.layers = self.levels
        return
    self.layers = (0.5 * (self._levels[:(-1)] + self._levels[1:]))
    if (self.extend in (u'both', u'min')):
        self.layers[0] = (-1e+150)
    if (self.extend in (u'both', u'max')):
        self.layers[(-1)] = 1e+150
