The GRID_INPUT procedure preprocesses and sorts two-dimensional scattered data points, and removes duplicate values. This procedure is also used for converting spherical coordinates to Cartesian coordinates.
Note: GRID_INPUT accepts complex input but only utilizes the real part of any complex number.
These are input arguments for scattered data points, where X, and Y are location. All of these arguments are N point vectors.
The function value at each location in the form of an N point vector.
These are input arguments representing scattered data points on a sphere, specifying location (longitude and latitude). All are N point vectors. Lon, Lat are in degrees or radians (default).
These are scattered data point input arguments representing the R and Theta polar coordinate location in degrees or radians (default). All arguments are N point vectors.
X1, Y1, F1
These output arguments are processed and sorted single precision floating point data which are passed as the input points to the GRIDDATA function.
Upon return, a named variable that contains a 3-by-n array of Cartesian coordinates representing points on a sphere.
By default, all angular inputs and keywords are assumed to be in radian units. Set the DEGREES keyword to change the angular input units to degrees.
Set this keyword to a string indicating how duplicate data points are handled per the following table. The case (upper or lower) is ignored. The default setting for DUPLICATES is “First”.
Retain only the first encounter of the duplicate locations.
Retain only the last encounter of the duplicate locations.
Retains all locations, which is invalid for any gridding technique that requires a TRIANGULATION. Some methods, such as Inverse Distance or Polynomial Regression with no search criteria can handle duplicates.
Retain the average F value of the duplicate locations.
Retain the average of the minimum and maximum duplicate locations ((Max(F) + Min (F)) / 2).
Retain the minimum of the duplicate locations (Min(F)).
Retain the maximum of the duplicate locations (Max(F)).
The tolerance for finding duplicates. Points within EPSILON distance of each other are considered duplicates. For spherical coordinates, EPSILON is in units of angular distance, as set by the DEGREES keyword.
An N-point vector specifying the indices of the points to exclude.
Set to indicate inputs are in polar coordinates.
Set to indicate inputs are in spherical coordinates. In this case, the output argument Xyz is set to a 3-by-n array containing the spherical coordinates converted to 3-dimensional Cartesian points on a sphere.
The following example uses the data from the irreg_grid1.txt ASCII file included in the examples/data subdirectory of the IDL distribution. This file contains scattered elevation data of a model of an inlet. This scattered elevation data contains two duplicate locations. The GRID_INPUT procedure is used to omit the duplicate locations.
file = FILE_SEARCH(!DIR, 'irreg_grid1.txt')
; Import the data from the file into a structure.
dataStructure = READ_ASCII(file)
; Get the imported array from the first field of the structure.
dataArray = TRANSPOSE(dataStructure.field1)
; Initialize the variables of this example from
; the imported array.
x = dataArray[*, 0]
y = dataArray[*, 1]
data = dataArray[*, 2]
Next, we display the data by scaling it to range from 1 to 253 so a color table can be applied. The values of 0, 254, and 255 are reserved as outliers. We tell IDL to use decomposed color mode (a maximum of 256 colors) and load a color table, then plot the data and show the data values in color.
scaled = BYTSCL(data, TOP = !D.TABLE_SIZE - 4) + 1B
DEVICE, DECOMPOSED = 0
; Open a display window and plot the data points.
WINDOW, 0, XSIZE=512, YSIZE=800
PLOT, x, y, /XSTYLE, /YSTYLE, LINESTYLE = 1, $
TITLE = 'Original Data, Scaled (1 to 253)', $
XTITLE = 'x', YTITLE = 'y'
; Now display the data values with respect to the color table.
FOR i = 0L, (N_ELEMENTS(x) - 1) DO PLOTS, x[i], y[i], PSYM = -1, $
SYMSIZE = 2., COLOR = scaled[i]
Finally, process the data with GRID_INPUT to sort and remove any duplicate locations, then display the results in a second window.
GRID_INPUT, x, y, data, xSorted, ySorted, dataSorted
; Scale the resulting data.
scaled = BYTSCL(dataSorted, TOP = !D.TABLE_SIZE - 4) + 1B
; Plot the resulting data points.
PLOT, xSorted, ySorted, /XSTYLE, /YSTYLE, LINESTYLE = 1, $
TITLE = 'The Data Preprocessed and Sorted, Scaled (1 to 253)', $
XTITLE = 'x', YTITLE = 'y'
; Now display the resulting data values with respect to the color
FOR i = 0L, (N_ELEMENTS(xSorted) - 1) DO PLOTS, $
xSorted[i], ySorted[i], PSYM = -1, COLOR = scaled[i], $
SYMSIZE = 2.
This page has no comments yet. Be the first one!