aermet_runner¶
aermet_runner ¶
AERMET binary runner + three-stage pipeline.
Parallel to :class:pyaermod.runner.AERMODRunner but for AERMET. The
EPA AERMET workflow is three sequential passes — Stage 1 ingests raw
obs, Stage 2 merges, Stage 3 computes boundary-layer parameters — and
each stage takes an input deck as its stdin or first argument.
from pyaermod import AERMETStage1, AERMETStage2, AERMETStage3
from pyaermod.aermet_runner import AERMETRunner, run_aermet_pipeline
runner = AERMETRunner()
result1 = runner.run_stage(1, stage1_inp_path, working_dir=tmp)
...
Or, for a full pipeline:
results = run_aermet_pipeline(
stage1, stage2, stage3, working_dir=tmp,
)
# results is a list of 3 AERMETRunResult; check all `.success`.
The module handles:
- Writing each stage's deck to disk via .to_aermet_input()
- Finding / validating the AERMET binary
- Capturing stdout, stderr, and the <stage>.msg log file
- Surfacing failure diagnostics via :func:runner_utils.summarize_failure
AERMETRunResult
dataclass
¶
Outcome of a single AERMET stage execution.
AERMETRunner ¶
Execute AERMET stages from Python.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executable_path
|
Optional[Union[str, Path]]
|
Path to the |
None
|
log_level
|
str
|
Python logging level name. |
'INFO'
|
run_stage ¶
run_stage(stage: int, input_file: Union[str, Path], *, working_dir: Union[str, Path], timeout: int = 600) -> AERMETRunResult
Run a single AERMET stage.
AERMET v23+ reads from a fixed file aermet.inp in the
current working directory (the same convention as AERMOD
with aermod.inp). We copy the user's deck to that path
before invoking the binary.
run_aermet_pipeline ¶
run_aermet_pipeline(stage1: AERMETStage1, stage2: AERMETStage2, stage3: AERMETStage3, *, working_dir: Union[str, Path], executable_path: Optional[Union[str, Path]] = None, stop_on_failure: bool = True, timeout: int = 600) -> List[AERMETRunResult]
Run all three AERMET stages in sequence in working_dir.
Writes each stage's deck to {working_dir}/stage{N}.inp before
dispatching to AERMET. If a stage fails and stop_on_failure is
True (default), the remaining stages are skipped.
Returns a list of AERMETRunResult (one per attempted stage).