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

Home » Public Forums » archive » Overlaying data on a MODIS reprojected image created with the TrueColor package
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
Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92374] Fri, 04 December 2015 02:12 Go to next message
Steve[7] is currently offline  Steve[7]
Messages: 5
Registered: December 2015
Junior Member
Hi

I have created a reprojected MODIS true color image using the TrueColor package (ftp://ftp.ssec.wisc.edu/pub/IMAPP/MODIS/TrueColor/)

I now want to read this image into IDL and overlay some data on top of the image e.g. an aircraft flight track. I am however having trouble getting the map projection correct.

Note that the gpd file used in the TrueColor packaged to create the original image continas the following

Map Projection: Azimuthal Equal-Area
Map Reference Latitude: 62.500
Map Reference Longitude: -10.000
Grid Map Units per Cell: 0.250
Grid Width: 4400.0
Grid Map Origin Column: 2199.5
Grid Height: 3400.0
Grid Map Origin Row: 1699.5

I have tried the following code which attempts to use the method from David Fanning's page http://www.idlcoyote.com/ng_tips/mapnogrid.php

;read in original image
img = READ_TIFF('true.tif')
img = REVERSE(img,3)

s=SIZE(img,/DIMENSIONS) ;3x4400x3400

projection='Lambert Azimuthal'
latcen = 62.50
loncen = -10.0
res = 0.25

map = Obj_New('cgMap', projection, /OnImage)
uv = map -> Forward(Loncen, Latcen)
uv_xcenter = uv[0,0]
uv_ycenter = uv[1,0]
xrange = [uv_xcenter - ((s[1]/2.)*res*1000.), uv_xcenter + ((s[1]/2.)*res*1000.)]
yrange = [uv_ycenter - ((s[2]/2.)*res*1000.), uv_ycenter + ((s[2]/2.)*res*1000.)]
map -> SetProperty, XRANGE=xrange, YRANGE=yrange
cgDisplay, s[1]/4., s[2]/4.
cgImage, img, Margin=0.1
map -> Draw
cgMap_Grid, MAP=map, /BOX_AXES, /cgGRID
cgMap_Continents, MAP=map, /continents, /hires

The above code displays the original image on a map which looks about right. However the coastlines produced by cgMap_Continents do not overlay the real landmass boundaries in the original image. Clearly the map projection isn't quite correct.

Until I get this sorted I can't overlay data onto the image.

Any ideas on what I am doing wrong?

Thanks in advance

Steve
Re: Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92376 is a reply to message #92374] Fri, 04 December 2015 05:57 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Steve writes:

> I have created a reprojected MODIS true color image using the
TrueColor package (ftp://ftp.ssec.wisc.edu/pub/IMAPP/MODIS/TrueColor/)
>
> I now want to read this image into IDL and overlay some data on top of the image e.g. an aircraft flight track. I am however having trouble getting the map projection correct.
>
> Note that the gpd file used in the TrueColor packaged to create the original image continas the following
>
> Map Projection: Azimuthal Equal-Area
> Map Reference Latitude: 62.500
> Map Reference Longitude: -10.000
> Grid Map Units per Cell: 0.250
> Grid Width: 4400.0
> Grid Map Origin Column: 2199.5
> Grid Height: 3400.0
> Grid Map Origin Row: 1699.5
>
> I have tried the following code which attempts to use the method from David Fanning's page http://www.idlcoyote.com/ng_tips/mapnogrid.php
>
> ;read in original image
> img = READ_TIFF('true.tif')
> img = REVERSE(img,3)
>
> s=SIZE(img,/DIMENSIONS) ;3x4400x3400
>
> projection='Lambert Azimuthal'
> latcen = 62.50
> loncen = -10.0
> res = 0.25
>
> map = Obj_New('cgMap', projection, /OnImage)
> uv = map -> Forward(Loncen, Latcen)
> uv_xcenter = uv[0,0]
> uv_ycenter = uv[1,0]
> xrange = [uv_xcenter - ((s[1]/2.)*res*1000.), uv_xcenter + ((s[1]/2.)*res*1000.)]
> yrange = [uv_ycenter - ((s[2]/2.)*res*1000.), uv_ycenter + ((s[2]/2.)*res*1000.)]
> map -> SetProperty, XRANGE=xrange, YRANGE=yrange
> cgDisplay, s[1]/4., s[2]/4.
> cgImage, img, Margin=0.1
> map -> Draw
> cgMap_Grid, MAP=map, /BOX_AXES, /cgGRID
> cgMap_Continents, MAP=map, /continents, /hires
>
> The above code displays the original image on a map which looks about right. However the coastlines produced by cgMap_Continents do not overlay the real landmass boundaries in the original image. Clearly the map projection isn't quite correct.
>
> Until I get this sorted I can't overlay data onto the image.
>
> Any ideas on what I am doing wrong?

It's hard to know without seeing the result, but I suspect you might
have to shift your range by half a grid unit to match the grid origins.

Cheers,

David

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: Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92377 is a reply to message #92376] Fri, 04 December 2015 07:43 Go to previous messageGo to next message
Steve[7] is currently offline  Steve[7]
Messages: 5
Registered: December 2015
Junior Member
On Friday, 4 December 2015 13:57:09 UTC, David Fanning wrote:
> Steve writes:
>
>> I have created a reprojected MODIS true color image using the
> TrueColor package (ftp://ftp.ssec.wisc.edu/pub/IMAPP/MODIS/TrueColor/)
>>
>> I now want to read this image into IDL and overlay some data on top of the image e.g. an aircraft flight track. I am however having trouble getting the map projection correct.
>>
>> Note that the gpd file used in the TrueColor packaged to create the original image continas the following
>>
>> Map Projection: Azimuthal Equal-Area
>> Map Reference Latitude: 62.500
>> Map Reference Longitude: -10.000
>> Grid Map Units per Cell: 0.250
>> Grid Width: 4400.0
>> Grid Map Origin Column: 2199.5
>> Grid Height: 3400.0
>> Grid Map Origin Row: 1699.5
>>
>> I have tried the following code which attempts to use the method from David Fanning's page http://www.idlcoyote.com/ng_tips/mapnogrid.php
>>
>> ;read in original image
>> img = READ_TIFF('true.tif')
>> img = REVERSE(img,3)
>>
>> s=SIZE(img,/DIMENSIONS) ;3x4400x3400
>>
>> projection='Lambert Azimuthal'
>> latcen = 62.50
>> loncen = -10.0
>> res = 0.25
>>
>> map = Obj_New('cgMap', projection, /OnImage)
>> uv = map -> Forward(Loncen, Latcen)
>> uv_xcenter = uv[0,0]
>> uv_ycenter = uv[1,0]
>> xrange = [uv_xcenter - ((s[1]/2.)*res*1000.), uv_xcenter + ((s[1]/2.)*res*1000.)]
>> yrange = [uv_ycenter - ((s[2]/2.)*res*1000.), uv_ycenter + ((s[2]/2.)*res*1000.)]
>> map -> SetProperty, XRANGE=xrange, YRANGE=yrange
>> cgDisplay, s[1]/4., s[2]/4.
>> cgImage, img, Margin=0.1
>> map -> Draw
>> cgMap_Grid, MAP=map, /BOX_AXES, /cgGRID
>> cgMap_Continents, MAP=map, /continents, /hires
>>
>> The above code displays the original image on a map which looks about right. However the coastlines produced by cgMap_Continents do not overlay the real landmass boundaries in the original image. Clearly the map projection isn't quite correct.
>>
>> Until I get this sorted I can't overlay data onto the image.
>>
>> Any ideas on what I am doing wrong?
>
> It's hard to know without seeing the result, but I suspect you might
> have to shift your range by half a grid unit to match the grid origins.
>
> Cheers,
>
> David
>
> 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.")

So when I said the original image on the map looks about right I was perhaps being generous! The coastlines are offset in places by a few tenths of a degree latitude for example. Note that the grid unit is 250 metres so much smaller than this difference.

Perhaps I am making incorrect assumptions on what the image output by the TrueColor package contains i.e. the info in the gpd file is not sufficient.

Steve
Re: Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92379 is a reply to message #92377] Fri, 04 December 2015 11:18 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
steven_abel@hotmail.com writes:

> So when I said the original image on the map looks about right I was perhaps being generous! The coastlines are offset in places by a few tenths of a degree latitude for example. Note that the grid unit is 250 metres so much smaller than this difference.
>
> Perhaps I am making incorrect assumptions on what the image output by the TrueColor package contains i.e. the info in the gpd file is not sufficient.

It is not entirely unknown for the map projection information in a file
to just be wrong. :-)

I really can't speak intelligently about it without seeing it. Can you
send me the image?

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: Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92380 is a reply to message #92379] Fri, 04 December 2015 11:24 Go to previous messageGo to next message
Steve[7] is currently offline  Steve[7]
Messages: 5
Registered: December 2015
Junior Member
I will send you the image on Monday. Appreciate your offer to help.

Thanks

Steve
Re: Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92393 is a reply to message #92380] Mon, 07 December 2015 01:35 Go to previous messageGo to next message
Steve[7] is currently offline  Steve[7]
Messages: 5
Registered: December 2015
Junior Member
On Friday, 4 December 2015 19:24:44 UTC, Steve wrote:
> I will send you the image on Monday. Appreciate your offer to help.
>
> Thanks
>
> Steve

Hi David

I have sent a Dropbox link to the image and code to your coyote email address. Let me know if you don't receive it.

Steve
Re: Overlaying data on a MODIS reprojected image created with the TrueColor package [message #92439 is a reply to message #92393] Wed, 16 December 2015 01:49 Go to previous message
Steve[7] is currently offline  Steve[7]
Messages: 5
Registered: December 2015
Junior Member
On Monday, 7 December 2015 09:35:15 UTC, Steve wrote:
> On Friday, 4 December 2015 19:24:44 UTC, Steve wrote:
>> I will send you the image on Monday. Appreciate your offer to help.
>>
>> Thanks
>>
>> Steve
>
> Hi David
>
> I have sent a Dropbox link to the image and code to your coyote email address. Let me know if you don't receive it.
>
> Steve

UPDATE: Laim Gumley pointed me towards the Polar2Grid package http://cimss.ssec.wisc.edu/cspp/npp_polar2grid_v2.0.shtml which aloows you to output MODIS true color GeoTiff images. These additional information in the GeoTiff image has made it easier to use in IDL and I can no overlay data on the image.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Google search from within an IDL program
Next Topic: chrome browser update

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

Current Time: Wed Oct 08 09:18:24 PDT 2025

Total time taken to generate the page: 0.00497 seconds