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

Home » Public Forums » archive » Re: Convert planetary sinusoidal map image to (lat,lon,value) array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Convert planetary sinusoidal map image to (lat,lon,value) array [message #31642 is a reply to message #31641] Mon, 29 July 2002 10:58 Go to previous message
Ken Mankoff is currently offline  Ken Mankoff
Messages: 158
Registered: February 2000
Senior Member
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 rectangular, 1440 pixels (length) X 720
> pixels (height). I am able to read the file and store it as an array
> of dimensions 1440(columns)X720(rows).
>
> I need to convert the planetary portion of the image (all other points
> have value 0 in the image array) into a table of form (latitude,
> longitude, value). I am also uncertain which type of array I should
> construct from the planetary portion of the image in order to apply
> the conversion.
>
> Sincerely,
> Suniti
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: integer?
Next Topic: Re: Hey Group!

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

Current Time: Sat Oct 11 19:07:00 PDT 2025

Total time taken to generate the page: 0.63806 seconds