GetValueAtLocation() method [message #84803] |
Tue, 11 June 2013 15:13  |
markjamie
Messages: 30 Registered: November 2012
|
Member |
|
|
Hi
I've been recently using the GetValueAtLocation() method in conjunction with the Surface function in IDL 8.2.2 but have been getting very mixed results.
When using p=surface(/test) together with p.getvalueatlocation(x, y), where x and Y are credible values it all works ok. When extending it's use to a real world example I encounter various errors.
My surface is a 2D array, essentially consisting of a number of time series, where the x dimension is usually positive (e.g. Time), the y dimension could be either positive of negative but is usually negative (e.g. Distance relative to a point), and the z dimension is a positive, scalar variable (e.g. Temperature).
I create a surface using p = surface(z, x, y) which gives good results. However when I try to use p.getvaluesatlocation(10,-15, /interpolation),where 10 and -15 are valid x and Y coordinates on the surface, but perhaps not the individual time series (hence /interpolation), the method returns an error about subscripting (yloc) of a heap pointer variable is out of bounds. If the interpolation flag is removed another error occurs with similar results but a different variable name (nyloc or something v.similar).
Not sure if it makes any difference but the x dimension is always evenly spaced (e.g 1,2,3) but the y dimension may not be (e.g. 1,2,7,9).
Any thoughts on what is going on here? Can the GetValueAtLocation method deal with surface data where one dimension contains negative numbers?
Any help would be greatly appreciated as I'm baffled!
Mark
|
|
|
Re: GetValueAtLocation() method [message #84806 is a reply to message #84803] |
Tue, 11 June 2013 15:58   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
markjamie@gmail.com writes:
> When using p=surface(/test) together with p.getvalueatlocation(x, y), where x and Y are credible values it all works ok. When extending it's use to a real world example I encounter various errors.
Haha! I really must be getting old, because this doesn't surprise me at
all. In my experience, *especially* with object graphics examples, the
published examples almost always assume axes that start at 0. In truth,
I understand the mindset, but I have been burned so many times myself, I
have learned to check this kind of thing. Well, most of the time,
anyway.
In any case, function graphics programs, at least in my hands, have not
worked well with real-world data on at least one or two occasions. :-)
http://www.idlcoyote.com/ng_tips/onion.php
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
Re: GetValueAtLocation() method [message #84823 is a reply to message #84814] |
Wed, 12 June 2013 06:19  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
markjamie@gmail.com writes:
> So, assuming it can't deal with negative axes and the problem is not me using the method incorrectly, what is the best way to extract the values along an arbitrary line across a surface (z) with defined x and y axes?
Well, I haven't ruled out you using the method incorrectly. I haven't
had time to actually fool with this yet. I'm just not surprised you are
running into a problem. :-)
> With a list of x and y values, can interpolate or interpol be used to provide the corresponding z values from the surface?
Assuming you can locate two points on the surface, I think some
variation of the interpolation algorithm in the following article could
be devised to come up with the values you are looking for.
http://www.idlcoyote.com/ip_tips/image_profile.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|