Wrapping image on polar projection [message #87767] |
Wed, 26 February 2014 12:58  |
Vinay
Messages: 3 Registered: February 2014
|
Junior Member |
|
|
Hi folks,
Was anyone out there successful in wrapping images on polar projection using 'cg' routines. Most of the other examples essentially uses cgCoutour. OK here is where, I got stuck.
My data is similar to the example given in
http://www.idlcoyote.com/map_tips/warptomap.php
------My code---------------------------
Filein = 'test1.sav'
RESTORE, Filein
Help, image, lats, lons
S = Size(image)
lat = Rebin(lats, s(1), s(2))
lon = Rebin(lons, s(1), s(2))
image1 = Bytscl(image,min = 0.0, max = 0.15,/NaN )
cgDisplay, Title='Polar Projection'
map = Obj_New('cgMap', 'Polar Stereographic', LIMIT=[60, -180, 90, 180], Center_Lat=90, Center_Lon=180, POSITION=[0.05, 0.05, 0.95, 0.95])
warped = cgWarpToMap(Image1, lon, lat, MAP=map, MISSING=0, Resolution=[400, 300], /SetRange)
cgImage, warped, Position=[0.1, 0.1, 0.9, 0.9]
cgMap_Grid, Map=map, /Label, Color='Blue'
cgMap_Continents, MAP=map, Color='Blue'
cgMap_Continents, MAP=map, Color='Blue', /Countries
------------------------------------
It will be great, if anyone has any suggestions!!
Thanks,
Vinay
|
|
|
Re: Wrapping image on polar projection [message #87768 is a reply to message #87767] |
Wed, 26 February 2014 13:10   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Vinay writes:
> Was anyone out there successful in wrapping images on polar projection using 'cg' routines. Most of the other examples essentially uses cgCoutour. OK here is where, I got stuck.
>
> My data is similar to the example given in
> http://www.idlcoyote.com/map_tips/warptomap.php
>
>
> ------My code---------------------------
> Filein = 'test1.sav'
> RESTORE, Filein
> Help, image, lats, lons
>
> S = Size(image)
> lat = Rebin(lats, s(1), s(2))
> lon = Rebin(lons, s(1), s(2))
> image1 = Bytscl(image,min = 0.0, max = 0.15,/NaN )
>
> cgDisplay, Title='Polar Projection'
>
> map = Obj_New('cgMap', 'Polar Stereographic', LIMIT=[60, -180, 90, 180], Center_Lat=90, Center_Lon=180, POSITION=[0.05, 0.05, 0.95, 0.95])
>
> warped = cgWarpToMap(Image1, lon, lat, MAP=map, MISSING=0, Resolution=[400, 300], /SetRange)
> cgImage, warped, Position=[0.1, 0.1, 0.9, 0.9]
> cgMap_Grid, Map=map, /Label, Color='Blue'
> cgMap_Continents, MAP=map, Color='Blue'
> cgMap_Continents, MAP=map, Color='Blue', /Countries
> ------------------------------------
>
> It will be great, if anyone has any suggestions!!
Have you read this article:
http://www.idlcoyote.com/code_tips/usegriddata.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.")
|
|
|
Re: Wrapping image on polar projection [message #87769 is a reply to message #87768] |
Wed, 26 February 2014 13:23   |
Vinay
Messages: 3 Registered: February 2014
|
Junior Member |
|
|
On Wednesday, February 26, 2014 12:10:38 PM UTC-9, David Fanning wrote:
> Vinay writes:
>
>
>
>> Was anyone out there successful in wrapping images on polar projection using 'cg' routines. Most of the other examples essentially uses cgCoutour. OK here is where, I got stuck.
>
>>
>
>> My data is similar to the example given in
>
>> http://www.idlcoyote.com/map_tips/warptomap.php
>
>>
>
>>
>
>> ------My code---------------------------
>
>> Filein = 'test1.sav'
>
>> RESTORE, Filein
>
>> Help, image, lats, lons
>
>>
>
>> S = Size(image)
>
>> lat = Rebin(lats, s(1), s(2))
>
>> lon = Rebin(lons, s(1), s(2))
>
>> image1 = Bytscl(image,min = 0.0, max = 0.15,/NaN )
>
>>
>
>> cgDisplay, Title='Polar Projection'
>
>>
>
>> map = Obj_New('cgMap', 'Polar Stereographic', LIMIT=[60, -180, 90, 180], Center_Lat=90, Center_Lon=180, POSITION=[0.05, 0.05, 0.95, 0.95])
>
>>
>
>> warped = cgWarpToMap(Image1, lon, lat, MAP=map, MISSING=0, Resolution=[400, 300], /SetRange)
>
>> cgImage, warped, Position=[0.1, 0.1, 0.9, 0.9]
>
>> cgMap_Grid, Map=map, /Label, Color='Blue'
>
>> cgMap_Continents, MAP=map, Color='Blue'
>
>> cgMap_Continents, MAP=map, Color='Blue', /Countries
>
>> ------------------------------------
>
>>
>
>> It will be great, if anyone has any suggestions!!
>
>
>
> Have you read this article:
>
>
>
> http://www.idlcoyote.com/code_tips/usegriddata.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.")
Hi David,
Yes, I know there are other ways to achieve this by using Map_set, Map_Patch, Map_Proj_Init ...etc. I was particularly, interested in using cgWarpToMap and was giving it a try !!!
Thanks,
Vinay
|
|
|
Re: Wrapping image on polar projection [message #87770 is a reply to message #87769] |
Wed, 26 February 2014 13:30   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Vinay writes:
> Yes, I know there are other ways to achieve this by using Map_set, Map_Patch, Map_Proj_Init ...etc. I was particularly, interested in using cgWarpToMap and was giving it a try !!!
Yes, cgWarpToMap is in a bit of a state. Well, not the one you have, but
the one I have. I was trying to incorporate the ideas I talk about in
the article I referenced into it, but it is pretty much half there.
Well, maybe two-thirds there, and I've run out of time right now to
finish it.
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: Wrapping image on polar projection [message #87786 is a reply to message #87767] |
Thu, 27 February 2014 05:26   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Vinay writes:
>
> Hi folks,
>
>
> Was anyone out there successful in wrapping images on polar projection using 'cg' routines. Most of the other examples essentially uses cgCoutour. OK here is where, I got stuck.
>
> My data is similar to the example given in
> http://www.idlcoyote.com/map_tips/warptomap.php
>
>
> ------My code---------------------------
> Filein = 'test1.sav'
> RESTORE, Filein
> Help, image, lats, lons
>
> S = Size(image)
> lat = Rebin(lats, s(1), s(2))
> lon = Rebin(lons, s(1), s(2))
> image1 = Bytscl(image,min = 0.0, max = 0.15,/NaN )
>
> cgDisplay, Title='Polar Projection'
>
> map = Obj_New('cgMap', 'Polar Stereographic', LIMIT=[60, -180, 90, 180], Center_Lat=90, Center_Lon=180, POSITION=[0.05, 0.05, 0.95, 0.95])
>
> warped = cgWarpToMap(Image1, lon, lat, MAP=map, MISSING=0, Resolution=[400, 300], /SetRange)
> cgImage, warped, Position=[0.1, 0.1, 0.9, 0.9]
> cgMap_Grid, Map=map, /Label, Color='Blue'
> cgMap_Continents, MAP=map, Color='Blue'
> cgMap_Continents, MAP=map, Color='Blue', /Countries
> ------------------------------------
>
> It will be great, if anyone has any suggestions!!
The reason you are not seeing *anything* in your window is that you have
resized the latitude array incorrectly. You have this:
lat = Rebin(lats, s(1), s(2))
And it should be this:
lat = Rebin(Reform(lats, 1, s(2)), s(1), s(2))
But, your other problem is that cgWarpToMap just doesn't deal well with
this kind of very low resolution data near the pole (always
problematic). Either of the two methods I outline in this article
"work", but I think the data itself limits our ability to get good
results.
http://www.idlcoyote.com/code_tips/usegriddata.html
I've sent you a program with the code I wrote to test this.
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: Wrapping image on polar projection [message #87823 is a reply to message #87767] |
Thu, 27 February 2014 09:57  |
Vinay
Messages: 3 Registered: February 2014
|
Junior Member |
|
|
On Wednesday, February 26, 2014 11:58:46 AM UTC-9, Vinay wrote:
> Hi folks,
>
>
>
>
>
> Was anyone out there successful in wrapping images on polar projection using 'cg' routines. Most of the other examples essentially uses cgCoutour. OK here is where, I got stuck.
>
>
>
> My data is similar to the example given in
>
> http://www.idlcoyote.com/map_tips/warptomap.php
>
>
>
>
>
> ------My code---------------------------
>
> Filein = 'test1.sav'
>
> RESTORE, Filein
>
> Help, image, lats, lons
>
>
>
> S = Size(image)
>
> lat = Rebin(lats, s(1), s(2))
>
> lon = Rebin(lons, s(1), s(2))
>
> image1 = Bytscl(image,min = 0.0, max = 0.15,/NaN )
>
>
>
> cgDisplay, Title='Polar Projection'
>
>
>
> map = Obj_New('cgMap', 'Polar Stereographic', LIMIT=[60, -180, 90, 180], Center_Lat=90, Center_Lon=180, POSITION=[0.05, 0.05, 0.95, 0.95])
>
>
>
> warped = cgWarpToMap(Image1, lon, lat, MAP=map, MISSING=0, Resolution=[400, 300], /SetRange)
>
> cgImage, warped, Position=[0.1, 0.1, 0.9, 0.9]
>
> cgMap_Grid, Map=map, /Label, Color='Blue'
>
> cgMap_Continents, MAP=map, Color='Blue'
>
> cgMap_Continents, MAP=map, Color='Blue', /Countries
>
> ------------------------------------
>
>
>
> It will be great, if anyone has any suggestions!!
>
>
>
>
>
> Thanks,
>
>
>
> Vinay
So true, the data is low-resolution and limits the ability to get good results. Yes, the gridded methods 'works' fine with quite acceptable results. Thankyou for your time.
Cheers!!
|
|
|