|
Creating Voxler Vector Maps from Surfer Grid Files
Several customers have questioned how to make a vector plot in Voxler. A vector plot can be created from a
lattice that contains 3 components or it can be created from a data file. The data file requires six data
fields: X, Y, Z and 3 components. The component fields should be ordered with first the X component of the
vector, then Y component, then Z component. Once the data file is created, you can use the File | Load
Data command in Voxler. After the file is imported, you can right click on the data module and
choose Graphics Output | VectorPlot to create the map. The data file can be created in any spreadsheet
program.
If you have just XYZ data, it can be rather tricky to calculate the vector component columns. The component
columns tell the vector the slope, magnitude, and direction of the vectors. This article discusses a way to
create this information using our Surfer program. This article assumes that you have Surfer and Voxler and
that you are gridding the data in Surfer. If you do not currently own Surfer, you may want to download a
copy of the demo version.
Sample Voxler vector map shows vectors pointing in a “downhill” direction.
Map is shown in planar view with additional contour map.
Creating the Grid File and Exported Data File in Surfer
Your original data file should contain 3 columns of data: X, Y, and Z information. For this article, I
am using the demogrid.dat data file located in the Samples directory of the Surfer program. This process
should work with any data file. If you already have a grid file created, you can skip to step 2.
- In a blank Surfer plot window, choose Grid | Data. Select your data file and click Open.
In the Grid Data dialog, change any options. Make sure that the GRD file extents, as shown in
the Grid Line Geometry section, go beyond the extents that you want for your vector map.
Click OK to create the GRD file.
The Grid Data dialog allows you to set the Spacing in the
Grid Line Geometry section to control the extents of the grid file.
- Choose Grid | Calculus. Select the GRD file created in step 1.
In the Grid Calculus dialog:
- Open the Terrain Modeling section and select Terrain Slope.
- Click the open folder button next to the Output Grid File section.
Type in a File name such as grid-slope. Change
the Save as type to ASCII XYZ (*.dat). Click Save.
- Click OK in the Grid Calculus dialog.
Select Terrain Slope on the left side of the dialog. Then, click the
open folder button next to the Output Grid File name to change
the file name and format of the resulting file.
- Choose Grid | Calculus. Select the GRD file created in step 1. In
the Grid Calculus dialog:
- Open the Terrain Modeling section and select Terrain Aspect.
- Click the open folder button next to the Output Grid File section.
Type in a File name such as grid-aspect. Change the Save as
type to ASCII XYZ (*.dat). Click Save.
- Click OK in the Grid Calculus dialog.
- Choose Grid | Convert.
- Select the GRD file created in step 1 and click Open.
- Change the File name to grid-XYZ. Change the Save as type
to ASCII XYZ (*.dat). Click Save.
Worksheet Data Manipulation
Some background may be warranted about the slope and aspect calculations that were performed in
steps 2 and 3 above and how they relate to the vector directions. The terrain slope and aspect
calculations are given for the gradient direction. Surfer determines which direction has the steepest
slope (gradient) and then performs the calculations on that direction. The slope is reported in degrees
with zero being horizontal and 90 being vertical. The aspect is a bearing direction that is
perpendicular to the contour lines on the surface, and is exactly opposite the gradient direction.
The aspect is also reported in degrees with zero being north and 90 being east. It is necessary to
convert the aspect bearing direction to a geometric direction where zero is along the positive X axis.
This is done below in the transform steps by subtracting the Aspect from 90. Vectors are a combination
of aspect and slope.
- Choose File | Open. Select the data file created in step 4.
- Place the cursor in column D, row 1. Choose File | Import. Select the
grid-slope file created in step 2. Click Open. The data is imported into
the current worksheet.
- Place the cursor in column G, row 1. Choose File | Import. Select the
grid-aspect file created in step 3. Click Open. The data is imported into
the current worksheet.
- Highlight columns D and E. These are duplicate columns of XY data.
Choose Edit | Delete to remove them.
- Highlight columns E and F. Again, these are duplicate columns of XY data.
Choose Edit | Delete to remove them.
- I like to label each column. This provides clarity if I need to stop the process and
restart. It will also help decide which column to use when you import the data into
Voxler. Highlight row 1 and choose Edit | Insert. The rows are all shifted
down. Add the following labels in row 1.
This worksheet shows the imported data and the added labels for
columns A, B, C, D, and E.
The area circled in blue is the select all button.
- Click the select all button. Choose Data | Sort. In the Sort dialog,
change the Sort First By to column D, Slope. Select Descending as
the sort order and click OK.
- Highlight all of the rows that contain the Surfer blanking value (1.70141E+38).
After all of these rows are highlighted, choose Edit | Delete to remove these values.
- If you wish, you can select all the rows and choose Data | Sort again. This
time, Sort First By column A, X. Sort Next By column B, Y. Make
sure that both sections are set to Ascending. Click OK.
- Click in Column F. In row 1, type in the label: X Component.
- Highlight the entire column F. Choose Data | Transform. In the Transform dialog,
type in the Transform equation: F=SIN(D2R(D))*COS(D2R(90-E)). Change the
First row to 2. Click OK to add the new data.
The Transform dialog allows you to add new data
based on values in other data columns.
- Click in Column G. In row 1, type in the label: Y Component.
- Highlight the entire column G. Choose Data | Transform. In the Transform dialog,
type in the Transform equation: G=SIN(D2R(D))*SIN(D2R(90-E)). Change
the First row to 2. Click OK to add the new data.
- Click in Column H. In row 1, type in the label: Z Component.
- Highlight the entire column H. Choose Data | Transform. In the Transform dialog,
type in the Transform equation: H=COS(D2R(D)). Change the First row to 2.
Click OK to add the new data.
- Choose File | Save As to save the data to a new file. You can save the data to
a Golden Software *.DAT format or to an Excel *XLS file format. Both can be read by Voxler.
At this point, you can close Surfer and open Voxler.
Creating and Editing the Vector Plot in Voxler
After the data is arranged, creating the vector plot is a straightforward process. Open the
Voxler program. A new plot window is automatically created.
- Choose File | Load Data. Select the worksheet created in the previous section
and click Open.
- Set the Data Import Options, if necessary, and click OK.
- In the Select Data Columns dialog, set the X Coordinate, Y
Coordinate, and Z Coordinate to columns A, B, and C, respectively.
Select Multiple Components and type in F, G, H in the box. Click OK
and the data is imported.
- In the Network window, click once on the data file. Then,
choose Create | Graphics Output | VectorPlot. The vector plot is created.
Multiple items can be changed for a vector plot. You can add other map types to enhance the display of
the vectors. Your vectors can also indicate a different item than the other maps. For instance, you
may have a map that shows vectors of water direction, contours of elevation, and an isosurface that
shows chemical concentration. As long as the XYZ values are in the same range for all data, they will
overlay to create an informative map. You can add axes, bounding boxes, etc. to create the final
desired image.
This final image shows a vector map, contour map, and isosurface overlay.
Back to
Newsletter Index
|