Have you ever wanted to “blank” a grid-based map, so that it does not display outside of a specified area? This can be useful if you want to limit a contour map to display only inside or outside a specified area. You can do this in Surfer using a blanking file. Described below is the process that you can use to blank a grid file using area that you define from digitized points.
As an example, I am going to start by using the example file Contours.srf that is installed with Surfer. This file is located in the Surfer installation directory, in the Samples folder. The typical file path for the sample files is: C:\Program Files\Golden Software\Surfer 12\Samples.
First, you will need to create a blanking file that you can use to blank your input grid file. To do so, follow these steps:
- In the Object Manager, click on the Contours map object.
- Click the Map | Digitize command.
- In the Plot Window, click along the area you would like to not be displayed in the contour map.
- In the Digitized Coordinates dialog, the points XYZ coordinates will be displayed. Click File | Save As to save the data points to a blanking file.
- In the Save As dialog (shown below), you can edit the File name and select the Save as type to be Boundary Files (*.bln). Click Save.
- To exit Digitize mode, click Map | Digitize or click Esc (on your keyboard).
- To close the Digitize Coordinates dialog, click the X in the upper right of the dialog.
To use this blanking file to blank the area inside or outside of your grid, you will need to open and edit the BLN file and add the appropriate blanking flag. Follow these steps to correctly format your blanking file:
- Use the File | Open command to open the saved BLN file in Surfer as a worksheet.
- Insert a blank row at the top of the worksheet using the Edit | Insert command.
- Into cell A1, enter the total number of points that you have defined in your blanking file.
- Into Cell B1, enter the blanking flag, 0 or 1.
- Entering a blanking flag equal to zero will cause the area outside the polygon to be blanked.
- Entering a blanking flag equal to one will result in the area inside the polygon being blanked.
- Use the File | Save command to save your blanking file.
Example Blanking File (*.bln) format,
to blank inside of a polygon.
Using the steps above, you can digitize the points which define any complex polygon in your map. For this example, I have digitized a rectangular area to create the blanking file show above.
You can view this blanking file on your map by adding it to your Map as a Base Map object with the following procedure:
- In the Object Manager, select your Map object.
- Click the Map | Add | Base Layer command.
- In the Import dialog, navigate to your saved BLN file. Click the file to select it for import.
- Click Open. A new Base map object will be added with the BLN filename (see image below).
Base map object added from BLN file.
By adding the blanking file as a basemap, you can confirm that it includes the entire area of the grid that you wish to blank. You can see that using the digitized coordinates shown above that I have defined the blanking polygon to separate the interior and exterior regions separated by 0.2 degrees of latitude and longitude.
Blanking file (in red) added as Base map to confirm coverage area.
When you are ready to blank your grid file, follow these steps to blank a grid file using a BLN file:
- Click the Grid | Blank command, shown below.
- In the Open Grid dialog, select the grid file and click Open.
- In the Open dialog, select the BLN file and click Open.
- In the Save Grid As dialog, enter a File name and click Save.
Use the Grid | Blank command.
With your grid file blanked, you can create a new contour layer with the blanked grid file. Click the Map | Add | Contour Layer command to add the new blanked contour map. In the Open Grid dialog, navigate to the location of your blanked grid file (Grand Canyon_BLANKED_IN.grd). Select the grid file you would like to add, and click the Open button. Below is an image which shows this setup in the Open Grid dialog.
Select your new grid file in the Open | Grid dialog.
Below I have included screenshots of the new contour layers that have been created using the blanking procedure described above. The grid named Grand Canyon_BLANKED_IN was created using a blanking flag of 1, while the Grand Canyon_Blanked_OUT grid was created using a blanking flag of 0.
Grand Canyon grid file blanked with blanking flag equal to 1, to blank inside the polygon.
Grand Canyon grid file blanked with blanking flag equal to 0, to blank outside the polygon.
Hopefully this blog post provides you with a better understanding of the procedure used to blank a grid file. If you would like to review the files that I have used in this example, you can download them here.