Skip to content

sources

sources

PyAERMOD Source dataclasses and helpers.

Contains all AERMOD source types (PointSource, AreaSource, VolumeSource, LineSource, etc.), deposition parameter dataclasses, building-downwash helpers, background concentration, source groups, and the SourcePathway collection.

This module is an internal implementation detail. Public imports should go through :mod:pyaermod.input_generator (the backwards-compatible facade) or :mod:pyaermod.api.

DepositionMethod

Bases: Enum

Labels once written on a per-source METHOD card.

AERMOD has no METHOD keyword (it is not in modules.f; SO E105), so the per-source deposition_method field that holds these, and this enum, change nothing in a written deck; both are kept so existing code and saved projects still load. What each member stands for is set elsewhere: GASDEPVD and GASDEPDF are CO keywords (:attr:ControlPathway.gas_deposition_velocity, :attr:ControlPathway.gas_deposition_defaults), and DRYDPLT and WETDPLT are MODELOPT switches (:attr:ControlPathway.dry_depletion, :attr:ControlPathway.wet_depletion). Method 2 particle deposition is the METHOD_2 card, from a source's method_2.

GasDepositionParams dataclass

Gas dry-deposition parameters for the GASDEPOS keyword.

The four fields are, in AERMOD's order (soset.f, subroutine GASDEP): GASDEPOS srcid Da Dw rcl Henry. All four are required by AERMOD (E201/E202 otherwise) and must be positive (E380), except that a 0 in any field selects AERMOD's built-in value for the pollutants it knows (HG0, HGII, TCDD, BAP, SO2, NO2; warning W473). GASDEPOS is an ALPHA-option keyword (E198) and is rejected when GASDEPVD is also given (E195).

Earlier pyaermod releases named the second and third fields alpha_r and reactivity and validated the third as a 0-1 fraction; EPA's own testgas deck (0.08962 1.04E-5 2.51E4 557.0) was rejected by that validator. The values themselves always went through unchanged.

Parameters:

Name Type Description Default
diffusivity float

Molecular diffusivity in air, Da (cm^2/s).

required
diffusivity_water float

Molecular diffusivity in water, Dw (cm^2/s).

required
cuticular_resistance float

Lipid cuticle resistance for individual leaves, rcl (s/cm).

required
henry_constant float

Henry's law constant (Pa m^3/mol).

required

ParticleDepositionParams dataclass

Particle deposition parameters for PARTDIAM/MASSFRAX/PARTDENS keywords.

AERMOD reads each PARTDIAM value as the physical (Stokes) diameter of a particle of the matching PARTDENS (soset.f VDP1 settles it by Stokes' law with that density). diameter_convention records which kind of diameter the list holds: "stokes" when the diameters are physical diameters of particles of densities, "aerodynamic" when they are aerodynamic diameters (what emission factors and impactors report), None when it is not known (a deck read from a file). Aerodynamic diameters settle as AERMOD intends only beside a density of 1; written beside a higher density they make AERMOD settle every category that many times too fast, and the validator warns. :meth:pyaermod.psd.SizeDistribution.to_deposition_params sets the field; nothing is written to the deck for it.

Method2Params dataclass

SO METHOD_2 srcid finemass dg: Method 2 particle deposition.

soset.f METH_2 reads exactly two values -- the fine-mass fraction (the fraction of the mass below 2.5 microns, 0-1, E332) and the mass mean diameter in microns -- and builds a single particle category from them, so a source has either this or the PARTDIAM/MASSFRAX/ PARTDENS arrays (E386). METHOD_2 is an ALPHA-only, non-DFAULT keyword (E198/E197; probe decks 21 and 21b). EPA's testpart, testprt2 and openpits decks use it. A 0 in either field selects AERMOD's built-in value for the pollutants AR, CD, PB, HG and POC (W473).

Parameters:

Name Type Description Default
fine_mass_fraction float

Fraction of particle mass finer than 2.5 microns.

required
mass_mean_diameter float

Representative particle diameter (microns).

required

PlatformParams dataclass

SO PLATFORM srcid elev hb wb: an offshore platform under a stack.

soset.f PLATFM reads the platform base elevation above sea level, the height of the platform's building above that base and its width; downwash is applied only when both are above zero. POINT, POINTCAP and POINTHOR sources only (E631), one card per source (E632), ALPHA required (E198; probe deck 22).

Parameters:

Name Type Description Default
base_elevation float

Platform base elevation above sea level (m).

required
building_height float

Platform building height above the base (m).

required
building_width float

Platform building width (m).

required

PointSource dataclass

AERMOD point source (stack)

Represents an elevated point source with emission parameters.

set_building_from_bpip

set_building_from_bpip(building) -> None

Populate building downwash fields from a Building object.

Runs BPIPCalculator to compute 36 direction-dependent values and stores them in the building_* fields.

Parameters:

Name Type Description Default
building Building

Building geometry to use for downwash calculations.

required

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

PointCapSource dataclass

Bases: PointSource

LOCATION srcid POINTCAP ...: a point source with a rain cap.

Same SRCPARAM layout as POINT (soset.f PPARM); AERMOD doubles the initial plume diameter for the PRIME algorithm (ADSFACT = 2) and, with the BETA option, models the capped release directly (EPA's capped deck). Every PointSource field applies.

PointHorSource dataclass

Bases: PointSource

LOCATION srcid POINTHOR ...: a horizontally discharging stack.

Same SRCPARAM layout as POINT (soset.f PPARM); the exit velocity is the horizontal release velocity.

SidewashPointSource dataclass

LOCATION srcid SWPOINT x y [zelev] with SRCPARAM srcid emis hs bw bl bh ba: a sidewash point source.

A stack on a building whose wake is modelled by the sidewash algorithm (soset.f SWPARM, v26135): the six SRCPARAM values are the emission rate, the release height, and the building's width, length, height and orientation angle (degrees; AERMOD folds it into 0-360). ALPHA is required (E198, probe deck 23b). A building dimension of zero or less is reset to 1 m by AERMOD.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

AreaSource dataclass

AERMOD area source (rectangular)

Represents a rectangular area source with uniform emissions: SRCPARAM srcid Aremis Relhgt Xinit [Yinit [Angle [Szinit]]] (soset.f APARM). x_coord/y_coord are the source's southwest vertex, not its centre; the rectangle is initial_lateral_dimension (Xinit) long in x and initial_vertical_dimension (Yinit) long in y, both full side lengths, turned clockwise about that vertex by angle. The two field names are historical: neither is a half-width, and initial_vertical_dimension is the y side, not a vertical spread; the vertical spread is initial_sigma_z.

set_building_from_bpip

set_building_from_bpip(building) -> None

Populate building downwash fields from a Building object.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

AreaCircSource dataclass

AERMOD circular area source

Represents a circular area source with uniform emissions.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

AreaPolySource dataclass

AERMOD polygonal area source

Represents an irregular polygonal area source defined by vertices.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

VolumeSource dataclass

AERMOD volume source

Represents a three-dimensional volume with initial dispersion. Useful for modeling emissions from buildings, structures, or areas with significant initial mixing.

set_building_from_bpip

set_building_from_bpip(building) -> None

Populate building downwash fields from a Building object.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

LineSource dataclass

AERMOD line source

Represents a linear source with uniform emissions per unit length. Useful for modeling roads, conveyor belts, pipelines, or any linear emission feature.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

StreetCanyon dataclass

Street canyon geometry for RLINE/RLINEXT sources.

Approximates canyon effects by adjusting initial vertical dispersion and applying a concentration scaling factor based on the canyon aspect ratio (building_height / street_width).

The approach uses three flow regimes (Oke, 1988): - AR < 0.65: isolated roughness -- minimal canyon trapping - 0.65 <= AR < 1.5: wake interference / skimming flow - AR >= 1.5: deep canyon with persistent vortex

The adjusted sigma-z reflects reduced ventilation inside the canyon, and the concentration factor accounts for pollutant trapping that cannot be captured by sigma-z alone.

aspect_ratio property

aspect_ratio: float

Canyon aspect ratio H/W.

adjusted_sigma_z

adjusted_sigma_z(base_sigma_z: float) -> float

Return sigma-z adjusted for canyon trapping.

In the recirculation zone the effective mixing height is limited to the canyon depth, which increases initial sigma-z (more vertical mixing within the confined space).

concentration_factor

concentration_factor() -> float

Multiplicative factor on emission rate to represent canyon trapping.

Derived from the OSPM box-model concept: reduced ventilation in the canyon raises concentrations relative to open-road dispersion. The factor equals 1.0 (no effect) for isolated roughness and increases with aspect ratio up to a cap of 3.0 for deep canyons.

RLineSource dataclass

AERMOD RLINE source (roadway source)

Specialized source for modeling mobile emissions on roadways. More sophisticated than basic LINE source with road-specific parameters.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

RLineExtSource dataclass

AERMOD RLINEXT source (extended roadway source)

Extension of RLINE with per-endpoint heights, noise barrier support, and depressed roadway modeling. Requires ALPHA model option for barrier/depression features.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

BuoyLineSegment dataclass

A single line segment within a BUOYLINE source group.

BuoyLineSource dataclass

AERMOD BUOYLINE source (buoyant line source)

Models buoyant line sources such as aluminum reduction plant potroom roof vents. Consists of multiple line segments sharing common plume rise parameters defined via BLPINPUT.

emission_rate property

emission_rate: float

Total emission rate across all segments.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

OpenPitSource dataclass

AERMOD OPENPIT source (open pit mine/quarry)

Models fugitive emissions from open pit sources. The escape fraction is computed internally by AERMOD based on pit geometry and wind speed. Coordinates specify the SW corner of the pit.

effective_depth property

effective_depth: float

Effective pit depth computed from volume and dimensions.

from_area classmethod

from_area(area: AreaSource, *, depth: Optional[float] = None, volume: Optional[float] = None, release_height: Optional[float] = None, source_id: Optional[str] = None) -> OpenPitSource

The OPENPIT source with the footprint and emissions of area.

A rectangular AREA source is sometimes used to stand in for a pit: the same south-west corner, sides, angle and emission rate per unit area, often with initial_sigma_z set to depth / 4.3 as the OPENPIT algorithm would. AERMOD then models a flat release in which nothing settles inside the pit. An OPENPIT source adds what the AREA cannot (v24142 pitarea.f, soset.f, calc1.f): each particle category leaves the pit with the escape fraction 1 / (1 + Vg / (0.029 Uref)) (ESCAPE; 1 for a gas) and the rest settles in the pit; the plume is released with sigma-z0 = depth / 4.3 from an effective area on the upwind side of the pit, sized by the pit's relative depth (OPARM, PDEPTH, PTFRAC, PITEFF); and receptors inside the pit are skipped (PITCALC).

Parameters:

Name Type Description Default
area AreaSource

The stand-in. Its corner, sides, angle, base elevation, flat flag, emission rate, source groups, urban flag, NO2 ratio and deposition fields (gas, particle, Method 2) carry over, the nested ones as copies. initial_sigma_z is dropped, because OPENPIT sets its own, and the building-downwash fields must be unset, because OPENPIT has no downwash.

required
depth float

The pit's effective depth (m) or its volume (m^3); exactly one, related by volume = depth * Xinit * Yinit. With neither, area.depth_hint is the depth.

None
volume float

The pit's effective depth (m) or its volume (m^3); exactly one, related by volume = depth * Xinit * Yinit. With neither, area.depth_hint is the depth.

None
release_height float

Hs, the average release height above the pit floor; defaults to the AREA's release height.

None
source_id str

Defaults to the AREA's.

None

Raises:

Type Description
ValueError

With both or neither of depth and volume (and no depth_hint), a depth or volume that is not above 0, a side that is not above 0, or a building-downwash field set.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD SO pathway text for this source

BackgroundSector dataclass

A wind direction sector for direction-dependent background concentrations.

Each sector is defined by its starting direction (degrees clockwise from north). AERMOD allows up to 6 sectors. The ending direction is implicitly the starting direction of the next sector (or the first sector for wrap-around).

BackgroundConcentration dataclass

AERMOD background concentration (SO BACKGRND / BGSECTOR).

BACKGRND [SECTn] flag values... in soset.f: the flag is one of EMISFACT's temporal-variation flags (:data:TEMPORAL_FLAG_COUNTS: ANNUAL takes 1 value, SEASON 4, MONTH 12, HROFDY 24, ...), not an averaging period. Three modes:

  1. Uniform: uniform_value, one value for every hour, written BACKGRND ANNUAL value.
  2. Temporally varying: period_values maps a flag to its value (ANNUAL) or list of values ({"SEASON": [w, sp, su, f]}).
  3. Sector-dependent: sectors and sector_values, which maps (sector_id, flag) to a value or list of values.

A list of values may be a list, a tuple, a range, a numpy array or a pandas Series (its values in order); see :func:~pyaermod.pathways.value_list. A one-shot iterator (a map, a generator, a zip) is refused: the validator reports it, and the writer raises :class:TypeError rather than write a BACKGRND card without values.

An hourly background file (BACKGRND [SECTn] HOURLY file) is kept verbatim from a deck in :attr:AERMODProject.unparsed_lines.

to_aermod_input

to_aermod_input() -> str

Generate AERMOD BACKGRND / BGSECTOR keywords.

VegetativeBarrier dataclass

One vegetative barrier beside an RLINEXT road (VBARRIER, v26135).

VBARRIER srcid ht wt dcl lai lm [ht2 wt2 dcl2 lai2 lm2] in soset.f (VBARRIER_INPUTS): eight fields for one barrier, thirteen for two, nothing in between (E201). AERMOD range-checks every field: height 2-10 m (E371), width 2.5-13 m (E372), leaf area index 4-10.92 (E373), mixing length 0.55-3.75 m (E374). dcl is the signed distance from the road centreline; a second barrier on the same side as the first is discarded with warning W375. Requires the ALPHA and FLAT options (E198 / E713).

SolidBarrierSegment dataclass

One straight piece of a solid barrier (SBARRIER segment line).

SolidBarrier dataclass

A free-standing solid barrier for RLINE modelling (SBARRIER, v26135).

Written as AERMOD's SBARRIER_INPUTS reads it: an opening SBARRIER barid STA nseg line, one SBARRIER barid xbb ybb xbe ybe ht z line per segment (1-50 segments, E320), and a closing SBARRIER barid END line whose segment count must match (E306). AERMOD re-orders a segment's endpoints west-to-east (or north-to-south for vertical segments) on read, so the coordinates may come back swapped. Requires the ALPHA and FLAT options (E198 / E713).

EmissionUnits dataclass

Emission-rate unit conversion (EMISUNIT, CONCUNIT, DEPOUNIT).

All three keywords take exactly factor emission_label output_label (soset.f EMUNIT / COUNIT / DPUNIT; E201/E202 otherwise). The factor multiplies the model's g/s output into the output units; the labels are printed in the output headers. EMISUNIT applies to a run with a single output type and conflicts with CONCUNIT or DEPOUNIT (E158, E159); CONCUNIT and DEPOUNIT set the concentration and deposition units separately when both are calculated.

SourceGroupDefinition dataclass

Centralized source group definition.

Allows defining named groups of sources for AERMOD's SRCGROUP keyword, enabling per-group output files and chemistry associations.

Parameters:

Name Type Description Default
group_name str

Group identifier (max 8 characters, AERMOD limitation).

required
member_source_ids list of str

Source IDs belonging to this group.

list()
description str

Optional description for documentation purposes.

''

HourlyEmissionFile dataclass

HOUREMIS filename srcid|range|ALL ...: sources whose emission rate AERMOD reads hour by hour from filename (soset.f HREMIS).

filename is written as given, so it must be the path AERMOD resolves from its working directory. source_ids are the member tokens of the card (IDs, LOW-HIGH ranges or ALL). v26135 accepts one card per file, so sources may be split across files, but a source may be named in only one of them (E834/E835). The file itself is written by :func:pyaermod.hourly_emissions.write_hourly_emissions or, together with this card, by :meth:SourcePathway.add_hourly_emissions.

SourcePathway dataclass

Collection of sources

add_source

add_source(source: Union[PointSource, AreaSource, AreaCircSource, AreaPolySource, VolumeSource, LineSource, RLineSource, RLineExtSource, BuoyLineSource, OpenPitSource, SidewashPointSource])

Add a source to the pathway

add_group

add_group(group: SourceGroupDefinition)

Add a source group definition.

add_hourly_emissions

add_hourly_emissions(path: Union[str, Path], hours: Sequence[Sequence[int]], rates: Mapping[str, Sequence[Optional[float]]], filename: Optional[str] = None) -> HourlyEmissionFile

Write an hourly emission file and add its HOUREMIS card.

Parameters:

Name Type Description Default
path str or Path

Where to write the file.

required
hours sequence of (year, month, day, hour)

Every hour of the surface met file, in order (see :func:pyaermod.hourly_emissions.write_hourly_emissions).

required
rates mapping of source ID to hourly rates

AREA, AREACIRC, AREAPOLY, OPENPIT, VOLUME, LINE, RLINE or RLINEXT sources of this pathway (those whose HOUREMIS record may carry the rate alone, aermod.f HRQREAD), in any order: the records are written in the order the pathway defines the sources, as AERMOD reads them (E342).

required
filename str

The name the card gives AERMOD, if it differs from path (a run directory other than the one path is relative to).

None

Returns:

Type Description
HourlyEmissionFile

The card added to :attr:hourly_emissions.

to_aermod_input

to_aermod_input(chemistry: Optional[ChemistryOptions] = None, psd_credit: bool = False, elevation_units: Optional[str] = None, multi_urban: bool = False) -> str

Generate AERMOD SO pathway text.

Parameters:

Name Type Description Default
chemistry ChemistryOptions

Chemistry options from ControlPathway for OLM group emission.

None
psd_credit bool

The PSDCREDIT option is on (ControlPathway.psd_credit): write :attr:psd_groups and no SRCGROUP lines, as AERMOD requires (E105).

False
elevation_units str

ControlPathway.elevation_units: anything but METERS (the default) is written as ELEVUNIT, the first SO card (soset.f SOELUN: it must precede every source, E152).

None
multi_urban bool

The project has more than one urban area: URBANSRC then names the area before the sources (soset.f URBANS with L_MULTURB), from each source's urban_area_name.

False