Using JPythonMethod's field function

May, 2001

Introduction

One of the most common representations of data in science is as a one- or two-dimensional array of numeric values. While VisAD has the flexibility to handle any form of numeric data, this type of structure is so common, that some short-hand methods are provided to create the VisAD Data objects.

The methods

In each of these, you supply an array (or Jython "list") of floating point values - either one or two dimesional. In the signatures that allow you to specify a name, the String you specify becomes the name of the range component of your data; the default is simply "value". This name may not contain spaces!

The domain is by default a simple one- or two-dimensional sampling from 0 to the number of items in the values array. In the one-dimensional case, the name associated with this is "domain"; in the 2-D case the components are called "ImageLine" and "ImageElement". You will find several methods that make it convenient and easy to define this domain (see, for example, makeDomain()...whereever it is).

A small example

from visad.python.JPythonMethods import *
import math

z = []
for i in range(0,32):
  a = []
  for j in range(0,32):
    a.append( math.sin(i*j*.0174533))
  z.append(a)

f = field(z)
plot(f)
Produces this display:


Back to the home page