input_reader¶
input_reader ¶
AERMOD .inp file reader.
Parses a textual AERMOD control-file back into an :class:AERMODProject
so a round-trip is possible:
>>> project = read_aermod_input("facility.inp")
>>> project.write("facility_clone.inp")
Supported pathway keywords (v1.4): CO: TITLEONE, TITLETWO, MODELOPT (incl. OLM/PVMRM/ARM2/GRSM/NOCHKD), AVERTIME, POLLUTID, RUNORNOT, ELEVUNIT, FLAGPOLE, URBANOPT, LOW_WIND, HALFLIFE, DCAYCOEF, NO2STACK, NO2EQUIL, OZONEVAL, OZONEFIL, O3VALUES, ERRORFIL, DEBUGOPT SO: LOCATION (POINT/AREA/VOLUME/LINE/RLINE/OPENPIT/AREACIRC), SRCPARAM, SRCGROUP, BACKGRND, BGSECTOR, BACKUNIT, GASDEPOS, PARTDIAM, MASSFRAX, PARTDENS, URBANSRC, BUILDHGT, BUILDWID, BUILDLEN, XBADJ, YBADJ, EMISFACT, HOUREMIS, INCLUDED, ELEVUNIT RE: GRIDCART (XYINC), GRIDPOLR, DISCCART, EVALCART, DISCPOLR, ELEVUNIT, INCLUDED ME: SURFFILE, PROFFILE, SURFDATA, UAIRDATA, PROFBASE, STARTEND, WDROTATE, SITEDATA OU: RECTABLE, MAXTABLE
Unknown keywords are collected in :attr:AERMODProject.unparsed_lines
and preserved on write via the project's writer, but are not round-
tripped structurally. Opening a file this reader doesn't fully
understand therefore still succeeds; it just won't produce a
byte-identical output when rewritten.
The reader is permissive about whitespace but strict about pathway
order: each pathway must appear once, inside XX STARTING and
XX FINISHED markers.
PathTraversalError ¶
Bases: ValueError
Raised when a sandboxed .inp references a path outside its base dir.
parse_aermod_input ¶
Parse the text of an AERMOD .inp file into an AERMODProject.
read_aermod_input ¶
Read an AERMOD .inp file from disk and return the project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to the .inp file. |
required |
sandbox
|
bool
|
If True, validate that every absolute path referenced inside
the .inp (SURFFILE, PROFFILE, OZONEFIL, etc.) and every
resolved relative path stays inside the .inp's parent directory.
Raises :class: The default (False) preserves prior behavior: paths are stored as-is and AERMOD itself decides what to open at run time. |
False
|