This project provides a Python-based solution to visualize urban air quality index (AQI) data over time as an animated GIF. Focusing specifically on Delhi, India, it fetches simulated (or real, if integrated) air quality data across various monitoring stations for a specified month and generates a time-lapse animation depicting the changing pollution levels geographically.
The primary goal is to offer an intuitive visual tool for understanding spatio-temporal trends in air quality, which can be beneficial for environmental studies, public awareness, and preliminary urban planning insights.
- Daily AQI Data Simulation: Simulates daily (hourly, in the backend logic) AQI data for a set of prominent monitoring stations in Delhi. (Note: This is currently a placeholder for actual CPCB data fetching).
- Spatio-Temporal Visualization: Generates individual map frames for each time step, showing AQI levels represented by color-coded markers at each station's geographical location.
- Animated Output: Compiles individual map frames into a single GIF animation for a dynamic visualization of air quality changes over a month.
- AQI Color Categorization: Utilizes standard AQI color codes (Good, Satisfactory, Moderate, Poor, Very Poor, Severe) for easy interpretation.
This section will guide you through setting up and running the project on your local machine.
Before you begin, ensure you have the following installed:
- Python 3.x: (e.g., Python 3.8+)
- You can download it from python.org.
- pip: Python's package installer (usually comes with Python).
-
Clone the repository (if applicable): If this project is in a Git repository, clone it:
git clone [https://github.com/your_username/Delhi-AQI-Animator.git](https://github.com/your_username/Delhi-AQI-Animator.git) cd Delhi-AQI-AnimatorIf not, just navigate to your project directory:
cd C:\Users\abc\PycharmProjects\Air_Quality _Index\
-
Create a Virtual Environment (Recommended): It's good practice to create a virtual environment to manage project dependencies.
python -m venv .venv1 # Or whatever you named your venv -
Activate the Virtual Environment:
- Windows:
.venv1\Scripts\activate
- macOS/Linux:
source .venv1/bin/activate
- Windows:
-
Install Dependencies: Install the required Python packages using pip:
pip install pandas matplotlib imageio requests # folium geopandas (if you expand mapping capabilities)Note:
imageiomight requireffmpegfor certain video formats. For GIF, it often works without it.
Once installed, you can run the script to generate the AQI animation.
-
Ensure your virtual environment is active. (See Installation Step 3)
-
Run the main script:
python p1.py
-
Output: The script will print progress messages for data fetching. Upon successful completion, it will generate:
- Individual PNG image frames in an
aqi_frames/directory within your project root. - A compiled GIF animation named
delhi_aqi_animation.gifin the project root directory.
Navigate to your project root folder (
C:\Users\abc\PycharmProjects\Air_Quality _Index\) to view thedelhi_aqi_animation.gif. - Individual PNG image frames in an
Air-Quality/ βββ delhi_aqi_animation.gif # Resulting animation
βββ p1.py # Main script generating frames & GIF
βββ aqi_frames/ # (Optional) generated image frames
βββ README.md # This project description
Here are some ideas you might implement next:
β Integrate actual AQI data from public APIs
β Add support for other cities
β Plot additional pollutants (PM2.5, NOβ, Oβ, etc.)
β Create web dashboard for interactive browsing
