docs: def iterative_plane_errors(axes,covariance_matrix, **kwargs):
      """
      An iterative version of `pca.plane_errors`,
      which computes an error surface for a plane.
      """
      sheet = kwargs.pop('sheet','upper')
      level = kwargs.pop('level',1)
      n = kwargs.pop('n',100)
  
      cov = N.sqrt(N.diagonal(covariance_matrix))
      u = N.linspace(0, 2*N.pi, n)
  
      scales = dict(upper=1,lower=-1,nominal=0)
      c1 = scales[sheet]
      c1 *= -1 # We assume upper hemisphere
      if axes[2,2] < 0:
          c1 *= -1
  
      def sdot(a,b):
          return sum([i*j for i,j in zip(a,b)])
  
      def step_func(a):
          e = [
              N.cos(a)*cov[0],
              N.sin(a)*cov[1],
              c1*cov[2]]
          d = [sdot(e,i)
              for i in axes.T]
          x,y,z = d[2],d[0],d[1]
          r = N.sqrt(x**2 + y**2 + z**2)
          lat = N.arcsin(z/r)
          lon = N.arctan2(y, x)
          return lon,lat
  
      # Get a bundle of vectors defining
      # a full rotation around the unit circle
      return N.array([step_func(i)
          for i in u])