Navigating AVIRIS Images [message #85584] |
Tue, 20 August 2013 11:25  |
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   |
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 #85593 is a reply to message #85590] |
Tue, 20 August 2013 12:47   |
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   |
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  |
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.")
|
|
|