Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Air Quality Analysis

Overview

This project analyzes Beijing's air quality using multi-source time-series data, following the methodology of Zhang et al. (2017). The main goal is to disentangle the effects of meteorology from emission trends, providing a "weather-adjusted" view of PM2.5 pollution.

Approach

1. Data Integration & Preprocessing

  • Combined hourly air quality and meteorological data from multiple monitoring stations (2013–2017).
  • Created a unified DataFrame with a datetime index and station labels.
  • Handled missing values and engineered features (e.g., cyclical time, wind direction encoding).

2. Exploratory Data Analysis (EDA)

  • Explored spatial, temporal, and meteorological patterns in PM2.5.
  • Visualized trends by station, hour, month, and wind direction.

3. Predictive Modeling

  • Trained three models to classify PM2.5 air quality categories based on meteorological features:
    • Random Forest
    • XGBoost
    • LSTM (PyTorch)
  • Evaluated models using accuracy, F1-score, and confusion matrices.

4. Weather-Adjusted PM2.5 Analysis

  • For each year, replaced actual weather with long-term average ("baseline") weather conditions.
  • Used trained models to predict what PM2.5 categories would have been under average weather.
  • Compared observed and weather-adjusted trends to reveal the true impact of emission controls, independent of meteorological variability.

Key Findings

  • Weather adjustment reveals greater air quality improvement than raw data suggests.
  • In years with unfavorable weather (e.g., 2017), observed PM2.5 can appear worse than it truly is.
  • Meteorological factors, especially wind speed and direction, are major drivers of short-term PM2.5 variation.

How to Run

  1. Install dependencies:

    pip install -r requirements.txt
  2. Train models:

    python -m src.train_rf
    python -m src.train_xgb
    python -m src.train_lstm
  3. Run weather-adjusted analysis:

    python -m src.weather_adjusted_pm25
    python -m src.weather_adjusted_pm25_xgb
    python -m src.weather_adjusted_pm25_lstm
  4. Check the output/ directory for visualizations and results.

References

  • Zhang, Q., et al. (2017). "Cautionary tales on air-quality improvement in Beijing." PNAS.

This project demonstrates the importance of meteorological adjustment in air quality trend analysis and provides a reproducible workflow for similar studies.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages