comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: differences among map_proj_image, map_image and map_patch
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: differences among map_proj_image, map_image and map_patch [message #83201] Wed, 20 February 2013 08:53
Olivia is currently offline  Olivia
Messages: 16
Registered: February 2006
Junior Member
Thanks David. It is really helpful.

Have a nice day.

Olivia

On Tuesday, February 19, 2013 3:11:40 PM UTC-6, David Fanning wrote:
> David Fanning writes:
>
>
>
>> And I've also put a Catalyst program here, that will allow you to
>
>> display this data in a resizeable graphics window. As you draw your
>
>> cursor over the image, you will see the pixel location, map location,
>
>> and image value printed in the window.
>
>>
>
>> http://www.idlcoyote.com/usa_mean_temperature.pro
>
>
>
> Whoops! That's not going to work. Try this:
>
>
>
> http://www.idlcoyote.com/misc/usa_mean_temperature.pro
>
>
>
> 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: differences among map_proj_image, map_image and map_patch [message #83202 is a reply to message #83201] Tue, 19 February 2013 13:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> And I've also put a Catalyst program here, that will allow you to
> display this data in a resizeable graphics window. As you draw your
> cursor over the image, you will see the pixel location, map location,
> and image value printed in the window.
>
> http://www.idlcoyote.com/usa_mean_temperature.pro

Whoops! That's not going to work. Try this:

http://www.idlcoyote.com/misc/usa_mean_temperature.pro

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: differences among map_proj_image, map_image and map_patch [message #83203 is a reply to message #83202] Tue, 19 February 2013 12:56 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Olivia writes:

>
> Thanks David for your answer, and I am really appreciate it. Now, I am more clear about the differences among these routines.
>
> I learned map projection mainly from book "AcrGIS 9 Understanding Map Projections." I began to doubt whether my understanding about map projection is right. If you can give us an example how to understand map projection will benefit many people.
>
> My research is about the climate change of national parks. For example, what't the temperature change at the end of 21st century under different climate scenarios? Since the geographic coordinate is not area conserve, and if I do analysis on the geographic coordinate directly, there will be some biases towards high latitude. That's the reason I wanna project the original data to the Lambert Azimuthal Equal-Area projection, and I need to know the value of warped image.
>
> I have found an easier way to solve my problem using ENVI. Using this software I can customize the output x/y pixel size, define the way to warp the image, and also know the warped value and its position on the image.

Yes, ENVI has better map projection software than IDL (it is using, at
least in part, the state-of-the-art proj4 software now). It is a shame
it doesn't trickle down to IDL. Still, I routinely display warped images
like this in the Catalyst application, ImgWin. This is a resizeable
graphics window that allows me to click in the window, on the image, and
obtain both the cursor location (in map coordinates) and the image value
at that location. So, ENVI is not strictly required. :-)

I've put a static version of your data in the Coyote Plot Gallery:

http://www.idlcoyote.com/gallery/

And I've also put a Catalyst program here, that will allow you to
display this data in a resizeable graphics window. As you draw your
cursor over the image, you will see the pixel location, map location,
and image value printed in the window.

http://www.idlcoyote.com/usa_mean_temperature.pro

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: differences among map_proj_image, map_image and map_patch [message #83205 is a reply to message #83203] Tue, 19 February 2013 11:54 Go to previous message
Olivia is currently offline  Olivia
Messages: 16
Registered: February 2006
Junior Member
Thanks David for your answer, and I am really appreciate it. Now, I am more clear about the differences among these routines.

I learned map projection mainly from book "AcrGIS 9 Understanding Map Projections." I began to doubt whether my understanding about map projection is right. If you can give us an example how to understand map projection will benefit many people.

My research is about the climate change of national parks. For example, what't the temperature change at the end of 21st century under different climate scenarios? Since the geographic coordinate is not area conserve, and if I do analysis on the geographic coordinate directly, there will be some biases towards high latitude. That's the reason I wanna project the original data to the Lambert Azimuthal Equal-Area projection, and I need to know the value of warped image.

I have found an easier way to solve my problem using ENVI. Using this software I can customize the output x/y pixel size, define the way to warp the image, and also know the warped value and its position on the image.

Cheers,

Fuyao



On Monday, February 18, 2013 7:55:21 PM UTC-6, David Fanning wrote:
> Olivia writes:
>
>
>
>> I wanna project air temperature (tmean: [7025 (lon), 3105 (lat)]) over the U.S. from geographic coordinate to Lambert Azimuthal Equal-Area coordinate, and need to know the x,y value of the new variable.
>
>>
>
>> Information of Lambert Azimuthal Equal-Area coordinate:
>
>> The central longitude and latitude is -100 and 50, respectively. Both false northing and false easting are 0. The ellipsoid is WGS 84.
>
>>
>
>> I didn't notice much difference among map_proj_image, map_image and map_patch according to the manual, so I used these three routines, and wanna compare them.
>
>>
>
>> I use tmean1, tmean2 and tmean3 to represent results from map_proj_image, map_image and map_patch, respectively.
>
>>
>
>> The spatial pattern of tmean1 and tmean3 are very similar, both of them showed the warped image correctly. Except, the dimension of tmean1 is [7025, 3105], which is the same with original tmean (I can understand this), and the dimension of tmean2 is [1171, 666].
>
>> tmean2 is totally wrong, and its dimension is [1, 680].
>
>>
>
>> Could someone help me to clarify the differences among these three routines, please?
>
>>
>
>> It seems all these three routines just warp the image, and won't give any information about the value of x, y. How can I know the x,y of projected image?
>
>
>
> OK, I am going to try to answer these questions now. :-)
>
>
>
> First, let me say your questions shows some evidence of confusion. This
>
> is normal and is the result of two different phenomenon. First, you are
>
> probably reading the IDL documentation. This is generally a Big Mistake.
>
> Second, map projections are inherently hard to understand. I once took
>
> at job at the National Snow and Ice Data Center specifically so I could
>
> learn to work with map projections. (This is where I learned reading the
>
> IDL documentation was a Big Mistake.) It took me about three years to
>
> finally come to grips with map projections, and I worked with them
>
> daily. Matt Savoie and I would get together about once a week and I
>
> would convince him that everything he knew about map projections was
>
> wrong, and he would do the same for me. Then we would swap places, until
>
> the next week, when we would convince each other to swap places again.
>
> By iteration, over three years time, we both got to the point that we
>
> sure the other person was out of his mind!
>
>
>
> Anyway, there are two different ways to set up map projections in IDL.
>
> You have used both incorrectly. :-)
>
>
>
> Map_Set is very old and is considered (generously, I think) a semi-
>
> professional way of handling map projections. The serious map
>
> professionals I worked with wouldn't consider using it, although I have
>
> come to think of it as useful when working with some map projections
>
> (although, God knows, NOT Mercator!) when you want a global map and are
>
> not concerned with matters of great precision. It works in lat/lon space
>
> (which is NOT where you want to be when working with map projected
>
> images) and is good for warping images to a map projection (something
>
> that sets many map projection expert's teeth on edge).
>
>
>
> Map_Proj_Init is based on the GCTP software that was state of the art
>
> 15-20 years ago, very professional in its time, and still generally
>
> useful today, although nowhere near the state of the art now. The
>
> Map_Proj** routines work in the much more sensible projected meter
>
> space, which matches map projected images extremely well, and will allow
>
> you to fit a map projection to your image, as God meant for it to be
>
> done. There is almost no support structure built into IDL for working
>
> with Map_Proj_Init. In fact, I'm pretty sure folks at ExelisVis don't
>
> really understand Map_Proj_Init, so strong is their bias for warping
>
> images to map projections, instead of the reverse.
>
>
>
> In the absence of of support for the Map_Proj** routines, I have built
>
> my own supporting routines for working with the Map_Proj** programs.
>
> These are available in the Coyote Library.
>
>
>
> The point is, both of these routines produce "map structures," but they
>
> are different and cannot be used interchangeably, as you are doing in
>
> your example code. You must pick one system or the other, and live with
>
> your choice.
>
>
>
> Map_Proj_Image works with the structure created with Map_Proj_Init, as
>
> you would expect. It does a much better job of "warping" an image from
>
> one map projection to another, because the warping is done on regular
>
> grids of map projected XY (sometimes called UV) coordinates. You can
>
> expect excellent results when warping in this manner.
>
>
>
> Map_Image is the warping routine for Map_Set and I think of it as a sort
>
> of "display" routine. It is not really interested in preserving image
>
> values. It's main purpose is to warp an image to a map projection in a
>
> close-enough-for-government-work sort of way.
>
>
>
> Map_Patch is the back-up shortstop for when Map_Image fails to do its
>
> job (usually when one of the poles is involved). It uses a slightly
>
> different (and slower) algorithm that is often more reliable. It is also
>
> the routine of choice if you have a lat/lon value for every pixel in the
>
> image. But, again, it is used mostly for "display", not science. (I've
>
> written an equivalent routine for Map_Proj_Init, named cgWarpToMap. It
>
> does low-resolution display things very well.)
>
>
>
> The data you have is extremely high resolution (too high to be shown on
>
> a graphics display, unless you have a wall-sized monitor). So, I am not
>
> absolutely sure it matters what routine you use to warp it, although I
>
> am always partial to Map_Proj_Image. I certainly wouldn't warp it and
>
> then inquire of the warped image what it's value is. I'd make a small,
>
> low-resolution image for display and I'd keep the original image around
>
> and use that to get actual values.
>
>
>
> So, I guess the answer to your question is really another question. What
>
> exactly are you planning to do with this image that you need to know its
>
> warped values?
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> P.S. I'm not entirely sure this answer will satisfy you. But, as I said,
>
> you asked a very complicated question, and there is no simple answer. In
>
> the end, it matters what you are hoping to do with the information. Tell
>
> us that, and we may be able to advise you more sensibly.
>
>
>
> --
>
> 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: differences among map_proj_image, map_image and map_patch [message #83209 is a reply to message #83205] Mon, 18 February 2013 17:55 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Olivia writes:

> I wanna project air temperature (tmean: [7025 (lon), 3105 (lat)]) over the U.S. from geographic coordinate to Lambert Azimuthal Equal-Area coordinate, and need to know the x,y value of the new variable.
>
> Information of Lambert Azimuthal Equal-Area coordinate:
> The central longitude and latitude is -100 and 50, respectively. Both false northing and false easting are 0. The ellipsoid is WGS 84.
>
> I didn't notice much difference among map_proj_image, map_image and map_patch according to the manual, so I used these three routines, and wanna compare them.
>
> I use tmean1, tmean2 and tmean3 to represent results from map_proj_image, map_image and map_patch, respectively.
>
> The spatial pattern of tmean1 and tmean3 are very similar, both of them showed the warped image correctly. Except, the dimension of tmean1 is [7025, 3105], which is the same with original tmean (I can understand this), and the dimension of tmean2 is [1171, 666].
> tmean2 is totally wrong, and its dimension is [1, 680].
>
> Could someone help me to clarify the differences among these three routines, please?
>
> It seems all these three routines just warp the image, and won't give any information about the value of x, y. How can I know the x,y of projected image?

OK, I am going to try to answer these questions now. :-)

First, let me say your questions shows some evidence of confusion. This
is normal and is the result of two different phenomenon. First, you are
probably reading the IDL documentation. This is generally a Big Mistake.
Second, map projections are inherently hard to understand. I once took
at job at the National Snow and Ice Data Center specifically so I could
learn to work with map projections. (This is where I learned reading the
IDL documentation was a Big Mistake.) It took me about three years to
finally come to grips with map projections, and I worked with them
daily. Matt Savoie and I would get together about once a week and I
would convince him that everything he knew about map projections was
wrong, and he would do the same for me. Then we would swap places, until
the next week, when we would convince each other to swap places again.
By iteration, over three years time, we both got to the point that we
sure the other person was out of his mind!

Anyway, there are two different ways to set up map projections in IDL.
You have used both incorrectly. :-)

Map_Set is very old and is considered (generously, I think) a semi-
professional way of handling map projections. The serious map
professionals I worked with wouldn't consider using it, although I have
come to think of it as useful when working with some map projections
(although, God knows, NOT Mercator!) when you want a global map and are
not concerned with matters of great precision. It works in lat/lon space
(which is NOT where you want to be when working with map projected
images) and is good for warping images to a map projection (something
that sets many map projection expert's teeth on edge).

Map_Proj_Init is based on the GCTP software that was state of the art
15-20 years ago, very professional in its time, and still generally
useful today, although nowhere near the state of the art now. The
Map_Proj** routines work in the much more sensible projected meter
space, which matches map projected images extremely well, and will allow
you to fit a map projection to your image, as God meant for it to be
done. There is almost no support structure built into IDL for working
with Map_Proj_Init. In fact, I'm pretty sure folks at ExelisVis don't
really understand Map_Proj_Init, so strong is their bias for warping
images to map projections, instead of the reverse.

In the absence of of support for the Map_Proj** routines, I have built
my own supporting routines for working with the Map_Proj** programs.
These are available in the Coyote Library.

The point is, both of these routines produce "map structures," but they
are different and cannot be used interchangeably, as you are doing in
your example code. You must pick one system or the other, and live with
your choice.

Map_Proj_Image works with the structure created with Map_Proj_Init, as
you would expect. It does a much better job of "warping" an image from
one map projection to another, because the warping is done on regular
grids of map projected XY (sometimes called UV) coordinates. You can
expect excellent results when warping in this manner.

Map_Image is the warping routine for Map_Set and I think of it as a sort
of "display" routine. It is not really interested in preserving image
values. It's main purpose is to warp an image to a map projection in a
close-enough-for-government-work sort of way.

Map_Patch is the back-up shortstop for when Map_Image fails to do its
job (usually when one of the poles is involved). It uses a slightly
different (and slower) algorithm that is often more reliable. It is also
the routine of choice if you have a lat/lon value for every pixel in the
image. But, again, it is used mostly for "display", not science. (I've
written an equivalent routine for Map_Proj_Init, named cgWarpToMap. It
does low-resolution display things very well.)

The data you have is extremely high resolution (too high to be shown on
a graphics display, unless you have a wall-sized monitor). So, I am not
absolutely sure it matters what routine you use to warp it, although I
am always partial to Map_Proj_Image. I certainly wouldn't warp it and
then inquire of the warped image what it's value is. I'd make a small,
low-resolution image for display and I'd keep the original image around
and use that to get actual values.

So, I guess the answer to your question is really another question. What
exactly are you planning to do with this image that you need to know its
warped values?

Cheers,

David

P.S. I'm not entirely sure this answer will satisfy you. But, as I said,
you asked a very complicated question, and there is no simple answer. In
the end, it matters what you are hoping to do with the information. Tell
us that, and we may be able to advise you more sensibly.

--
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: differences among map_proj_image, map_image and map_patch [message #83210 is a reply to message #83209] Mon, 18 February 2013 10:53 Go to previous message
Olivia is currently offline  Olivia
Messages: 16
Registered: February 2006
Junior Member
Thanks so much, David.

You can download the data using the link below.

https://www.dropbox.com/s/r7uqxwm3huf796p/tmean.nc

Olivia

On Monday, February 18, 2013 12:29:54 PM UTC-6, David Fanning wrote:
> David Fanning writes:
>
>
>
>>
>
>> Olivia writes:
>
>>
>
>>> I wanna project air temperature (tmean: [7025 (lon), 3105 (lat)]) over the U.S. from geographic coordinate to Lambert Azimuthal Equal-Area coordinate, and need to know the x,y value of the new variable.
>
>>
>
>> This is a fairly complicated question, unfortunately. Before I agree to
>
>> take it on, how much do you know about map projections, generally, and
>
>> what exactly do you mean by the "x,y value of the new variable". Can you
>
>> tell me very specifically what value (or values) you are looking for?
>
>
>
> It also might help, if you can tell me where I can download that data
>
> set. I'm afraid the answer to this question is going to involve more
>
> than just text. :-(
>
>
>
> 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: differences among map_proj_image, map_image and map_patch [message #83211 is a reply to message #83210] Mon, 18 February 2013 10:46 Go to previous message
Olivia is currently offline  Olivia
Messages: 16
Registered: February 2006
Junior Member
I know it is a complex question.
I am a newbie in this area, and began to use IDL just days ago.

The x, y value of new variable means the coordinate value of each point on the projection map.

Thanks for your instant response.
Olivia
Re: differences among map_proj_image, map_image and map_patch [message #83212 is a reply to message #83211] Mon, 18 February 2013 10:29 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> Olivia writes:
>
>> I wanna project air temperature (tmean: [7025 (lon), 3105 (lat)]) over the U.S. from geographic coordinate to Lambert Azimuthal Equal-Area coordinate, and need to know the x,y value of the new variable.
>
> This is a fairly complicated question, unfortunately. Before I agree to
> take it on, how much do you know about map projections, generally, and
> what exactly do you mean by the "x,y value of the new variable". Can you
> tell me very specifically what value (or values) you are looking for?

It also might help, if you can tell me where I can download that data
set. I'm afraid the answer to this question is going to involve more
than just text. :-(

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: differences among map_proj_image, map_image and map_patch [message #83213 is a reply to message #83212] Mon, 18 February 2013 10:23 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Olivia writes:

> I wanna project air temperature (tmean: [7025 (lon), 3105 (lat)]) over the U.S. from geographic coordinate to Lambert Azimuthal Equal-Area coordinate, and need to know the x,y value of the new variable.

This is a fairly complicated question, unfortunately. Before I agree to
take it on, how much do you know about map projections, generally, and
what exactly do you mean by the "x,y value of the new variable". Can you
tell me very specifically what value (or values) you are looking for?

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Excluding Decimal Places in the Values of a Variable
Next Topic: K-Mean clustering

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:44:50 PDT 2025

Total time taken to generate the page: 0.00506 seconds