Importing Field Data from CSV Files

oSP3D can import field data objects from a CSV file. In addition to the CSV file format specifications summarized in CSV Files, the CSV field data import interface has these restrictions:

  • There may be an optional header line appearing as the first line of the file with the same format as normal record lines. The optional header record must start with the hash character (#) and must contain the same number of fields as the longest record in the entire file. Fields after the hash character are interpreted as unique field quantity object names corresponding to the fields in the file. Non-unique names are made unique by appending an underscore followed by a serial number.

  • If a header line is present, multiple-field data objects might be imported:

    • Records must start with the first data value of the first quantity identifier in the first field.

    • Data values are interpreted as double.

    • If the first field is interpreted as missing data, the record must start with the delimiter.

    • Missing fields, empty lines, or missing lines at the end of the file are interpreted as missing data.

    • Records must not contain any part or item ID.

    • Data values are automatically associated to their quantity idents given in the header line.

    • All data values are automatically associated to part ID 0 and an automatically generated item ID.

    • Item identifiers start counting with 0 and are incremented continuously and strictly monotonously with each new line.

  • If no header line is present, only a single-field data object can be imported. The single mode allows you more control regarding the identifier associated with the data value:

    • Each record can have up to three fields. The data are interpreted as an optional part ID, optional item ID, and associated data value.

    • If no optional part identifier field is specified, the CSV field data import interface assumes the part ID is 0 for all records.

    • If only the data value column is provided, the CSV field data interface starts associating each value with an identifier starting at 0 (equivalent to line number minus 1).

    • Each record must count the same number of fields, separated by a delimiter. A record may also be completely empty. oSP3D interprets these missing fields as missing data. Spaces are considered part of a field. The last field in the record must not be followed by a delimiter.

    • Any optional identifier field must be convertible to an integer. The data value is interpreted as double.

Field Data Best Practice

  • Without any indexing column, it is best practice to insert an empty record line after the header, avoiding potential zero-index issues between different FEM mesh formats.

  • For tight adherence to the CSV specification, it is best practice to avoid white spaces and use only the comma (,) as the delimiter.

#field1,field2,field3
,,
0.1,0.1,0.1
0.2,0.2,0.2

Field Data Example Files

The following examples define the data values for the item identifiers 0 through 4 in part 0 in all valid format descriptions. Example 4 adds another data value for a different part just to demonstrate it.

Example 1: Uses multiple-field data mode

# s_eqv, temp, react
1.23, 3.45, 25.23

, , 23.457
14.5, 4.56, 0
5,23e-3, 5.17,

Example 2: Uses data value column only in single-field data mode

3.45

4.56
5.17

Example 3: Uses optional item identifier and data value columns in single-field data mode

0, 3.45

3, 4.56
4, 5.17

Example 4: Uses full-format specification in single-field data mode, namely the optional part and the item identifier and data value columns

0; 0; 3.45
0; 3;    4.56
0; 4;5.17
3;20;28.3333333