title: scipy's interpn for interpolate high N data
body: <p>I try to interpolate some data using <a href="https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.interpolate.interpn.html#scipy.interpolate.interpn" rel="nofollow"><code>scipy.interpolate.interpn</code></a>. It might not be the right function, so please advise me if it's not. I need to interpolate over 3 variables where each have 2 values (8 in total) down to a single point.</p>
  
  <p>Here is a working example for N=2 (I think).</p>
  
  <pre><code>from scipy.interpolate import interpn
  import numpy as np
  points = np.zeros((2, 2))
  points[0, 1] = 1
  points[1, 1] = 1
  values = np.array(([ 5.222, 6.916], [6.499, 4.102]))
  xi = np.array((0.108, 0.88))
  
  print(interpn(points, values, xi))  # Gives: 6.462
  </code></pre>
  
  <p>But when I try to use it for a higher dimension, it breaks. I have a feeling it is because how my arrays are constructed.</p>
  
  <pre><code>p2 = np.zeros((2, 2, 2))
  p2[0,0,1] = 1
  p2[0,1,1] = 1
  p2[1,0,1] = 1
  p2[1,1,1] = 1
  v2 = np.array([[[5.222,4.852],
                  [6.916,4.377]],
                 [[6.499,6.076],
                  [4.102,5.729]]])
  x2 = np.array((0.108, 0.88, 1))
  print(interpn(p2, v2, x2))
  </code></pre>
  
  <p>This gives me the following error message:</p>
  
  <pre><code>/usr/local/lib/python2.7/dist-packages/scipy/interpolate/interpolate.pyc in interpn(points, values, xi, method, bounds_error, fill_value)
     1680         if not np.asarray(p).ndim == 1:
     1681             raise ValueError("The points in dimension %d must be "
  -&gt; 1682                              "1-dimensional" % i)
     1683         if not values.shape[i] == len(p):
     1684             raise ValueError("There are %d points and %d values in "
  
  ValueError: The points in dimension 0 must be 1-dimensional
  </code></pre>
  
  <p>How do I fix my code? Keep in mind I need to interpolate over 3 variables with 2 values in each (<code>v2.shape = (2, 2, 2)</code>).</p>