tecio-python 0.2.1__py3-none-any.whl → 0.2.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/cli/tecaux.py CHANGED
@@ -1,21 +1,29 @@
1
- r"""Add dataset-, zone-, or variable-level auxiliary data to a Tecplot data file.
2
-
3
- Tecplot's auxiliary data mechanism attaches arbitrary ``name=value`` string metadata to
4
- a dataset, a zone, or a variable -- solver name, run date, units, a description, or any
5
- other annotation that doesn't belong in the numerical data itself. Adding this after
6
- the fact ordinarily means writing a one-off script against the TecIO API. ``tecaux``
7
- does this from the command line: it copies the input file verbatim (every zone,
8
- variable, and existing sharing relationship preserved exactly) and merges in whatever
9
- new auxiliary entries were requested at each level, in a single read/write pass. An
10
- existing key with the same name is overwritten; everything else about the source file is
11
- unchanged.
1
+ r"""Add, remove, or export dataset, zone, or variable level auxiliary data.
2
+
3
+ Tecplot's auxiliary data mechanism attaches arbitrary ``name=value`` metadata to a
4
+ dataset, a zone, or a variable (solver name, run date, units, a description, or any
5
+ other annotation that doesn't belong in the numerical data itself_). Managing this
6
+ after the fact ordinarily means writing a one-off script against the TecIO API.
7
+ ``tecaux`` does this from the command line, in a single read/write pass, in three
8
+ mutually exclusive modes:
9
+
10
+ * By default (no ``--strip``/``--export-json``): merges new auxiliary entries (from
11
+ ``-d``/``-z``/``-v`` and/or ``-j``) into a copy of the input file. Every zone,
12
+ variable, and existing sharing relationship is preserved exactly; an existing key with
13
+ the same name is overwritten.
14
+ * ``--strip`` removes every auxiliary entry at all three levels and writes the result to
15
+ a new file, still preserving sharing.
16
+ * ``--export-json`` writes every *existing* auxiliary entry to a JSON file, in the same
17
+ format ``-j`` reads back -- without touching the source file at all, unless combined
18
+ with ``--strip``.
12
19
 
13
20
  :Usage:
14
21
 
15
22
  .. code:: bash
16
23
 
17
24
  tecaux [-h] [-d KEY=VALUE] ... [-z INDEX KEY=VALUE] ...
18
- [-v INDEX_OR_NAME KEY=VALUE] ... [-j PATH] [-o PATH] [-f] PATH
25
+ [-v INDEX_OR_NAME KEY=VALUE] ... [-j PATH] [-s] [--export-json]
26
+ [-o PATH] [-f] PATH
19
27
 
20
28
  :Positional Arguments:
21
29
  ``PATH``
@@ -23,12 +31,12 @@ unchanged.
23
31
 
24
32
  :Options:
25
33
  ``-d KEY=VALUE``, ``--data KEY=VALUE``
26
- A ``name=value`` pair to set as dataset-level auxiliary data. Repeat the flag
34
+ A ``name=value`` pair to set as dataset-level auxiliary data. Repeat the flag
27
35
  for multiple pairs.
28
36
 
29
37
  ``-z INDEX KEY=VALUE``, ``--zone INDEX KEY=VALUE``
30
38
  A ``name=value`` pair to set as zone-level auxiliary data on the one-based zone
31
- ``INDEX`` -- or on every zone if ``INDEX`` is the literal word ``all``. Repeat
39
+ ``INDEX`` -- or on every zone if ``INDEX`` is the literal word ``all``. Repeat
32
40
  the flag for multiple pairs and/or multiple zones; each occurrence takes exactly
33
41
  one zone and one pair, so ``-z 1 A=1 -z 1 B=2`` sets both ``A`` and ``B`` on
34
42
  zone 1.
@@ -36,20 +44,33 @@ unchanged.
36
44
  ``-v INDEX_OR_NAME KEY=VALUE``, ``--var INDEX_OR_NAME KEY=VALUE``
37
45
  A ``name=value`` pair to set as variable-level auxiliary data on the variable
38
46
  given by a one-based index or a name (case-insensitive) -- or on every variable
39
- if the target is the literal word ``all``. Repeatable, same as ``-z``.
47
+ if the target is the literal word ``all``. Repeatable, same as ``-z``.
40
48
 
41
49
  ``-j PATH``, ``--json PATH``
42
- Load bulk auxiliary data from a JSON file (see format below). Applied before
50
+ Load bulk auxiliary data from a JSON file (see format below). Applied before
43
51
  any ``-d``/``-z``/``-v`` flags, which take precedence on a key collision.
44
52
 
53
+ ``-s``, ``--strip``
54
+ Remove all auxiliary data (dataset, zone, and variable levels) and write the
55
+ result to ``<stem>_no_aux<ext>`` (or ``-o``'s path). Mutually exclusive with
56
+ ``-d``/``-z``/``-v``/``-j``. Combine with ``--export-json`` to keep a JSON copy
57
+ of what was removed.
58
+
59
+ ``--export-json``
60
+ Write every existing auxiliary entry to ``<stem>_aux.json``, in the same
61
+ ``AUXDATASET``/``AUXZONE``/``AUXVAR`` format ``-j`` reads, without modifying
62
+ the source file, unless combined with ``--strip``. Mutually exclusive with
63
+ ``-d``/``-z``/``-v``/``-j``.
64
+
45
65
  ``-o PATH``, ``--output PATH``
46
- Output file path. The extension controls the output format: ``.szplt``,
47
- ``.plt``, or ``.dat``. Defaults to ``<stem>_aux<ext>`` in the same directory as
48
- the input file.
66
+ Output file path. The extension controls the output format: ``.szplt``,
67
+ ``.plt``, or ``.dat``. Defaults to ``<stem>_aux<ext>``, or
68
+ ``<stem>_no_aux<ext>`` with ``--strip``. Not used by ``--export-json`` alone
69
+ which always writes ``<stem>_aux.json``, regardless of ``-o``.
49
70
 
50
71
  ``-f``, ``--force``
51
- Overwrite the output file if it already exists. Without this flag the command
52
- exits with an error rather than silently clobbering an existing file.
72
+ Overwrite the output file(s) if they already exist. Without this flag the
73
+ command exits with an error rather than silently clobbering an existing file.
53
74
 
54
75
  :JSON Format:
55
76
  .. code:: json
@@ -77,11 +98,19 @@ unchanged.
77
98
  (the same three forms ``-z``/``-v`` accept on the command line). Every JSON key must
78
99
  be a quoted string, including numeric indices (``"1"``, not ``1``).
79
100
 
101
+ ``--export-json`` writes this exact format back out, keyed by exact 1-based index
102
+ (never ``"all"``, even if every zone happens to share identical aux content) and
103
+ omitting any zone/variable/level with nothing to report.
104
+
80
105
  :Returns:
81
- A new Tecplot file written to the output path with the requested auxiliary data
82
- merged in. Exit code is ``0`` on success and non-zero if the input file cannot be
83
- read, a ``-z``/``-v``/JSON target cannot be resolved, or the output file already
84
- exists and ``--force`` is not set.
106
+ In the default mode, a new Tecplot file written to the output path with the
107
+ requested auxiliary data merged in. With ``--strip``, a new Tecplot file with all
108
+ auxiliary data removed. With ``--export-json``, a JSON file of everything that was
109
+ found (and the source file is untouched, unless ``--strip`` is also given). Exit
110
+ code is ``0`` on success and non-zero if the input file cannot be read, a
111
+ ``-z``/``-v``/JSON target cannot be resolved, ``--strip``/``--export-json`` is
112
+ combined with ``-d``/``-z``/``-v``/``-j``, or an output file already exists and
113
+ ``--force`` is not set.
85
114
 
86
115
  Examples:
87
116
  Tag a dataset with solver metadata (repeat the flag for multiple pairs)::
@@ -115,6 +144,21 @@ Examples:
115
144
 
116
145
  $ tecaux -j metadata.json -d Version=2.2 flow.szplt
117
146
 
147
+ Back up everything currently on a file before editing it by hand, without touching
148
+ the file itself::
149
+
150
+ $ tecaux --export-json flow.szplt # writes flow_aux.json
151
+
152
+ Sanitize a file for external sharing, discarding whatever aux data it had::
153
+
154
+ $ tecaux --strip flow.szplt # writes flow_no_aux.szplt
155
+
156
+ Sanitize a file but keep a record of what was removed, in case it's needed later
157
+ (e.g. to reapply with ``-j`` after review)::
158
+
159
+ $ tecaux --strip --export-json flow.szplt
160
+ # writes flow_no_aux.szplt and flow_aux.json
161
+
118
162
  Call directly from a Python session::
119
163
 
120
164
  import tecio.cli.tecaux.main as tecaux
@@ -182,6 +226,10 @@ def _parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
182
226
  " $ tecaux -z all RunDate=2024-01-15 <file>\n"
183
227
  " Bulk metadata from a file\n"
184
228
  " $ tecaux -j metadata.json <file>\n"
229
+ " Export existing aux data without touching the source file\n"
230
+ " $ tecaux --export-json <file>\n"
231
+ " Strip all aux data, keeping a JSON backup of what was removed\n"
232
+ " $ tecaux --strip --export-json <file>\n"
185
233
  ),
186
234
  formatter_class=lambda prog: argparse.RawDescriptionHelpFormatter(
187
235
  prog, width=70, max_help_position=24
@@ -240,6 +288,29 @@ def _parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
240
288
  "Write.auxvar). Full format in the module docstring."
241
289
  ),
242
290
  )
291
+ parser.add_argument(
292
+ "-s",
293
+ "--strip",
294
+ action="store_true",
295
+ default=False,
296
+ help=(
297
+ "Remove all auxiliary data (dataset, zone, and variable levels) "
298
+ "and write the result to <stem>_no_aux<ext> (or -o's path). "
299
+ "Mutually exclusive with -d/-z/-v/-j; combine with "
300
+ "--export-json to also save what was removed."
301
+ ),
302
+ )
303
+ parser.add_argument(
304
+ "--export-json",
305
+ action="store_true",
306
+ default=False,
307
+ help=(
308
+ "Write every existing auxiliary entry to <stem>_aux.json, in "
309
+ "the same AUXDATASET/AUXZONE/AUXVAR format -j reads -- without "
310
+ "modifying the source file, unless combined with --strip. "
311
+ "Mutually exclusive with -d/-z/-v/-j."
312
+ ),
313
+ )
243
314
  parser.add_argument(
244
315
  "-o",
245
316
  "--output",
@@ -248,7 +319,9 @@ def _parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
248
319
  metavar="PATH",
249
320
  help=(
250
321
  "Output file path. The extension controls the output format. "
251
- "Defaults to <stem>_aux<ext> in the same directory as the input."
322
+ "Defaults to <stem>_aux<ext> in the same directory as the input "
323
+ "(or <stem>_no_aux<ext> with --strip; not used by --export-json "
324
+ "alone, which always writes <stem>_aux.json)."
252
325
  ),
253
326
  )
254
327
  parser.add_argument(
@@ -270,9 +343,9 @@ def _parse_kv(token: str) -> tuple[str, str]:
270
343
  """Parse one ``KEY=VALUE`` token.
271
344
 
272
345
  Args:
273
- token: A single string like ``"Solver=MyCFD"``. Only the first ``"="`` is
346
+ token: A single string like ``"Solver=MyCFD"``. Only the first ``"="`` is
274
347
  significant, so a value may itself contain ``"="``
275
- (e.g. ``"Formula=a=b+c"``). A value containing spaces must be quoted as
348
+ (e.g. ``"Formula=a=b+c"``). A value containing spaces must be quoted as
276
349
  a whole on the command line, the same as any other shell argument
277
350
  (e.g. ``-z 1 "Description=Wing surface"``) -- this function only ever
278
351
  sees whatever single token the shell already produced, so it can't
@@ -302,7 +375,7 @@ def _resolve_variable(spec: str, var_names: list[str]) -> int | None:
302
375
  var_names: Ordered list of variable names from the reader.
303
376
 
304
377
  Returns:
305
- 0-based variable index, or ``None`` if *spec* cannot be resolved. Callers are
378
+ 0-based variable index, or ``None`` if *spec* cannot be resolved. Callers are
306
379
  responsible for reporting the failure.
307
380
 
308
381
  """
@@ -440,6 +513,57 @@ def _load_json_aux(
440
513
  return dataset_aux, zone_groups, var_groups
441
514
 
442
515
 
516
+ def _collect_all_aux(reader: Any) -> dict[str, Any]:
517
+ """Collect every dataset-, zone-, and variable-level aux entry from *reader*.
518
+
519
+ The exact inverse of ``_load_json_aux``: produces the same
520
+ ``AUXDATASET``/``AUXZONE``/``AUXVAR`` structure, so a file exported with
521
+ ``--export-json`` can be fed straight back in with ``-j`` (to the same
522
+ file, a modified copy, or an entirely different one) without any
523
+ reshaping. Zones/variables are keyed by their exact 1-based index --
524
+ never collapsed into an ``"all"`` entry even when every zone happens to
525
+ share the same aux content, since a later zone added to the file
526
+ wouldn't have had that entry originally and shouldn't silently inherit
527
+ it on a subsequent import.
528
+
529
+ A zone or variable with no aux entries at all is omitted entirely
530
+ (sparse), not written as an empty object -- matching how a missing key
531
+ on the *input* side already means "nothing to apply here".
532
+
533
+ Args:
534
+ reader: An open ``Read`` instance.
535
+
536
+ Returns:
537
+ A dict with up to three top-level keys (``AUXDATASET``, ``AUXZONE``,
538
+ ``AUXVAR``); a level with nothing to export is omitted entirely, so
539
+ a file with no aux data anywhere yields ``{}``.
540
+
541
+ """
542
+ result: dict[str, Any] = {}
543
+
544
+ dataset_aux = dict(reader.auxdata.items())
545
+ if dataset_aux:
546
+ result["AUXDATASET"] = dataset_aux
547
+
548
+ zone_aux: dict[str, dict[str, str]] = {}
549
+ for i, zone in enumerate(reader.zone):
550
+ entries = dict(zone.auxdata.items())
551
+ if entries:
552
+ zone_aux[str(i + 1)] = entries
553
+ if zone_aux:
554
+ result["AUXZONE"] = zone_aux
555
+
556
+ var_aux: dict[str, dict[str, str]] = {}
557
+ for i in range(reader.num_vars):
558
+ entries = dict(reader.get_var_auxdata(i + 1).items())
559
+ if entries:
560
+ var_aux[str(i + 1)] = entries
561
+ if var_aux:
562
+ result["AUXVAR"] = var_aux
563
+
564
+ return result
565
+
566
+
443
567
  # --------------------------------------------------------------------------------------
444
568
  # Per-zone processing
445
569
  # --------------------------------------------------------------------------------------
@@ -501,13 +625,161 @@ def _process_zone(
501
625
  return writer_data, writer_locs, passive_vars, var_sharing, existing_aux
502
626
 
503
627
 
628
+ def _write_zone_data(
629
+ writer: Any,
630
+ zone: Any,
631
+ writer_data: list[np.ndarray],
632
+ writer_locs: list[Any],
633
+ passive_vars: list[bool],
634
+ var_sharing: list[int],
635
+ zone_aux: dict[str, str] | None,
636
+ ) -> None:
637
+ """Perform the actual write zone call for one already processed zone.
638
+
639
+ Shared between add-mode (``main()``) and strip/export-mode
640
+ (``_run_strip_or_export()``) -- the only thing that differs between them
641
+ is what *zone_aux* is (a merged dict, or ``None`` when stripping), so
642
+ this is the one piece worth keeping in exactly one place rather than
643
+ risking the ``con_sharing``/``node_map`` handling drifting between two
644
+ copies.
645
+
646
+ Args:
647
+ writer: Open ``Write`` instance for the destination file.
648
+ zone: Source ``ReadZone`` being copied.
649
+ writer_data: Active, non-shared variable arrays (from ``_process_zone``).
650
+ writer_locs: Matching value locations (from ``_process_zone``).
651
+ passive_vars: Per-variable passive flags, dataset order.
652
+ var_sharing: Per-variable sharing, dataset order.
653
+ zone_aux: Zone-level aux to write, or ``None`` for none at all.
654
+
655
+ """
656
+ zt = zone.zone_type
657
+ common_kw: dict[str, Any] = dict(
658
+ title=zone.title,
659
+ value_locations=writer_locs,
660
+ passive_vars=passive_vars,
661
+ var_sharing=var_sharing,
662
+ solution_time=zone.solution_time,
663
+ strand_id=zone.strand_id,
664
+ aux=zone_aux,
665
+ )
666
+
667
+ if zt == ZoneType.ORDERED:
668
+ writer.write_ijk_zone(data=writer_data, **common_kw)
669
+ else:
670
+ con_sharing = zone.shared_connectivity
671
+ writer.write_fe_zone(
672
+ zone_type=zt,
673
+ data=writer_data,
674
+ node_map=None if con_sharing else zone.node_map,
675
+ con_sharing=con_sharing,
676
+ **common_kw,
677
+ )
678
+
679
+
504
680
  # --------------------------------------------------------------------------------------
505
681
  # Main entry point
506
682
  # --------------------------------------------------------------------------------------
507
683
 
508
684
 
685
+ def _run_strip_or_export(args: argparse.Namespace, src: Path) -> int:
686
+ """Handle ``--strip``/``--export-json``, independently or together.
687
+
688
+ Args:
689
+ args: Parsed arguments; ``args.strip`` and/or ``args.export_json``
690
+ is ``True`` (``main()`` only calls this when at least one is).
691
+ src: Validated-to-exist input file path.
692
+
693
+ Returns:
694
+ Exit code -- ``0`` on success, ``1`` on error.
695
+
696
+ """
697
+ if args.output is not None and args.export_json and not args.strip:
698
+ print(
699
+ "Warning: -o is ignored by --export-json alone -- the export "
700
+ f"always goes to {src.stem}_aux.json.",
701
+ file=sys.stderr,
702
+ )
703
+
704
+ json_dst = src.with_name(f"{src.stem}_aux.json")
705
+ strip_dst = (
706
+ Path(args.output)
707
+ if args.output is not None
708
+ else src.with_stem(src.stem + "_no_aux")
709
+ )
710
+
711
+ if args.export_json and json_dst.exists() and not args.force:
712
+ print(
713
+ f"Error: output file already exists: {json_dst}\nUse --force to overwrite.",
714
+ file=sys.stderr,
715
+ )
716
+ return 1
717
+ if args.strip and strip_dst.exists() and not args.force:
718
+ print(
719
+ (
720
+ f"Error: output file already exists: {strip_dst}\n"
721
+ "Use --force to overwrite."
722
+ ),
723
+ file=sys.stderr,
724
+ )
725
+ return 1
726
+
727
+ try:
728
+ with tecio_open(str(src), "r") as reader:
729
+ if args.export_json:
730
+ aux = _collect_all_aux(reader)
731
+ with open(json_dst, "w", encoding="utf-8") as fh:
732
+ json.dump(aux, fh, indent=2)
733
+ print(f"Exported auxiliary data: {src} -> {json_dst}")
734
+
735
+ if args.strip:
736
+ print(f"Stripping auxiliary data: {src} -> {strip_dst}")
737
+ with tecio_open(
738
+ str(strip_dst),
739
+ "w",
740
+ title=reader.title,
741
+ variables=reader.variables,
742
+ file_type=reader.file_type,
743
+ ) as writer:
744
+ for i, zone in enumerate(reader.zone):
745
+ zt = zone.zone_type
746
+ if zt in _FE_POLY:
747
+ print(
748
+ f"Warning: zone {i + 1} ('{zone.title}') is "
749
+ f"{zt.name} and cannot be copied -- skipping.",
750
+ file=sys.stderr,
751
+ )
752
+ continue
753
+
754
+ writer_data, writer_locs, passive_vars, var_sharing, _ = (
755
+ _process_zone(zone)
756
+ )
757
+ # No dataset/var aux is ever added to the writer, and zone_aux
758
+ # is unconditionally None here.
759
+ _write_zone_data(
760
+ writer,
761
+ zone,
762
+ writer_data,
763
+ writer_locs,
764
+ passive_vars,
765
+ var_sharing,
766
+ None,
767
+ )
768
+ print(f"Done. Stripped output written to: {strip_dst}")
769
+
770
+ except Exception as exc: # noqa: BLE001
771
+ print(f"Error: {exc}", file=sys.stderr)
772
+ if args.strip:
773
+ strip_dst.unlink(missing_ok=True)
774
+ if args.export_json:
775
+ json_dst.unlink(missing_ok=True)
776
+ return 1
777
+
778
+ return 0
779
+
780
+
509
781
  def main(argv: Sequence[str] | None = None) -> int:
510
- """Add auxiliary data to a Tecplot file.
782
+ """Add, remove, or export auxiliary data to a Tecplot file.
511
783
 
512
784
  Returns:
513
785
  Exit code -- ``0`` on success, ``1`` on error.
@@ -520,6 +792,17 @@ def main(argv: Sequence[str] | None = None) -> int:
520
792
  print(f"Error: input file not found: {src}", file=sys.stderr)
521
793
  return 1
522
794
 
795
+ if args.strip or args.export_json:
796
+ add_flags_given = bool(args.data or args.zone or args.var or args.json)
797
+ if add_flags_given:
798
+ print(
799
+ "Error: --strip/--export-json cannot be combined with "
800
+ "-d/-z/-v/-j -- run them as separate calls.",
801
+ file=sys.stderr,
802
+ )
803
+ return 1
804
+ return _run_strip_or_export(args, src)
805
+
523
806
  dst = (
524
807
  Path(args.output)
525
808
  if args.output is not None
@@ -635,7 +918,7 @@ def main(argv: Sequence[str] | None = None) -> int:
635
918
 
636
919
  # add_auxdataset_dict()/add_auxvar_dict() only buffer; the write happens
637
920
  # in flush_aux(), normally auto-triggered by the *lazy*-open path on the
638
- # first zone write. Passing variables= above means this writer is
921
+ # first zone write. Passing variables= above means this writer is
639
922
  # already open (eager), so that automatic trigger never fires.
640
923
  writer.flush_aux()
641
924
 
@@ -665,28 +948,16 @@ def main(argv: Sequence[str] | None = None) -> int:
665
948
  **zone_by_target.get(zone_num, {}),
666
949
  } or None
667
950
 
668
- common_kw: dict[str, Any] = dict(
669
- title=zone.title,
670
- value_locations=writer_locs,
671
- passive_vars=passive_vars,
672
- var_sharing=var_sharing,
673
- solution_time=zone.solution_time,
674
- strand_id=zone.strand_id,
675
- aux=merged_zone_aux,
951
+ _write_zone_data(
952
+ writer,
953
+ zone,
954
+ writer_data,
955
+ writer_locs,
956
+ passive_vars,
957
+ var_sharing,
958
+ merged_zone_aux,
676
959
  )
677
960
 
678
- if zt == ZoneType.ORDERED:
679
- writer.write_ijk_zone(data=writer_data, **common_kw)
680
- else:
681
- con_sharing = zone.shared_connectivity
682
- writer.write_fe_zone(
683
- zone_type=zt,
684
- data=writer_data,
685
- node_map=None if con_sharing else zone.node_map,
686
- con_sharing=con_sharing,
687
- **common_kw,
688
- )
689
-
690
961
  except Exception as exc: # noqa: BLE001
691
962
  print(f"Error: {exc}", file=sys.stderr)
692
963
  dst.unlink(missing_ok=True)
tecio/cli/tecdump.py CHANGED
@@ -2,10 +2,10 @@ r"""Dump the full contents of a Tecplot data file to standard output.
2
2
 
3
3
  Inspecting the contents of a binary Tecplot file (variable names, zone metadata,
4
4
  auxiliary data, and raw nodal or element values) ordinarily requires either opening the
5
- file in Tecplot itself or writing a dedicated script against the TecIO API. For a quick
5
+ file in Tecplot itself or writing a dedicated script against the TecIO API. For a quick
6
6
  sanity check during a simulation or post-processing workflow, ``tecdump`` serializes
7
7
  every record in the file to plain text, providing a complete and human-readable
8
- representation of the file contents directly in the terminal. The output is structured
8
+ representation of the file contents directly in the terminal. The output is structured
9
9
  hierarchically: file header and auxiliary data first, followed by per-zone headers and,
10
10
  optionally, the underlying variable and connectivity arrays.
11
11
 
@@ -27,7 +27,7 @@ arrays can be suppressed entirely to focus on structural metadata.
27
27
 
28
28
  :Options:
29
29
  ``--ignore-zones``
30
- Print only the file-level header and auxiliary data, then exit. Zone records
30
+ Print only the file-level header and auxiliary data, then exit. Zone records
31
31
  and variable arrays are suppressed entirely. Useful for confirming file-level
32
32
  metadata such as solver, strand IDs, or global auxiliary entries without the
33
33
  overhead of parsing zone data.
@@ -47,7 +47,7 @@ arrays can be suppressed entirely to focus on structural metadata.
47
47
 
48
48
  ``-maxvals INT``
49
49
  Maximum number of values to print from any variable or connectivity array before
50
- truncating with a summary line. Defaults to a small number suitable for a quick
50
+ truncating with a summary line. Defaults to a small number suitable for a quick
51
51
  preview; set to a large value (e.g. ``1000000``) to print an array in full.
52
52
 
53
53
  :Returns:
tecio/cli/tecextract.py CHANGED
@@ -1,12 +1,12 @@
1
1
  r"""Extract a subset of zones and/or variables from a Tecplot data file.
2
2
 
3
3
  Large Tecplot files produced by CFD solvers frequently contain many zones and variables,
4
- only a fraction of which are relevant to a given analysis. Loading the full file into
4
+ only a fraction of which are relevant to a given analysis. Loading the full file into
5
5
  Tecplot or writing a dedicated extraction script is impractical when the goal is simply
6
6
  to isolate a surface zone or a handful of flow variables for downstream processing.
7
7
  ``tecextract`` addresses this by writing a new Tecplot file containing only the
8
8
  requested subset, with the output format determined by the file extension of the output
9
- path. This makes it straightforward to reduce file size, change format, or prepare a
9
+ path. This makes it straightforward to reduce file size, change format, or prepare a
10
10
  subset for use with another tool in a single command.
11
11
 
12
12
  :Usage:
@@ -158,7 +158,7 @@ def _parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
158
158
  metavar="LIST",
159
159
  help=(
160
160
  "Comma-separated list of 1-based zone indices to extract "
161
- "(e.g. -zones 1,3,5). Default is all zones."
161
+ "(e.g. -zones 1,3,5). Default is all zones."
162
162
  ),
163
163
  )
164
164
  parser.add_argument(
@@ -168,7 +168,7 @@ def _parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
168
168
  metavar="LIST",
169
169
  help=(
170
170
  "Comma-separated list of 1-based variable indices to extract "
171
- "(e.g. -variables 1,2,5). Default is all variables."
171
+ "(e.g. -variables 1,2,5). Default is all variables."
172
172
  ),
173
173
  )
174
174
  parser.add_argument(
@@ -178,8 +178,8 @@ def _parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
178
178
  default=None,
179
179
  metavar="PATH",
180
180
  help=(
181
- "Output file path. The extension controls the output format "
182
- "(.szplt, .plt, .dat). Defaults to <stem>_extract<ext> in "
181
+ "Output file path. The extension controls the output format "
182
+ "(.szplt, .plt, .dat). Defaults to <stem>_extract<ext> in "
183
183
  "the same directory as the input."
184
184
  ),
185
185
  )
tecio/cli/tecfix.py CHANGED
@@ -156,7 +156,7 @@ def _parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
156
156
  default=None,
157
157
  metavar="PATH",
158
158
  help=(
159
- "Explicit output file path. Defaults to <stem>_fixed<ext> "
159
+ "Explicit output file path. Defaults to <stem>_fixed<ext> "
160
160
  "in the same directory as the input file."
161
161
  ),
162
162
  )
@@ -196,7 +196,7 @@ def _classify_array(arr: npt.NDArray) -> str | None:
196
196
 
197
197
  """
198
198
  # Some readers (e.g. DAT) may return an empty or None array for passive
199
- # or otherwise unavailable variables. Treat these as clean -> there is
199
+ # or otherwise unavailable variables. Treat these as clean -> there is
200
200
  # nothing to inspect and numpy operations like isnan would error or
201
201
  # return misleading results on a zero-size array.
202
202
  if arr is None or arr.size == 0:
@@ -235,7 +235,7 @@ def _process_zone(
235
235
 
236
236
  For each variable:
237
237
  - If the variable is already passive or shared, it is forwarded exactly
238
- as-is. Sharing references are 1-based zone indices that are identical
238
+ as-is. Sharing references are 1-based zone indices that are identical
239
239
  in the output file because tecfix writes every zone in order without
240
240
  skipping any.
241
241
  - If the variable is a floating-point type and contains NaN or Inf it is
@@ -478,7 +478,7 @@ def main(argv: Sequence[str] | None = None) -> int:
478
478
  } or None
479
479
 
480
480
  # Sanitize solution_time: if it is NaN the zone metadata
481
- # is corrupt. Reset both solution_time and strand_id to 0
481
+ # is corrupt. Reset both solution_time and strand_id to 0
482
482
  # so Tecplot treats the zone as stationary and the writer
483
483
  # does not propagate the bad value downstream.
484
484
  sol_time = zone.solution_time