Skip to content

shubham0745/Lightning-Forecasting-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšก Lightning Forecasting System

A Machine Learningโ€“based early warning tool for predicting lightning risk in Jharkhand, India. Lightning have immediate and long-term effects on people, structures and the environment, resulting in deaths, severe injuries and property damage. Lightning is a frequent occurrence with an estimated 50 occurrence per second. Jharkhand, in particular, is experiencing an increase in the number of deaths due to lightning strikes. It is estimated that 431 people have lost their lives in the 2025 monsoon period. Along with people, many animals have also lost their lives. Out of all the states in India, Jharkhand is one of the six states highly prone to lightning deaths. In the annual report of Climate Resilient Observation System Promotion Council (CROPC), 1669 people have died in Jharkhand due to lightning strikes with an average of 436,250 lightning strikes in last five years. To prevent this from happening, we should have a Lightning Prediction System, to prevent from these casualties and damage. A good Lightning Prediction System can save crores of the Government from structural damages and also save millions of lives, not only in Jharkhand but all across the world.

๐Ÿ“Œ Project Overview

Lightning strikes have become a growing threat in Jharkhand, leading to casualties, loss of livestock, and damage to property. This project aims to build a data-driven Lightning Forecasting System that predicts lightning probability using:

LIS (Lightning Imaging Sensor) satellite lightning occurrence data

MTS (Meteorological Time Series) district-wise weather data

Engineered atmospheric features

Machine Learning ensemble models

The final system provides real-time lightning risk, with a clean Streamlit UI for public-facing use.

๐Ÿš€ Live Demo

๐Ÿ‘‰ Streamlit App: https://lightning-forecasting-system-ff4dsyp9dxkqtxthi3hfss.streamlit.app

๐Ÿ“ Features โœ” Machine Learning Ensemble Model

The final prediction is based on the average probability from: Logistic Regression Multi-Layer Perceptron (MLP) Gradient Boosting

โœ” Key Weather Inputs Temperature Relative Humidity Rainfall Wind Speed Surface Pressure 3-day rolling features Pressure drop District spatial encoding

โœ” Clean and Modern Streamlit Interface District-wise weather inputs Real-time OpenWeather API fetch Lightning probability with risk category Detailed engineered feature vector

๐Ÿ”ง Tech Stack Component Technology Frontend Streamlit Backend Python ML Models Logistic Regression, MLP, Gradient Boosting Data Processing Pandas, NumPy Feature Engineering Weather-based engineered attributes API OpenWeatherMap Deployment Streamlit Cloud

๐Ÿง  Machine Learning Approach

  1. Data Preprocessing Missing-value handling Duplicate removal Unnamed column cleanup Merge of LIS + MTS datasets

  2. Feature Engineering Generated new atmospheric features: Heat Index (THI) Pressure Drop 3-day rolling means Rainfall category Season encoding District one-hot encoding Calendar features (Month, DOY, Week)

  3. Data Balancing Used SMOTEโ€“Tomek Links to handle extreme class imbalance (lightning days are very rare).

  4. Model Training Evaluated models: Logistic Regression Random Forest XGBoost Gradient Boosting Multi-Layer Perceptron (MLP) Final ensemble = LR + MLP + Gradient Boosting

๐Ÿ–ฅ How the App Works

The Streamlit UI allows the user to: Select a district Fetch live weather via OpenWeather API Or enter weather values manually Press โ€œPredict Lightning Riskโ€ See: Probability % Risk category Safety advice Full feature vector passed to model

๐Ÿ“Œ Folder Structure Lightning-Forecasting-System/ โ”‚ โ”œโ”€โ”€ app.py # Main Streamlit application โ”œโ”€โ”€ lightning_ensemble_model.pkl # Trained ML ensemble model โ”œโ”€โ”€ requirements.txt # Required dependencies โ””โ”€โ”€ README.md # Documentation

โš™ Installation (Run Locally) Clone the repo: git clone https://github.com/shubham0745/Lightning-Forecasting-System.git cd Lightning-Forecasting-System

Install dependencies: pip install -r requirements.txt

Set API Keys (Windows CMD): setx OPENWEATHER_API_KEY "your_key_here" setx NEWS_API_KEY "your_newsapi_key"

Run: streamlit run app.py

๐ŸŒฆ Environment Variables

Before running the app locally or on Streamlit Cloud, add:

OPENWEATHER_API_KEY = "<your_openweather_key>" NEWS_API_KEY = "<your_newsapi_key>" # optional

๐Ÿ“š References

LIS Satellite Lightning Data MTS District-level Weather Data SMOTE & Tomek Links (Imbalanced-learn) OpenWeatherMap API Documentation Scikit-learn ML Documentation Research on lightning detection & atmospheric patterns

๐Ÿ™‹โ€โ™‚๏ธ Author

Shubham Kumar MCA โ€“ Birla Institute of Technology, Mesra GitHub: @shubham0745

Priyangshu Paul MCA-Bira Institute of Technology,Mesra Github: @Priyangshu22

โญ Show Your Support

If this project helped you or you found it interesting:

๐Ÿ‘‰ Star โญ the repository ๐Ÿ‘‰ Share the app link ๐Ÿ‘‰ Use it in your resume / LinkedIn

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages