Reading point data

Revision as of 00:19, 3 February 2010 by BradWhitlock (talk | contribs) (Using Point3D files)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Point data comes in many, many formats. VisIt can read point data from many of its database readers but getting data into those supported file formats is not always obvious.

Binary point data

If you want to write out point data using a binary file format, try saving out a point mesh as described in the Getting Data Into VisIt manual.

ASCII point data

So, you have a program that writes out ASCII data as a set of XYZ triples. There are many file formats that you can use to read that data into VisIt. However, most of those file formats require you to add different types of header information to your file. That's the problem with ASCII data: every format is a little different.

Using Point3D files

Point3D is a simple data format created for reading points with scalar data into VisIt. The format supports a single point mesh with a single scalar variable defined at each point in the mesh. The file format looks like this:


X Y Z value
x0 y0 z0 v0
x1 y1 z1 v1
x2 y2 z2 v2

The first line contains the name of each column. The first three values are used as XYZ coordinates regardless of how you name them.

If you don't care about the scalar variable defined at each point in the point mesh, just use "0." to create a constant field of zeroes on the mesh.

Example file:

X Y Z value
0. 0. 0. 0.
1. 0. 0. 10.
1. 0. 1. 20.
0. 0. 1. 30.

Once you have created your file, you can open it in VisIt versions after 1.10 like this:

visit -assume_format Point3D -o filename

Note: In VisIt versions prior to 1.10 you should use the "-default_format" argument instead of "-assume_format".

If you do not want to have to specify these additional arguments to VisIt then be sure to make your files have the ".3D" file extension.

Point3D example

Here is an example of a small Python program that can create Point3D files. Basically, you open up a text file and write out a line that contains names for the 4 columns of data. After that, you write out 4 floating point numbers per line where each line is of the form: x y z value. Each line corresponds to a single point.

import math
n = 10000
f = open("values.3D", "wt")
f.write("x y z value\n");
for i in range(n):
    t = float(i) / float(n-1)
    angle = t * (math.pi * 2.) * 50.
    r = t * 10.
    x = r * math.cos(angle)
    y = r * math.sin(angle)
    z = t * 10.
    value = math.sqrt(x*x + y*y + z*z)
    f.write("%g %g %g %g\n" % (x,y,z,value))


Using Xmdv files

Xmdv is a simple ASCII file format that supports a single point mesh with N additional scalar variables. Xmdv is a good choice when you have a lot of columns of data that you want to explore inside of VisIt. Xmdv is often used to represent N-dimensional data since each column of data can be considered a separate dimension. The file format description uses this convention:

  • N = the number of variables
  • R = the number of rows
  • C = the number of columns
File format Example file
N R 12
var0minvalue   var0maxvalue    10
varN-1minvalue varN-1maxvalue  10
data0,0   data1,0   data2,0  ...  dataC-1,0
data0,R-1 data1,R-1 data2,R-1 ... dataC-1,R-1
3 4 12
0.   5.   10
1.   5.   10
2.   5.   10
0.   1.   2.
1.5  2.   3.
2.5  3.5  4.
5.   5.   5.

VisIt assumes that files having an ".okc" file extension are Xmdv files. The easiest way to open Xmdv data is to make sure that your file has the ".okc" file extension.