Skip to content

aermod_outputs

aermod_outputs

PyAERMOD auxiliary output-file parsers.

AERMOD emits several text-format auxiliary files in addition to the main .OUT log and the POSTFILE binary (handled by postfile.py):

  • PLOTFILE one value per receptor for a given averaging period
  • MAXIFILE ranked top-N values at every receptor
  • RANKFILE overall top-N values across receptors, with dates
  • SEASONHR seasonal-hourly-average grid (4 seasons * 24 hours)
  • TOXXFILE top-N concentrations for toxics post-processing
  • deposition DDEP / WDEP / TOTDEP (same layout as PLOTFILE)

All share a common structure: comment header lines starting with '*' followed by fixed-width numeric rows. AERMOD prints the Fortran FORMAT statement it used in the header (* FORMAT: (3(1X,F13.5),...)); when that line is present the rows are sliced by those field widths, which is the only way to read a record whose trailing NET ID column is blank (discrete receptors) without shifting every column after it. Files without a FORMAT line fall back to whitespace splitting.

The readers here return either a pandas DataFrame (preferred) or a list of dicts.

AERMODFileHeader dataclass

Parsed comment-header info common to all AERMOD text outputs.

AERMODAuxResult dataclass

Unified result for any AERMOD auxiliary output file.

concentration_column property

concentration_column: Optional[str]

Name of the column holding the concentration, if identifiable.

AERMOD labels it AVERAGE CONC in most files (parsed here as AVERAGE_CONC) and plain CONC in others, so callers should ask rather than guess a spelling.

deposition_column property

deposition_column: Optional[str]

Name of the first deposition value column (DRY_DEPO, WET_DEPO, TOTAL_DEPO), if the file has one.

values

values(column: Optional[str] = None) -> List[float]

Numeric values of column (default: the concentration, or for a deposition file its first deposition column).

EventContribution dataclass

One *** SOURCE CONTRIBUTIONS FOR EVENT: <name> *** block.

An EVENT run (a deck with an EV pathway, see :class:pyaermod.pathways.EventPathway) writes, per event, the group total and every source's share of it (EVENTOUT SOCONT; DETAIL adds the hourly meteorology and contributions, which are not parsed here).

Attributes:

Name Type Description
event_name str

The EVENTPER name.

averaging_period int

Hours.

end_date str

YYMMDDHH of the period's last hour, as printed.

x, y, z_elev, z_flag float

The receptor, as printed on the LOCATION line.

group_id str

The source group.

group_value float

The group's concentration for the event.

contributions dict

Source ID -> contribution to group_value.

parse_fortran_format

parse_fortran_format(spec: str) -> List[Tuple[str, int]]

Expand a Fortran FORMAT statement into a flat list of (kind, width).

kind is "skip" for nX positional descriptors and "data" for value-carrying descriptors (I/F/E/D/G/A/L). Group repeats (3(1X,F13.5)) and the colon terminator are handled; everything else -- string literals, T/P edit descriptors -- is not used by AERMOD's auxiliary-file writers and raises ValueError.

AERMOD prints the exact FORMAT it wrote each file with, so these widths are authoritative: they are what makes a blank trailing column (an unset NET ID on discrete receptors) parse as blank rather than shifting every later column left by one.

parse_aermod_header

parse_aermod_header(lines: List[str]) -> AERMODFileHeader

Parse the comment-header block of any AERMOD auxiliary file.

read_aermod_aux_file

read_aermod_aux_file(filepath: Union[str, Path]) -> AERMODAuxResult

Read any AERMOD text auxiliary output file.

Auto-detects the file type (PLOTFILE, MAXIFILE, RANKFILE, SEASONHR, TOXXFILE, DDEP, WDEP, TOTDEP) from the header comments and infers columns when the header doesn't label them.

read_plotfile

read_plotfile(filepath: Union[str, Path]) -> AERMODAuxResult

Read a PLOTFILE (one concentration value per receptor).

read_maxifile

read_maxifile(filepath: Union[str, Path]) -> AERMODAuxResult

Read a MAXIFILE (top-N values at each receptor).

read_rankfile

read_rankfile(filepath: Union[str, Path]) -> AERMODAuxResult

Read a RANKFILE (overall top-N values across receptors).

read_seasonhr

read_seasonhr(filepath: Union[str, Path]) -> AERMODAuxResult

Read a SEASONHR file (seasonal-hourly averages).

read_toxxfile

read_toxxfile(filepath: Union[str, Path]) -> AERMODAuxResult

Read a TOXXFILE (toxics post-processing top-N).

AERMOD writes the TOXXFILE as Fortran unformatted binary; that layout is read here (see :func:_read_toxxfile_binary) and a binary file that does not match it raises ValueError rather than being read as text. A text file with a TOXXFILE header is read as the other auxiliary files are.

read_deposition

read_deposition(filepath: Union[str, Path]) -> AERMODAuxResult

Read a deposition output file.

AERMOD writes deposition to the ordinary PLOTFILE/POSTFILE layout with a DRY DEPO, WET DEPO or TOTAL DEPO value column, so a PLOTFILE with such a column is accepted; so is a file whose header names its type DDEP, WDEP or TOTDEP. Any other file raises ValueError.

read_event_output

read_event_output(filepath: Union[str, Path]) -> List[EventContribution]

Read the per-event source contributions from an EVENT run's .out.

Returns one :class:EventContribution per event, in file order. A normal run's output has no event blocks and gives an empty list.