aerscreen_runner¶
aerscreen_runner ¶
AERSCREEN binary runner.
AERSCREEN is interactive and spawns other programs, so running it takes more staging than the other EPA binaries:
- It reads its answers from stdin, in the order
:meth:
~pyaermod.aerscreen.AERSCREENConfig.to_stdin_answersgives them, or, when anaerscreen.inprestart file is in the working directory, asks whether to continue with it. - Before starting a run it checks that
AERMOD.EXE,MAKEMET.EXEand (when needed)BPIPPRM.EXEandAERMAP.EXEexist in the working directory, then invokes them through the shell asaermod,makemet,bpipprmandaermap. The runner stages both spellings as links to the real binaries and puts the working directory first onPATH. - Its call
bpipprm <inp> <out> <sum>assumes a BPIP-PRIME that takes file names; the onescripts/build_bpip.shbuilds readsfort.10and writesfort.12/fort.14(EPA's OPEN statements are commented out), so the stagedbpipprmis a small wrapper that bridges the two. - Auxiliary inputs the configuration names (surface-characteristics
file, discrete-receptor file, BPIP file, DEMs, NADCON grids) are
copied in beside it, and
DEMlist.txtis written for terrain runs.
Typical usage::
from pyaermod import AERSCREENConfig, AERSCREENSourceType
from pyaermod.aerscreen_runner import AERSCREENRunner
cfg = AERSCREENConfig(...)
result = AERSCREENRunner().run(cfg, working_dir="/tmp/aerscreen_so2")
if result.success:
print(result.summary.maximum.conc_1hr, "ug/m3 at",
result.summary.maximum.distance, "m")
Build the binaries with scripts/build_aerscreen.sh (AERSCREEN and
MAKEMET), scripts/build_aermod.sh (AERMOD and AERMAP) and
scripts/build_bpip.sh.
AERSCREENRunResult
dataclass
¶
Outcome of an AERSCREEN execution.
AERSCREENRunner ¶
Execute AERSCREEN from Python.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executable_path
|
Optional[Union[str, Path]]
|
Path to the |
None
|
aermod_path
|
Optional[Union[str, Path]]
|
The programs AERSCREEN spawns. Each defaults to the first match on $PATH; AERMOD and MAKEMET are required for any screening run, BPIP-PRIME only with building downwash and AERMAP only with terrain, so a missing one is reported when a run needs it. |
None
|
makemet_path
|
Optional[Union[str, Path]]
|
The programs AERSCREEN spawns. Each defaults to the first match on $PATH; AERMOD and MAKEMET are required for any screening run, BPIP-PRIME only with building downwash and AERMAP only with terrain, so a missing one is reported when a run needs it. |
None
|
bpipprm_path
|
Optional[Union[str, Path]]
|
The programs AERSCREEN spawns. Each defaults to the first match on $PATH; AERMOD and MAKEMET are required for any screening run, BPIP-PRIME only with building downwash and AERMAP only with terrain, so a missing one is reported when a run needs it. |
None
|
aermap_path
|
Optional[Union[str, Path]]
|
The programs AERSCREEN spawns. Each defaults to the first match on $PATH; AERMOD and MAKEMET are required for any screening run, BPIP-PRIME only with building downwash and AERMAP only with terrain, so a missing one is reported when a run needs it. |
None
|
log_level
|
str
|
Python logging level name. |
'INFO'
|
required_helpers ¶
The spawned programs this configuration will call.
stdin_text ¶
What the runner types: the prompt answers, or the restart reply.
stage ¶
Put everything AERSCREEN will look for into work.
Returns the path of the file the run reads its configuration
from: aerscreen.inp in restart mode, the answers file in
prompt mode.
run ¶
run(config: AERSCREENConfig, *, working_dir: Union[str, Path], timeout: int = 1800, mode: str = 'prompts') -> AERSCREENRunResult
Run AERSCREEN for one configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
AERSCREENConfig
|
The run. |
required |
working_dir
|
Union[str, Path]
|
Directory AERSCREEN runs in. It fills it with met files, AERMOD decks and outputs; use one per run. |
required |
timeout
|
int
|
Seconds before the run is killed. A flat run takes seconds, a terrain run with AERMAP minutes. |
1800
|
mode
|
str
|
|
'prompts'
|