Skip to content

unparsed

unparsed

Runstream lines the reader keeps verbatim because it has no model for them.

:mod:pyaermod.input_reader turns the keywords it understands into fields on the :class:~pyaermod.input_generator.AERMODProject. Every other line of a deck -- a keyword the reader has no structure for, a form of a known keyword it does not model (a BACKGRND hourly file, an EVENTFIL with an output option), or a whole EV pathway -- is recorded here as an :class:UnparsedLine so that nothing is dropped on the floor:

  • the reader logs one warning per pathway and keyword saying how many lines were kept this way;
  • the writer puts the lines back into the pathway they came from, just before its FINISHED marker, unless asked not to (AERMODProject.to_aermod_input(preserve_unparsed=False)).

The lines are re-emitted with the keyword spelled out even when the source deck left the keyword columns blank (AERMOD lets a line inherit the previous keyword), so they stay valid wherever the writer places them. Field text is kept as written -- 36*50. stays 36*50. and filenames keep their case -- because AERMOD reads it from the deck, not from pyaermod's model of it.

UnparsedLine dataclass

One runstream line the reader could not represent structurally.

Attributes:

Name Type Description
pathway str

Two-letter pathway code the line sits in (CO, SO, ...).

keyword str

The keyword AERMOD would dispatch the line on, upper-cased. For a continuation line this is the inherited keyword, not the first token of the line.

fields list of str

The data fields as written, with any leading pathway code and the keyword removed. Repeat shorthand (36*50.) is not expanded here.

lineno int

1-based line number in the source text.

raw str

The source line with trailing whitespace stripped.

to_aermod_line

to_aermod_line() -> str

The line as the writer re-emits it.

AERMOD reads the keyword from columns 4-11 and the data from column 13 on (setup.f DEFINE), so a keyword shorter than eight characters is padded: XBADJ STACK1 would otherwise be read as the keyword XBADJ S (E105).

unparsed_summary

unparsed_summary(lines: Iterable[UnparsedLine]) -> Dict[Tuple[str, str], int]

Count preserved lines per (pathway, keyword), in deck order.

preserved_block

preserved_block(pathway: str, lines: Iterable[UnparsedLine]) -> List[str]

The deck lines that put pathway's preserved lines back.

Empty when there is nothing to put back; otherwise a banner comment followed by one line per :class:UnparsedLine, in source order.