Data Access Containers#

ZoneList and VariableList are the format-agnostic container types returned by Read.zone and ReadZone.variable for every supported format (tecio.szl, tecio.plt, and tecio.dat).

class tecio.ZoneList#

Bases: Generic[_ZoneT]

Read-only sequence of zones: positional access and slicing only.

Drop-in for the list previously returned by Read.zone: iteration, len(), and integer indexing are unchanged. Slicing returns another ZoneList (not a plain list) so navigation composes.

This container deliberately exposes no data-extraction method. Pulling one variable across many zones is an explicit loop over the zones, keeping the outer (zone) axis owned by the caller (see the module docs).

Parameters:

zones – Ordered list of zone elements (each exposing .variable).

__getitem__(key)[source]#

Index a single zone or slice a sub-collection of zones.

Parameters:

key – A 0-based zone index, or a slice.

Returns:

A zone element (int key) or a new ZoneList (slice key).

Raises:

IndexError – If an integer key is out of range.

__init__(zones)[source]#
class tecio.VariableList#

Bases: Generic[_VarT]

Read-only sequence of variables with positional and named access.

Drop-in for the list previously returned by ReadZone.variable: iteration, len(), and integer indexing are unchanged. A string key resolves a variable by its exact, case-sensitive name.

Subscripting returns the variable object; use its .values (or the zone’s get_array) to obtain the underlying array.

Parameters:

variables – Ordered list of variable elements (each exposing .name).

Note

If two variables share a name (rare), the first occurrence wins for name-based lookup.

__getitem__(key)[source]#

Return a variable object by 0-based index or exact name.

Parameters:

key – A 0-based integer index or an exact, case-sensitive variable name.

Returns:

The matching variable element.

Raises:
  • KeyError – If key is a name that does not exist.

  • IndexError – If key is an out-of-range index.

__init__(variables)[source]#
names()[source]#

Return the variable names in dataset order.