On 10/13/06, Paul McGuire <[EMAIL PROTECTED]> wrote: > "Theerasak Photha" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On 13 Oct 2006 07:33:17 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > > wrote: > >> Hi everyone, > >> > >> I'm wondering if anyone knows of a way to extract data from a numeric > >> array along a line. I have a gridded dataset which I would like to be > >> able to choose two points and extract a 1-d array of the data values > >> along the line between the two points. Any ideas? > > > > Are these all 45 degree lines or what? > > > > If not, you'll have to use trigonometry and approximate the closest > > matching cell. (Don't worry, Python has maths functions!! :)) > > > > -- Theerasak > > No need for that messy trig stuff - simpler and faster would be to use > linear interpolation, since you know the starting and ending cell > coordinates, and how many values you want, compute the array of... oh, hell, > here it is:
I'm not in kolluge yet and I just learned about linear interpolation today---although I don't think it would necessarily apply to this problem, where the increments set by the grid might be more discrete than the line itself (hope you see what my innumerate self is trying to say!!), thanx for teaching me something new. :) To myself: Gee duh, Theerasak, it make sense now! -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list