visualization¶
visualization ¶
PyAERMOD Visualization Tools
Create publication-ready plots and interactive maps for AERMOD results.
AERMODVisualizer ¶
Visualization tools for AERMOD results
Creates contour plots, interactive maps, and publication-ready figures.
plot_contours ¶
plot_contours(averaging_period: str = 'ANNUAL', levels: Optional[List[float]] = None, colormap: str = 'YlOrRd', show_sources: bool = True, show_max: bool = True, title: Optional[str] = None, units: str = 'ug/m³', figsize: Tuple[int, int] = (12, 10), save_path: Optional[Union[str, Path]] = None, dpi: int = 300, plotfile: Any = None, zflag: Optional[float] = None) -> matplotlib.figure.Figure
Create concentration contour plot
:meth:AERMODResults.get_concentrations returns the rows of AERMOD's
summary tables (the top ten or so receptors of each period), too few
points to contour a grid. Pass the period's PLOTFILE as plotfile
to contour the value at every receptor; without it the plot is drawn
from the summary rows, with a warning when they cover fewer
receptors than the run has.
Args:
averaging_period: Averaging period to plot
levels: Contour levels (auto-generated if None)
colormap: Matplotlib colormap name
show_sources: Whether to show source locations
show_max: Whether to mark maximum concentration
title: Plot title (auto-generated if None)
units: Concentration units for label
figsize: Figure size (width, height)
save_path: Path to save figure (optional)
dpi: Resolution for saved figure
plotfile: The period's PLOTFILE (a path, a
:func:~pyaermod.aermod_outputs.read_plotfile result or a
DataFrame); its values at every receptor are contoured.
zflag: Flagpole height to contour, for a plotfile from a
CO FLAGPOLE run with receptors at several heights
(:func:plotfile_frame raises ValueError without it).
Returns: matplotlib Figure object
create_interactive_map ¶
create_interactive_map(averaging_period: str = 'ANNUAL', center: Optional[Tuple[float, float]] = None, zoom_start: int = 13, colormap: str = 'YlOrRd', opacity: float = 0.6, show_sources: bool = True, show_max: bool = True, basemap: str = 'OpenStreetMap', save_path: Optional[Union[str, Path]] = None, utm_zone: Optional[int] = None, northern_hemisphere: bool = True) -> folium.Map
Create interactive Leaflet map
The results are in model coordinates (UTM metres). Leaflet needs
latitude and longitude, so pass utm_zone (and
northern_hemisphere=False for a southern zone) to have the
receptors, sources and maximum converted. Without a zone the
coordinates are used as given, as latitude (y) and longitude (x),
and a warning says so; that is right only for results already in
degrees.
Args: averaging_period: Averaging period to plot center: Map center (lat, lon) or None for auto zoom_start: Initial zoom level colormap: Colormap name opacity: Overlay opacity (0-1) show_sources: Show source markers show_max: Show maximum concentration marker basemap: Base map style save_path: Path to save HTML file utm_zone: UTM zone of the model coordinates (1-60); converts them to latitude and longitude northern_hemisphere: False for a southern-hemisphere zone
Returns: folium.Map object
plot_time_series ¶
plot_time_series(receptor_location: Tuple[float, float], averaging_periods: Optional[List[str]] = None, title: Optional[str] = None, figsize: Tuple[int, int] = (12, 6), save_path: Optional[Union[str, Path]] = None) -> matplotlib.figure.Figure
Plot concentration time series at a specific receptor
Args: receptor_location: (x, y) coordinates averaging_periods: List of periods to plot title: Plot title figsize: Figure size save_path: Path to save figure
Returns: matplotlib Figure object
plot_comparison ¶
plot_comparison(results_list: List, labels: List[str], averaging_period: str = 'ANNUAL', metric: str = 'max', title: Optional[str] = None, figsize: Tuple[int, int] = (10, 6), save_path: Optional[Union[str, Path]] = None) -> matplotlib.figure.Figure
Compare multiple AERMOD runs
Args: results_list: List of AERMODResults objects labels: Labels for each run averaging_period: Averaging period to compare metric: 'max', 'mean', or 'median' title: Plot title figsize: Figure size save_path: Path to save figure
Returns: matplotlib Figure object
plotfile_frame ¶
A PLOTFILE's values at every receptor as x, y, concentration.
plotfile is a path to an AERMOD PLOTFILE, the result of
:func:pyaermod.aermod_outputs.read_plotfile, or a DataFrame with
x/y/concentration (or the PLOTFILE's X/Y and
concentration column) already in it.
A flagpole run (CO FLAGPOLE with one network per height) puts
receptors at the same (x, y) at several heights (ZFLAG), and a
contour of mixed heights means nothing. Pass zflag to keep the
receptors at that flagpole height; when the file holds several heights
and zflag is None a :class:ValueError asks for one. A file with a
single height needs no zflag, and a DataFrame without a zflag
column is taken as one height.
quick_plot ¶
quick_plot(results, averaging_period: str = 'ANNUAL', save_path: Optional[str] = None, plotfile: Any = None, zflag: Optional[float] = None) -> matplotlib.figure.Figure
Quick contour plot with default settings
Args:
results: AERMODResults object
averaging_period: Averaging period to plot
save_path: Optional save path
plotfile: The period's PLOTFILE, contoured at every receptor (see
:meth:AERMODVisualizer.plot_contours)
zflag: Flagpole height to contour when the PLOTFILE has several
heights (see :meth:AERMODVisualizer.plot_contours)
Returns: matplotlib Figure object
quick_map ¶
quick_map(results, averaging_period: str = 'ANNUAL', save_path: Optional[str] = None, utm_zone: Optional[int] = None, northern_hemisphere: bool = True) -> folium.Map
Quick interactive map with default settings
Args:
results: AERMODResults object
averaging_period: Averaging period to plot
save_path: Optional save path (HTML)
utm_zone: UTM zone of the results (see create_interactive_map)
northern_hemisphere: False for a southern-hemisphere zone
Returns: folium.Map object