tecio.TecplotVariableReader#

class tecio.TecplotVariableReader#

Bases: ABC

Read-only handle to one variable’s metadata and data within a zone.

Every metadata field is resolved by the concrete subclass on each access (a single libtecio call, or a lookup in already-parsed metadata), cheap enough in every format that this base does not add its own caching layer on top. Only values reads actual array data, and only when called.

Note

__setattr__ is blocked here, which also applies inside a subclass’s own __init__. A concrete subclass must store its private fields with object.__setattr__(self, "_name", value) rather than plain assignment, and should declare its own __slots__ for them.

Attributes

data_type

Stored data type.

name

Variable name string.

num_values

Number of stored values, 0 for a passive variable.

shared_zone

0-based source zone index if shared, else None.

value_location

NODAL or CELL_CENTERED.

values

All values as a NumPy array, or None if passive.

Methods

get_values([value_range])

Read values from disk or memory.

is_enabled()

True unless the variable is passive.

is_passive()

True if this variable has no data in this zone.

abstract property data_type#

Stored data type.

abstractmethod get_values(value_range=(None, None))[source]#

Read values from disk or memory.

Parameters:

value_range – 1-based (start, end), half-open. (None, None) reads all values.

Returns:

The data array, or None if the variable is passive. A shared variable resolves to its source zone’s array.

Raises:

ValueError – If only one of start/end is given.

is_enabled()[source]#

True unless the variable is passive.

SZL overrides this with the dataset-level enabled flag it actually stores; PLT and DAT have no such flag and use this default.

Returns:

bool – True for an active variable.

abstractmethod is_passive()[source]#

True if this variable has no data in this zone.

abstract property name#

Variable name string.

abstract property num_values#

Number of stored values, 0 for a passive variable.

abstract property shared_zone#

0-based source zone index if shared, else None.

abstract property value_location#

NODAL or CELL_CENTERED.

property values#

All values as a NumPy array, or None if passive.