Skip to content

aermap

aermap

PyAERMOD AERMAP Input Generator

Generates AERMAP input files for terrain preprocessing. AERMAP is the EPA's terrain preprocessor for AERMOD.

AERMAP reads Digital Elevation Model (DEM) data and calculates: - Receptor elevations - Hill heights (for terrain-following calculations) - Source elevations

AERMAPDomain dataclass

Domain definition for AERMAP processing

AERMAPReceptor dataclass

Receptor definition for AERMAP

AERMAPSource dataclass

Source definition for AERMAP.

source_type is the AERMAP source type (AERMAP_SOURCE_TYPES). A LINE, RLINE or BUOYLINE source also needs its end point (x_end, y_end), and a LINE its width: AERMAP takes the elevation of RLINE and BUOYLINE sources at the midpoint of the two ends, and of a LINE source at the south-west corner of its equivalent area (SOLOCA in aermap.f). Every other type is placed at (x_coord, y_coord).

AERMAPProject dataclass

AERMAP project configuration

Generates terrain elevations for receptors and sources.

to_aermap_input writes the runstream syntax of EPA's AERMAP 24142, the current release: the pathways in the order CO, SO, RE, OU, the mandatory ANCHORXY and RUNORNOT keywords, TERRHGTS EXTRACT or PROVIDED, and the RECEPTOR and SOURCLOC output files.

Receptor networks. grids holds AERMOD CartesianGrid and PolarGrid objects, each written as a GRIDCART or GRIDPOLR block under its grid_name (at most 8 characters, unique). The older single-grid fields (grid_receptor, grid_x_init ...) still work and write a network named GRID. A polar grid centred on a source (origin_source_id) is written with that source's coordinates, which must be one of sources of a single-point type.

NADCON. When the DEM files' datum differs from datum, AERMAP shifts between the two with the NADCON grid files (conus.las, conus.los ...) and stops with E365 if it cannot find them. nad_grids_dir names the directory that holds them (NADGRIDS); without it AERMAP looks in the working directory.

Coordinates. Receptor and source coordinates are in the "user" system of the AERMOD deck. ANCHORXY ties one user point (anchor_x, anchor_y) to a UTM point (anchor_utm_x, anchor_utm_y, which default to the same values, i.e. user coordinates are UTM coordinates in utm_zone). datum is the datum of those coordinates and becomes AERMAP's NADA code (AERMAP_DATUM_CODES, or an integer 0 to 7 given directly).

Domain. DOMAINXY is written when all four of domain_x_min, domain_y_min, domain_x_max and domain_y_max are set (UTM metres, zone utm_zone). AERMAP searches only this area for the hill heights, so it must take in every terrain feature that rises above a 10% slope from any receptor (the rule in sub_calchc.f), or the hill heights come out too low without any warning. The whole area must also lie inside the DEM files (otherwise AERMAP stops with E310). Without it AERMAP searches the full extent of the DEM files, which is the safe default.

Terrain heights. terrain_type is "EXTRACT" (AERMAP takes the elevations from the DEM; any elevation on a receptor or source is left out of the deck, since AERMAP would ignore it) or "PROVIDED" (every receptor and source must carry its elevation; AERMAP then computes only the receptors' hill heights and writes no source file, so SOURCLOC is left out). "ELEVATED" is read as "EXTRACT".

AERMAP has no receptor IDs: AERMAPReceptor.receptor_id is kept for the caller's bookkeeping and is not written. AERMAP writes its messages to <input stem>.out beside the input file, not to a file the deck names, so message_file is not written either.

from_aermod_project classmethod

from_aermod_project(aermod_project, dem_files: List[str], utm_zone: int = 16, datum: str = 'NAD83', buffer: Optional[float] = None, dem_format: Optional[str] = None, nad_grids_dir: Optional[str] = None) -> AERMAPProject

Create an AERMAPProject from an AERMODProject.

Every source, every Cartesian and polar grid and every discrete receptor of the AERMOD project is written, so AERMAP gives each of them an elevation. Each source is written as the AERMAP type that places its elevation where AERMOD expects it (the AERMOD type itself where AERMAP 24142 has it; SWPOINT as POINT, RLINEXT as RLINE, an AREAPOLY at its first vertex and each BUOYLINE segment under its own ID). A source type AERMAP cannot place raises ValueError rather than being left without an elevation.

The AERMOD coordinates are taken as UTM coordinates in utm_zone. By default no DOMAINXY is written, so AERMAP searches the whole DEM for hill heights. With buffer the domain is the project's extent widened by buffer metres on every side: AERMAP then ignores terrain outside it, so the buffer must take in every feature that rises above a 10% slope from any receptor, and the DEM files must cover the whole domain.

Parameters:

Name Type Description Default
aermod_project AERMODProject
required
dem_files list of str

DEM file paths.

required
utm_zone int
16
datum str

Datum of the AERMOD coordinates. When it differs from the DEM files' datum (USGS .dem files are usually NAD27), AERMAP needs the NADCON grid files: see nad_grids_dir.

'NAD83'
buffer float

Metres around the project's extent for DOMAINXY; None (the default) writes no domain.

None
dem_format str

"NED" (GeoTIFF) or "DEM" (USGS native format). By default "DEM" when every file ends in .dem, otherwise "NED".

None
nad_grids_dir str

Directory of the NADCON grid files (NADGRIDS).

None

Returns:

Type Description
AERMAPProject

add_receptor

add_receptor(receptor: AERMAPReceptor)

Add a discrete receptor

add_source

add_source(source: AERMAPSource)

Add a source

to_aermap_input

to_aermap_input() -> str

Generate the AERMAP runstream (AERMAP 24142 syntax).

Raises ValueError for a project AERMAP would reject or misread: no anchor point, no DEM file, no receptor and no source, an unknown terrain_type, dem_format, datum or source type, a partial domain, a source ID or grid name AERMAP would cut short, a line source without its end point (or a LINE without its width), or a PROVIDED project with a receptor or source that has no elevation, with grid receptors (the grid has no elevations to provide) or with no discrete receptor.

write

write(filename: str)

Write AERMAP input file

create_grid_receptors_for_aermap

create_grid_receptors_for_aermap(x_min: float, x_max: float, y_min: float, y_max: float, spacing: float) -> Tuple[float, float, int, int]

Helper function to calculate grid parameters for AERMAP

Args: x_min, x_max: X coordinate range y_min, y_max: Y coordinate range spacing: Grid spacing in meters

Returns: Tuple of (x_init, y_init, x_num, y_num)