Data

ProjectElements include a list of ProjectElementData. These specify mesh location (‘vertices’, ‘faces’, etc.) as well as the array, name, and description. See class descriptions below for specific types of Data.

Mapping array values to a mesh is staightforward for unstructured meshes (those defined by vertices, segments, triangles, etc); the order of the data array simply corresponds to the order of the associated mesh parameter. For grid meshes, however, mapping 1D data array to the 2D or 3D grid requires correctly ordered unwrapping. The default is C-style, row-major ordering, order='c'. To align data this way, you may start with a numpy array that is size (x, y) for 2D data or size (x, y, z) for 3D data then use numpy’s flatten() function with default order ‘C’. Alternatively, if your data uses Fortran- or Matlab-style, column-major ordering, you may specify data order='f'.

Here is a code snippet to show data binding in action; this assumes the surface contains a mesh with 9 vertices and 4 faces (ie a 2x2 square grid).

>> ...
>> my_surface = omf.Surface(...)
>> ...
>> my_node_data = omf.ScalarData(
       name='Nine Numbers',
       array=[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0],
       location='vertices',
       order='c'  # Default
   )
>> my_face_data = omf.ScalarData(
       name='Four Numbers',
       array=[0.0, 1.0, 2.0, 3.0],
       location='faces'
   )
>> my_surface.data = [
       my_face_data,
       my_node_data
   ]

NumericData

class omf.data.NumericData(**kwargs)[source]

Data array with scalar values

Required Properties:

  • array (Array): Numeric values at locations on a mesh (see location parameter); these values must be scalars, an instance of Array
  • description (String): Description of the object, a unicode string
  • location (StringChoice): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells”, “elements”
  • metadata (ArbitraryMetadataDict): Attribute metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against AttributeMetadata
  • name (String): Title of the object, a unicode string
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode

Optional Properties:

  • colormap (Colormap): colormap associated with the data, an instance of Colormap

VectorData

class omf.data.VectorData(**kwargs)[source]

Data array with vector values

This data type cannot have a colormap, since you cannot map colormaps to vectors.

Required Properties:

  • array (Array): Numeric vectors at locations on a mesh (see location parameter); these vectors may be 2D or 3D, an instance of Array
  • description (String): Description of the object, a unicode string
  • location (StringChoice): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells”, “elements”
  • metadata (ArbitraryMetadataDict): Attribute metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against AttributeMetadata
  • name (String): Title of the object, a unicode string
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode

StringData

class omf.data.StringData(**kwargs)[source]

Data consisting of a list of strings or datetimes

Required Properties:

  • array (StringList): String values at locations on a mesh (see location parameter); these values may be DateTimes or arbitrary strings, an instance of StringList
  • description (String): Description of the object, a unicode string
  • location (StringChoice): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells”, “elements”
  • metadata (ArbitraryMetadataDict): Attribute metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against AttributeMetadata
  • name (String): Title of the object, a unicode string
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode

MappedData

class omf.data.MappedData(**kwargs)[source]

Data array of indices linked to legend values or -1 for no data

Required Properties:

  • array (Array): indices into 1 or more legends for locations on a mesh, an instance of Array
  • description (String): Description of the object, a unicode string
  • legends (a list of Legend): legends into which the indices map, a list (each item is an instance of Legend)
  • location (StringChoice): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells”, “elements”
  • metadata (ArbitraryMetadataDict): Attribute metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against AttributeMetadata
  • name (String): Title of the object, a unicode string
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode

Legend

class omf.data.Legend(**kwargs)[source]

Legends to be used with MappedData indices

Required Properties:

  • description (String): Description of the object, a unicode string
  • metadata (ArbitraryMetadataDict): Basic object metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against BaseMetadata
  • name (String): Title of the object, a unicode string
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode
  • values (a list of Color, a list of String, a list of Integer, a list of Float): values for mapping indexed data, a list (each item is a color) or a list (each item is a unicode string) or a list (each item is an integer) or a list (each item is a float)

Colormap

class omf.data.Colormap(**kwargs)[source]

Length-128 color gradient with min/max values, used with ScalarData

Required Properties:

  • description (String): Description of the object, a unicode string
  • gradient (Array): N x 3 Array of RGB values between 0 and 255 which defines the color gradient, an instance of Array
  • limits (a list of Float): Data range associated with the gradient, a list (each item is a float) with length of 2
  • metadata (ArbitraryMetadataDict): Basic object metadata, an arbitrary JSON-serializable dictionary, with certain keys validated against BaseMetadata
  • name (String): Title of the object, a unicode string
  • uid (String): Unique identifier, a unicode string, Default: new instance of unicode