X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



3938 Rate this article:
No rating

Obtaining Irregular Grid Intervals with IDL

 

This Help Article demonstrates how the XOUT and YOUT keywords, to the TRIGRID routine, can be used to obtain a grid with irregular intervals.

The following example begins by creating an irregularly-gridded dataset of a Gaussian surface. A grid is then formed from these points using the TRIANGULATE and TRIGRID routines. The inputs to the XOUT and YOUT keywords are determined at random to produce an irregular interval. Since the XOUT and YOUT vectors must be monotonically increasing or decreasing, they must be sorted before passing them to the TRIGRID routine. The lines of the resulting surface are spaced at the irregular intervals provided by the settings of the XOUT and YOUT keywords.

See also TRIANGULATE and TRIGRID in the IDL Help for more information on these routines.

Code Example:

PRO griddingIrregularIntervals

    ; Make 100 normal x, y points:
    x = RANDOMN(seed, 100)
    y = RANDOMN(seed, 100)
    PRINT, MIN(x), MAX(x)
    PRINT, MIN(y), MAX(y)

    ; Make a Gaussian surface:
    z = EXP(-(x^2 + y^2))

    ; Obtain triangulation:
    TRIANGULATE, x, y, triangles, boundary

    ; Create random x values. These values will be used to
    ; form the x locations of the resulting grid.
    gridX = RANDOMN(seed, 30)
    ; Sort x values. Sorted values are required for the XOUT
    ; keyword.
    sortX = UNIQ(gridX, SORT(gridX))
    gridX = gridX[sortX]
    ; Output sorted x values to be used with the XOUT
    ; keyword.
    PRINT, 'gridX:'
    PRINT, gridX

    ; Create random y values. These values will be used to
    ; form the y locations of the resulting grid.
    gridY = RANDOMN(seed, 30)
    ; Sort y values. Sorted values are required for the YOUT
    ; keyword.
    sortY = UNIQ(gridY, SORT(gridY))
    gridY = gridY[sortY]
    ; Output sorted y values to be used with the YOUT
    ; keyword.
    PRINT, 'gridY:'
    PRINT, gridY

    ; Derive grid of initial values. The location of the
    ; resulting grid points are the inputs to the XOUT and
    ; YOUT keywords.
    grid = TRIGRID(x, y, z, triangles, XOUT = gridX, $
     YOUT = gridY, EXTRAPOLATE = boundary)

    ; Display resulting grid. The grid lines are not
    ; at regular intervals because of the randomness of the
    ; inputs to the XOUT and YOUT keywords.
    SURFACE, grid, gridX, gridY, /XSTYLE, /YSTYLE

END
______________________________________________________________
Reviewed by BC on 09/05/2014



		
		
			
			
			
			
			
			

		
		
		
		
Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »