Line algorithim for python and numeric
hanumizzle at gmail.com
Fri Oct 13 17:57:03 CEST 2006
On 10/13/06, Paul McGuire <ptmcg at austin.rr._bogus_.com> wrote:
> "Theerasak Photha" <hanumizzle at gmail.com> wrote in message
> news:mailman.449.1160750510.11739.python-list at python.org...
> > On 13 Oct 2006 07:33:17 -0700, bcdonovan at gmail.com <bcdonovan at gmail.com>
> > 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!
More information about the Python-list