comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Convert planetary sinusoidal map image to (lat,lon,value) array

Re: Convert planetary sinusoidal map image to (lat,lon,value) array
type: item
description: Hi Suniti, I guess I'll give this a shot. Never done this but here is what I would try first if I were doing it: 1) Set up an identical map projection. The key word (no pun intended) here is *identical*, so that every pixel of your new "sinusoidal equal area" projection is the same as the BYTARR you have been given. If you can't get it identical, I am not sure what to do next. You can test if it is identical via: IDL> WINDOW, XSIZE=1440, YSIZE=720 IDL> MAP_SET, 0, 0, /SIN, /ISO IDL> TV, sinusoidal_projection IDL> MAP_GRID & MAP_CONTINENTS & MAP_HORIZON Does the border created by MAP_HORIZON line up exactly (to the pixel) with the data your data from the TV command? Look up the keywords to MAP_SET if not, and try other projections... 2) Redo the above code, but stop after the TV command so its just your data, nothing extra. You don't actually need a window, but you need the MAP_SET command to be run (with the correct 1440,720 sizes) so that IDL defines the map coordinate system. You are going to use this later to convert between (x,y) pixels and (lat,lon) degrees. 3) Set up the new array you want to put your data into. I suggest a cylindrical 'projection', which can then be warped to any other projection you want. So... IDL> new_array = BYTARR( 1440, 720 ) 4) Step through every (x,y) pixel in your image. Actually, don't use the image itself, just use your array. For each (x,y), figure out what (lat,lon) it is at. Stick it into the correct bin in NEW_ARRAY. FOR x=0,1439 DO BEGIN FOR y=0,719 DO BEGIN aPixel = sinusoidal( x, y ) IF ( aPixel NE 0 ) THEN BEGIN ; not a valid (lat,lon) coord. latlon = CONVERT_COORD( x, y, /device, /to_data ) new_array[ latlon[0], latlon[1] ] = aPixel ENDIF ENDFOR ENDFOR I am not sure if my syntax is correct, but this should give you the general idea Hope this helps, Let us know if it works, -Ken. On 29 Jul 2002, Suniti Karunatillake wrote: > I have a sinusoidal equal area map projection image in the form of a > byte array. The image is rect…
creator: Ken Mankoff
date: 2002-07-29T17:58:49-00:00

Re: Convert planetary sinusoidal map image to (lat,lon,value) array
type: item
description: Ken Mankoff (mankoff@I.HATE.SPAM.cs.colorado.edu) writes: > I guess I'll give this a shot. Never done this but here is what I > would try first if I were doing it: Not too bad, not too bad. :-) It would certainly work something like this, *if* you could get an IDL map projection to work. I have my doubts about what a "sinusoidal equal area" projection is, but assuming it is the same thing as a sinusoidal projection in IDL, I would make a few modifications to your suggestions. > 1) Set up an identical map projection. The key word (no pun intended) > here is *identical*, so that every pixel of your new "sinusoidal equal > area" projection is the same as the BYTARR you have been given. If > you can't get it identical, I am not sure what to do next. > > You can test if it is identical via: > IDL> WINDOW, XSIZE=1440, YSIZE=720 > IDL> MAP_SET, 0, 0, /SIN, /ISO > IDL> TV, sinusoidal_projection > IDL> MAP_GRID & MAP_CONTINENTS & MAP_HORIZON > > Does the border created by MAP_HORIZON line up exactly (to the pixel) > with the data your data from the TV command? Look up the keywords to > MAP_SET if not, and try other projections... I would add MARGIN=0 and NOBORDER=1 keywords to the MAP_SET command. And if I knew (or could figure out) the lat/lon coordinates of the corners of the image I would add the 8-element version of the LIMIT keyword as well. Then there is a reasonably good chance the map might match the image. You could set up the map coordinates in a pixmap if you didn't want to see something happening on the display. Just make the pixmap the same size as your image, etc. > 2) Redo the above code, but stop after the TV command so its just your > data, nothing extra. You don't actually need a window, but you need > the MAP_SET command to be run (with the correct 1440,720 sizes) so > that IDL defines the map coordinate system. You are going to use this > later to convert between (x,y) pixels and (lat,lon) degrees. > > 3) Set up the new array you want to put your data int…
creator: David Fanning
date: 2002-07-29T18:27:08-00:00

Re: Convert planetary sinusoidal map image to (lat,lon,value) array
type: item
description: David Fanning wrote: ... > get an IDL map projection to work. I have my doubts about > what a "sinusoidal equal area" projection is, but assuming it > is the same thing as a sinusoidal projection in IDL, I would The sinusoidal projection is an equal-area projection, so "sinusoidal equal-area" is redundant, but accurate.
creator: James Kuyper
date: 2002-07-29T19:09:18-00:00

Re: Convert planetary sinusoidal map image to (lat,lon,value) array
type: item
description: On Mon, 29 Jul 2002 11:27:08 -0700, David Fanning wrote: > Ken Mankoff (mankoff@I.HATE.SPAM.cs.colorado.edu) writes: > >> I guess I'll give this a shot. Never done this but here is what I would >> try first if I were doing it: > > Not too bad, not too bad. :-) > > It would certainly work something like this, *if* you could get an IDL > map projection to work. I have my doubts about what a "sinusoidal equal > area" projection is, but assuming it is the same thing as a sinusoidal > projection in IDL, I would make a few modifications to your suggestions. > >> 1) Set up an identical map projection. The key word (no pun intended) >> here is *identical*, so that every pixel of your new "sinusoidal equal >> area" projection is the same as the BYTARR you have been given. If you >> can't get it identical, I am not sure what to do next. >> >> You can test if it is identical via: >> IDL> WINDOW, XSIZE=1440, YSIZE=720 >> IDL> MAP_SET, 0, 0, /SIN, /ISO >> IDL> TV, sinusoidal_projection >> IDL> MAP_GRID & MAP_CONTINENTS & MAP_HORIZON >> >> Does the border created by MAP_HORIZON line up exactly (to the pixel) >> with the data your data from the TV command? Look up the keywords to >> MAP_SET if not, and try other projections... > > I would add MARGIN=0 and NOBORDER=1 keywords to the MAP_SET command. And > if I knew (or could figure out) the lat/lon coordinates of the corners > of the image I would add the 8-element version of the LIMIT keyword as > well. Then there is a reasonably good chance the map might match the > image. > > You could set up the map coordinates in a pixmap if you didn't want to > see something happening on the display. Just make the pixmap the same > size as your image, etc. > >> 2) Redo the above code, but stop after the TV command so its just your >> data, nothing extra. You don't actually need a window, but you need the >> MAP_SET command to be run (with the correct 1440,720 sizes) so that IDL >> defines the map coordinate system. You are going to use this l…
creator: JD Smith
date: 2002-07-31T01:15:36-00:00