Skip to content

input_generator

input_generator

PyAERMOD Input File Generator

Generates AERMOD-compatible input files from Python objects. Based on AERMOD version 26135 keyword specifications (validated against 26135 and 24142; see :mod:pyaermod.versions).

.. note::

As of v1.6.0 the dataclasses that used to live in this single file have been split into focused submodules:

  • :mod:pyaermod.pathways -- enums, chemistry options, Control / Met / Output / Event pathways
  • :mod:pyaermod.sources -- deposition helpers, building-downwash helpers, all source dataclasses, SourcePathway
  • :mod:pyaermod.receptors -- CartesianGrid, PolarGrid, DiscreteReceptor, ReceptorPathway

This module re-exports every public name so that existing imports (from pyaermod.input_generator import X) continue to work unchanged.

AERMODProject dataclass

Complete AERMOD project

Combines all pathways into a single input file.

to_aermod_input

to_aermod_input(validate: bool = True, check_files: bool = False, preserve_unparsed: bool = True, event_processing: Optional[bool] = None) -> str

Generate complete AERMOD input file.

Parameters:

Name Type Description Default
validate bool

If True (default in pyaermod 2.0+), run the configuration validator before generating output. Raises ValueError on validation errors (warnings are allowed). Pass validate=False to skip validation entirely.

True
check_files bool

If True (and validate is True), also verify that meteorology files exist on disk.

False
preserve_unparsed bool

If True (default), every :attr:unparsed_lines entry is written back into its pathway, just before the pathway's FINISHED line, under a ** comment banner. Pass False to write only what the model represents; validation then skips the checks of the model against those lines.

True
event_processing bool

Write the EVENT-run layout (CO SO ME EV OU, see :attr:event_processing); the default is the project's own flag. The RE pathway is not part of an event deck (AERMOD reads it as an invalid pathway there) and is left out; the events come from :attr:events, and the OU pathway holds EVENTOUT (:attr:OutputPathway.event_output, else :attr:ControlPathway.eventfil_option, else DETAIL).

None

write

write(filename: Union[str, Path], event_filename: Optional[Union[str, Path]] = None, validate: bool = True, check_files: bool = False)

Write input file to disk.

Parameters:

Name Type Description Default
filename str or Path

Path for the main AERMOD input file.

required
event_filename str or Path

Path for the event deck: the same project written in the EVENT-run layout (to_aermod_input(event_processing=True)), which needs :attr:events. This is the deck AERMOD would write itself for ControlPathway.eventfil; writing it here lets a hand-built or edited event set be run directly.

None
validate bool

Forwarded to :meth:to_aermod_input. Default True (pyaermod 2.0+). Pass validate=False to skip.

True
check_files bool

Forwarded to :meth:to_aermod_input.

False

create_example_project

create_example_project() -> AERMODProject

Create an example AERMOD project