Skip to content

akxyverse/ThunderCast-Storm-Forecasting-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ThunderCast: Storm Forecasting Platform

Real-time Thunderstorm Prediction System using Time-Series Forecasting


πŸš€ Live Demo

Try it now: ThunderCast Live on Streamlit β†’

Streamlit App


πŸ“‹ Project Overview

ThunderCast is an automated thunderstorm prediction system that uses Facebook Prophet (time-series forecasting) to predict thunderstorm probabilities for Pimpri-Chinchwad, Pune. The system collects real-time weather data, analyzes patterns, and provides predictions with an interactive dashboard.


🎯 Features

  • βœ… Real-time Weather Data Collection - Automated hourly data collection via OpenWeatherMap API
  • βœ… Time-Series Forecasting - Facebook Prophet model for thunderstorm prediction
  • βœ… Interactive Dashboard - Built with Streamlit and Plotly for data visualization
  • βœ… Historical Analysis - EDA and statistical insights on 13+ years of weather data
  • βœ… Automated Predictions - 6-24 hour thunderstorm probability forecasts
  • βœ… Cloud Database - Supabase for data storage and retrieval

πŸ› οΈ Tech Stack

Languages & Libraries:

  • Python 3.13
  • Pandas & NumPy (Data manipulation)
  • Prophet (Time-series forecasting)
  • Plotly (Interactive visualizations)
  • Streamlit (Dashboard framework)

Tools & Services:

  • Supabase (PostgreSQL database)
  • OpenWeatherMap API (Weather data source)
  • APScheduler (Task automation)

Domain:

  • Time-Series Forecasting
  • Weather Analytics
  • Predictive Analytics

πŸ“‚ Project Structure

ThunderCast/
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ raw/              # Raw Kaggle dataset
β”‚   β”œβ”€β”€ processed/        # Cleaned and featured data
β”‚   β”œβ”€β”€ models/           # Trained Prophet model
β”‚   └── visualizations/   # Generated charts (Plotly HTML files)
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ data_collection.py      # Fetch weather data from API
β”‚   β”œβ”€β”€ data_exploration.py     # Initial data exploration
β”‚   β”œβ”€β”€ data_cleaning.py        # Data cleaning and preprocessing
β”‚   β”œβ”€β”€ eda_analysis.py         # Exploratory Data Analysis
β”‚   β”œβ”€β”€ feature_engineering.py  # Feature creation
β”‚   β”œβ”€β”€ model_training.py       # Prophet model training
β”‚   β”œβ”€β”€ prediction.py           # Generate predictions
β”‚   β”œβ”€β”€ scheduler.py            # Automated data collection
β”‚   └── visualizations.py       # Create Plotly charts
β”‚
β”œβ”€β”€ dashboard/
β”‚   └── app.py            # Streamlit dashboard
β”‚
β”œβ”€β”€ config/
β”‚   └── config.py         # Configuration settings
β”‚
β”œβ”€β”€ .env                  # Environment variables (API keys)
β”œβ”€β”€ requirements.txt      # Python dependencies
└── README.md            # Project documentation

πŸš€ Installation & Setup

Prerequisites

  • Python 3.13+
  • pip package manager
  • Supabase account (free tier)
  • OpenWeatherMap API key (free)

Step 1: Clone Repository

git clone <repository-url>
cd ThunderCast

Step 2: Create Virtual Environment

python -m venv venv
venv\Scripts\activate  # Windows
# source venv/bin/activate  # Mac/Linux

Step 3: Install Dependencies

pip install -r requirements.txt

Step 4: Configure Environment Variables

Create .env file in project root:

SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_anon_key
OPENWEATHER_API_KEY=your_openweather_api_key

Step 5: Setup Database

Run SQL script in Supabase SQL Editor to create tables:

-- weather_data table
CREATE TABLE weather_data (
    id BIGSERIAL PRIMARY KEY,
    timestamp TIMESTAMPTZ DEFAULT NOW(),
    temperature FLOAT,
    humidity FLOAT,
    pressure FLOAT,
    wind_speed FLOAT,
    cloud_cover FLOAT,
    location VARCHAR(100),
    latitude FLOAT,
    longitude FLOAT
);

-- predictions table
CREATE TABLE predictions (
    id BIGSERIAL PRIMARY KEY,
    prediction_time TIMESTAMPTZ DEFAULT NOW(),
    forecast_time TIMESTAMPTZ,
    thunderstorm_probability FLOAT,
    location VARCHAR(100),
    model_version VARCHAR(50)
);

-- alerts table (optional)
CREATE TABLE alerts (
    id BIGSERIAL PRIMARY KEY,
    alert_time TIMESTAMPTZ DEFAULT NOW(),
    location VARCHAR(100),
    severity VARCHAR(20),
    message TEXT,
    sent BOOLEAN DEFAULT FALSE
);

πŸ“Š Usage

1. Collect Weather Data

python src/data_collection.py

2. Data Cleaning & Feature Engineering

python src/data_cleaning.py
python src/feature_engineering.py

3. Train Model

python src/model_training.py

4. Generate Predictions

python src/prediction.py

5. Launch Dashboard

streamlit run dashboard/app.py

6. Run Automated Scheduler (Optional)

python src/scheduler.py

πŸ“ˆ Model Details

Algorithm: Facebook Prophet (Time-Series Forecasting)

Features Used:

  • Temperature (Β°C)
  • Humidity (%)
  • Atmospheric Pressure (hPa)
  • Wind Speed (km/h)
  • Cloud Cover (%)
  • Precipitation (mm)

Target Variable: Thunderstorm occurrence (Binary: 0/1)

Training Data: 116,135 hourly records (2008-2022, Pune weather)

Prediction Horizon: 6-24 hours ahead

Performance Metrics:

  • Model captures seasonal patterns
  • Identifies high-risk conditions (humidity >70%, pressure <1010 hPa)
  • Low false positive rate for clear weather conditions

🎨 Dashboard Features

Live Weather Monitoring:

  • Current temperature, humidity, pressure, wind speed, cloud cover

Thunderstorm Predictions:

  • 6-24 hour probability forecast
  • Risk level indicators (Low/Moderate/High)
  • Interactive Plotly charts

Historical Trends:

  • Multi-parameter weather visualizations
  • Statistical summaries
  • Customizable time ranges (6h, 12h, 24h, 7 days)

πŸ”‘ Key Insights from EDA

  1. Thunderstorm Conditions:

    • Average humidity during storms: 85%+
    • Average pressure during storms: <1008 hPa
    • Peak occurrence: Monsoon season (June-September)
  2. Temporal Patterns:

    • Higher frequency in afternoon/evening hours
    • Seasonal variations clearly visible
  3. Data Quality:

    • 0% missing values
    • 116,136 complete records
    • 482 thunderstorm events identified (0.42%)

πŸ“ License

This project is for educational purposes.


πŸ™ Acknowledgments

  • OpenWeatherMap for weather data API
  • Facebook (Meta) for Prophet library
  • Supabase for cloud database
  • Kaggle for historical weather dataset

πŸ“ž Contact

For queries or collaboration:


Built with ❀️ using Python, Prophet, and Streamlit

About

Automated thunderstorm prediction using Prophet (Facebook's time-series ML). Live weather API integration, predictive analytics dashboard built with Python, Streamlit & Plotly.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors