tecio.AppendReadWrite#

class tecio.AppendReadWrite#

Bases: AppendWrite

Read + write handle returned by tecio.open() with mode='a+'.

Inherits all write methods from AppendWrite and additionally exposes the full read interface populated from the original file. The read data reflects the file as it existed before any new zones were appended — zones written during the current session are not visible via zone until the file is closed and re-opened.

Useful when new zones depend on existing zone data — for example, computing a time-average over all previous time steps and writing it as an additional zone.

Do not instantiate this class directly — use tecio.open().

Example

>>> with tecio.open("flow.szplt", "a+") as tec:
...     # Read from all zones present before this session
...     times = [tec.zone[i].solution_time for i in range(tec.num_zones)]
...     p_avg = (
...         sum(tec.zone[i].variable["p"].values for i in range(tec.num_zones))
...         / tec.num_zones
...     )
...
...     # Append a new zone using the computed average
...     x = tec.zone[0].variable["x"].values
...     y = tec.zone[0].variable["y"].values
...     tec.write_ijk_zone(
...         data=[x, y, p_avg],
...         title="Time-average",
...         solution_time=max(times) + 1.0,
...         strand_id=2,
...     )
__init__(original_path, tmp_path, writer, reader)[source]#
property auxdata#

Dataset-level auxiliary data from the original file.

property file_type#

File type of the original file (FULL / GRID / SOLUTION).

get_var_auxdata(var_index)[source]#

Return variable aux data for var_index (1-based).

get_zone_auxdata(zone_index)[source]#

Return zone aux data for zone_index (1-based).

property num_auxdata_items#

Number of dataset-level aux data items in the original file.

property num_vars#

Number of variables in the original file.

property num_zones#

Number of zones in the original file (before appending).

property var_auxdata#

Per-variable auxiliary data list from the original file.

property zone#

Zone list from the original file.