title: Differentiate a 2d cubic spline in python
body: <p>I'm using interpolate.interp2d() to fit a 2-D spline over a function. How can I get the first derivative of the spline w.r.t. each of the dependent variables? Here is my code so far, Z are the descrete points on a mesh-grid that I have </p>
  
  <pre><code>from scipy import interpolate
  YY, XX = np.meshgrid(Y, X)
  f = interpolate.interp2d(AA, XX, Z, kind='cubic')
  </code></pre>
  
  <p>So, I need df/dx and df/dy. Note also that my Y-grid is not evenly spaced. I guess I can numerically differentiate Z and then fit a new spline, but it seemed like too much hassle. Is there an easier way? </p>