Python-based real-time emergency leakage and dispersion quantification model
Project description
pyELDQM is an open-source, modular toolkit for real-time chemical emergency modelling. It provides Gaussian plume / puff dispersion, dense-gas (Britter-McQuaid), fire & explosion consequence models, PAR (Protective Action Recommendation) analysis, evacuation route optimisation, and an interactive Dash web application — all in pure Python.
Author: Dr. Zohaib Atiq Khan
Other Contributors:
- Dr. Muhammad Imran Rashid
- Mr. Muhammad Ahmad
- Ms. Aroosa Dilbar
- Mr. Muhammad Saleem Akhtar
- Ms. Fatima
Features
| Module | Description |
|---|---|
| Dispersion | Gaussian plume/puff (single & multi-source), dense-gas Britter-McQuaid ODE |
| Source models | Gas pipeline leaks, pressurised tank gas/liquid/two-phase releases, puddle evaporation |
| Fire & explosion | Pool fire, jet fire thermal flux; flash-fire radius; BLEVE |
| Meteorology | Pasquill-Gifford stability classification, Monin-Obukhov / power-law wind profiles, solar insolation |
| Health thresholds | AEGL, ERPG, IDLH, PAC look-up from SQLite chemical database |
| Consequences | AEGL/ERPG hazard-zone footprints from dispersion output |
| PAR analysis | Shelter-in-place vs. evacuation decision support with population raster integration |
| Sensor placement | Coverage-optimised sensor network design |
| Evacuation routing | OpenStreetMap-based route optimisation (osmnx / networkx) |
| Web app | Interactive Dash 2 dashboard with real-time threat maps (Folium/Leaflet) |
Installation
Recommended: Install pyELDQM inside a dedicated virtual environment to avoid package conflicts with other projects on your system.
# 1. Create and activate a virtual environment
python -m venv pyeldqm-env
# Windows
pyeldqm-env\Scripts\activate
# macOS / Linux
source pyeldqm-env/bin/activate
# 2. Install pyELDQM
pip install pyeldqm
Conda installation (local build)
# 1. Create and activate a conda environment
conda create -n pyeldqm python=3.14
conda activate pyeldqm
# 2a. Install published release from PyPI
pip install pyeldqm
# 2b. OR install from local source (development / editable)
pip install -e .
Important: Always use
pip install -e .(note the-eflag) when installing from a cloned source tree. Omitting-ewill cause a "unable to open database file" error and missing-module errors.
Development install
git clone https://github.com/SIHPCC/pyeldqm.git
cd pyeldqm
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
pip install -e .
Quick start
Launch the web application
pyeldqm-app
# → http://localhost:8050
Environment variables (all optional):
| Variable | Default | Description |
|---|---|---|
PORT |
8050 |
Listening port |
HOST |
localhost |
Bind address |
DEBUG |
true |
Dash debug mode |
Python API
from pyeldqm.core.chemical_database import ChemicalDatabase
with ChemicalDatabase() as db:
ammonia = db.get_chemical_by_name("AMMONIA")
print(ammonia["cas_number"], ammonia["molecular_weight"])
from pyeldqm.core.meteorology.realtime_weather import get_weather
# Real-time weather (Open-Meteo)
weather = get_weather(source="open_meteo", latitude=24.9, longitude=67.1)
print(weather["wind_speed"], weather["wind_dir"], weather["temperature_K"])
import numpy as np
from pyeldqm.core.dispersion_models.gaussian_model import multi_source_concentration
# 2D local grid (meters)
x_vals = np.linspace(10, 2000, 200)
y_vals = np.linspace(-800, 800, 160)
X, Y = np.meshgrid(x_vals, y_vals)
# Multiple continuous release sources (g/s)
sources = [
{"name": "A", "Q": 800, "x0": 0, "y0": 0, "h_s": 3.0, "wind_dir": 45.0},
{"name": "B", "Q": 600, "x0": 250, "y0": -120, "h_s": 2.5, "wind_dir": 45.0},
]
C_total = multi_source_concentration(
sources=sources,
x_grid=X,
y_grid=Y,
z=1.5,
t=600,
t_r=600,
U=5.0,
stability_class="D",
roughness="URBAN",
mode="continuous",
grid_wind_direction=45.0,
)
print(float(np.max(C_total)))
Scenario configuration (YAML)
Pre-built scenarios live in pyeldqm/configs/:
| File | Scenario |
|---|---|
base_config.yaml |
Generic Gaussian dispersion |
chlorine_pipeline_leak.yaml |
Chlorine pipeline rupture |
ammonia_tank_release.yaml |
Pressurised ammonia tank release |
lpg_bleve.yaml |
LPG pool fire / BLEVE |
realtime_monitoring.yaml |
Live weather + multi-source |
Project structure
pyELDQM/
|-- pyeldqm/ # Python package root
| |-- app/ # Dash web application
| | |-- assets/
| | |-- callbacks/
| | |-- components/
| | | `-- tabs/
| | |-- layout/
| | `-- utils/
| | `-- script_generator/
| |-- core/ # Scientific and modelling engine
| | |-- dispersion_models/
| | |-- evacuation/
| | |-- fire_models/
| | |-- geography/
| | |-- meteorology/
| | |-- population/
| | |-- protective_actions/
| | |-- source_models/
| | | |-- gas_pipeline/
| | | |-- puddle_evaporation/
| | | `-- tank_release/
| | |-- utils/
| | `-- visualization/
| |-- data/ # Runtime/reference data
| | |-- chemicals_database/
| | |-- geographic_data/
| | |-- population/
| | |-- thermodynamics_data/
| | `-- weather_samples/
| |-- configs/ # Scenario YAML files
| `-- validation/
| `-- validation_scripts/
|-- examples/
| |-- notebooks/
| `-- scripts/
|-- docs/
| `-- images/
|-- tests/
|-- cache/
|-- outputs/
|-- .github/
| `-- workflows/
|-- run_app.py
|-- pyproject.toml
|-- MANIFEST.in
|-- requirements.txt
|-- CHANGELOG.md
|-- CONTRIBUTING.md
|-- README.md
`-- LICENSE
Gallery
| Screenshot | Description |
|---|---|
| Chemical Threat Zones | |
| Population At Risk analysis | |
| Emergency route optimization | |
| Sensor network optimization | |
| Health impact threshold zones | |
| Shelter-in-place vs evacuation guidance |
Running tests
pytest tests/ --cov=core --cov-report=term-missing
The test suite covers dispersion utilities, meteorology, health thresholds, geographic constants, source models, fire models, and consequence models (~65 tests).
Contributing
See CONTRIBUTING.md for setup instructions, coding standards, and the pull-request workflow.
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyeldqm-0.1.2.tar.gz.
File metadata
- Download URL: pyeldqm-0.1.2.tar.gz
- Upload date:
- Size: 2.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d525eef82911fc72e7fbdb1873687566ba1c5a7a01e3f481826aebc2bbeca7de
|
|
| MD5 |
a55c77863d928fe9ca1ae3e7fc4b342f
|
|
| BLAKE2b-256 |
78b7024383394344e3e2a3ce663fa0323a30f7b376782e812b7d8a3c37d9aea6
|
File details
Details for the file pyeldqm-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyeldqm-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
499d0486e082acf6a47b0f89b33306f9d5d431fffffc42cbcedd62b961ca8715
|
|
| MD5 |
170bb4ae73aafa17da0d2d221720c26a
|
|
| BLAKE2b-256 |
4466b6bdfbcbba460594216405f32216d100768cef719010ff5222c46b3e0a3f
|