vayuayan: Collect and Analyze Air Quality and Pollution Data¶
A Python package that gets and analyzes air quality data from many sources:
Overview¶
vayuayan gives a simple interface to pollution data from the Central Pollution Control Board (CPCB) of India and from WUSTL ACAG. It supports:
Air Quality Index (AQI) data: Historical and live air quality measurements
PM2.5 data: Fine particulate matter data for a geographic region in a GeoJSON file
Live data: Live air quality parameters of monitoring stations
Location: The package finds your location and the nearest station
Quick Start¶
Installation¶
pip install vayuayan
Basic Usage¶
from vayuayan import CPCBHistorical, CPCBLive, PM25Client
# Initialize clients
aqi_client = CPCBHistorical()
live_client = CPCBLive()
pm25_client = PM25Client()
# Get available states
states = aqi_client.get_state_list()
print(states)
# Get live AQI data for your location
location = live_client.get_system_location()
nearest_station = live_client.get_nearest_station()
live_data = live_client.get_live_aqi_data()
Command Line Interface¶
# List available states
vayuayan list_states
# Get city data for Mumbai in 2024
vayuayan city_data --city "Mumbai" --year 2024 --path "mumbai_aqi.csv"
# Get live AQI data for your location
vayuayan live_aqi --path "current_aqi.json"
Jupyter Notebooks¶
The notebooks/ directory has interactive notebooks with examples: