The MAP_PATCH function warps an image (or other dataset) to 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.
Note: 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.
n = 24
lat = replicate(180./(n-1),n) # findgen(n) - 90
lon = findgen(n) # replicate(360./(n-1), n)
x = cos(lon * !dtor) * cos(lat * !dtor)
y = sin(lon * !dtor) * cos(lat * !dtor)
z = sin(lat * !dtor)
f = BYTSCL((x-1)^2 + (y-1)^2 + z^2)
MAP_SET, 90, 0, /STEREO, /ISOTROPIC, /HORIZ
TV, MAP_PATCH(f, XSTART=x0, YSTART=y0), x0, y0
Result = MAP_PATCH( Image_Orig [, Lons, Lats] [, LAT0=value] [, LAT1=value] [, LON0=value] [, LON1=value] [, MAX_VALUE=value] [, MISSING=value] [, /TRIANGULATE] [, XSIZE=variable] [, XSTART=variable] [, YSIZE=variable] [, YSTART=variable] )
Returns the image or dataset warped to the current map projection.
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.
The latitude of the first row of data. The default is -90.
The latitude of the last row of data. The default is +90.
The longitude of the first column of data. The default is -180.
The longitude of the last column of data. The default is 180 - (360/number of rows)
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 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).
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 (PostScript, for example), 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.
Set this keyword to a named variable in which the height of the output image is returned, in graphic coordinate units. If the current graphics device has scalable pixels (PostScript, for example), the values returned by XSIZE and YSIZE should be passed to the TV procedure.
Set this keyword to a named variable in which the Y coordinate where the bottom edge of the image should be placed on the screen is returned.
MAP_CONTINENTS Procedure, MAP_GRID Procedure, MAP_IMAGE, MAP_SET Procedure