GRID_SPHERE Function
Returns a gridded, 2D array containing radii, given random longitude, latitude, and radius values.
Usage
result = GRID_SPHERE(points, grid_x, grid_y)
Input Parameters
pointsA (3, n) array containing the random longitude, latitude, and radius coordinates to be gridded.
grid_x—The x dimension of the grid. The longitude values are scaled to fit this dimension (unless the XMin or XMax keywords are set).
grid_y—The y dimension of the grid. The latitude values are scaled to fit this dimension (unless the YMin or YMax keywords are set).
Returned Value
resultA gridded, 2D array containing radius values.
Keywords
DegreesIf present and nonzero, reads the input coordinates in degrees instead of in radians.
OrderThe order of the weighting function to use for neighborhood averaging. Points are weighted by the function:
w = 1.0 / (dist ^ Order)
where dist is the distance to the point. (Default: 2)
RadiusRadius of the sphere to grid on. The minimum allowable radius is 0.5. (Default: 1.0). With a smaller radius, data points are closer together and more smoothing occurs. A larger radius causes less smoothing.
XMaxThe longitude of the right edge of the grid. Should be in the range –π to +π radians (–180 to +180 degrees). The XMax value is assumed to be in radians unless the Degrees keyword is set. If XMax is omitted, then a longitude of π is mapped to the right edge of the grid.
XMinThe longitude of the left edge of the grid. Should be in the range –π to +π radians (–180 to +180 degrees). The value is assumed to be in radians unless the Degrees keyword is set. If XMin is omitted, then a longitude of –π is mapped to the left edge of the grid.
YMaxThe latitude of the top edge of the grid. Should be in the range –π/2 to +π/2 radians (–90 to +90 degrees). The YMax value is assumed to be in radians unless the Degrees keyword is set. If YMax is omitted, then a latitude of π/2 is mapped to the top edge of the grid.
YMinThe latitude of the bottom edge of the grid. Should be in the range –π/2 to +π/2 radians (–90 to +90 degrees). The YMin value is assumed to be in radians unless the Degrees keyword is set. If YMin is omitted, then a latitude of –π/2 is mapped to the bottom edge of the grid.
Discussion
GRID_SPHERE uses an inverse distance averaging technique to interpolate missing data values. The gridded array returned by GRID_SPHERE is suitable for use with the POLY_SPHERE function.
The longitude values are assumed to be in the range –π to +π (–180 to +180 if the Degrees keyword is set). The latitude values are assumed to be in the range –π/2 to +π/2 (–90 to +90 if the Degrees keyword is set).
To grid on a portion of a sphere rather than on an entire sphere, use the XMin, XMax, YMin, and YMax keywords.
Examples
These commands show spherical gridding.
; Generate the data.
; Random longitude, latitude and radius points.
sphere = FLTARR(3, 6)
sphere(*, 0) = [ 33.0, -64.0, 0.2]
sphere(*, 1) = [280.0,   5.0, 1.8]
sphere(*, 2) = [350.0,  41.0, 1.9]
sphere(*, 3) = [310.0,  83.0, 0.3]
sphere(*, 4) = [ 67.0, -16.0, 1.6]
sphere(*, 5) = [133.0, -75.0, 0.2]
sphere(0, *) = sphere(0, *) - 180.0
; Grid the resulting sphere.
sphere = GRID_SPHERE(sphere, 32, 32,  $
   /Degrees, Order=4.0, Radius=20.0)
; Generate the polygons representing the spherical surface.
POLY_SPHERE, sphere, 32, 32, vertex_list, polygon_list
; Set up the viewing window and load the color table.
WINDOW, 0, Colors=128, XSize=800, YSize=600
LOADCT, 3
CENTER_VIEW, Xr=[-2.0, 2.0], Yr=[-2.0, 2.0],  $
   Zr=[-2.0, 2.0], Ax=(-40.0), Az=0.0,  $
   Zoom=1.0, Winx=800, Winy=600
; Specify the shading and display the resulting
; spherical surface.
SET_SHADING, Light=[-0.5, 0.5, 1.0]
TVSCL, POLYSHADE(vertex_list, polygon_list, /T3d)
For another example, see the sphere_demo3 demonstration program in:
(UNIX) <wavedir>/demo/arl
(WIN) <wavedir>\demo\arl
Where <wavedir> is the main PV-WAVE directory.
See Also