# Create a vector map with magnitude and direction arrows at the data points in Surfer

There are multiple methods available to create a map showing magnitude and direction vectors in Surfer:

## Create a vector map with a grid file

Surfer can create vector plots from a single grid file, or from two grid files individually containing direction and magnitude information in either polar or Cartesian coordinates.

If you have an XYZ data file, you can grid the data and create a 1-grid vector map. The 1-grid vector map calculates the maximum slope and slope direction from the Z values in the GRD file to draw vectors with magnitude and direction.

1. Click Home | New Map | Specialty | 1-Grid Vector.
2. Select the grid file and click Open. The vector map is created.

If you have a data file with X,Y, direction, and magnitude data or starting XY and ending XY data, you can grid the data twice, once to create a grid of directions or changes in X and once to create a grid of magnitudes or changes in Y. Then you can create a 2-grid vector map. The 2-grid vector map draws vectors based on two grid files containing the X and Y components or the magnitude and direction components. See Gridding directional data, such as wind speed and direction, in Surfer for more information

1. Click Home | New Map | Specialty | 2-Grid Vector.
2. Select the first grid file and click Open. This is the grid with the X component or angle component, depending on the coordinate system.
3. Select the second grid file and click Open. This is the grid with the Y component or magnitude component, depending on the coordinate system. The vector map is created.
4. If your grid file Z values are polar coordinates, angle and magnitude, select the Vectors layer in the Contents window and set the Coordinate system property to Polar (angle, length) in the Properties window Data page.

## Create a post map from an XY data file magnitude and direction data

If you have an XY data file that includes direction and magnitude data, you can quickly display vectors at XY locations by creating a post map with proportional scaling and an angle column.

1. Combine the magnitude and direction information into a single file with your XY point location coordinates.
2. Create a post map with the Home | New Map | Post command, select your data file and click Open.
3. Select the Post layer in the Contents window.
4. In the Properties window, click on the Symbol tab.
5. In the Symbol section, expand Symbol properties and select a Symbol Set and Symbol.Some recommended symbols include:
1. GSI Default Symbols 60 and 61 plot the center of the arrow at that location.
2. GSI Default Symbols 62 and 63 plot the base of the arrow at the XY coordinate.
3. For wind arrows, select the GSI Wind Barb Symbols set.
6. In the Symbol Angle section, change the Angle column to the column containing the direction information.
Note: Surfer rotates the symbol in the counter-clockwise direction. You can use the Transform command in the worksheet to multiply the direction column by -1 to reverse the rotation direction.
7. In the Symbol Size section, change the Sizing method to Proportional.
8. Click on the Scaling button.
9. Set the Worksheeet Column Containing Height to the column containing the magnitude data. Change the Symbol Height values if you want and click OK.

## Calculate direction and magnitude data for your XYZ data

If you wish to create a post map with vectors at specific XY locations but do not have magnitude and direction data, you can use Surfer to calculate the direction and magnitude at each data point.

1. If you do not already have a grid of the XYZ data for your points, click Home | Grid Data | Grid Data, select the data file and click Open.  Select the gridding parameters (or accept the defaults) and click OK in the Grid Data dialog to create the grid.
2. Click Grids | Calculate | Calculus to create the magnitude grid. The Grid Calculus dialog is displayed.
1. In the Grid Calculus dialog, click Browse to select the grid. If you have already created a map from your grid, such as a contour map, you can select the grid in the Input Grid list.
2. If you wish to calculate slope for your magnitude data, select Terrain Modeling | Terrain Slope. This will be a grid of the steepest slope (in degrees) at each grid node. If you wish to calculate gradient for your magnitude data, select Differential & Integral Operator | Gradient Operator. This will be a grid of maximum gradient (in rational numbers: rise over run) at each grid node.
3. Specify a grid file name in the Output Grid section, such as magnitude.grd.
4. If Add grid as a layer to is checked, clear the Add grid as layer to option.
5. Click OK. This will create a grid file of the slope or gradient, depending on your selection in step (2.2).
3. Click Grids | Calculate | Calculus again to create the direction grid.
1. Select the original grid from the Input Grid list, or click Browse to select the original grid.
2. Select Terrain Modeling | Terrain Aspect. This will be a grid of the direction of the steepest slope at each grid node.
3. Specify a grid file name in the Output Grid section, such as slopeDirection.grd.
4. If Add grid as a layer to is checked, clear the Add grid as layer to option.
5. Click OK. This will create a grid file of the downhill direction of the steepest slope.
4. Next we need to transform the slope direction grid values with the Grid Math command. The slope direction grid points downhill, and the polar coordinates are set to 0 = north and to rotate clockwise. However, the post map rotates symbols counter-clockwise with increasing angle. Click the Grids | Calculate | Math command.
1. Click Add Grids... and select the slope direction grid in the Open Grid(s) dialog.
2. Enter one of the following functions in the Enter a function of the form f(A,B,...) where A, B, ... are the variables in the list above field:
1. To keep the slope (downhill) direction but rotate symbols clockwise with increasing angle, type A*-1. Name the grid in the Output Grid field, such as PostSlopeDirection.grd.
2. To point the vector symbol in the gradient (uphill) direction and change the symbol rotation direction to clockwise with increasing angle, type (A+180)*-1. Name the grid in the Output Grid field, such as PostGradientDirection.grd.
1. Clear the Add grid as layer to option and click OK. The grid is created.
5. Click Grids | Calculate | Point Sample to generate a data column of direction values.
1. In the Point Sample dialog, click Browse and select the PostSlopeDirection.grd or PostGradientDirection.grd grid file in the Open Grid dialog.
2. Set the data file used to create the original grid as XY Data. This data file should have XY coordinates for each point where you want a vector.
3. In the Data Columns section, assign the X and Y columns from the data file to X and Y.
4. Choose a column to store the values. By default, Surfer chooses the first empty column.
5. Click OK. A worksheet opens with the XY data values and new grid values for each XY point in the selected column.
6. Change the Grid Value column header to Direction.
7. Click File | Save and save the file.
8. Click File | Close and close the file.
9. Click Grids | Calculate | Point Sample again to generate a data column of magnitude values.
1. In the Point Sample dialog, click Browse and select the magnitude grid file in the Open Grid dialog.
2. Click Browse in the XY Data section and select the data file saved in step (7.0) in the Open Data dialog.
3. In the Data Columns section, assign the X and Y columns from the data file to X and Y.
4. Choose a column to store the values. By default, Surfer chooses the first empty column.
5. Click OK. A worksheet opens with the XY data values and new grid values for each XY point in the selected column.
10. Change the Grid Value column header to Magnitude.
11. Click File | Save and save the file.

Now you can create a post map to display the data by following the steps in the Create a post map from an XY data file magnitude and direction data section above.

Updated November, 2021