From: <halldor@ve...>  20060330 11:33:37

First, I want to thank John Hunter and Jouni Seppanen for their very=20 useful help with my xticklabel problems. I have little experience with=20 python, and am a total newbie wrt. matplotlib ( which is very=20 impressive...). Few days ago I was looking for a method to interpolate 12hourly data,=20 and was not happy with the python alternatives I found. I wanted=20 something in native python, not wrappers to C or Fortran programs (in this case speed is not a big issue). It so happened that few weeks=20 ago a coworker gave me a faint photocopy of a photocopy from an article=20 published 26 years ago with an interpolation method I had not seen before. The main point of the method was that it did not generate spline like=20 excursions. The claim was that the method was "consistantly well behaved". So, I wrote it up in Python (well, I translated my Matlab code). It=20 seems to work as the author claimed. The interpolation method needs x,y=20 and y' (the slope of y(x)) as input, but the article also provided a=20 simple algorithm to estimate the slope. I am including these functions=20 in an attachment. To use them is very simple: Example where y' is known x =3D seq(0,2*pi,10); y =3D sin(x); yp =3D cos(x) xi =3D seq(0,2*pi,40); yi =3D StinemanInterp(x,y,yp,xi); plot(x,y,'o',xi,yi) Example where y' is calculated using slopes() x =3D seq(0,2*pi,10); y =3D sin(x); yp =3D slopes(x,y) xi =3D seq(0,2*pi,40); yi =3D StinemanInterp(x,y,yp,xi); plot(x,y,'o',xi,yi) I make no claim that the method is fast, nor that my coding is optimal.=20  I am sure it can be sped up, but it is fast enough for my uses. Nor do I claim that this is the best interpolation algorithm,  I have=20 no interest in taking part in a religous debate on the merits of=20 different interpolation methods. For me this is simply a consise method that works resonably well. The=20 slope y' can be calculated using other methods than slopes(), using=20 divided differences to get the derivative of a quadratic through any=20 three points is straightforward (but not implemented here). Also if yp=20 is simply the linear slope the method yields linear interpolation. As I said, I have not seen this method before, but it may well be that=20 it is known under a different guise....My coworker got it from a Swiss=20 glaciologist.... Sincerely, Halld=F3r =20 Halldor Bjornsson Bustadavegur 9 IS150 Reykjavik Iceland. e: halldor()vedur.is tel:+354522600 