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
]
ScalarData¶
-
class
omf.data.
ScalarData
(**kwargs)[source]¶ Data array with scalar values
Required Properties:
- array (
ScalarArray
): scalar values at locations on a mesh (see location parameter), an instance of ScalarArray - description (
String
): Description, a unicode string - location (
StringChoice
): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells” - name (
String
): Title, a unicode string
Optional Properties:
- colormap (
ScalarColormap
): colormap associated with the data, an instance of ScalarColormap
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- array (
Vector3Data¶
-
class
omf.data.
Vector3Data
(**kwargs)[source]¶ Data array with 3D vectors
Required Properties:
- array (
Vector3Array
): 3D vectors at locations on a mesh (see location parameter), an instance of Vector3Array - description (
String
): Description, a unicode string - location (
StringChoice
): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells” - name (
String
): Title, a unicode string
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- array (
Vector2Data¶
-
class
omf.data.
Vector2Data
(**kwargs)[source]¶ Data array with 2D vectors
Required Properties:
- array (
Vector2Array
): 2D vectors at locations on a mesh (see location parameter), an instance of Vector2Array - description (
String
): Description, a unicode string - location (
StringChoice
): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells” - name (
String
): Title, a unicode string
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- array (
ColorData¶
-
class
omf.data.
ColorData
(**kwargs)[source]¶ Data array of RGB colors specified as three integers 0-255 or color
If n x 3 integers is provided, these will simply be clipped to values between 0 and 255 inclusive; invalid colors will not error. This allows fast array validation rather than slow element-by-element list validation.
Other color formats may be used (ie String or Hex colors). However, for large arrays, validation of these types will be slow.
Required Properties:
- array (
Int3Array
,ColorArray
): RGB color values at locations on a mesh (see location parameter), an instance of Int3Array or an instance of ColorArray - description (
String
): Description, a unicode string - location (
StringChoice
): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells” - name (
String
): Title, a unicode string
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- array (
StringData¶
-
class
omf.data.
StringData
(**kwargs)[source]¶ Data array with text entries
Required Properties:
- array (
StringArray
): text at locations on a mesh (see location parameter), an instance of StringArray - description (
String
): Description, a unicode string - location (
StringChoice
): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells” - name (
String
): Title, a unicode string
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- array (
DateTimeData¶
-
class
omf.data.
DateTimeData
(**kwargs)[source]¶ Data array with DateTime entries
Required Properties:
- array (
DateTimeArray
): datetimes at locations on a mesh (see location parameter), an instance of DateTimeArray - description (
String
): Description, a unicode string - location (
StringChoice
): Location of the data on mesh, any of “vertices”, “segments”, “faces”, “cells” - name (
String
): Title, a unicode string
Optional Properties:
- colormap (
DateTimeColormap
): colormap associated with the data, an instance of DateTimeColormap
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- array (
MappedData¶
-
class
omf.data.
MappedData
(**kwargs)[source]¶ Data array of indices linked to legend values or -1 for no data
Required Properties:
- array (
ScalarArray
): indices into 1 or more legends for locations on a mesh, an instance of ScalarArray - description (
String
): Description, 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” - name (
String
): Title, a unicode string
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- array (
Legend¶
-
class
omf.data.
Legend
(**kwargs)[source]¶ Legends to be used with DataMap indices
Required Properties:
- description (
String
): Description, a unicode string - name (
String
): Title, a unicode string - values (
ColorArray
,DateTimeArray
,StringArray
,ScalarArray
): values for mapping indexed data, an instance of ColorArray or an instance of DateTimeArray or an instance of StringArray or an instance of ScalarArray
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- description (
ScalarColormap¶
-
class
omf.data.
ScalarColormap
(**kwargs)[source]¶ Length-128 color gradient with min/max values, used with ScalarData
Required Properties:
- description (
String
): Description, a unicode string - gradient (
ColorArray
): length-128 ColorArray defining the gradient, an instance of ColorArray - limits (a list of
Float
): Data range associated with the gradient, a list (each item is a float) with length of 2 - name (
String
): Title, a unicode string
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- description (
DateTimeColormap¶
-
class
omf.data.
DateTimeColormap
(**kwargs)[source]¶ Length-128 color gradient with min/max values, used with DateTimeData
Required Properties:
- description (
String
): Description, a unicode string - gradient (
ColorArray
): length-128 ColorArray defining the gradient, an instance of ColorArray - limits (a list of
DateTime
): Data range associated with the gradient, a list (each item is a datetime object) with length of 2 - name (
String
): Title, a unicode string
Other Properties:
- date_created (
GettableProperty
): Date project was created - date_modified (
GettableProperty
): Date project was modified - uid (
Uuid
): Unique identifier, a unique ID auto-generated with uuid.uuid4()
- description (