Find Optimal Lag

• Identify two DEMs:
• Fixed or referenceDEM will be held in place.  For a time series, this should be the earlier DEM.
• DEM to shift will be moved until the best correlation is obtained, using all points in the reference DEM and comparing them to the lagged shifted DEM. The shift will be in whole grid units of the shifting DEM, which might have different spacing than the reference DEM (1" versus 3", or UTM versus geographic).
• The computation will use the elevations at grid nodes in the fixed DEM, and interpolate in the shifting DEM (if the grids have the same spacing and projection, the program will use the grid node elevations in both DEMs).
• The user specifies the maximum lag to consider in each direction (if you are looking at something like dune migration and you know the direction, it does not make sense to test lags that you know will not be reasonable).
• The users specifies the size of the analysis region.
• The user specifies the sampling interval, or how far to move the sampling regions before resampling.  This will determine the speed of the operation
• The shift will be computed as a integer lag (pixel size) in both the x and y directions, and for each possible lag the program will compute the correlation coefficient between the elevations in the two DEMs.  The reported lag will have the largest correlation coefficient.
• The program will create a database, and for each sampling location, will report the integer lags in the x and y direction, as well as the floating point lag along the diagonal.
• The database can be used for any desired statistical operations (average, min, max, lag distribution), and to visually look for any spatial patterns in the displacements.
• The displacement direction can be computed from the x and y lags.
• The average displacements for the entire region can be computed from the sampling point data.
• Sub pixel shifts for individual points not allowed, but the average will be a fractional value.

 Lag range to consider (pixels); this should be the smallest value that you reasonably expect, or you should be prepared to wait a long time.  If you know the lags will be in a particular direction, say with a migration landform like a dune, this does not have to be the same in all directions Search radius (pixels): size of the box in pixels in the fixed or reference DEM to use for picking the best lag. Lag sampling (pixels): moves the center point, which determines the number of regions over which the computation will be done.  Smaller sampling distance, more time to compute All open DEMs: does the computations for all open DEMs, which of course will take longer.   Compute: figures the best lag for either the entire DEM or the map area. Region size; interactive used to assess the effect of how big a region must be considered

This was initially designed for hole filling SRTM with ASTER data (, before the release of GDEM.  It was redone  to monitor change in grids, for instance with dune crest migration.  The latest changes were to see if there are shifts between the Global Regional DEMs

Example comparing shifts

Last revision 3/29/2022