[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cartesian IDLgrSurface of [theta,phi] data to a sphere??



Todd Bowers writes:

> I have a 10x24 2D array of 'intensities' where the cols and rows are
> values at each theta (0 to 90, every 10 degrees, includes a polar
> 'cap') and phi (0 to 360, every 15 degrees) 'look' angle over the
> hemisphere. I can easily plot this as a shaded surface via DFanning's
> xsurface program. Problem is, it's difficult to see the directional
> relationship of the data projected on this 2D surface. So, after much
> twiddling, I tried replacing the IDLgrSurface object with an
> IDLgrPolygon. E.g,. replace this line in david's code
> 
> thisSurface = OBJ_NEW('IDLgrSurface', data, x, y, $
>    Color=[255,255,0], _Extra=extra)
> 
> with this below to see the data shaded by value (easier to see how
> data maps to sphere in a minute)
> 
> thisPalette=Obj_New('IDLgrPalette')
> thisPalette->LoadCT, 13  ;data colored blue - red
> s = Size(data, /Dimensions)
> dataColoringByValue = Reform(BytScl(data, /NaN), s[0]*s[1])
> thisSurface = OBJ_NEW('IDLgrSurface', data, x, y,
> Vert_Colors=dataColoringByValue, $
>    Color=[255,255,0], Palette=thisPalette, _Extra=extra)
> 
> Compile and run this. Now, think of the x axis running from the
> equator to the pole, and the y data as starting from prime meridian
> and going 360 degrees. Then, without closing this window so you can
> compare, comment out just the last line above and paste in these 2
> lines of code right after:
> 
> MESH_OBJ, 4, Vertex_List, Polygon_List,Replicate(1, s[0], s[1])
> thisSurface = OBJ_NEW('IDLgrPolygon', Vertex_List,
> polygons=Polygon_List, $
>   Vert_Colors=dataColoringByValue, Palette=thisPalette, style=2,
> shading=1)
> 
> Move the 2 graphics windows side by side and you can see how it
> transfers to the sphere. I've tried transposing and rot'ing the heck
> outta it, as well as just trying to get it to only the hemisphere with
> NaN data to get it to plot correctly, but to no avail. 1 problem I see
> is that my (real) data is computed with a polar cap so the
> 'longitudnal' lines don't converge to a point, but the mesh_obj'd
> sphere does. Even so, my major problem is that the mapping to the
> sphere just isn't panning out. Could I please ask for
> hints/tips/suggestions???

I'm not sure I totally understand this problem, but
wouldn't it be easier (and help with the mapping)
if you put the data on the sphere as a texture map?
That way you could use the Texture_Coord keyword to
position the data anywhere you like.

Cheers,

David
-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155