Skip to content

Bharanikumar55/Typhoon-Risk-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

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

Repository files navigation

πŸŒ€ Typhoon Risk Analyzer β€” Western Pacific Ocean

Python XGBoost Streamlit License

Predicting Daily Typhoon Risk Using Oceanic & Atmospheric Data

An end-to-end machine learning system that predicts daily typhoon risk across the Western Pacific Ocean using NOAA OISST, ERA5, and IBTrACS datasets. The project integrates data preprocessing, feature engineering, XGBoost-based risk prediction, explainable AI (SHAP), and an interactive Streamlit dashboard.

πŸš€ Live Demo: https://typhoon-risk-analyser.streamlit.app/

πŸ“‚ GitHub Repository: https://github.com/Bharanikumar55/Typhoon-Risk-Analysis


πŸ“Œ Overview

Typhoons are among the most destructive natural disasters in the world, forming over warm ocean waters in the Western Pacific. This project builds an end-to-end data science pipeline β€” from raw scientific datasets to a deployed interactive web application β€” that predicts daily typhoon risk for any location in the Western Pacific region.

Unlike typical ML projects that use pre-cleaned Kaggle datasets, this project works with raw scientific reanalysis and satellite data used by actual climate researchers, requiring significant domain knowledge and data engineering effort.


🎯 Key Highlights

  • Multi-source data fusion β€” integrates 3 independent scientific datasets (NOAA OISST, ERA5, IBTrACS) with different spatial resolutions and time frequencies
  • Custom spatiotemporal label generation β€” typhoon presence labels generated using Haversine distance formula applied to storm track coordinates
  • 10 years of data β€” trained on 2011–2019, tested on completely unseen year 2020 (genuine temporal generalization)
  • Physically meaningful results β€” SHAP analysis confirms the model learned real meteorological patterns (low pressure = typhoon)
  • Interactive deployment β€” Streamlit app allows exploration of any date from 2011–2020

🌍 Region of Study

Parameter Value
Region Western Pacific Ocean
Latitude 5Β°N – 45Β°N
Longitude 120Β°E – 160Β°E
Time Period 2011 – 2020 (June–November)
Spatial Resolution 1Β° Γ— 1Β°
Temporal Resolution Daily

This region covers the Philippine Sea, East China Sea, and waters surrounding Japan β€” the most active typhoon basin in the world.


πŸ“Š Data Sources

Dataset Source Variables Resolution
NOAA OISST v2.1 https://www.ncei.noaa.gov/products/optimum-interpolation-sst Sea Surface Temperature (SST) 0.25Β° Γ— Daily
ERA5 Reanalysis (ECMWF) https://cds.climate.copernicus.eu/ Mean Sea Level Pressure (MSL), 10 m U-Wind, 10 m V-Wind 0.25Β° Γ— Hourly
IBTrACS v4 https://www.ncei.noaa.gov/products/international-best-track-archive Tropical Cyclone Tracks 6-hourly

Study Period: 2011–2020 (June–November)

Study Region: Western Pacific (5Β°N–45Β°N, 120Β°E–160Β°E)

🧠 Machine Learning Pipeline

Raw Data (NetCDF)
      β”‚
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Phase 1: Data Preprocessing        β”‚
β”‚  β€’ SST: crop region, filter months  β”‚
│  ‒ ERA5: Pa→hPa, compute wind speed │
β”‚  β€’ ERA5: hourly β†’ daily averages    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Phase 2: Dataset Alignment         β”‚
β”‚  β€’ Coarsen SST: 0.25Β° β†’ 1Β°         β”‚
β”‚  β€’ Interpolate ERA5 onto SST grid   β”‚
β”‚  β€’ Merge into unified env dataset   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Phase 3: Label Generation          β”‚
β”‚  β€’ Filter IBTrACS: WP basin         β”‚
β”‚  β€’ Haversine distance per grid cell β”‚
β”‚  β€’ Label = 1 if storm within 300km  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Phase 4: ML Training               β”‚
β”‚  β€’ Logistic Regression              β”‚
β”‚  β€’ Random Forest                    β”‚
β”‚  β€’ XGBoost (best model)             β”‚
β”‚  β€’ Temporal train/test split        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Phase 5: Deployment                β”‚
β”‚  β€’ Streamlit interactive app        β”‚
β”‚  β€’ Daily risk maps                  β”‚
β”‚  β€’ Predicted vs actual comparison   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ˆ Results

Model Comparison (Single Year β€” 2011)

Model AUC-ROC
Logistic Regression 0.9145
Random Forest 0.8924
XGBoost 0.9350 βœ…

Final Model Performance (Multi-year β€” tested on 2020)

Metric Value
AUC-ROC 0.86
Typhoon Recall 0.64
Training Period 2011–2019
Test Period 2020 (unseen)

The model was deliberately tested on a completely unseen year (2020) rather than a random split β€” this demonstrates genuine temporal generalization, a much stronger evaluation than standard cross-validation.


ROC Curve β€” All Models

ROC Curve

All three models significantly outperform random guessing. XGBoost (green) achieves the best performance, hugging the top-left corner most closely.


Class Imbalance

Class Imbalance

Typhoon-present cells represent only ~2.4% of all data β€” a severe class imbalance. This was addressed using scale_pos_weight in XGBoost and class_weight='balanced' in other models, combined with stratified splitting.


Feature Importance

Feature Importance

Both XGBoost and Random Forest consistently rank Sea Level Pressure as the dominant predictor (~65% importance in XGBoost). This aligns with meteorological theory β€” typhoons are extreme low-pressure systems.


SHAP Analysis

SHAP Summary

SHAP values confirm the model learned physically meaningful patterns:

  • Low pressure (blue dots, left) β†’ strong positive typhoon signal
  • High wind speed (red dots, right) β†’ positive typhoon signal
  • High SST (red dots) β†’ weak positive signal

SHAP Pressure Dependence

The pressure dependence plot reveals a clear threshold around 1010 hPa β€” below this, typhoon risk increases sharply. This is consistent with known meteorology.


Typhoon Risk Maps

Daily predicted risk vs actual typhoon labels:

Risk Map Day 90

The model successfully identifies the circular low-pressure structure of a typhoon β€” a pattern it learned purely from data, without being explicitly programmed with any meteorological rules.

Average risk across the entire 2011 typhoon season:

Mean Risk Map

The highest average risk zone (deep red) is centered around 15–30Β°N, 120–130Β°E β€” the Philippine Sea β€” which is the most active typhoon genesis region in the Western Pacific. The model correctly learned this spatial pattern from historical data.


πŸ—‚ Project Structure

typhoon_project/
β”‚
β”œβ”€β”€ data_raw/
β”‚   β”œβ”€β”€ sst/                    # NOAA OISST NetCDF files (2011–2020)
β”‚   β”œβ”€β”€ era5/                   # ERA5 reanalysis NetCDF files (2011–2020)
β”‚   └── ibtracs/                # IBTrACS storm track data
β”‚
β”œβ”€β”€ data_processed/
β”‚   β”œβ”€β”€ environmental_YYYY_jun_nov.nc   # Combined SST+MSL+Wind (per year)
β”‚   β”œβ”€β”€ labels_YYYY_jun_nov.nc          # Typhoon labels (per year)
β”‚   β”œβ”€β”€ X_multiyear.npy                 # Final ML feature matrix
β”‚   β”œβ”€β”€ y_multiyear.npy                 # Final ML labels
β”‚   └── xgb_final_model.pkl             # Trained XGBoost model
β”‚
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ era5.ipynb                  # ERA5 preprocessing
β”‚   β”œβ”€β”€ sst.ipynb                   # SST preprocessing
β”‚   β”œβ”€β”€ align_sst_era5.ipynb        # Dataset alignment
β”‚   β”œβ”€β”€ labels_ibtracs.ipynb        # Label generation
β”‚   β”œβ”€β”€ 05_dataset_construction.ipynb
β”‚   β”œβ”€β”€ 06_baseline_models.ipynb
β”‚   β”œβ”€β”€ 07_shap.ipynb
β”‚   β”œβ”€β”€ 08_risk_map.ipynb
β”‚   └── 09_multiyear_pipeline.ipynb
β”‚
β”œβ”€β”€ app.py                      # Streamlit deployment
β”œβ”€β”€ requirements.txt
└── README.md

πŸš€ Run Locally

1. Clone the repository

git clone https://github.com/bharanikumar55/typhoon-risk-analyzer
cd typhoon-risk-analyzer

2. Install dependencies

pip install -r requirements.txt

3. Download data

Download the following datasets and place in data_raw/:

4. Run notebooks in order

era5.ipynb β†’ sst.ipynb β†’ align_sst_era5.ipynb β†’ labels_ibtracs.ipynb
β†’ 05_dataset_construction.ipynb β†’ 06_baseline_models.ipynb
β†’ 07_shap.ipynb β†’ 08_risk_map.ipynb β†’ 09_multiyear_pipeline.ipynb

5. Launch the app

streamlit run app.py

πŸ“¦ Requirements

xarray
numpy
pandas
matplotlib
cartopy
scikit-learn
xgboost
shap
streamlit
joblib
netCDF4

πŸ”¬ What Makes This Project Unique

Aspect This Project Typical Student Project
Data source Raw scientific NetCDF (ERA5, NOAA, IBTrACS) Pre-cleaned Kaggle CSV
Label generation Custom Haversine-based spatial labeling Pre-made labels
Train/test split By year (temporal) Random shuffle
Evaluation AUC-ROC, F1, temporal generalization Accuracy only
Explainability SHAP values with physical validation None
Deployment Live Streamlit app None

πŸ‘€ Author

Bharani Kumar Madisetty

GitHub


πŸ“„ License

This project is licensed under the MIT License.


Built with ❀️ using ERA5 · NOAA OISST · IBTrACS · XGBoost · Streamlit

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors