The MAP_PATCH function returns an image (or other dataset) warped to fit the current map projection. Mapping coordinates should be setup via a call to MAP_SET before using MAP_PATCH.
MAP_PATCH works in object (data) space. It divides the input data set, Image_Orig , into triangular patches, either directly from the implicit rectangular grid, or by triangulating the data points on the surface of the sphere using the TRIANGULATE procedure. These triangular patches are then projected to the map plane in the image space of the destination array and then interpolated. The time required by MAP_PATCH depends mainly on the number of elements in the input array.
MAP_PATCH is more efficient than MAP_IMAGE when the destination area is large compared to the input data set. If the converse is true, MAP_IMAGE is more efficient.
This routine is written in the IDL language. Its source code can be found in the file
map_patch.pro
in the
lib
subdirectory of the IDL distribution.
A one- or two-dimensional array that contains the data to be overlaid on the map. If the TRIANGULATE keyword is not set, Image_Orig must be a two-dimensional array. Rows and columns must be arranged in increasing longitude and latitude order. Also, the corner points of each cell must be contiguous. This means that the seam of a map must lie on a cell boundary, not in its interior, splitting the cell.
An optional vector that contains the longitude value for each column in Image_Orig . If Lons is a one-dimensional vector, longitude ( Image_Orig [i,j]) = Lons [i]; if Lons is a two-dimensional vector, longitude ( Image_Orig [i,j]) = Lons [i,j].
This argument can be omitted if the longitudes are equally-spaced and the beginning and ending longitudes are specified with the LON0 and LON1 keywords.
An optional vector that contains the latitude value for each row in Image_Orig . If Lats is a one-dimensional vector, latitude ( Image_Orig [i,j]) = Lats [i]; if Lats is a two-dimensional vector, latitude ( Image_Orig [i,j]) = Lats [i,j].
This argument can be omitted if the latitudes are equally-spaced and the beginning and ending latitudes are specified with the LAT0 and LAT1 keywords.
Set this keyword to a value to be used for areas outside the valid map coordinates (i.e., the "background color"). If the current plotting device is PostScript, the default is 255 (white). Otherwise, the default is 0 (usually black).
The largest data value to be warped. Values in Image_Orig greater than this value are considered missing. Pixels in the output image that correspond to these missing values are set to the value specified by the MISSING keyword.
Set this keyword to convert the input data to device space and triangulate them. This keyword must be specified if the connectivity of the data points is not rectangular and monotonic in device space.
Set this keyword to a named variable in which the width of the output image is returned, in graphic coordinate units. If the current graphics device has scalable pixels (e.g., PostScript), the values returned by XSIZE and YSIZE should be passed to the TV procedure.
Set this keyword to a named variable in which the X coordinate where the left edge of the image should be placed on the screen is returned.
n = 24 ; Form a 24 x 24 dataset on a sphere.
lat = replicate(180./(n-1),n) # findgen(n) - 90
;
Specify equally gridded latitudes.
lon = findgen(n) # replicate(360./(n-1), n)
;
Specify equally gridded longitudes.
x = cos(lon * !dtor) * cos(lat * !dtor)
y = sin(lon * !dtor) * cos(lat * !dtor)
z = sin(lat * !dtor) ; Convert to Cartesian coordinates.
f = BYTSCL((x-1)^2 + (y-1)^2 + z^2) ; Set interpolation function to scaled distance squared from (1,1,0).
MAP_SET, 90, 0, /STEREO, /ISOTROPIC, /HORIZ
;
Set up projection.
TV, MAP_PATCH(f, XSTART=x0, YSTART=y0), x0, y0
;
Grid and display the data.
MAP_GRID ; Draw gridlines over the map and image.