Surfer can read uniformly spaced data in matrix format directly as a grid file. To create a grid-based map from matrix data in Surfer:
- Save the matrix data in a TXT, CSV, DAT or FTG file format (FTG is simply a text format with the FTG extension).
- Click Home | New Map | Contour or the grid-based map type you wish to create.
- In the Open Grid dialog, change the Files of type to TXT Formatted Text Grid.
- Select the data file and click Open.
- If the Select Format dialog appears, select TXT Formatted Text Grid from the list and click OK.
- In the Formatted Text Grid Import Options, select the options that define how the matrix data is organized. Note the preview will update when the settings change, to help identify that that selected settings represent the correct format the data is in.
- Click OK and the map is created.
If you are using Surfer 12 or a previous version, you can convert the matrix data to a grid file to use to create a map. You can do this by either converting the matrix data to XYZ data and gridding it, or converting the matrix data directly to a text grid.
Option 1: Converting the matrix to an XYZ data file and gridding the data.
- Download the attached example script Matrix2XYZ.bas.
- Open Scripter, which comes with Surfer, open the script, and click Script | Run to run it. The script converts data in matrix format to data in XYZ format.
- After the data is converted, click Grid | Data in Surfer to grid the data and generate the grid file. I recommend gridding the data using the Nearest Neighbor gridding method, setting the Spacing value to be equal to the spacing in the matrix data file.
Option 2: Converting the matrix directly to a text grid file.
A text grid file has a 5 line header followed by a list of Z values, from left to right, bottom to top. If the grid file is reversed in either the X or Y direction (depending on the data listing in the matrix file), then reverse the grid file so that the X or Y data is going the right direction. To do this:
- Save your data in a text file (e.g. DAT, TXT, CSV, etc).
- Open it in a text editor (like Notepad).
- Remove the header row or header column from the matrix if necessary.
- Add a 5-line header at the very top, so that you just see the 5-line header and a list of Z values. The 5-line header is simply:
- DSAA
- # of lines in X # of lines in Y
- Xmin Xmax
- Ymin Ymax
- Zmin Zmax
- Click File | Save As and save it with a .grd extension (put the name in quotes "testgrid.grd"). This will be in the correct format to create a map.
- If the X or Y data are reversed, click Grid | Calculate | Transform, select the grid file and click Open.
- In the Grid Transform dialog, select either the Mirror X or the Mirror Y as the Operation, and click OK. This is the grid with the data in the correct orientation.
Updated October, 2021
Comments
0 comments
Please sign in to leave a comment.