tecio-python 0.3.0__py3-none-any.whl → 0.3.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tecio/__init__.py CHANGED
@@ -9,9 +9,22 @@ from importlib import metadata
9
9
  try:
10
10
  __version__ = metadata.version("tecio")
11
11
  except metadata.PackageNotFoundError:
12
- __version__ = "0.3.0"
12
+ __version__ = "0.3.2"
13
13
 
14
14
  from . import cli, libtecio
15
+ from ._constants import (
16
+ Boolean,
17
+ DataPacking,
18
+ DataType,
19
+ Debug,
20
+ FaceNeighborMode,
21
+ FeCellShape,
22
+ FileFormat,
23
+ FileType,
24
+ ValueLocation,
25
+ VarStatus,
26
+ ZoneType,
27
+ )
15
28
  from ._containers import VariableList, ZoneList
16
29
  from ._dat_read import TecplotDatReader
17
30
  from ._dat_write import TecplotDatWriter
@@ -33,11 +46,11 @@ from ._writer import TecplotWriter
33
46
  # Ensure these display as their canonical public name in docs and help(),
34
47
  # rather than the private module they're actually defined in.
35
48
  open.__module__ = "tecio"
36
- AppendWrite.__module__ = "tecio"
37
- AppendReadWrite.__module__ = "tecio"
38
- ZoneList.__module__ = "tecio"
39
- VariableList.__module__ = "tecio"
40
49
  for _cls in (
50
+ AppendWrite,
51
+ AppendReadWrite,
52
+ ZoneList,
53
+ VariableList,
41
54
  TecplotReader,
42
55
  TecplotZoneReader,
43
56
  TecplotOrderedZoneReader,
@@ -51,6 +64,17 @@ for _cls in (
51
64
  TecplotSzlWriter,
52
65
  TecplotPltWriter,
53
66
  TecplotDatWriter,
67
+ Boolean,
68
+ DataPacking,
69
+ DataType,
70
+ Debug,
71
+ FaceNeighborMode,
72
+ FeCellShape,
73
+ FileFormat,
74
+ FileType,
75
+ ValueLocation,
76
+ VarStatus,
77
+ ZoneType,
54
78
  ):
55
79
  _cls.__module__ = "tecio"
56
80
  del _cls
@@ -76,5 +100,32 @@ __all__ = [
76
100
  "TecplotSzlWriter",
77
101
  "TecplotPltWriter",
78
102
  "TecplotDatWriter",
79
- "__version__",
103
+ "Boolean",
104
+ "DataPacking",
105
+ "DataType",
106
+ "Debug",
107
+ "FaceNeighborMode",
108
+ "FeCellShape",
109
+ "FileFormat",
110
+ "FileType",
111
+ "ValueLocation",
112
+ "VarStatus",
113
+ "ZoneType",
80
114
  ]
115
+
116
+ _STANDARD_MODULE_ATTRIBUTES = (
117
+ "__name__",
118
+ "__file__",
119
+ "__path__",
120
+ "__doc__",
121
+ "__all__",
122
+ "__package__",
123
+ "__version__",
124
+ "__cached__",
125
+ "__spec__",
126
+ )
127
+
128
+
129
+ # Only public API visible to user
130
+ def __dir__() -> list:
131
+ return sorted((*_STANDARD_MODULE_ATTRIBUTES, *__all__))
tecio/_constants.py ADDED
@@ -0,0 +1,345 @@
1
+ """Tecplot meaningful integers.
2
+
3
+ The TecIO library often uses integers with special meanings (zone types, data types,
4
+ data locations). The same values are used both for writing (``tec*142`` functions) and
5
+ for SZL reading and writing (``tec_*`` functions). Where available, the equivalent
6
+ keyword used in Tecplot ASCII files is exposed as a class property, returning the
7
+ corresponding int value.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from enum import Enum
13
+
14
+ __all__ = [
15
+ "Boolean",
16
+ "DataPacking",
17
+ "DataType",
18
+ "Debug",
19
+ "FaceNeighborMode",
20
+ "FeCellShape",
21
+ "FileFormat",
22
+ "FileType",
23
+ "ValueLocation",
24
+ "VarStatus",
25
+ "ZoneType",
26
+ ]
27
+
28
+
29
+ class FileFormat(Enum):
30
+ """Binary data format selector.
31
+
32
+ .. list-table::
33
+ :header-rows: 1
34
+ :widths: 25 10 65
35
+
36
+ * - Attribute
37
+ - Value
38
+ - Description
39
+ * - ``PLT``
40
+ - ``0``
41
+ - Classic PLT binary format.
42
+ * - ``SZPLT``
43
+ - ``1``
44
+ - SZL subzone-loadable format.
45
+ """
46
+
47
+ PLT = 0
48
+ SZPLT = 1
49
+
50
+
51
+ class FileType(Enum):
52
+ """Tecplot file type.
53
+
54
+ .. list-table::
55
+ :header-rows: 1
56
+ :widths: 25 10 65
57
+
58
+ * - Attribute
59
+ - Value
60
+ - Description
61
+ * - ``FULL``
62
+ - ``0``
63
+ - Contains both grid and solution data.
64
+ * - ``GRID``
65
+ - ``1``
66
+ - Grid coordinates only.
67
+ * - ``SOLUTION``
68
+ - ``2``
69
+ - Solution variables only.
70
+ """
71
+
72
+ FULL = 0
73
+ GRID = 1
74
+ SOLUTION = 2
75
+
76
+
77
+ class ZoneType(Enum):
78
+ """Tecplot zone type.
79
+
80
+ .. list-table::
81
+ :header-rows: 1
82
+ :widths: 25 10 65
83
+
84
+ * - Attribute
85
+ - Value
86
+ - Description
87
+ * - ``ORDERED``
88
+ - ``0``
89
+ - Structured IJK grid.
90
+ * - ``FELINESEG``
91
+ - ``1``
92
+ - Finite-element line segments.
93
+ * - ``FETRIANGLE``
94
+ - ``2``
95
+ - Finite-element triangles.
96
+ * - ``FEQUADRILATERAL``
97
+ - ``3``
98
+ - Finite-element quadrilaterals.
99
+ * - ``FETETRAHEDRON``
100
+ - ``4``
101
+ - Finite-element tetrahedra.
102
+ * - ``FEBRICK``
103
+ - ``5``
104
+ - Finite-element hexahedra.
105
+ * - ``FEPOLYGON``
106
+ - ``6``
107
+ - Finite-element polygons (face-based).
108
+ * - ``FEPOLYHEDRON``
109
+ - ``7``
110
+ - Finite-element polyhedra (face-based).
111
+ * - ``FEMIXED``
112
+ - ``8``
113
+ - Mixed finite-element types.
114
+ """
115
+
116
+ ORDERED = 0
117
+ FELINESEG = 1
118
+ FETRIANGLE = 2
119
+ FEQUADRILATERAL = 3
120
+ FETETRAHEDRON = 4
121
+ FEBRICK = 5
122
+ FEPOLYGON = 6
123
+ FEPOLYHEDRON = 7
124
+ FEMIXED = 8
125
+
126
+
127
+ class FeCellShape(Enum):
128
+ """Unstructured cell shape category.
129
+
130
+ .. list-table::
131
+ :header-rows: 1
132
+ :widths: 25 10 65
133
+
134
+ * - Attribute
135
+ - Value
136
+ - Description
137
+ * - ``BAR``
138
+ - ``0``
139
+ - 2D two-node element.
140
+ * - ``TRIANGLE``
141
+ - ``1``
142
+ - 2D three-node element.
143
+ * - ``QUADRILATERAL``
144
+ - ``2``
145
+ - 2D four-node element.
146
+ * - ``TETRAHEDRON``
147
+ - ``3``
148
+ - 3D four-node element.
149
+ * - ``HEXAHEDRON``
150
+ - ``4``
151
+ - 3D six-node element.
152
+ * - ``PYRAMID``
153
+ - ``5``
154
+ - 3D five-node element.
155
+ * - ``PRISM``
156
+ - ``6``
157
+ - 3D eight-node element.
158
+ """
159
+
160
+ BAR = 0
161
+ TRIANGLE = 1
162
+ QUADRILATERAL = 2
163
+ TETRAHEDRON = 3
164
+ HEXAHEDRON = 4
165
+ PYRAMID = 5
166
+ PRISM = 6
167
+
168
+
169
+ class FaceNeighborMode(Enum):
170
+ """Boundary face-sharing mode between zones.
171
+
172
+ .. list-table::
173
+ :header-rows: 1
174
+ :widths: 35 10 55
175
+
176
+ * - Attribute
177
+ - Value
178
+ - Description
179
+ * - ``LOCAL_ONE_TO_ONE``
180
+ - ``0``
181
+ - Each face has at most one local neighbor.
182
+ * - ``LOCAL_ONE_TO_MANY``
183
+ - ``1``
184
+ - Each face may have multiple local neighbors (hanging nodes).
185
+ * - ``GLOBAL_ONE_TO_ONE``
186
+ - ``2``
187
+ - Each face has at most one neighbor in any zone.
188
+ * - ``GLOBAL_ONE_TO_MANY``
189
+ - ``3``
190
+ - Each face may have multiple neighbors in any zone (hanging nodes).
191
+ """
192
+
193
+ LOCAL_ONE_TO_ONE = 0
194
+ LOCAL_ONE_TO_MANY = 1
195
+ GLOBAL_ONE_TO_ONE = 2
196
+ GLOBAL_ONE_TO_MANY = 3
197
+
198
+
199
+ class ValueLocation(Enum):
200
+ """Data value location within a cell.
201
+
202
+ .. list-table::
203
+ :header-rows: 1
204
+ :widths: 25 10 65
205
+
206
+ * - Attribute
207
+ - Value
208
+ - Description
209
+ * - ``CELL_CENTERED``
210
+ - ``0``
211
+ - Values stored at cell centres.
212
+ * - ``NODAL``
213
+ - ``1``
214
+ - Values stored at grid nodes.
215
+ """
216
+
217
+ CELL_CENTERED = 0
218
+ NODAL = 1
219
+
220
+
221
+ class DataPacking(Enum):
222
+ """Zone data packing order for ASCII (``.dat``) files.
223
+
224
+ Controls whether data is laid out variable-by-variable or point-by-point
225
+ in the ASCII file. The ``DATAPACKING`` keyword in a zone header takes one
226
+ of these two values.
227
+
228
+ .. list-table::
229
+ :header-rows: 1
230
+ :widths: 25 10 65
231
+
232
+ * - Attribute
233
+ - Value
234
+ - Description
235
+ * - ``POINT``
236
+ - ``0``
237
+ - One row per node/cell containing all variable values.
238
+ * - ``BLOCK``
239
+ - ``1``
240
+ - One contiguous block per variable containing all node/cell values.
241
+ Tecplot default; faster for variable-at-a-time access patterns.
242
+ """
243
+
244
+ POINT = 0
245
+ BLOCK = 1
246
+
247
+
248
+ class DataType(Enum):
249
+ """On-disk storage type for variable data.
250
+
251
+ .. list-table::
252
+ :header-rows: 1
253
+ :widths: 25 10 65
254
+
255
+ * - Attribute
256
+ - Value
257
+ - Description
258
+ * - ``FLOAT``
259
+ - ``1``
260
+ - 32-bit IEEE floating point.
261
+ * - ``DOUBLE``
262
+ - ``2``
263
+ - 64-bit IEEE floating point.
264
+ * - ``INT32``
265
+ - ``3``
266
+ - 32-bit signed integer.
267
+ * - ``INT16``
268
+ - ``4``
269
+ - 16-bit signed integer.
270
+ * - ``BYTE``
271
+ - ``5``
272
+ - 8-bit unsigned integer.
273
+ """
274
+
275
+ FLOAT = 1
276
+ DOUBLE = 2
277
+ INT32 = 3
278
+ INT16 = 4
279
+ BYTE = 5
280
+
281
+
282
+ class VarStatus(Enum):
283
+ """Variable active/passive flag.
284
+
285
+ .. list-table::
286
+ :header-rows: 1
287
+ :widths: 25 10 65
288
+
289
+ * - Attribute
290
+ - Value
291
+ - Description
292
+ * - ``ACTIVE``
293
+ - ``0``
294
+ - Variable has data in this zone.
295
+ * - ``PASSIVE``
296
+ - ``1``
297
+ - Variable has no data in this zone.
298
+ """
299
+
300
+ ACTIVE = 0
301
+ PASSIVE = 1
302
+
303
+
304
+ class Boolean(Enum):
305
+ """Boolean flag for C function arguments.
306
+
307
+ .. list-table::
308
+ :header-rows: 1
309
+ :widths: 25 10 65
310
+
311
+ * - Attribute
312
+ - Value
313
+ - Description
314
+ * - ``FALSE``
315
+ - ``0``
316
+ - Logical false.
317
+ * - ``TRUE``
318
+ - ``1``
319
+ - Logical true.
320
+ """
321
+
322
+ FALSE = 0
323
+ TRUE = 1
324
+
325
+
326
+ class Debug(Enum):
327
+ """Debug flag for C function arguments.
328
+
329
+ .. list-table::
330
+ :header-rows: 1
331
+ :widths: 25 10 65
332
+
333
+ * - Attribute
334
+ - Value
335
+ - Description
336
+ * - ``FALSE``
337
+ - ``0``
338
+ - Debug output disabled.
339
+ * - ``TRUE``
340
+ - ``1``
341
+ - Debug output enabled.
342
+ """
343
+
344
+ FALSE = 0
345
+ TRUE = 1
tecio/_containers.py CHANGED
@@ -1,35 +1,35 @@
1
1
  """Index- and name-based container types for Tecplot data collections.
2
2
 
3
- These containers are shared by the ``tecio`` readers: ``Read.zone`` returns a
4
- :class:`ZoneList` of ``ReadZone`` and ``ReadZone.variable`` returns a
3
+ These containers are shared by the ``tecio`` readers: ``Read.zones`` returns a
4
+ :class:`ZoneList` of ``ReadZone`` and ``ReadZone.variables`` returns a
5
5
  :class:`VariableList` of ``ReadVariable`` for every supported format (SZL, PLT, DAT).
6
- They depend only on small structural protocols (``.name`` for variables, ``.variable``
6
+ They depend only on small structural protocols (``.name`` for variables, ``.variables``
7
7
  for zones) so they import nothing from either hierarchy and cannot introduce a circular
8
8
  dependency.
9
9
 
10
10
  Access model:
11
11
 
12
- reader.zone # ZoneList
13
- reader.zone[0] # ReadZone (element)
14
- reader.zone[1:4] # ZoneList (sub-collection, same kind)
15
- reader.zone[0].variable # VariableList
16
- reader.zone[0].variable["x"] # ReadVariable (object: .values, .is_passive)
17
- reader.zone[0].variable[2] # ReadVariable (0-based index)
12
+ reader.zones # ZoneList
13
+ reader.zones[0] # ReadZone (element)
14
+ reader.zones[1:4] # ZoneList (sub-collection, same kind)
15
+ reader.zones[0].variables # VariableList
16
+ reader.zones[0].variables["x"] # ReadVariable (object: .values, .is_passive)
17
+ reader.zones[0].variables[2] # ReadVariable (0-based index)
18
18
 
19
19
  Subscripting always returns an element or a sub-collection *of the same kind* (never a
20
20
  raw array). The underlying NumPy data is pulled with ``get_array`` on a single zone,
21
21
  which mirrors the pandas ``df[...]`` split: a scalar key returns one array, a list of
22
22
  names returns a tuple of arrays (for unpacking)::
23
23
 
24
- p = reader.zone[0].get_array("p") # ndarray | None
25
- p = reader.zone[0].get_array(2) # ndarray | None (0-based index)
26
- x, y, z = reader.zone[0].get_array(["x", "y", "z"]) # tuple, one per name
24
+ p = reader.zones[0].get_array("p") # ndarray | None
25
+ p = reader.zones[0].get_array(2) # ndarray | None (0-based index)
26
+ x, y, z = reader.zones[0].get_array(["x", "y", "z"]) # tuple, one per name
27
27
 
28
28
  There is deliberately **no** cross-zone array accessor. To pull one variable across
29
29
  many zones (e.g. a transient sequence), iterate explicitly so the outer axis is owned by
30
30
  your code, and stack only when you know the result is rectangular::
31
31
 
32
- seq = [z.get_array("p") for z in reader.zone] # list[ndarray | None]
32
+ seq = [z.get_array("p") for z in reader.zones] # list[ndarray | None]
33
33
  stack = np.stack(seq) # only if shapes all match
34
34
 
35
35
  Name lookup is exact and case-sensitive throughout, so distinct variables such
@@ -78,7 +78,7 @@ class _HasVariableList(Protocol):
78
78
  """A zone element exposing a name/index-addressable variable container."""
79
79
 
80
80
  @property
81
- def variable(self) -> VariableList[Any]: ...
81
+ def variables(self) -> VariableList[Any]: ...
82
82
 
83
83
 
84
84
  _VarT = TypeVar("_VarT", bound=_HasName)
@@ -137,7 +137,7 @@ def select_variable_arrays(
137
137
  class VariableList(Generic[_VarT]):
138
138
  """Read-only sequence of variables with positional *and* named access.
139
139
 
140
- Drop-in for the ``list`` previously returned by ``ReadZone.variable``:
140
+ Drop-in for the ``list`` previously returned by ``ReadZone.variables``:
141
141
  iteration, ``len()``, and integer indexing are unchanged. A string key
142
142
  resolves a variable by its exact, case-sensitive name.
143
143
 
@@ -208,7 +208,7 @@ class VariableList(Generic[_VarT]):
208
208
  """Return the variable names in dataset order."""
209
209
  return [var.name for var in self._items]
210
210
 
211
- def __repr__(self) -> str:
211
+ def __repr__(self) -> str: # pragma: no cover
212
212
  n = len(self._items)
213
213
  if n == 0:
214
214
  return "VariableList([])"
@@ -229,16 +229,16 @@ class VariableList(Generic[_VarT]):
229
229
  class ZoneList(Generic[_ZoneT]):
230
230
  """Read-only sequence of zones: positional access and slicing only.
231
231
 
232
- Drop-in for the ``list`` previously returned by ``Read.zone``: iteration, ``len()``,
233
- and integer indexing are unchanged. Slicing returns another :class:`ZoneList` (not a
234
- plain ``list``) so navigation composes.
232
+ Drop-in for the ``list`` previously returned by ``Read.zones``: iteration,
233
+ ``len()``, and integer indexing are unchanged. Slicing returns another
234
+ :class:`ZoneList` (not a plain ``list``) so navigation composes.
235
235
 
236
236
  This container deliberately exposes **no** data-extraction method. Pulling one
237
237
  variable across many zones is an explicit loop over the zones, keeping the outer
238
238
  (zone) axis owned by the caller (see the module docs).
239
239
 
240
240
  Args:
241
- zones: Ordered list of zone elements (each exposing ``.variable``).
241
+ zones: Ordered list of zone elements (each exposing ``.variables``).
242
242
  """
243
243
 
244
244
  __slots__ = ("_items",)
@@ -277,7 +277,7 @@ class ZoneList(Generic[_ZoneT]):
277
277
  return ZoneList(self._items[key])
278
278
  return self._items[key]
279
279
 
280
- def __repr__(self) -> str:
280
+ def __repr__(self) -> str: # pragma: no cover
281
281
  n = len(self._items)
282
282
  if n == 0:
283
283
  return "ZoneList([])"