How can I replace the data in an area of one grid, with data in another grid in Surfer?

You can substitute the data in an area of one grid with data from a second grid using Surfer's Grid Mosaic feature. For example, you can replace the data inside a lake boundary of a DEM file with bathymetric data.
Surfer 3D surface maps showing bathymetry and terrain grids that can be merged
using the Grid | Mosaic feature.
To complete the merge, follow the steps below.
  1. Click Grids | Resize | Mosaic.
  2. In the Open Grid(s) dialog, select the first grid file and click Open.  The first grid file should be the grid that contains data you want replaced.
  3. In the Grid Mosaic dialog, click the Add button.
  4. In the Open Grid(s) dialog, select the second grid file and click Open.  The second grid file should be the grid that contains the replacement data.
  5. Click the current value in the Overlap Method field and select Last.  This will use the data from the second grid (the last grid in the list) to create the output grid file where the two grids overlap.
  6. In the Output Grid File field, enter a name for the new grid file and then click OK.

Surfer 3D surface map of combined terrain and elevation grids.

Data in one grid can also be replaced by data in another grid by assigning a NoData value to the area of interest in the first grid and then using Grid Math to substitute the NoData value with the data from the second grid. 

 These are the steps:

  1. Make sure the second grid has the exact same grid extents and resolution as the first grid. If it does not, I suggest clicking Home | Grid Data and re-gridding the data. In the Grid Data dialog, in the Grid Line Geometry section, set the X and Y Minimum and Maximum values and # of Nodes so that they are exactly the same as the first grid file. Click OK to create the new grid file. You could also use Grids | Resize | Mosaic to modify the grid resolution and extents.
  2. Then, assign a NoData value to the area you want to replace in the first file. The first step is to create a vector or BLN file of the boundary. For tips on creating a BLN file, please see:  How can I create a BLN file in Surfer? Once you have the area in vector format, go to Grids | Edit | Blank, select the Input Grid and Blanking Polygon Boundary, toggle the desired blanking option, specify a new name for the blanked grid file and click Save. The new blanked grid file will be created.
  3. Lastly, use Grids | Calculate | Math to substitute the NoData value (or whatever unique value you used above) in the blanked grid file with the data from the second grid.
    1. Click Grids | Calculate | Math.
    2. In the Grid Math dialog, click the Add Grids button, hold the CTRL key on the keyboard, select both grids, and click Open.
    3. Enter the function:  IF(A=1.70141E+38, B, A). Where A is the blanked grid, B is the grid with the data you want to use to replace, and 1.70141E+38 is the NoData value.
    4. Click OK and the new grid is created. This grid will have the data from the second grid file inside the boundary of the first grid file.


Updated November 7, 2017

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.