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.
2 of Surfer's 3D Surface maps where the terrian needs to be combined.
Surfer 3D surface maps showing bathymetry and terrain grids that can be merged
using the Grids | Resize | Mosaic Command.
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's 3D Surface map with the terrian combined from both grid filesSurfer 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 | Assign NoData, select the Input Grid and NoData Polygon Boundary, toggle the desired NoData option, specify a name for the new grid file and click Save. The new 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. In the Input Grids table next to grid A, click in the NoData Handling field and select Remap to:
    4. Enter -999 or a unique value in the Remap Value field.
    5. Repeat steps 3 & 4 for grid B if the second grid also has area with NoData values.
    6. Enter the function:  IF(A=-999, B, A). Where A is the blanked grid, B is the grid with the data you want to use to replace, and -999 is the unique value assigned in step 4.
      Surfer's Grd Math dialog where Nodata values can be assinged
    7. 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 11, 2018

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


Please sign in to leave a comment.