arrayprobe 0.1.0__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.
- arrayprobe/__init__.py +219 -0
- arrayprobe/__main__.py +19 -0
- arrayprobe/_v314_lazy.py +48 -0
- arrayprobe/ai_ready.py +212 -0
- arrayprobe/attributed_export.py +1333 -0
- arrayprobe/authordefaults.py +267 -0
- arrayprobe/cli.py +3510 -0
- arrayprobe/combine.py +12 -0
- arrayprobe/compare.py +950 -0
- arrayprobe/config.py +1239 -0
- arrayprobe/constants.py +12 -0
- arrayprobe/count_closure.py +204 -0
- arrayprobe/diagnostic_views.py +769 -0
- arrayprobe/diode_report.py +265 -0
- arrayprobe/driver/__init__.py +5 -0
- arrayprobe/driver/_load_record.py +331 -0
- arrayprobe/driver/preflight_inputs.py +250 -0
- arrayprobe/driver/reprocess.py +553 -0
- arrayprobe/driver/run_flight.py +8166 -0
- arrayprobe/driver/tas_from_probe_housekeeping.py +124 -0
- arrayprobe/dropsize.py +519 -0
- arrayprobe/friendly.py +206 -0
- arrayprobe/geometry/__init__.py +77 -0
- arrayprobe/geometry/min_rectangle.py +92 -0
- arrayprobe/intarr.py +12 -0
- arrayprobe/intarr_analysis.py +16 -0
- arrayprobe/intarr_plots.py +12 -0
- arrayprobe/inventory.py +129 -0
- arrayprobe/jit_kernels.py +344 -0
- arrayprobe/lwc.py +44 -0
- arrayprobe/masks.py +349 -0
- arrayprobe/matio.py +410 -0
- arrayprobe/matlab_compat.py +13 -0
- arrayprobe/ncio.py +26 -0
- arrayprobe/particle.py +55 -0
- arrayprobe/particle_perimeter.py +12 -0
- arrayprobe/products.py +78 -0
- arrayprobe/profiles.py +179 -0
- arrayprobe/provenance.py +21 -0
- arrayprobe/py.typed +11 -0
- arrayprobe/readers/__init__.py +9 -0
- arrayprobe/readers/dmt.py +603 -0
- arrayprobe/readers/mask_csv.py +12 -0
- arrayprobe/readers/pms.py +12 -0
- arrayprobe/readers/sea.py +433 -0
- arrayprobe/readers/tasinfo.py +12 -0
- arrayprobe/regimes.py +507 -0
- arrayprobe/render.py +728 -0
- arrayprobe/reproduce_report.py +149 -0
- arrayprobe/review_agreement.py +135 -0
- arrayprobe/review_sampling.py +327 -0
- arrayprobe/run_page.py +624 -0
- arrayprobe/sample_area.py +12 -0
- arrayprobe/selector.py +206 -0
- arrayprobe/sizing.py +151 -0
- arrayprobe/time_convert.py +12 -0
- arrayprobe/timing_closure.py +141 -0
- arrayprobe/tools/__init__.py +27 -0
- arrayprobe/tools/make_demo_flight.py +1089 -0
- arrayprobe/tools/make_tas_file.py +760 -0
- arrayprobe/tools/probe_comparison.py +569 -0
- arrayprobe/tools/synthetic_truth.py +698 -0
- arrayprobe/tools/tas_sources.py +705 -0
- arrayprobe/triage_context.py +488 -0
- arrayprobe/triage_server.py +5215 -0
- arrayprobe/tune/__init__.py +15 -0
- arrayprobe/tune/diodes.py +400 -0
- arrayprobe/tune/distributions.py +300 -0
- arrayprobe/tune/sample.py +243 -0
- arrayprobe/tune/score.py +230 -0
- arrayprobe/tune/settings.py +354 -0
- arrayprobe/validate_by_condition.py +208 -0
- arrayprobe/validation_report.py +166 -0
- arrayprobe-0.1.0.dist-info/METADATA +260 -0
- arrayprobe-0.1.0.dist-info/RECORD +189 -0
- arrayprobe-0.1.0.dist-info/WHEEL +5 -0
- arrayprobe-0.1.0.dist-info/entry_points.txt +2 -0
- arrayprobe-0.1.0.dist-info/licenses/LICENSE +31 -0
- arrayprobe-0.1.0.dist-info/licenses/LICENSES/BSD-3-Clause.txt +47 -0
- arrayprobe-0.1.0.dist-info/licenses/NOTICE.md +369 -0
- arrayprobe-0.1.0.dist-info/top_level.txt +4 -0
- arrayprobe_soda2/__init__.py +131 -0
- arrayprobe_soda2/angles.py +143 -0
- arrayprobe_soda2/aspect_ratio.py +541 -0
- arrayprobe_soda2/backfill.py +100 -0
- arrayprobe_soda2/binary_dof.py +181 -0
- arrayprobe_soda2/buildindex.py +113 -0
- arrayprobe_soda2/decompress_dmt.py +285 -0
- arrayprobe_soda2/enhancement_hooks.py +275 -0
- arrayprobe_soda2/export_ascii.py +732 -0
- arrayprobe_soda2/export_ncdf.py +683 -0
- arrayprobe_soda2/export_ncdf_raf.py +396 -0
- arrayprobe_soda2/fillholes.py +161 -0
- arrayprobe_soda2/find_radius.py +105 -0
- arrayprobe_soda2/findsize.py +407 -0
- arrayprobe_soda2/fit_poisson.py +170 -0
- arrayprobe_soda2/fix2dimage.py +63 -0
- arrayprobe_soda2/fixraking.py +162 -0
- arrayprobe_soda2/fixstuckbits.py +146 -0
- arrayprobe_soda2/hvps4_read_frame.py +121 -0
- arrayprobe_soda2/jit_kernels.py +152 -0
- arrayprobe_soda2/label_blobs.py +177 -0
- arrayprobe_soda2/min_circle_fast.py +320 -0
- arrayprobe_soda2/particlesort.py +703 -0
- arrayprobe_soda2/pbp_writer.py +558 -0
- arrayprobe_soda2/poisson_spot_correct.py +183 -0
- arrayprobe_soda2/princomp.py +107 -0
- arrayprobe_soda2/probespecs.py +361 -0
- arrayprobe_soda2/process_2d.py +1364 -0
- arrayprobe_soda2/process_2d_parallel.py +626 -0
- arrayprobe_soda2/process_hk.py +512 -0
- arrayprobe_soda2/processbuffer_2dc.py +155 -0
- arrayprobe_soda2/processbuffer_cip.py +213 -0
- arrayprobe_soda2/processbuffer_f2dc.py +139 -0
- arrayprobe_soda2/processbuffer_spec.py +441 -0
- arrayprobe_soda2/processbuffer_tail.py +350 -0
- arrayprobe_soda2/pth_readers.py +245 -0
- arrayprobe_soda2/py.typed +11 -0
- arrayprobe_soda2/read2dbuffer.py +371 -0
- arrayprobe_soda2/reject.py +246 -0
- arrayprobe_soda2/reprocess_pbp.py +156 -0
- arrayprobe_soda2/sample_area.py +264 -0
- arrayprobe_soda2/save_writer.py +480 -0
- arrayprobe_soda2/sea.py +324 -0
- arrayprobe_soda2/spec_absolutepointers.py +109 -0
- arrayprobe_soda2/spec_decompress.py +203 -0
- arrayprobe_soda2/spec_index.py +476 -0
- arrayprobe_soda2/spec_read_frame.py +286 -0
- arrayprobe_soda2/spec_read_hk.py +301 -0
- arrayprobe_soda2/spec_readint.py +127 -0
- arrayprobe_soda2/timeconv.py +77 -0
- arrayprobe_soda2/update_op.py +101 -0
- arrayprobe_uiops/__init__.py +45 -0
- arrayprobe_uiops/combine.py +192 -0
- arrayprobe_uiops/combine_fork.py +359 -0
- arrayprobe_uiops/constants.py +830 -0
- arrayprobe_uiops/decode_naming.py +113 -0
- arrayprobe_uiops/diode_mask.py +250 -0
- arrayprobe_uiops/engine_absence.py +41 -0
- arrayprobe_uiops/export_oap.py +325 -0
- arrayprobe_uiops/geometry_core.py +366 -0
- arrayprobe_uiops/habit.py +749 -0
- arrayprobe_uiops/habit_core.py +248 -0
- arrayprobe_uiops/hollow_size_rule.py +376 -0
- arrayprobe_uiops/imgproc.py +2081 -0
- arrayprobe_uiops/imgproc_core.py +275 -0
- arrayprobe_uiops/intarr.py +167 -0
- arrayprobe_uiops/intarr_analysis.py +569 -0
- arrayprobe_uiops/intarr_plots.py +119 -0
- arrayprobe_uiops/jit_kernels.py +430 -0
- arrayprobe_uiops/lwc.py +70 -0
- arrayprobe_uiops/matlab_compat.py +860 -0
- arrayprobe_uiops/measure.py +346 -0
- arrayprobe_uiops/min_circle.py +204 -0
- arrayprobe_uiops/min_ellipse.py +161 -0
- arrayprobe_uiops/min_rectangle.py +200 -0
- arrayprobe_uiops/ncar_2dc_timing.py +100 -0
- arrayprobe_uiops/ncio.py +810 -0
- arrayprobe_uiops/oap_read.py +228 -0
- arrayprobe_uiops/particle.py +51 -0
- arrayprobe_uiops/particle_perimeter.py +94 -0
- arrayprobe_uiops/particle_physics.py +199 -0
- arrayprobe_uiops/pecan_params.py +134 -0
- arrayprobe_uiops/probe_cases.py +298 -0
- arrayprobe_uiops/product_sanity.py +337 -0
- arrayprobe_uiops/profile.py +71 -0
- arrayprobe_uiops/profiles.py +756 -0
- arrayprobe_uiops/provenance.py +804 -0
- arrayprobe_uiops/py.typed +11 -0
- arrayprobe_uiops/qc.py +169 -0
- arrayprobe_uiops/readers/__init__.py +8 -0
- arrayprobe_uiops/readers/mask_csv.py +74 -0
- arrayprobe_uiops/readers/pms.py +239 -0
- arrayprobe_uiops/readers/tasinfo.py +57 -0
- arrayprobe_uiops/rect_ellipse.py +129 -0
- arrayprobe_uiops/register_image_assisted.py +25 -0
- arrayprobe_uiops/reject.py +501 -0
- arrayprobe_uiops/reject_core.py +220 -0
- arrayprobe_uiops/sample_area.py +93 -0
- arrayprobe_uiops/sizedist.py +1923 -0
- arrayprobe_uiops/sizedist_core.py +814 -0
- arrayprobe_uiops/sizedist_tables.py +642 -0
- arrayprobe_uiops/spec.py +1094 -0
- arrayprobe_uiops/spec_core.py +703 -0
- arrayprobe_uiops/stray_pixel.py +103 -0
- arrayprobe_uiops/tas.py +191 -0
- arrayprobe_uiops/time_convert.py +41 -0
- uiops/__init__.py +402 -0
- uiops/py.typed +11 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
"""Open every input a long run needs, before the long run starts.
|
|
3
|
+
|
|
4
|
+
**The failure this replaces, measured 2026-09-20.** A run died with
|
|
5
|
+
``KeyError: 'TAS'`` **754 seconds in** — after the whole S2 decode had
|
|
6
|
+
finished — because the aircraft file it was handed does not use UIOOPS's
|
|
7
|
+
variable names and nothing had opened it. The information needed to refuse was
|
|
8
|
+
available in the first second of the run: the file was on disk, and the names
|
|
9
|
+
it carries are in its header. Thirteen minutes of decode were spent to learn
|
|
10
|
+
something a single ``Dataset(...).variables`` call answers.
|
|
11
|
+
|
|
12
|
+
That is the whole idea. This tool **opens** each input the way the stage that
|
|
13
|
+
consumes it will open it, and reports what it could not read. It computes
|
|
14
|
+
nothing, writes nothing, and takes no position on whether the run is a good
|
|
15
|
+
idea — it answers one question: *will every input this run needs be readable
|
|
16
|
+
when the run reaches it?*
|
|
17
|
+
|
|
18
|
+
**Where it lives.** It could have been written
|
|
19
|
+
inside ``scripts/run_flight.py``; it lives here
|
|
20
|
+
instead, as a module with its own entry point, for two reasons. The driver was
|
|
21
|
+
held by another lane when this was built, and — the durable reason — a
|
|
22
|
+
preflight that only exists inside the driver cannot be run *before* deciding
|
|
23
|
+
to launch the driver, which is exactly when its answer is worth the most. The
|
|
24
|
+
wiring into ``run_flight.py`` is then one call to :func:`check_inputs`, and the
|
|
25
|
+
tool stays usable on its own:
|
|
26
|
+
|
|
27
|
+
.venv/Scripts/python.exe scripts/preflight_inputs.py RAW.2DS \\
|
|
28
|
+
--tas-file flightData.cdf --iat-file 2DS_intArrThreshold.cdf --out _decoded
|
|
29
|
+
|
|
30
|
+
Exit ``0`` when every input opened, ``2`` when any did not. Nothing about this
|
|
31
|
+
changes a computed number, so it is tooling in the port's sense
|
|
32
|
+
(the test being whether it moves a written byte).
|
|
33
|
+
|
|
34
|
+
**What this is not.** It is not a validity check on the *contents* — a TAS
|
|
35
|
+
array of the wrong length, or thresholds for the wrong flight, pass here. The
|
|
36
|
+
claim is narrow and stated that way deliberately: each named input exists and
|
|
37
|
+
yields the variable its consumer asks for by name. A check that promised more
|
|
38
|
+
than it tests would be the third silent guard this project has had.
|
|
39
|
+
"""
|
|
40
|
+
from __future__ import annotations
|
|
41
|
+
|
|
42
|
+
import argparse
|
|
43
|
+
import os
|
|
44
|
+
import sys
|
|
45
|
+
from dataclasses import dataclass
|
|
46
|
+
from pathlib import Path
|
|
47
|
+
|
|
48
|
+
from arrayprobe.tools import tas_sources as _tas_sources
|
|
49
|
+
|
|
50
|
+
#: The (true-airspeed, time) variable-name pairs an aircraft file may use, in
|
|
51
|
+
#: the order ``run_flight._aircraft_series`` tries them. **This table is a
|
|
52
|
+
#: second copy on purpose, and it is checked against the first**:
|
|
53
|
+
#: ``tests/test_preflight_opens_inputs.py`` reads ``_TAS_VARIANTS`` out of
|
|
54
|
+
#: ``scripts/run_flight.py``'s own source and fails if the two disagree. A
|
|
55
|
+
#: preflight that accepted a name the run then rejects — or rejected one the
|
|
56
|
+
#: run accepts — would be worse than no preflight, because it would be trusted.
|
|
57
|
+
#: Neither side may grow a name that was not read off a real file first.
|
|
58
|
+
#:
|
|
59
|
+
#: Since 2026-09-23 both copies derive from one registry,
|
|
60
|
+
#: :data:`arrayprobe.tools.tas_sources.SOURCES`, each entry read off a real file.
|
|
61
|
+
#: This copy had stayed a two-row literal after the driver moved to the registry, so it
|
|
62
|
+
#: refused the ORACLES merge file (``True_Air_Speed``/``Start_UTC``) the run accepts.
|
|
63
|
+
TAS_VARIANTS: tuple[tuple[str, str], ...] = tuple(
|
|
64
|
+
(_src.tas_var, _src.time_var) for _src in _tas_sources.SOURCES)
|
|
65
|
+
|
|
66
|
+
#: ``sizedist.py:1409-1411`` opens the interarrival-threshold file and reads
|
|
67
|
+
#: exactly this variable. A file that exists and does not carry it fails the
|
|
68
|
+
#: run at the shattering block, deep inside S4.
|
|
69
|
+
IAT_VARIABLE = "threshold"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass(frozen=True)
|
|
73
|
+
class Problem:
|
|
74
|
+
"""One input that will not be readable when the run reaches it."""
|
|
75
|
+
|
|
76
|
+
kind: str
|
|
77
|
+
path: str
|
|
78
|
+
why: str
|
|
79
|
+
|
|
80
|
+
def __str__(self) -> str: # pragma: no cover - exercised through report()
|
|
81
|
+
return f"{self.kind} {self.path}: {self.why}"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _variables(path: str | os.PathLike[str]) -> list[str]:
|
|
85
|
+
"""The variable names a netCDF file carries, or raise.
|
|
86
|
+
|
|
87
|
+
Imported lazily so that ``--help`` and the argument surface work in an
|
|
88
|
+
environment without netCDF4 — the preflight refusing to start is itself a
|
|
89
|
+
preflight failure, and a confusing one.
|
|
90
|
+
"""
|
|
91
|
+
from netCDF4 import Dataset # noqa: PLC0415 - deliberate, see docstring
|
|
92
|
+
|
|
93
|
+
with Dataset(str(path), "r") as ds:
|
|
94
|
+
return list(ds.variables)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _check_readable_file(kind: str, path: Path) -> Problem | None:
|
|
98
|
+
if not path.exists():
|
|
99
|
+
return Problem(kind, str(path), "does not exist")
|
|
100
|
+
if not path.is_file():
|
|
101
|
+
return Problem(kind, str(path), "is not a file")
|
|
102
|
+
try:
|
|
103
|
+
with path.open("rb") as fh:
|
|
104
|
+
fh.read(1)
|
|
105
|
+
except OSError as exc:
|
|
106
|
+
return Problem(kind, str(path), f"cannot be opened for reading: {exc}")
|
|
107
|
+
if path.stat().st_size == 0:
|
|
108
|
+
return Problem(kind, str(path), "is empty (0 bytes)")
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def check_tas_file(path: str | os.PathLike[str],
|
|
113
|
+
variants: tuple[tuple[str, str], ...] = TAS_VARIANTS,
|
|
114
|
+
) -> list[Problem]:
|
|
115
|
+
"""The aircraft file, opened the way ``_aircraft_series`` opens it.
|
|
116
|
+
|
|
117
|
+
This is the check that would have refused the 2026-09-20 run in its first
|
|
118
|
+
second instead of its 755th.
|
|
119
|
+
"""
|
|
120
|
+
p = Path(path)
|
|
121
|
+
bad = _check_readable_file("--tas-file", p)
|
|
122
|
+
if bad is not None:
|
|
123
|
+
return [bad]
|
|
124
|
+
try:
|
|
125
|
+
present = _variables(p)
|
|
126
|
+
except Exception as exc: # netCDF4 raises OSError, but not only
|
|
127
|
+
return [Problem("--tas-file", str(p),
|
|
128
|
+
f"exists but cannot be read as a netCDF file: {exc}")]
|
|
129
|
+
for tas_name, time_name in variants:
|
|
130
|
+
if tas_name in present and time_name in present:
|
|
131
|
+
return []
|
|
132
|
+
tried = ", ".join(f"{t}/{ti}" for t, ti in variants)
|
|
133
|
+
return [Problem(
|
|
134
|
+
"--tas-file", str(p),
|
|
135
|
+
f"carries no true-airspeed/time pair. Tried {tried}. It carries: "
|
|
136
|
+
f"{sorted(present)}. Add the pair to _TAS_VARIANTS in run_flight.py "
|
|
137
|
+
f"once you have read it out of the file -- do not guess a name")]
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def check_iat_file(path: str | os.PathLike[str]) -> list[Problem]:
|
|
141
|
+
"""The interarrival-threshold file, if one is named.
|
|
142
|
+
|
|
143
|
+
**A named-but-absent file is not an error**, and that is not an oversight:
|
|
144
|
+
``sizeDist.m:65`` sets ``iaThreshFile = 'NONE'`` and falls back to the
|
|
145
|
+
per-probe default, and the archived product was made exactly
|
|
146
|
+
that way (the ``_MISSING`` convention). So absence returns
|
|
147
|
+
no problem. A file that *is* there and cannot be opened, or does not carry
|
|
148
|
+
``threshold``, fails S4 deep in the shattering block and is a problem.
|
|
149
|
+
"""
|
|
150
|
+
p = Path(path)
|
|
151
|
+
if not p.exists():
|
|
152
|
+
return []
|
|
153
|
+
bad = _check_readable_file("--iat-file", p)
|
|
154
|
+
if bad is not None:
|
|
155
|
+
return [bad]
|
|
156
|
+
try:
|
|
157
|
+
present = _variables(p)
|
|
158
|
+
except Exception as exc:
|
|
159
|
+
return [Problem("--iat-file", str(p),
|
|
160
|
+
f"exists but cannot be read as a netCDF file: {exc}")]
|
|
161
|
+
if IAT_VARIABLE not in present:
|
|
162
|
+
return [Problem(
|
|
163
|
+
"--iat-file", str(p),
|
|
164
|
+
f"carries no {IAT_VARIABLE!r} variable (sizedist.py:1409-1411 reads "
|
|
165
|
+
f"it by that name). It carries: {sorted(present)}")]
|
|
166
|
+
return []
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def check_out_dir(path: str | os.PathLike[str]) -> list[Problem]:
|
|
170
|
+
"""The output directory exists, or can be made, and accepts a write."""
|
|
171
|
+
p = Path(path)
|
|
172
|
+
if p.exists() and not p.is_dir():
|
|
173
|
+
return [Problem("--out", str(p), "exists and is not a directory")]
|
|
174
|
+
probe = p / ".preflight_write_probe"
|
|
175
|
+
try:
|
|
176
|
+
p.mkdir(parents=True, exist_ok=True)
|
|
177
|
+
probe.write_text("", encoding="utf-8")
|
|
178
|
+
except OSError as exc:
|
|
179
|
+
return [Problem("--out", str(p), f"is not writable: {exc}")]
|
|
180
|
+
finally:
|
|
181
|
+
try:
|
|
182
|
+
probe.unlink()
|
|
183
|
+
except OSError:
|
|
184
|
+
pass
|
|
185
|
+
return []
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def check_inputs(raws=(), tas_file=None, iat_file=None, out_dir=None,
|
|
189
|
+
tas_variants: tuple[tuple[str, str], ...] = TAS_VARIANTS,
|
|
190
|
+
) -> list[Problem]:
|
|
191
|
+
"""Every named input, opened. Returns the problems, empty when all opened.
|
|
192
|
+
|
|
193
|
+
Deliberately returns *all* problems rather than raising on the first: a
|
|
194
|
+
long run is launched once, and being told about one unreadable input per
|
|
195
|
+
attempt is how a preflight becomes something people skip.
|
|
196
|
+
"""
|
|
197
|
+
problems: list[Problem] = []
|
|
198
|
+
for raw in raws:
|
|
199
|
+
bad = _check_readable_file("raw", Path(raw))
|
|
200
|
+
if bad is not None:
|
|
201
|
+
problems.append(bad)
|
|
202
|
+
if tas_file:
|
|
203
|
+
problems += check_tas_file(tas_file, tas_variants)
|
|
204
|
+
if iat_file:
|
|
205
|
+
problems += check_iat_file(iat_file)
|
|
206
|
+
if out_dir is not None:
|
|
207
|
+
problems += check_out_dir(out_dir)
|
|
208
|
+
return problems
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def report(problems: list[Problem], n_checked: int) -> str:
|
|
212
|
+
"""The preflight verdict as printed lines: one ok line, or each refused input and how
|
|
213
|
+
to proceed."""
|
|
214
|
+
if not problems:
|
|
215
|
+
return f"preflight {n_checked} input(s) opened; nothing refused"
|
|
216
|
+
lines = [f"preflight REFUSED: {len(problems)} of {n_checked} input(s) "
|
|
217
|
+
f"could not be read"]
|
|
218
|
+
lines += [f"preflight {p}" for p in problems]
|
|
219
|
+
lines.append("preflight nothing was run. Fix the above, or drop the flag "
|
|
220
|
+
"that names the input, and launch again.")
|
|
221
|
+
return "\n".join(lines)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def main(argv: list[str] | None = None) -> int:
|
|
225
|
+
"""Command line: open every named input, print the report, and return 2 if any was
|
|
226
|
+
refused, else 0."""
|
|
227
|
+
ap = argparse.ArgumentParser(
|
|
228
|
+
prog="preflight_inputs.py",
|
|
229
|
+
description=__doc__.split("\n\n")[0],
|
|
230
|
+
formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
231
|
+
ap.add_argument("raws", nargs="*", help="raw probe files the run will decode")
|
|
232
|
+
ap.add_argument("--tas-file", default=None,
|
|
233
|
+
help="the aircraft file run_flight.py would be given")
|
|
234
|
+
ap.add_argument("--iat-file", default=None,
|
|
235
|
+
help="sizeDist's optional twelfth argument; a named-but-absent "
|
|
236
|
+
"file is valid (the _MISSING convention) and passes")
|
|
237
|
+
ap.add_argument("--out", default=None,
|
|
238
|
+
help="the output directory the run will write into")
|
|
239
|
+
args = ap.parse_args(argv)
|
|
240
|
+
|
|
241
|
+
n = len(args.raws) + sum(
|
|
242
|
+
1 for x in (args.tas_file, args.iat_file, args.out) if x)
|
|
243
|
+
problems = check_inputs(raws=args.raws, tas_file=args.tas_file,
|
|
244
|
+
iat_file=args.iat_file, out_dir=args.out)
|
|
245
|
+
print(report(problems, n))
|
|
246
|
+
return 2 if problems else 0
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
if __name__ == "__main__": # pragma: no cover
|
|
250
|
+
sys.exit(main())
|