def METHOD_NAME(self, z):
    if z is not None:
        if self._x is not None and z.shape[0] != len(self._x):
            raise TypeError('Z values must have shape (len(x), len(y))')
        if self._y is not None and z.shape[1] != len(self._y):
            raise TypeError('Z values must have shape (len(x), len(y))')
        self._z = z
        if (self.__vertices is not None and
                self._z.shape != self.__vertices.shape[:2]):
            self.__vertices = None