Re: Map_Image and interpolation [message #18215] |
Thu, 09 December 1999 00:00 |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
David Fanning wrote:
> Remind me again what we are trying to do here. I thought
> we were trying to find the depth profile of the ocean
> between two known ship locations. If you want to know
> the distance between those two ships, I can provide you
> will a great circle algorithm given to me by David Stern
> himself, as a peace offering after a particularly
> spirited exchange of ideas on something or other I
> said about map projections in this newsgroup. :-)
Or check out great_circle.pro and compass.pro at
ftp://origin.ssec.wisc.edu/pub/gumley/IDL/
Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: Map_Image and interpolation [message #18218 is a reply to message #18215] |
Thu, 09 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Ben Tupper (Ben_member@newsguy.com) writes:
> Actually, I think Ray's algorithm should work fine... if I can get a handle on
> how the warped image is georeferenced.
You don't know my teenage son, do you? Something about
the head-knocking tone of this conversation reminds me
of him. :-)
> When I interpolate off the unwarped image I don't get the right answer because I
> am assuming that the unwarped image pixel locations are all the same physical
> size everywhere.
What do you mean by you "don't get the right
answer". Why do you think the answer isn't right?
Any chance we could see a code fragment?
> But of course, they are not... because the east-west length of
> an arc second decreases as you move poleward (lines of longitude converge.) So
> if I try to calculate the distance between two points assuming a regular grid
> cell size, then I get the wrong distance (and if I interpolate or sample the
> grid at arbitrary locations between two points... I'll sample the wrong pixels.)
Why are we calculating the distance now? I thought we were
trying to create a depth profile. Sigh...
Remind me again what we are trying to do here. I thought
we were trying to find the depth profile of the ocean
between two known ship locations. If you want to know
the distance between those two ships, I can provide you
will a great circle algorithm given to me by David Stern
himself, as a peace offering after a particularly
spirited exchange of ideas on something or other I
said about map projections in this newsgroup. :-)
> Here's a thought; suppose I wanted to make the mapped image program interactive.
> I want to post the lon/lat value of the cursor into two FSC_INPUTFIELD widgets.
> How do I convert the cursor position into lon/lat using direct graphics?
Assuming you have this is a draw widget and you
have kept the !Map, !X, !Y, and !P system variables
around when you created the map projection, then you
simply convert the XY device locations to data coordinates!
This is *exactly* my point. Map_Set should be doing
*all* of the work for you.
Cheers,
David
P.S. Oh, where's my wife!? She can explain this better
than I can. :-(
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Map_Image and interpolation [message #18220 is a reply to message #18215] |
Thu, 09 December 1999 00:00  |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
In article <MPG.12b8d3f3d1de4d19899bb@news.frii.com>, davidf@dfanning.com
says...
>
> Well, I'm ready to concede the simple algorithm you
> found on my web page may not be what you want for an arc,
> but I think you might find an equivalent arc-interpolation
> scheme on Ray Sterner's web page. (That's where I found
> this algorithm.) Or, it would be easy enough, I think,
> to come up with one of your own. (Let's let the lurkers
> come up with something. :-)
>
Actually, I think Ray's algorithm should work fine... if I can get a handle on
how the warped image is georeferenced.
When I interpolate off the unwarped image I don't get the right answer because I
am assuming that the unwarped image pixel locations are all the same physical
size everywhere. But of course, they are not... because the east-west length of
an arc second decreases as you move poleward (lines of longitude converge.) So
if I try to calculate the distance between two points assuming a regular grid
cell size, then I get the wrong distance (and if I interpolate or sample the
grid at arbitrary locations between two points... I'll sample the wrong pixels.)
But you have suggested something nifty in the arc-interpolation idea. Hey, I've
got this computer and this software... maybe I could calculate distance in along
the surface of a sphere between two points. Ooo! Ooo! I like it!
Here's a thought; suppose I wanted to make the mapped image program interactive.
I want to post the lon/lat value of the cursor into two FSC_INPUTFIELD widgets.
How do I convert the cursor position into lon/lat using direct graphics?
>
> I always enjoy these conversations, Ben. I don't always
> understand them. But I do enjoy them. :-)
>
That's good... everybody needs a straight-man like me!
Thanks again,
Ben
Ben Tupper
PemaquidRiver@tidewater.net
|
|
|
Re: Map_Image and interpolation [message #18231 is a reply to message #18215] |
Wed, 08 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Ben Tupper (Ben_member@newsguy.com) writes:
> Uhoh. You have said the very same thing to me before. Generally, as you have
> learned recently, I often don't know my point either.
Oh, good, then we can have another one of those moot discussions. :-)
> I can indeed plot the ship locations on the warped grid correctly. No problem
> with MAP_SET, MAP_IMAGE, PLOTS, etc. What I want to do is make a profile plot
> of depth between consecutive ship locations. In order to do so, I MUST do
> interpolation between two locations on the warped grid.
Now here is where I fail to follow your argument. Because
my first reaction is this: why in the WORLD would you want
to do the interpolation between two locations on the
warped grid!? That would be the *last* place I think
I would want to do an interpolation. For one thing,
the warped grid is not really the data. It's a
representation of the data, in the same way that
a TVed image is a representation of the image and
not the image itself. A profile of scaled image
data, for example, would be essentially meaningless;
you want a profile of the *real* image data.
I would do an interpolation along the line (or
arc, probably) of the bathymetric grid, and then
project that line (or arc, which would turn into
a line in the projection) onto the map projection.
How do you know which pixels to light up? The ones
Map_Set *tells* you to light up.
> Now a certain person
> with an excellent IDL Tips Web site (think Canis latrans) has a page that
> suggest something like the following for interpolating values off an image
> (grid, ...)between points (x1,y1) and (x2,y2)
>
>
> nPoints = Round(ABS(x2-x1+1) > ABS(y2-y1+1.))
> xloc = X1 + (X2-X1) * Findgen(nPoints) / (nPoints - 1)
> yloc = Y1 + (Y2-Y1) * Findgen(nPoints) / (nPoints - 1)
> Z = Interpolate(WarpedGrid, xloc, yloc)
>
> (or maybe I could do Z = WarpedGrid[xloc,yloc])
>
> So, the question is... if I have a coordinate like (-68.503, 44.056), how do I
> convert that into the appropriate subscript locations on the warped grid?
The simple answer is: by running it through the map projection.
You may not readily know is specific XY location, but you can
certainly light it up.
> You might be wondering why the points must be interpolated from the warped image
> and not the original...
Indeed, I'm wondering ...
> Well, the warped image has been flattened onto a 2d
> surface while the original is for a sphere(its grid spacing is 0.0416667 arc
> seconds.)
Well, I'm ready to concede the simple algorithm you
found on my web page may not be what you want for an arc,
but I think you might find an equivalent arc-interpolation
scheme on Ray Sterner's web page. (That's where I found
this algorithm.) Or, it would be easy enough, I think,
to come up with one of your own. (Let's let the lurkers
come up with something. :-)
The point is, the curved line in real space will turn into
a straight line on the map projection in just the same way
that the curved image turned into a flat image.
I always enjoy these conversations, Ben. I don't always
understand them. But I do enjoy them. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Map_Image and interpolation [message #18233 is a reply to message #18231] |
Wed, 08 December 1999 00:00  |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
In article <MPG.12b84831bc0510cf9899b9@news.frii.com>, davidf@dfanning.com
>
> P.S. I have a sneaking suspicion I have completely
> missed the point here. If so, I apologize profusely. :-)
>
Uhoh. You have said the very same thing to me before. Generally, as you have
learned recently, I often don't know my point either. I have to get out of this
pattern where the two of us have absolutely no idea what I'm talking about. I
remind myself of Admiral Stockwell (R.Perot's running mate) who started his
first debate against Al Gore and Dan Quayle with "Who am I? And why am I here?"
Admiral Stockwell is a very fine person... he didn't articulate well. So here's
another stab at my challenge.
I can indeed plot the ship locations on the warped grid correctly. No problem
with MAP_SET, MAP_IMAGE, PLOTS, etc. What I want to do is make a profile plot
of depth between consecutive ship locations. In order to do so, I MUST do
interpolation between two locations on the warped grid. Now a certain person
with an excellent IDL Tips Web site (think Canis latrans) has a page that
suggest something like the following for interpolating values off an image
(grid, ...)between points (x1,y1) and (x2,y2)
nPoints = Round(ABS(x2-x1+1) > ABS(y2-y1+1.))
xloc = X1 + (X2-X1) * Findgen(nPoints) / (nPoints - 1)
yloc = Y1 + (Y2-Y1) * Findgen(nPoints) / (nPoints - 1)
Z = Interpolate(WarpedGrid, xloc, yloc)
(or maybe I could do Z = WarpedGrid[xloc,yloc])
So, the question is... if I have a coordinate like (-68.503, 44.056), how do I
convert that into the appropriate subscript locations on the warped grid?
You might be wondering why the points must be interpolated from the warped image
and not the original... Well, the warped image has been flattened onto a 2d
surface while the original is for a sphere(its grid spacing is 0.0416667 arc
seconds.)
Thanks!
Ben
Ben Tupper
Pemaquid River Company
|
|
|
Re: Map_Image and interpolation [message #18239 is a reply to message #18231] |
Wed, 08 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Ben Tupper (tupper@seadas.bigelow.org) writes:
> I have a set of ship positions (Lon/Lat in WGS 84 map datum). I also
> have a bathymetric grid which I have warped into a tranverse mercator
> projection (Datum = WGS 84). The ship locations plot correctly on the
> warped image. Now I would like to interpolate values off of the warped
> image between consecutive ship locations.
Uh, why?! Surely the ships (and the bathymetric gird)
are in "real" space (as opposed to, say, "map" space)
and the interpolation should be done there. Once you
have the interpolated data, you just put it on the
map coordinate system using PLOTS, or whatever you do.
This is the beauty of the Map_Set command: it sets
up the mapping between your real coordinate system
and the map coordinate system.
> So how do I go from Ship Lon/Lat to WarpedGrid[X,Y]?
Make your calculations in Lon/Lat space and then
just *place* them on the Map, using the !Map system
variable to handle any transformations for you.
Cheers,
David
P.S. I have a sneaking suspicion I have completely
missed the point here. If so, I apologize profusely. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|