Skip to content

Machine learning weather prediction platform leveraging NASA POWER API data. Features: 5 binary classifiers, 100+ engineered features, interactive React UI with Leaflet maps, FastAPI backend. Predicts extreme weather events with probability scores.

Notifications You must be signed in to change notification settings

namanxdev/AtmoPredict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

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

Repository files navigation

๐ŸŒ AtmoPredict - Extreme Weather Forecasting System

An intelligent weather prediction system using LSTM deep learning to forecast extreme weather conditions with NASA POWER data

Python FastAPI React TensorFlow License

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Overview

AtmoPredict is an advanced weather forecasting system that uses a trained LSTM (Long Short-Term Memory) deep learning model to predict climate anomalies and extreme weather conditions:

  • ๐Ÿ”ฅ Very Hot - High temperature events
  • โ„๏ธ Very Cold - Low temperature events
  • ๐Ÿ’จ Very Windy - High wind speed events
  • ๐ŸŒง๏ธ Very Wet - Heavy precipitation events
  • ๐Ÿฅต Very Uncomfortable - High heat index conditions

The system uses an LSTM neural network trained on historical NASA POWER weather data (2010-2024) to predict temperature and precipitation anomalies, which are then converted to extreme weather probabilities. Predictions are delivered through an interactive web interface.

โœจ Features

๐Ÿค– LSTM Deep Learning Model

  • LSTM Neural Network: Advanced time-series prediction using TensorFlow/Keras
  • Climate Anomaly Prediction: Forecasts temperature and precipitation anomalies
  • Model Performance:
    • Temperature Anomaly: Rยฒ = 0.35, RMSE = 0.107
    • Precipitation Anomaly: Rยฒ = 0.79, RMSE = 0.237
  • 18 Input Features: Including temporal patterns, weather parameters, and location data
  • Trained on NASA POWER Data: 2010-2024, 10 major global cities
  • Automatic Probability Conversion: Converts anomalies to extreme weather probabilities

๐ŸŒ Web Interface

  • Modern React UI with Tailwind CSS and DaisyUI
  • Interactive Maps using Leaflet for location selection
  • Real-time Forecasts with probability visualizations
  • Multi-day Predictions with detailed weather insights
  • Responsive Design for desktop and mobile

๐Ÿš€ Backend API

  • FastAPI for high-performance async operations
  • LSTM Model Integration for intelligent predictions
  • RESTful Endpoints for forecasting and climate data
  • Automatic Documentation with Swagger UI
  • CORS Enabled for cross-origin requests
  • Health Check and monitoring endpoints

๐Ÿ“Š Data Sources

  • NASA POWER API - Historical climate data (2010-2024)
  • OpenWeatherMap API - Real-time current weather
  • Continental Climate Patterns - Long-term forecasting (6 months)
  • Hemisphere Data - Global climate context

๐Ÿ›  Technology Stack

Backend

  • Python 3.8+ - Core programming language
  • FastAPI - Modern async web framework
  • Uvicorn - ASGI server
  • TensorFlow 2.15+ - Deep learning framework
  • Keras 3.0+ - Neural network API
  • scikit-learn - Data preprocessing and utilities
  • pandas/numpy - Data manipulation

Frontend

  • React 19 - UI library
  • Vite - Build tool and dev server
  • Tailwind CSS - Utility-first CSS framework
  • DaisyUI - Component library
  • Leaflet - Interactive maps
  • Axios - HTTP client
  • Plotly.js - Data visualization

Data Source

  • NASA POWER API - Global weather and solar data
  • OpenWeatherMap API - Real-time weather data
  • Coverage: 2010-2024 historical data
  • Resolution: Daily/Monthly temporal granularity
  • Parameters: Temperature, precipitation, wind, humidity, pressure, cloud cover, radiation

๐Ÿ— System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      USER INTERFACE                          โ”‚
โ”‚                  (React + Tailwind + Leaflet)               โ”‚
โ”‚                   http://localhost:5173                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚ HTTP/JSON
                           โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     BACKEND API                              โ”‚
โ”‚                   (FastAPI + Uvicorn)                       โ”‚
โ”‚                   http://127.0.0.1:8000                     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  Endpoints:                                         โ”‚    โ”‚
โ”‚  โ”‚  โ€ข POST /predict          - LSTM predictions       โ”‚    โ”‚
โ”‚  โ”‚  โ€ข POST /forecast/hybrid  - Hybrid forecasts       โ”‚    โ”‚
โ”‚  โ”‚  โ€ข POST /forecast         - Long-term forecasts    โ”‚    โ”‚
โ”‚  โ”‚  โ€ข GET  /climate/summary  - Climate information    โ”‚    โ”‚
โ”‚  โ”‚  โ€ข GET  /docs             - API documentation      โ”‚    โ”‚
โ”‚  โ”‚  โ€ข GET  /health           - Health check           โ”‚    โ”‚
โ”‚  โ”‚  โ€ข GET  /model/info       - LSTM model info        โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              LSTM DEEP LEARNING MODEL                        โ”‚
โ”‚              (ml nasa/models/climate_lstm_model.keras)      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  LSTM Neural Network:                               โ”‚    โ”‚
โ”‚  โ”‚  โ€ข Input: 18 features (weather + temporal)         โ”‚    โ”‚
โ”‚  โ”‚  โ€ข Output: 2 predictions                           โ”‚    โ”‚
โ”‚  โ”‚    - Temperature Anomaly                           โ”‚    โ”‚
โ”‚  โ”‚    - Precipitation Anomaly                         โ”‚    โ”‚
โ”‚  โ”‚                                                     โ”‚    โ”‚
โ”‚  โ”‚  Converted to 5 Extreme Weather Probabilities:     โ”‚    โ”‚
โ”‚  โ”‚  โ€ข very_hot          (hot temperature events)      โ”‚    โ”‚
โ”‚  โ”‚  โ€ข very_cold         (cold temperature events)     โ”‚    โ”‚
โ”‚  โ”‚  โ€ข very_windy        (high wind conditions)        โ”‚    โ”‚
โ”‚  โ”‚  โ€ข very_wet          (heavy precipitation)         โ”‚    โ”‚
โ”‚  โ”‚  โ€ข very_uncomfortable (high heat index)            โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    DATA SOURCES                              โ”‚
โ”‚                                                              โ”‚
โ”‚  โ€ข NASA POWER API (historical 2010-2024)                    โ”‚
โ”‚  โ€ข OpenWeatherMap API (current weather)                     โ”‚
โ”‚  โ€ข Continental Climate Patterns (data/continents/)          โ”‚
โ”‚  โ€ข Hemisphere Data (data/hemispheres/)                      โ”‚
โ”‚  โ€ข Location Mappings (data/location_mapping.json)           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ฅ Installation

Prerequisites

  • Python 3.8+ installed
  • Node.js 16+ and npm installed
  • Git installed
  • Windows OS (batch files provided) or adapt for Linux/Mac

Step 1: Clone the Repository

git clone https://github.com/namanxdev/AtmoPredict.git
cd AtmoPredict

Step 2: Backend Setup

Option A: Using Batch File (Windows)

INSTALL_FIRST.bat

This will:

  • Create a Python virtual environment
  • Install all required Python packages
  • Verify installation

Option B: Manual Installation

# Create virtual environment
python -m venv venv

# Activate virtual environment
venv\Scripts\activate  # Windows
# source venv/bin/activate  # Linux/Mac

# Install dependencies
pip install -r requirements.txt

Step 3: Frontend Setup

cd Frontend_nasa

# Install Node.js dependencies
npm install

cd ..

Step 4: Verify Installation

python check_installation.py

๐Ÿš€ Usage

Quick Start (Recommended)

Use the provided batch files to start the entire system:

Option 1: Complete System

START_COMPLETE_SYSTEM.bat

This starts both the backend API and frontend development server.

Option 2: Manual Start

Terminal 1 - Start Backend API:

venv\Scripts\activate
uvicorn src.api:app --host 127.0.0.1 --port 8000 --reload

Terminal 2 - Start Frontend:

cd Frontend_nasa
npm run dev

Access the Application

Using the Web Interface

  1. Open the Application: Navigate to http://localhost:5173
  2. Enter Location:
    • Click on the map to select a location
    • Or enter latitude/longitude manually
  3. View Current Weather: See real-time weather conditions
  4. Get Forecast: Click "Get Forecast" to see predictions
  5. Analyze Results: View probabilities and risk levels for each extreme condition

๐Ÿ“ก API Documentation

Main Forecast Endpoint

POST /forecast/hybrid

Request body:

{
  "latitude": 40.7128,
  "longitude": -74.0060,
  "forecast_days": 7,
  "location_name": "New York"
}

Response:

{
  "location": {
    "name": "New York",
    "latitude": 40.7128,
    "longitude": -74.006,
    "continent": "North America",
    "hemisphere": "Northern"
  },
  "current_weather": {
    "temperature": 22.5,
    "feels_like": 24.3,
    "humidity": 65,
    "wind_speed": 3.2,
    "description": "Partly cloudy"
  },
  "forecast": [
    {
      "date": "2024-10-06",
      "predictions": {
        "very_hot": 0.12,
        "very_cold": 0.05,
        "very_windy": 0.18,
        "very_wet": 0.35,
        "very_uncomfortable": 0.09
      },
      "risk_level": "MODERATE",
      "max_risk_category": "very_wet"
    }
  ],
  "summary": {
    "highest_risk_day": "2024-10-08",
    "dominant_risk": "very_wet",
    "average_risk_level": "MODERATE"
  }
}

Climate Summary Endpoint

GET /climate/summary

Query parameters:

  • latitude (required): Latitude coordinate
  • longitude (required): Longitude coordinate

Response:

{
  "location": {
    "latitude": 40.7128,
    "longitude": -74.006,
    "continent": "North America",
    "hemisphere": "Northern"
  },
  "climate_info": {
    "description": "Humid subtropical climate",
    "temperature_range": "Cold winters, hot summers",
    "precipitation": "Evenly distributed throughout year"
  }
}

Health Check Endpoint

GET /health

Response:

{
  "status": "healthy",
  "models_loaded": 5,
  "timestamp": "2024-10-05T12:00:00"
}

๐Ÿค– Model Details

LSTM Neural Network Architecture

The system uses a trained LSTM (Long Short-Term Memory) deep learning model for climate prediction:

Model Specifications

  • Type: LSTM Neural Network (TensorFlow/Keras)
  • Input Shape: (timesteps=1, features=18)
  • Output Shape: 2 predictions (temperature anomaly, precipitation anomaly)
  • Training Data: NASA POWER climate data (2010-2024)
  • Locations: 10 major global cities
  • Total Samples: ~1,800 data points

Performance Metrics

  • Temperature Anomaly Prediction:

    • Rยฒ Score: 0.35
    • RMSE: 0.107
    • MAE: 0.085
  • Precipitation Anomaly Prediction:

    • Rยฒ Score: 0.79
    • RMSE: 0.237
    • MAE: 0.178

Input Features (18 total)

  1. Weather Parameters (scaled):

    • T2M (mean temperature)
    • T2M_MAX (maximum temperature)
    • T2M_MIN (minimum temperature)
    • PRECTOTCORR (precipitation, log-transformed)
    • ALLSKY_SFC_SW_DWN (solar radiation)
    • RH2M (relative humidity)
    • QV2M (specific humidity)
    • T2M_range (temperature range)
  2. Temporal Features:

    • month_sin (cyclical month encoding)
    • month_cos (cyclical month encoding)
    • season (encoded)
  3. Location Features:

    • latitude (scaled)
    • longitude (scaled)
  4. Derived Features:

    • precip_log (log-transformed precipitation)
    • heat_index components

Prediction Pipeline

Input Weather Data
        โ†“
Feature Extraction (18 features)
        โ†“
Feature Scaling (StandardScaler)
        โ†“
LSTM Model Inference
        โ†“
Output: [temp_anomaly, precip_anomaly]
        โ†“
Probability Conversion
        โ†“
5 Extreme Weather Probabilities:
  โ€ข very_hot (0.0 - 1.0)
  โ€ข very_cold (0.0 - 1.0)
  โ€ข very_windy (0.0 - 1.0)
  โ€ข very_wet (0.0 - 1.0)
  โ€ข very_uncomfortable (0.0 - 1.0)

Anomaly to Probability Conversion

The LSTM model predicts temperature and precipitation anomalies (deviations from normal). These are converted to extreme weather probabilities using:

  1. Very Hot: Based on adjusted temperature (base_temp + anomaly) and positive temperature anomaly
  2. Very Cold: Based on adjusted temperature and negative temperature anomaly
  3. Very Wet: Based on adjusted precipitation (base_precip ร— (1 + anomaly)) and positive precipitation anomaly
  4. Very Windy: Based on current wind speed measurements
  5. Very Uncomfortable: Based on calculated heat index (temperature + humidity interaction)

Risk Level Calculation

max_probability = max(all_predictions)

if max_probability >= 0.8:   risk_level = "EXTREME"
elif max_probability >= 0.6: risk_level = "HIGH"
elif max_probability >= 0.4: risk_level = "MODERATE"
elif max_probability >= 0.2: risk_level = "LOW"
else:                        risk_level = "MINIMAL"

Model Files Location

  • LSTM Model: ml nasa/models/climate_lstm_model.keras (3.79 MB)
  • Feature Scaler: ml nasa/models/lstm_scaler.pkl
  • Model Metadata: ml nasa/models/lstm_model_metadata.json
  • Model Configuration: ml nasa/data/model_configuration.json

๐Ÿ“ Project Structure

AtmoPredict/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ README.md                      # This file
โ”œโ”€โ”€ ๐Ÿ“„ ARCHITECTURE.md                # Detailed system architecture
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt               # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ config.yaml                    # Configuration file
โ”œโ”€โ”€ ๐Ÿ“„ .gitignore                     # Git ignore rules
โ”‚
โ”œโ”€โ”€ ๐Ÿš€ INSTALL_FIRST.bat             # Installation script
โ”œโ”€โ”€ ๐Ÿš€ START_COMPLETE_SYSTEM.bat     # Start entire system
โ”œโ”€โ”€ ๐Ÿš€ START_HYBRID_API.bat          # Start backend only
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ src/                           # Backend source code
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ api.py                        # Main FastAPI application (LSTM integrated)
โ”‚   โ”œโ”€โ”€ lstm_model_loader.py          # LSTM model loader and predictor
โ”‚   โ”œโ”€โ”€ data_collection.py            # NASA API data fetching
โ”‚   โ”œโ”€โ”€ feature_engineering.py        # Feature creation
โ”‚   โ”œโ”€โ”€ data_router.py                # Location data routing
โ”‚   โ””โ”€โ”€ climate_service.py            # Climate information service
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ Frontend_nasa/                 # React frontend
โ”‚   โ”œโ”€โ”€ package.json                  # Node dependencies
โ”‚   โ”œโ”€โ”€ vite.config.js                # Vite configuration
โ”‚   โ”œโ”€โ”€ tailwind.config.js            # Tailwind CSS config
โ”‚   โ”œโ”€โ”€ index.html                    # Entry HTML
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx                   # Main React component
โ”‚   โ”‚   โ”œโ”€โ”€ components/               # React components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ WeatherMap.jsx        # Map component
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CurrentWeather.jsx    # Current weather display
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ForecastMini.jsx      # Forecast cards
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ModelResponse.jsx     # ML predictions display
โ”‚   โ”‚   โ”œโ”€โ”€ services/                 # API services
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ weatherApi.js         # Backend API calls
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ weatherDataManager.js # Data management
โ”‚   โ”‚   โ””โ”€โ”€ utils/
โ”‚   โ”‚       โ””โ”€โ”€ constants.js          # Configuration constants
โ”‚   โ””โ”€โ”€ public/                       # Static assets
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ ml nasa/                       # LSTM Model & Training Pipeline
โ”‚   โ”œโ”€โ”€ local_inference.py            # Run LSTM predictions locally
โ”‚   โ”œโ”€โ”€ main_pipeline.py              # Data collection pipeline
โ”‚   โ”œโ”€โ”€ cleaning_pipeline.py          # Data cleaning workflow
โ”‚   โ”œโ”€โ”€ test_project.py               # Comprehensive tests
โ”‚   โ”œโ”€โ”€ models/                       # Trained models
โ”‚   โ”‚   โ”œโ”€โ”€ climate_lstm_model.keras  # ๐Ÿค– Main LSTM model (3.79 MB)
โ”‚   โ”‚   โ”œโ”€โ”€ lstm_scaler.pkl           # Feature scaler
โ”‚   โ”‚   โ”œโ”€โ”€ lstm_model_metadata.json  # Performance metrics
โ”‚   โ”‚   โ””โ”€โ”€ lstm_training_history.pkl # Training logs
โ”‚   โ”œโ”€โ”€ data/                         # Training data
โ”‚   โ”‚   โ”œโ”€โ”€ climate_model_ready_transformed.csv
โ”‚   โ”‚   โ”œโ”€โ”€ model_configuration.json  # Feature configuration
โ”‚   โ”‚   โ””โ”€โ”€ locations_major_cities.csv
โ”‚   โ””โ”€โ”€ src/                          # Pipeline modules
โ”‚       โ”œโ”€โ”€ location_grid.py
โ”‚       โ”œโ”€โ”€ data_fetcher.py
โ”‚       โ””โ”€โ”€ data_processor.py
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ data/                          # Climate pattern data
โ”‚   โ”œโ”€โ”€ location_mapping.json         # Location metadata
โ”‚   โ”œโ”€โ”€ continents/                   # Continental climate data
โ”‚   โ”‚   โ”œโ”€โ”€ asia.json
โ”‚   โ”‚   โ”œโ”€โ”€ europe.json
โ”‚   โ”‚   โ”œโ”€โ”€ north_america.json
โ”‚   โ”‚   โ”œโ”€โ”€ south_america.json
โ”‚   โ”‚   โ”œโ”€โ”€ africa.json
โ”‚   โ”‚   โ”œโ”€โ”€ australia.json
โ”‚   โ”‚   โ””โ”€โ”€ antarctica.json
โ”‚   โ””โ”€โ”€ hemispheres/                  # Hemisphere climate data
โ”‚       โ”œโ”€โ”€ northern_hemisphere.json
โ”‚       โ””โ”€โ”€ southern_hemisphere.json
โ”‚
โ””โ”€โ”€ ๐Ÿ“‚ FloatChatMap/                  # Additional dashboard tools
    โ””โ”€โ”€ ...                           # Climate visualization tools

๐Ÿ”„ LSTM Model Information

The LSTM model is pre-trained on NASA POWER climate data (2010-2024). The model files are located in ml nasa/models/:

  • Model File: climate_lstm_model.keras (3.79 MB)
  • Scaler: lstm_scaler.pkl
  • Metadata: lstm_model_metadata.json
  • Configuration: ../data/model_configuration.json

Running Local Inference

To test the LSTM model independently:

cd "ml nasa"
python local_inference.py

This generates predictions for all samples and creates visualizations in ml nasa/results/.

Model Training (Advanced)

The model was trained using Google Colab with the data collection pipeline. To retrain (advanced users):

cd "ml nasa"

# 1. Collect new data
python main_pipeline.py --grid cities --start 2010 --end 2024

# 2. Clean and process data
python cleaning_pipeline.py

# 3. Train model (requires Google Colab or local GPU)
# See ml nasa/README.md for detailed training instructions

๐Ÿงช Testing

Test Backend Connection

TEST_BACKEND_CONNECTION.bat

# Or manually
python test_backend_api.py

Test Hybrid Forecast

TEST_HYBRID_FORECAST.bat

# Or manually
python test_hybrid_forecast.py

๐ŸŒŸ Key Features Explained

1. Multi-Location Support

The system uses a data router to map any latitude/longitude to the nearest trained location, ensuring predictions work globally.

2. Real-time Weather Integration

Current weather conditions are fetched from external APIs and displayed alongside ML predictions.

3. Climate-Aware Predictions

The system considers continental and hemispheric climate patterns to adjust predictions.

4. Interactive Visualization

  • Leaflet maps for location selection
  • Plotly charts for trend visualization
  • Progress bars for probability display
  • Color-coded risk levels

5. Responsive Design

The interface adapts to different screen sizes, from mobile phones to desktop monitors.

๐Ÿ”ฎ Future Enhancements

  • Enhanced LSTM model with attention mechanisms
  • Multi-timestep predictions (sequence forecasting)
  • Real-time NASA data integration
  • Extended forecast range (14+ days)
  • Ensemble model combining LSTM with traditional ML
  • Historical trend comparison and visualization
  • Email/SMS alerts for extreme conditions
  • Mobile app (React Native)
  • User accounts and saved locations
  • Integration with more weather data sources (ERA5, MERRA-2)
  • Multi-language support
  • Export reports as PDF
  • Model explainability (SHAP, LIME)
  • Transfer learning for regional models

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • NASA POWER - For providing free access to global weather data
  • FastAPI - For the excellent async web framework
  • React Team - For the powerful UI library
  • scikit-learn, XGBoost, LightGBM - For robust ML algorithms
  • Leaflet - For beautiful interactive maps

๐Ÿ“ง Contact

For questions, suggestions, or collaboration:

๐ŸŽ“ NASA Space Apps Challenge

This project was developed for the NASA Space Apps Challenge 2025. It demonstrates the practical application of machine learning for climate science and extreme weather prediction using NASA's open data.


Made with โค๏ธ for better weather prediction

๐ŸŒ Predicting tomorrow's weather, today ๐ŸŒค๏ธ

About

Machine learning weather prediction platform leveraging NASA POWER API data. Features: 5 binary classifiers, 100+ engineered features, interactive React UI with Leaflet maps, FastAPI backend. Predicts extreme weather events with probability scores.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors