lair.air.stilt#
Stochastic Time-Inverted Lagrangian Transport (STILT) Model.
A python implementation of the [R-STILT](jmineau/stilt) model framework.
> Inspired by uataq/air-tracker-stiltctl
Functions
|
Initialize STILT project |
Classes
|
STILT Configuration |
|
Represents a vertical column receptor at a single (x, y) location, defined by a bottom and top height. |
|
HYSPLIT control parameters. |
|
|
|
STILT footprint. |
|
|
|
|
|
Represents a spatial location for STILT models, independent of time. |
|
|
|
Meteorological data files for STILT simulations. |
|
|
|
|
|
|
|
Represents a receptor composed of multiple 3D points, all at the same time. |
|
Abstract base class for STILT model outputs. |
|
Represents a single receptor at a specific 3D point (latitude, longitude, height) in space and time. |
|
|
|
|
|
|
|
|
|
|
|
Represents a slanted column receptor, defined by multiple points along the slant. |
|
|
|
STILT trajectory. |
|
|
|
- lair.air.stilt.stilt_init(project: str | Path, branch: str | None = None, repo: str | None = None)[source]#
Initialize STILT project
Python implementation of Rscript -e “uataq::stilt_init(‘project’)”
- Parameters:
- projectstr
Name/path of STILT project. If path is not provided, project will be created in current working directory.
- branchstr, optional
Branch of STILT project repo. The default is jmineau.
- repostr, optional
URL of STILT project repo. The default is jmineau/stilt.
- class lair.air.stilt.Meteorology(path: str | Path, format: str, tres: str | Timedelta)[source]#
Meteorological data files for STILT simulations.
- class lair.air.stilt.Location(geometry: Geometry)[source]#
Represents a spatial location for STILT models, independent of time. Can be used to generate consistent location IDs and create receptors when combined with time.
- __init__(geometry: Geometry)[source]#
Initialize a location with a shapely geometry.
- Parameters:
- geometryshapely.Geometry
A geometric object (e.g., Point, MultiPoint, LineString).
- property geometry#
Location geometry.
- property points: List[Point]#
Returns a list of shapely Point objects representing the location’s coordinates.
- classmethod from_point(longitude, latitude, height) Location [source]#
Create a Location from a single point.
- Parameters:
- longitudefloat
Longitude coordinate
- latitudefloat
Latitude coordinate
- heightfloat
Height above ground level
- Returns:
- Location
A point location
- classmethod from_column(longitude, latitude, bottom, top) Location [source]#
Create a Location representing a vertical column.
- Parameters:
- longitudefloat
Longitude coordinate
- latitudefloat
Latitude coordinate
- bottomfloat
Bottom height of column
- topfloat
Top height of column
- Returns:
- Location
A column location
- class lair.air.stilt.Receptor(time, location: Location)[source]#
- __init__(time, location: Location)[source]#
A receptor that wraps a geometric object (Point, MultiPoint, etc.) and associates it with a timestamp.
- Parameters:
- timedatetime
The timestamp associated with the receptor.
- locationLocation
A location object representing the receptor’s spatial position.
- property geometry: Geometry#
Receptor geometry.
- property timestr: str#
Get the time as an ISO formatted string.
- Returns:
- str
Time in ‘YYYYMMDDHHMM’ format.
- static build(time, longitude, latitude, height) Receptor [source]#
Build a receptor object from time, latitude, longitude, and height.
- Parameters:
- timedatetime
Timestamp of the receptor.
- longitudefloat | list[float]
Longitude(s) of the receptor.
- latitudefloat | list[float]
Latitude(s) of the receptor.
- heightfloat | list[float]
Height(s) above ground level of the receptor.
- Returns:
- Receptor
The constructed receptor object.
- class lair.air.stilt.PointReceptor(time, longitude, latitude, height)[source]#
Represents a single receptor at a specific 3D point (latitude, longitude, height) in space and time.
- __init__(time, longitude, latitude, height)[source]#
A receptor that wraps a geometric object (Point, MultiPoint, etc.) and associates it with a timestamp.
- Parameters:
- timedatetime
The timestamp associated with the receptor.
- locationLocation
A location object representing the receptor’s spatial position.
- class lair.air.stilt.MultiPointReceptor(time, points)[source]#
Represents a receptor composed of multiple 3D points, all at the same time.
- class lair.air.stilt.ColumnReceptor(time, longitude, latitude, bottom, top)[source]#
Represents a vertical column receptor at a single (x, y) location, defined by a bottom and top height.
- __init__(time, longitude, latitude, bottom, top)[source]#
A receptor that wraps a geometric object (Point, MultiPoint, etc.) and associates it with a timestamp.
- Parameters:
- timedatetime
The timestamp associated with the receptor.
- locationLocation
A location object representing the receptor’s spatial position.
- class lair.air.stilt.SlantReceptor(time, points)[source]#
Represents a slanted column receptor, defined by multiple points along the slant.
- classmethod from_top_and_bottom(time, bottom, top, numpar, weights=None)[source]#
- Parameters:
- timeany
Timestamp.
- bottomtuple
(lon, lat, height) tuple for the bottom of the slant.
- toptuple
(lon, lat, height) tuple for the top of the slant.
- numparint
Number of points along the slant.
- weightslist of float, optional
Weights for each point along the slant. Must be the same length as numpar.
- class lair.air.stilt.FootprintParams(*args: Any, **kwargs: Any)[source]#
- property resolutions: List[Resolution] | None#
Get the x and y resolutions as a list of tuples.
- class lair.air.stilt.BaseConfig(*args: Any, **kwargs: Any)[source]#
STILT Configuration
This class consolidates all configuration parameters for the STILT model, including system settings, footprint parameters, meteorological data, model specifics, transport settings, error handling, and user-defined functions.
- class lair.air.stilt.ModelConfig(*args: Any, **kwargs: Any)[source]#
-
- build_simulation_configs() List[SimulationConfig] [source]#
Build a list of SimulationConfig objects, one for each receptor.
- class lair.air.stilt.Output(simulation_id, receptor, data)[source]#
Abstract base class for STILT model outputs.
- class lair.air.stilt.Trajectory(simulation_id: str, receptor: Receptor, data: DataFrame, n_hours: int, met_files: list[Path], params: dict)[source]#
STILT trajectory.
- class lair.air.stilt.Footprint(simulation_id: str, receptor: Receptor, data: DataArray, xmin: float, xmax: float, ymin: float, ymax: float, xres: float, yres: float, projection: str = '+proj=longlat', smooth_factor: float = 1.0, time_integrate: bool = False)[source]#
STILT footprint.
- __init__(simulation_id: str, receptor: Receptor, data: DataArray, xmin: float, xmax: float, ymin: float, ymax: float, xres: float, yres: float, projection: str = '+proj=longlat', smooth_factor: float = 1.0, time_integrate: bool = False)[source]#
- property time_range: tuple[datetime, datetime]#
Get time range of footprint data.
- Returns:
- tuple[pd.Timestamp, pd.Timestamp]
Time range of footprint data.
- classmethod from_path(path: str | Path, **kwargs) Self [source]#
Create Footprint object from netCDF file.
- Parameters:
- pathstr | Path
Path to netCDF file.
- **kwargsdict
Additional keyword arguments for xr.open_dataset.
- Returns:
- Footprint
Footprint object.
- static get_res_from_file(file: str | Path) str [source]#
Extract resolution from the file name.
- Parameters:
- filestr | Path
Path to the footprint netCDF file.
- Returns:
- str
resolution.
- static read_netcdf(file: str | Path, parse_receptor: bool = True, **kwargs) Dataset [source]#
Read netCDF file and return xarray Dataset.
- Parameters:
- filestr | Path
Path to netCDF file.
- parse_receptorbool, optional
Whether to parse receptor coordinates. Default is True.
- **kwargsdict
Additional keyword arguments for xr.open_dataset.
- Returns:
- xr.Dataset
Footprint data as an xarray Dataset.
- integrate_over_time(start: datetime | None = None, end: datetime | None = None) DataArray [source]#
Integrate footprint over time.
- Parameters:
- startdatetime, optional
Start time of integration. The default is None.
- enddatetime, optional
End time of integration. The default is None.
- Returns:
- xr.DataArray
Time-integrated footprint