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

Home » Public Forums » archive » Navigating AVIRIS Images
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
Navigating AVIRIS Images [message #85584] Tue, 20 August 2013 11:25 Go to next message
Scott Ozog is currently offline  Scott Ozog
Messages: 5
Registered: August 2013
Junior Member
Hi I'm still new to IDL, and I'm trying to learn it for grad school. I'm trying to navigate images from NASA's AVIRIS platform. If anyone has experience in this it would be greatly appreciated.
I have a file that has Lons in band 1, Lats in band 2, and a elevation model image in band 3.
The arrays are [677, 3068] and the resolution of each pixel is unknown. The image is in UTM using WGS84.

The actual image file is larger in both sample and lines, but I'm at least trying to learn how the MAP_PATCH or Fanning's WarpToImage procedures work. I still can't quite get them to work yet with my image.

Thanks,
Scott
Re: Navigating AVIRIS Images [message #85590 is a reply to message #85584] Tue, 20 August 2013 12:29 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Scott Ozog writes:

> Hi I'm still new to IDL, and I'm trying to learn it for grad school. I'm trying to navigate images from NASA's AVIRIS platform. If anyone has experience in this it would be greatly appreciated.
> I have a file that has Lons in band 1, Lats in band 2, and a elevation model image in band 3.
> The arrays are [677, 3068] and the resolution of each pixel is unknown. The image is in UTM using WGS84.
>
> The actual image file is larger in both sample and lines, but I'm at least trying to learn how the MAP_PATCH or Fanning's WarpToImage procedures work. I still can't quite get them to work yet with my image.

I wouldn't waste too much time with cgWarpToMap. I am THIS close to the
IDL Holy Grail and I've got cgWarpToMap all torn apart right now. I've
been searching for 10 years to find a fast way to convert a MODIS swath
file to a navigable image and I am very, very close. (In fact, I woke up
at 2AM and worked on it last night, when I had a new idea.)

If this image is already projected, though, as you indicate, I doubt
very much that you will need to bother with either Map_Patch or
cgWarpToMap. Rather, you will need the UTM zone number, which you can
obtain from cgUTMZone by passing in any lat/lon pair you have laying
around in your lats and lons arrays.

zone = cgUTMZone(lon[0,0], lat[0,0])

Then, you need a map object:

map = Obj_New('cgMap', 'UTM', ELLIPSOID='WGS84', Zone=zone)

Make sure the longitudes are in the range -180 to 180.

lons = ((lons + 180) MOD 360) - 180

Convert these values to XY projected meter space:

xy = map -> Forward(lons, lats)

Find the min and max of the X and Y space:

x = Reform(xy[0,*])
y = Reform(xy[1,*])
xmin = Min(x, MAX=xmax)
ymin = Min(y, MAX=ymax)

Find the size of your image:

s = Size(image, /Dimensions)

Calculate the X and Y scales:

scale_x = (xmax - xmin) / (s[0]-1)
scale_y = (ymax - ymin) / (s[1]-1)

Calculate the XY ranges and set the map object appropriately:

rect = [xmin-(scale_x/2.), ymin-(scale_y/2.), $
xmax+(scale_x/2.), ymax+(scale_y/2.)]
xrange = rect[[0,2]]
yrange = rect[[1,3]]
map -> SetProperty, XRANGE=xrange, YRANGE=yrange

Display your image and navigate it.

cgDisplay, Aspect=image, 800, 800
cgImage, image
cgMap_Continents, Map=map, Color='red6'
cgMap_Grid, Map=map, Color='blu6'

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: Navigating AVIRIS Images [message #85592 is a reply to message #85590] Tue, 20 August 2013 12:42 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
>
> I am THIS close to the IDL Holy Grail and I've got cgWarpToMap all torn apart right now.

Just remember to "Choose wisely" and if you do, don't take the Grail beyond the Great Seal. :-)

Tangentially related, I threw some radar data at your working example and it worked great! (Well except some radar-related problems, particularly non-uniform gate size. But that can be overcome....)
Re: Navigating AVIRIS Images [message #85593 is a reply to message #85590] Tue, 20 August 2013 12:47 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Display your image and navigate it.
>
> cgDisplay, Aspect=image, 800, 800
> cgImage, image
> cgMap_Continents, Map=map, Color='red6'
> cgMap_Grid, Map=map, Color='blu6'

Forgot to set the position on the map object. Do this before you call
cgMap_Continents, etc.

map -> SetProperty, Position=[0,0,1,1]

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: Navigating AVIRIS Images [message #85626 is a reply to message #85590] Thu, 22 August 2013 09:24 Go to previous messageGo to next message
Scott Ozog is currently offline  Scott Ozog
Messages: 5
Registered: August 2013
Junior Member
On Tuesday, August 20, 2013 3:29:24 PM UTC-4, David Fanning wrote:
> Scott Ozog writes:
>
>
>
>> Hi I'm still new to IDL, and I'm trying to learn it for grad school. I'm trying to navigate images from NASA's AVIRIS platform. If anyone has experience in this it would be greatly appreciated.
>
>> I have a file that has Lons in band 1, Lats in band 2, and a elevation model image in band 3.
>
>> The arrays are [677, 3068] and the resolution of each pixel is unknown. The image is in UTM using WGS84.
>
>>
>
>> The actual image file is larger in both sample and lines, but I'm at least trying to learn how the MAP_PATCH or Fanning's WarpToImage procedures work. I still can't quite get them to work yet with my image.
>
>
>
> I wouldn't waste too much time with cgWarpToMap. I am THIS close to the
>
> IDL Holy Grail and I've got cgWarpToMap all torn apart right now. I've
>
> been searching for 10 years to find a fast way to convert a MODIS swath
>
> file to a navigable image and I am very, very close. (In fact, I woke up
>
> at 2AM and worked on it last night, when I had a new idea.)
>
>
>
> If this image is already projected, though, as you indicate, I doubt
>
> very much that you will need to bother with either Map_Patch or
>
> cgWarpToMap. Rather, you will need the UTM zone number, which you can
>
> obtain from cgUTMZone by passing in any lat/lon pair you have laying
>
> around in your lats and lons arrays.
>
>
>
> zone = cgUTMZone(lon[0,0], lat[0,0])
>
>
>
> Then, you need a map object:
>
>
>
> map = Obj_New('cgMap', 'UTM', ELLIPSOID='WGS84', Zone=zone)
>
>
>
> Make sure the longitudes are in the range -180 to 180.
>
>
>
> lons = ((lons + 180) MOD 360) - 180
>
>
>
> Convert these values to XY projected meter space:
>
>
>
> xy = map -> Forward(lons, lats)
>
>
>
> Find the min and max of the X and Y space:
>
>
>
> x = Reform(xy[0,*])
>
> y = Reform(xy[1,*])
>
> xmin = Min(x, MAX=xmax)
>
> ymin = Min(y, MAX=ymax)
>
>
>
> Find the size of your image:
>
>
>
> s = Size(image, /Dimensions)
>
>
>
> Calculate the X and Y scales:
>
>
>
> scale_x = (xmax - xmin) / (s[0]-1)
>
> scale_y = (ymax - ymin) / (s[1]-1)
>
>
>
> Calculate the XY ranges and set the map object appropriately:
>
>
>
> rect = [xmin-(scale_x/2.), ymin-(scale_y/2.), $
>
> xmax+(scale_x/2.), ymax+(scale_y/2.)]
>
> xrange = rect[[0,2]]
>
> yrange = rect[[1,3]]
>
> map -> SetProperty, XRANGE=xrange, YRANGE=yrange
>
>
>
> Display your image and navigate it.
>
>
>
> cgDisplay, Aspect=image, 800, 800
>
> cgImage, image
>
> cgMap_Continents, Map=map, Color='red6'
>
> cgMap_Grid, Map=map, Color='blu6'
>
>
>
> 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.")


Thank you Dr. Fanning!
That helped a lot. Combining this with the last part of your warptomap.php I was able to get something like what I'm trying to do. However, I know that my image is not oriented N-S and that is how it is being displayed on the map... Just confined to its x and y min/max. I'm not sure how to upload a photo to show you what I mean. The image is a small swath only about 10km x 50km in southern New Mexico.

Thanks,
Scott Ozog
University of Maryland
Department of
Earth and Atmospheric Science
Re: Navigating AVIRIS Images [message #85627 is a reply to message #85626] Thu, 22 August 2013 09:52 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Scott Ozog writes:

> That helped a lot. Combining this with the last part of your warptomap.php I was able to get something like what I'm trying to do. However, I know that my image is not oriented N-S and that is how it is being displayed on the map... Just confined to its x and y min/max. I'm not sure how to upload a photo to show you what I mean. The image is a small swath only about 10km x 50km in southern New Mexico.

UTM grids are always oriented N/S! That's sort of the definition of a
UTM grid. :-)

Save it as a PNG file and e-mail it to me. I see these images are
rotated by about 19 degrees. Did you use the ROTATE keyword and set it
to this amount when you set up the map projection?

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: Adding extra white in middle of colour bar
Next Topic: Call object cleanup method when IDL exits

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

Current Time: Wed Oct 08 13:43:09 PDT 2025

Total time taken to generate the page: 0.00674 seconds