The SPH_SCAT function performs spherical gridding. Scattered samples on the surface of a sphere are interpolated to a regular grid. This routine is a convenient interface to the spherical gridding and interpolation provided by TRIANGULATE and TRIGRID.
This routine is written in the IDL language. Its source code can be found in the file
sph_scat.pro in the
lib subdirectory of the IDL distribution.
Result = SPH_SCAT( Lon, Lat, F [, BOUNDS=[lonmin, latmin, lonmax, latmax]] [, BOUT=variable] [, GOUT=variable] [, GS=[lonspacing, latspacing]] [, NLON=value] [, NLAT=value] )
Returns a regularly-interpolated grid of the function.
A vector of sample longitudes, in degrees.
A vector of sample latitudes, in degrees.
A vector of data values which are functions of Lon and Lat. Fi represents a value at (Loni, Lati).
Set this keyword to a four-element vector containing the grid limits in longitude and latitude of the output grid. The four elements are: [Lonmin, Latmin, Lonmax, Latmax]. If this keyword is not set, the grid limits are set to the extent of Lon and Lat.
Set this keyword to a named variable that, on return, contains a four-element vector (similar to BOUNDS) that describes the actual extent of the regular grid.
Set this keyword to a named variable that, on return, contains a two-element vector (similar to GS) that describes the actual grid spacing.
Set this keyword to a two-element vector that specifies the spacing between grid points in longitude (the first element) and latitude (the second element).
If this keyword is not set, the default value is based on the extents of Lon and Lat. The default longitude spacing is (Lonmax - Lonmin)/(NLON-1). The default latitude spacing is (Latmax - Latmin)/(NLAT-1). If NLON and NLAT are not set, the default grid size of 26 by 26 is used for NLON and NLAT.
The output grid size in the longitude direction. The default value is 26.
The output grid size in the latitude direction. The default value is 26.
; Create some random longitude points: lon = RANDOMU(seed, 50) * 360. -180. ; Create some random latitude points: lat = RANDOMU(seed, 50) * 180. -90. ; Make a function to fit: z = SIN(lat*!DTOR) c = COS(lat*!DTOR) x = COS(lon*!DTOR) * c y = SIN(lon*!DTOR) * c ; The finished dependent variable: f = SIN(x+y) * SIN(x*z) ; Interpolate the data and return the result in variable r: r = SPH_SCAT(lon, lat, f, BOUNDS=[0, -90, 350, 85], GS=[10,5])