[SciPy-User] Inconsistent conventions in scipy.interpolate

Armando Serrano Lombillo arserlom at gmail.com
Wed Oct 31 10:59:13 EDT 2012


On Tue, Oct 30, 2012 at 9:39 PM, Pauli Virtanen <pav at iki.fi> wrote:

> 30.10.2012 12:08, Armando Serrano Lombillo kirjoitti:
> > I've recently been catched by the fact that
> > scipy.interpolate.interp2d(x, y, z) expects z.shape=(len(y), len(x))
> > while scipy.interpolate.RectBivariateSpline(x, y, z) expects
> > z.shape=(len(x), len(y)). I find this inconsistency quite annoying and
> > error prone, is there a reason for it?
>
> No reason I'm aware of. The "transposed" convention comes from how
> meshgrid and probably ultimately comes from image processing or so,
> whereas the other convention is more natural for Numpy.
>
> I would suggest avoiding using interp2d --- use RectBivariateSpline if
> you want to fit splines to rectangular array data,
> Smooth/LSQBivariateSpline if you want to do spline fitting to scattered
> data, and griddata for scattered data interpolation.
>
> --
> Pauli Virtanen
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>

If interp2d should be avoided, then, shouldn't it be deprecated so that
future unsuspecting users use the most appropriate functions?

Armando.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121031/876df321/attachment.html>


More information about the SciPy-User mailing list