VisAD Binary File Format

This document describes Version 1 of the VisAD binary file format.

All VisAD binary files must start with an 8-byte "magic" string VisADBin, followed by a 4-byte integer holding the version number.
     Note that Java is "big-endian", meaning that if the 4-byte version number is 1, it would be stored in the file as 00 00 00 01.


Following the 12-byte header are a series of objects which all start with a byte which indicates the type of that object followed by a 4-byte integer holding length of the object (i.e. the number of bytes.of data remaining in the object, not counting the type byte and the 4-byte length). The current list of object types and their associated byte values can be found in Appendix A.


Objects

OBJ_COORDSYS

A VisAD coordinate system object. For version 1, these are all serialized.
BytesTypeDescription
1OBJ_COORDSYSStart-of-object marker
4intNumber of bytes before end of object
4intIndex number
1FLD_COORDSYS_SERIALSerialized CoordinateSystem marker
lenserialized objectA serialized CoordinateSystem object
1FLD_ENDEnd-of-object marker

OBJ_DATA

A VisAD Data object.
BytesTypeDescription
1OBJ_DATAStart-of-object marker
4intNumber of bytes before end of object
1byteData object byte value
?--Remainder of Data object
1FLD_ENDEnd-of-object marker
See the DATA section below for the formats of the various standard Data objects.

OBJ_DATA_SERIAL

A non-standard Data object, written as a serialized Java object.
BytesTypeDescription
1OBJ_DATA_SERIALStart-of-object marker
4intSerialized object length
lenserialized objectA serialized Data object
1FLD_ENDEnd-of-object marker

OBJ_ERROR

A VisAD error estimate.
BytesTypeDescription
1OBJ_ERRORStart-of-object marker
4intNumber of bytes before end of object
4intIndex number
8doubleError value
8doubleMean
8longNumber of values
1FLD_INDEX_UNITIf CoordinateSystem has a Unit
4Unit index
1FLD_ENDEnd-of-object marker

OBJ_MATH

A VisAD MathType.
BytesTypeDescription
1OBJ_MATHStart-of-object marker
4intNumber of bytes before end of object
4intIndex number
1byteMathType byte value
?--Remainder of MathType object
1FLD_ENDEnd-of-object marker
See the MATH section below for the formats of the various standard MathTypes

OBJ_MATH_SERIAL

A non-standard MathType, written as a serialized Java object.
BytesTypeDescription
1OBJ_MATH_SERIALStart-of-object marker
4intSerialized object length
lenserialized objectA serialized MathType object
1FLD_ENDEnd-of-object marker

OBJ_UNIT

A VisAD unit specification.
BytesTypeDescription
1OBJ_UNITStart-of-object marker
4intNumber of bytes before end of object
4intIndex number
4intIdentifier string length
lenstringIdentifier string
4intDescription string length
lenstringDescription string
1FLD_ENDEnd-of-object marker

MathTypes

MATH_FUNCTION

BytesTypeDescription
1OBJ_MATHStart-of-object marker
4intNumber of bytes before end of object (should always be 14)
4intIndex number
1MATH_FUNCTIONFunctionType marker
4intFunction domain MathType index
4intFunction range MathType index
1FLD_ENDEnd-of-object marker

MATH_QUANTITY

BytesTypeDescriptionComment
1OBJ_MATHStart-of-object marker 
4intNumber of bytes before end of object 
4intIndex number 
1MATH_QUANTITYQuantity MathType marker 
4intName string length 
lenstringName string 
4intUnit specification string length 
lenstringUnit specification string 
1FLD_SET_FOLLOWS_TYPEThe Set associated with this object follows immediately after this object's FLD_END byteOnly specified if there is a Set associated with this MathType
1FLD_ENDEnd-of-object marker 

MATH_REAL_TUPLE

BytesTypeDescriptionComment
1OBJ_MATHStart-of-object marker 
4intNumber of bytes before end of object 
4intIndex number 
1MATH_REAL_TUPLERealTupleType marker 
4intNumber of MathType tuplesThe tuple dimension is followed by the appropriate number of ints to hold the list of MathType indices
4intFirst tuple member index
...
4intLast tuple member index
1FLD_INDEX_COORDSYSMarker for MathType CoordinateSystem index.Only specified if there is a CoordinateSystem associated with this MathType
4intCoordinateSystem index
1FLD_SET_FOLLOWS_TYPEThe Set associated with this object follows immediately after this object's FLD_END byteOnly specified if there is a Set associated with this MathType
1FLD_ENDEnd-of-object marker 

MATH_REAL

BytesTypeDescriptionComment
1OBJ_MATHStart-of-object marker 
4intNumber of bytes before end of object 
4intIndex number 
1MATH_REALRealType marker 
4intAttribute mask 
4intName string length 
lenstringName string 
1FLD_INDEX_UNITMarker for MathType Unit indexOnly specified if there is a Unit associated with this MathType
4intUnit index
1FLD_SET_FOLLOWS_TYPEThe Set associated with this object follows immediately after this object's FLD_END byteOnly specified if there is a Set associated with this MathType
1FLD_ENDEnd-of-object marker 

MATH_SET

BytesTypeDescription
1OBJ_MATHStart-of-object marker
4intNumber of bytes before end of object (should always be 10)
4intIndex number
1MATH_SETSetType marker
4intDomain MathType index
1FLD_ENDEnd-of-object marker

MATH_TEXT

BytesTypeDescription
1OBJ_MATHStart-of-object marker
4intNumber of bytes before end of object
4intIndex number
1MATH_TEXTTextType marker
lenstringName string
1FLD_ENDEnd-of-object marker

MATH_TUPLE

BytesTypeDescription
1OBJ_MATHStart-of-object marker
4intNumber of bytes before end of object
4intIndex number
1MATH_TUPLETupleType marker
4intFirst tuple member index
...
4intLast tuple member index
1FLD_ENDEnd-of-object marker

Data Types

Note that for all Data types which contain one or more embedded data objects, the OBJ_DATA marker may be preceeded by any number of OBJ_COORDSYS, OBJ_ERROR, OBJ_MATH, OBJ_MATH_SERIAL or OBJ_UNIT objects.

Also, any field marked as containing an OBJ_DATA object may instead contain an OBJ_DATA_SERIAL object.

DATA_DOUBLE_SET

Coming soon.

DATA_FIELD

BytesTypeDescriptionComment
1OBJ_DATAStart-of-object marker 
4intNumber of bytes before end of object 
1DATA_FIELDFieldImpl/FileField marker 
4intFunctionType index 
1FLD_SETMarker for default Set object.Only specified if there is a default Set.
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteSet object byte value
?--Remainder of Set object
1FLD_DATA_SAMPLESMarker for list of Data fields.Only specified if there are Data fields.
4intNumber of Data fields
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteFirst field Data object byte value
?--Remainder of first field Data object
...
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteLast field Data object byte value
?--Remainder of last field Data object
1FLD_ENDEnd-of-object marker 

DATA_FLAT_FIELD

BytesTypeDescriptionComment
1OBJ_DATAStart-of-object marker 
4intNumber of bytes before end of object 
1DATA_FLAT_FIELDFlatField/FileFlatField marker 
4intFunctionType index 
1FLD_SETMarker for domain Set object.Only specified if there is a domain Set.
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteSet object byte value
?--Remainder of Set object
1FLD_DATA_SAMPLESMarker for list of Data fields.Only specified if there are Data fields.
4intNumber of Data fields
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteFirst field Data object byte value
?--Remainder of first field Data object
...
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteLast field Data object byte value
?--Remainder of last field Data object
1FLD_INDEX_COORDSYSMarker for FlatField CoordinateSystem index.Only specified if there is a CoordinateSystem associated with this FlatField
4intCoordinateSystem index
1FLD_RANGE_COORDSYSMarker for list of range CoordinateSystemsOnly specified if there is are CoordinateSystems associated with this FlatField's range.
4intList length
4intFirst CoordinateSystem index
...
4intLast CoordinateSystem index
1FLD_SET_LISTMarker for list of range default Sets.Only specified if there are default Sets for this FlatField's range.
4intNumber of range Sets.
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteFirst Set object byte value
?--Remainder of first Set object
...
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteLast Set object byte value
?--Remainder of last Set object
1FLD_INDEX_UNITSMarker for list of range UnitsOnly specified if there is are Units associated with this FlatField's range.
4intList length
4intFirst Unit index
...
4intLast Unit index
1FLD_ENDEnd-of-object marker 

DATA_FLOAT_SET

Coming soon.

DATA_GRIDDED_1D_DOUBLE_SET,
DATA_GRIDDED_2D_DOUBLE_SET,
and DATA_GRIDDED_3D_DOUBLE_SET

Coming soon.

DATA_GRIDDED_SET,
DATA_GRIDDED_1D_SET,
DATA_GRIDDED_2D_SET,
and DATA_GRIDDED_3D_SET

Coming soon.

DATA_INTEGER_1D_SET,
DATA_INTEGER_2D_SET,
DATA_INTEGER_3D_SET,
and DATA_INTEGER_ND_SET

All four of these Data objects use the same format, differing only in the dimension of their FLD_LENGTHS or FLD_INTEGER_SETS list.
BytesTypeDescriptionComment
1OBJ_DATAStart-of-object marker 
4intNumber of bytes before end of object 
1byteSet markerOne of DATA_INTEGER_1D_SET, DATA_INTEGER_2D_SET, DATA_INTEGER_3D_SET or DATA_INTEGER_ND_SET,
4intSetType index 
1FLD_LENGTHSMarker for list of lengths At most one of FLD_LENGTHS and FLD_INTEGER_SETS will be present
4intList length
4intFirst Set length
...
4intLast Set length
1FLD_INTEGER_SETSMarker for list of Integer1DSets.It is not legal for FLD_INTEGER_1D_SET to contain this list.
4intNumber of Integer1DSets
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteFirst Integer1DSet object byte value
?--Remainder of first Integer1DSet object
...
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteLast Integer1DSet object byte value
?--Remainder of last Integer1DSet object
1FLD_INDEX_COORDSYSMarker for integer Set CoordinateSystem index.Only specified if there is a CoordinateSystem associated with this integer Set
4intCoordinateSystem index
1FLD_INDEX_UNITSMarker for list of range UnitsOnly specified if there is are Units associated with this integer Set range.
4intList length
4intFirst Unit index
...
4intLast Unit index
1FLD_INDEX_ERRORSMarker for list of range ErrorsOnly specified if there is are Errors associated with this integer Set.
4intList length
4intFirst Error index
...
4intLast Error index
1FLD_ENDEnd-of-object marker 

DATA_IRREGULAR_1D_SET,
DATA_IRREGULAR_2D_SET,
and DATA_IRREGULAR_3D_SET

Coming soon.

DATA_LINEAR_1D_SET,
DATA_LINEAR_2D_SET,
DATA_LINEAR_3D_SET,
DATA_LINEAR_ND_SET,
and DATA_LINEAR_LATLON_SET

All five of these Data objects use the same format, differing only in the dimension of their FLD_FIRSTS/FLD_LASTS/FLD_LENGTHS or FLD_LINEAR_SETS list.
BytesTypeDescriptionComment
1OBJ_DATAStart-of-object marker 
4intNumber of bytes before end of object 
1byteSet markerOne of DATA_LINEAR_1D_SET, DATA_LINEAR_2D_SET, DATA_LINEAR_3D_SET or DATA_LINEAR_ND_SET,
4intSetType index 
1FLD_FIRSTSMarker for list of lengths At most one of FLD_FIRSTS/FLD_LASTS/FLD_LENGTHS and FLD_LINEAR_SETS will be present
4intList length
4intFirst initial Set value
...
4intLast initial Set value
1FLD_LASTSMarker for list of final Set values. 
4intList length
4intFirst final Set value
...
4intLast final Set value
1FLD_LENGTHSMarker for list of lengths 
4intList length
4intFirst Set length
...
4intLast Set length
1FLD_LINEAR_SETSMarker for list of Linear1DSets.It is not legal for FLD_LINEAR_1D_SET to contain this list.
4intNumber of Linear1DSets
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteFirst Linear1DSet object byte value
?--Remainder of first Linear1DSet object
...
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteLast Linear1DSet object byte value
?--Remainder of last Linear1DSet object
1FLD_INDEX_COORDSYSMarker for integer Set CoordinateSystem index.Only specified if there is a CoordinateSystem associated with this integer Set
4intCoordinateSystem index
1FLD_INDEX_UNITSMarker for list of range UnitsOnly specified if there is are Units associated with this integer Set range.
4intList length
4intFirst Unit index
...
4intLast Unit index
1FLD_INDEX_ERRORSMarker for list of range ErrorsOnly specified if there is are Errors associated with this integer Set.
4intList length
4intFirst Error index
...
4intLast Error index
1FLD_ENDEnd-of-object marker 

DATA_LIST1D_SET

Coming soon.

DATA_PRODUCT_SET

Coming soon.

DATA_REAL

BytesTypeDescriptionComment
1OBJ_DATAStart-of-object marker 
4intNumber of bytes before end of object 
1DATA_REALReal marker 
4intRealType index 
8doubleValue 
1FLD_INDEX_UNITMarker for Real Unit index.Only specified if there is a Unit associated with this Real
4intUnit index
1FLD_INDEX_ERRORMarker for Real ErrorEstimate index.Only specified if there is an ErrorEstimate associated with this Real
4intErrorEstimate index
1FLD_ENDEnd-of-object marker 

DATA_REAL_TUPLE

BytesTypeDescriptionComment
1OBJ_DATAStart-of-object marker 
4intNumber of bytes before end of object 
1DATA_REAL_TUPLERealTuple marker 
4intTupleType index 
1FLD_REAL_SAMPLESMarker for list of Real tuples.Only specified if there are non-trivial Real tuplesAt most one of FLD_REAL_SAMPLES and FLD_TRIVIAL_SAMPLES will be present, and it's possible for neither to be present.
4intNumber of Real tuples
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteFirst DATA_REAL marker
?--Remainder of first Real object
...
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteLast DATA_REAL marker
?--Remainder of last Real object
1FLD_TRIVIAL_SAMPLESMarker for list of Real values.Only specified if there are trivial Real tuples
4intNumber of Real values.
8doubleFirst tuple value
...
8doubleLast tuple value
1FLD_ENDEnd-of-object marker  

DATA_SINGLETON_SET

Coming soon.

DATA_TEXT

BytesTypeDescription
1OBJ_DATAStart-of-object marker
4intNumber of bytes before end of object
1DATA_TEXTText marker
4intTextType index
4intText string length
lenstringText string
1FLD_ENDEnd-of-object marker 

DATA_TUPLE

BytesTypeDescriptionComment
1OBJ_DATAStart-of-object marker 
4intNumber of bytes before end of object 
1DATA_TUPLETuple marker 
4intTupleType index 
1FLD_DATA_SAMPLESMarker for list of Data tuples.Only specified if there are Data tuples
4intNumber of Data tuples
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteFirst tuple Data object byte value
?--Remainder of first tuple Data object
...
1byteOBJ_DATA
4intNumber of bytes before end of object
1byteLast Tuple Data object byte value
?--Remainder of last Tuple Data object
1FLD_ENDEnd-of-object marker 

DATA_UNION_SET

Coming soon.

Data Field Notes

FLD_SET_FOLLOWS_TYPE

Because some MathTypes contain a default Set with uses that MathType in the definition of its SetType, that Set cannot be encapsulated within the MathType's object. Instead, a FLD_SET_FOLLOWS_TYPE byte indicates that, immediately after the end of the MATH_* object's FLD_END marker, an OBJ_DATA object can be found which will be used to build this MathType's default Set object.

Appendix A: Object Type Byte Values

NameValue    NameValue
OBJ_COORDSYS1OBJ_ERROR4
OBJ_DATA2OBJ_MATH5
OBJ_DATA_SERIAL3OBJ_MATH_SERIAL6
OBJ_ERROR4OBJ_UNIT7

Appendix B: MathType Byte Values

NameValue    NameValue
MATH_FUNCTION1MATH_SET4
MATH_REAL2MATH_TEXT5
MATH_REAL_TUPLE3MATH_TUPLE6
MATH_SET4MATH_QUANTITY7

Appendix C: Data Object Byte Values

NameValue    NameValue
DATA_SCALAR1DATA_IRREGULAR_2D_SET41
DATA_TEXT2DATA_IRREGULAR_3D_SET42
DATA_REAL3DATA_GRIDDED_SET43
DATA_TUPLE10DATA_GRIDDED_1D_SET44
DATA_REAL_TUPLE11DATA_GRIDDED_2D_SET45
DATA_FIELD20DATA_GRIDDED_3D_SET46
DATA_FLAT_FIELD21DATA_GRIDDED_1D_DOUBLE_SET47
DATA_SET30DATA_GRIDDED_2D_DOUBLE_SET48
DATA_SIMPLE_SET31DATA_GRIDDED_3D_DOUBLE_SET49
DATA_DOUBLE_SET32DATA_LINEAR_1D_SET50
DATA_FLOAT_SET33DATA_LINEAR_2D_SET51
DATA_LIST1D_SET34DATA_LINEAR_3D_SET52
DATA_SAMPLED_SET35DATA_LINEAR_ND_SET53
DATA_SINGLETON_SET36DATA_LINEAR_LATLON_SET54
DATA_UNION_SET37DATA_INTEGER_1D_SET55
DATA_PRODUCT_SET38DATA_INTEGER_2D_SET56
DATA_IRREGULAR_SET39DATA_INTEGER_3D_SET57
DATA_IRREGULAR_1D_SET40DATA_INTEGER_ND_SET58

Appendix D: Object Field Byte Values

NameValue    NameValue
FLD_FIRSTS1FLD_COORDSYS_SERIAL20
FLD_LASTS2FLD_DELAUNAY_SERIAL21
FLD_LENGTHS3FLD_INDEX_UNIT30
FLD_FLOAT_LIST4FLD_INDEX_ERROR31
FLD_SAMPLE5FLD_INDEX_COORDSYS32
FLD_FLOAT_SAMPLES6FLD_INDEX_UNITS40
FLD_DOUBLE_SAMPLES7FLD_INDEX_ERRORS41
FLD_DATA_SAMPLES8FLD_INDEX_COORDSYSES42
FLD_REAL_SAMPLES9FLD_DELAUNAY50
FLD_TRIVIAL_SAMPLES10FLD_DELAUNAY_TRI51
FLD_SET_SAMPLES11FLD_DELAUNAY_VERTICES52
FLD_SET12FLD_DELAUNAY_WALK53
FLD_LINEAR_SETS13FLD_DELAUNAY_EDGES54
FLD_INTEGER_SETS14FLD_DELAUNAY_NUM_EDGES55
FLD_SET_LIST15FLD_SET_FOLLOWS_TYPE60
FLD_COORDSYS_SERIAL20FLD_END70