tecio.dat.Write#
- class tecio.dat.Write#
Bases:
objectContext-manager writer for Tecplot 360 ASCII (
.dat) files.The public interface is identical to
szl.Writeandplt.Write.- Parameters:
path – Destination file path.
title – Dataset title. Defaults to
"untitled".variables – Variable name list.
Nonedefers file creation until the first zone-writing call (lazy open).file_type –
FileTypeenum. Defaults toFileType.FULL.sig_digits – Significant digits for scientific-notation float output. Default is
9; use17for fullfloat64round-trip fidelity.
- auxdataset#
dict[str, str] Dataset-level auxiliary data buffer.
- auxvar#
dict[int | str, dict[str, str]] Variable-level auxiliary data buffer.
- __init__(path, title='untitled', variables=None, file_type=FileType.FULL, sig_digits=None)[source]#
Store configuration; open the file immediately if variables given.
- flush_aux()[source]#
Write buffered dataset- and variable-level aux data to the file.
Called automatically before the first zone.
- Raises:
IOError – If the file has not been opened yet.
- write_fe_zone(data, zone_type, *, node_map=None, title=None, variables=None, value_locations=None, passive_vars=None, var_sharing=None, con_sharing=0, face_neighbors=None, face_nbr_mode=FaceNeighborMode.LOCAL_ONE_TO_ONE, solution_time=0.0, strand_id=0, aux=None, datapacking=DataPacking.BLOCK)[source]#
Write a complete finite-element zone.
Warning
FEPOLYGONandFEPOLYHEDRONraiseNotImplementedError.- Parameters:
data – Sequence of 1-D arrays, one per dataset variable. NODAL arrays must have length
num_nodes; CELL_CENTERED arrays must have lengthnum_cells.num_nodesandnum_cellsare inferred fromnode_map.zone_type – FE zone type from the ZoneType enum. Must be one of the types in
_FE_SIMPLE.node_map – Integer array of shape
(num_cells, nodes_per_cell)containing 1-based node indices. 32- or 64-bit write is chosen automatically based on the maximum index value.title – Zone title string. Defaults to
"FE_Zone_{current_zone + 1}"if not provided.variables – Variable name list. Required only when the file has not been opened yet (lazy-open path). Ignored on subsequent zones once the file is already initialised. Default to
[V1, V2, V3, ...]if not provided in open or zone call.value_locations – Per-variable ValueLocation. Defaults to all NODAL.
passive_vars – Per-variable passive flags. Defaults to all active (False).
var_sharing – Per-variable share from zone index. Defaults to no sharing.
con_sharing – Optional zone index that the connectivity is shared from Pass 0 to indicate no connectivity. You must pass 0 for the first zone in a dataset. Connectivity cannot be shared when face neighbor mode is set to global. Connectivity cannot be shared between cell-based and face-based finite element zones.
face_neighbors – Optional face-neighbor connectivity array.
num_face_consin the zone header is set tolen(face_neighbors)automatically when this is supplied.face_nbr_mode – Face-neighbor mode, used only when
face_neighborsis provided. Defaults to LOCAL_ONE_TO_ONE.solution_time – Solution time for transient data (0.0 = static).
strand_id – Strand ID for transient data (0 = static).
aux – Zone-level auxiliary data as
{name: value}strings.datapacking – Must be
BLOCK(the default).POINTis an ASCII-only layout and is not supported by the SZL binary format. Defined only for parity with ASCII writer.
- Raises:
NotImplementedError – For FEPOLYGON, FEPOLYHEDRON, or if datapacking is
POINT.ValueError – On variable count or array length mismatch.
ValueError – If I/O operation attempted on closed or None file handle.
RuntimeError – If attempting to write variable aux before variables are defined.
- write_ijk_zone(data, *, title=None, variables=None, value_locations=None, passive_vars=None, var_sharing=None, solution_time=0.0, strand_id=0, aux=None, datapacking=DataPacking.BLOCK)[source]#
Write a complete IJK-ordered zone.
Zone dimensions are inferred from the shape of the first NODAL array.
- Parameters:
data – One NumPy array per dataset variable. Array shape is used to infer
imax,jmax, andkmax; Fortran (column-major) order is assumed. PassNoneto write a zone header only.title – Zone title. Defaults to
"IJK_Zone_{current_zone + 1}".variables – Variable name list. Required on the first call when the file has not been opened yet (lazy-open path); ignored once the file is already initialised. Default to
[V1, V2, V3, ...]if not provided in open or zone call.value_locations – Per-variable
ValueLocation. Defaults to allNODAL.passive_vars – Per-variable passive flags. Defaults to all active (
False).var_sharing – Per-variable share-from zone index (1-based). Defaults to no sharing (all zeros).
solution_time – Solution time for transient data. Use
0.0for static zones. Default to0.0if not defined.strand_id – Strand ID for transient data. Use
0for static zones. Default to0(static) if not defined.aux – Zone-level auxiliary data as
{name: value}string pairs.datapacking – Must be
BLOCK(the default).POINTis an ASCII-only layout and is not supported by the SZL binary format. Defined only for parity with ASCII writer.
- Raises:
NotImplementedError – If datapacking is
POINT.ValueError – If I/O operation attempted on closed or None file handle.
RuntimeError – If attempting to write variable aux before variables are defined.