# udithkumar-tech/meghova architecture

> Architecture diagram of the GitHub repository udithkumar-tech/meghova, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/udithkumar-tech/meghova
- Repository: https://github.com/udithkumar-tech/meghova

## Overview

Meghova is a regime-based post-processor for numerical weather prediction (NWP) rainfall. Its principal workflow trains a weather-regime classifier and regime-specific rainfall-correction experts, then applies them to future NWP inputs to produce corrected rainfall predictions. Separate evaluation scripts compare predictions with observations using error and rainfall-event metrics. The sampled code supports these training, inference, and evaluation links; the README describes the product only briefly, so unsampled details are not inferred.

Main entry points: [`ML/future_prediction.py`](https://github.com/udithkumar-tech/meghova/blob/main/ML/future_prediction.py) (Future prediction), [`ML/data/meghova_training_data.csv`](https://github.com/udithkumar-tech/meghova/blob/main/ML/data/meghova_training_data.csv) (Training observations), [`ML/time_based_evaluation.py`](https://github.com/udithkumar-tech/meghova/blob/main/ML/time_based_evaluation.py) (Time-based evaluation), [`ML/regime_classifier.pkl`](https://github.com/udithkumar-tech/meghova/blob/main/ML/regime_classifier.pkl) (Regime classifier and encoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_classifier_training["Train regime classifier"]
  node_expert_training["Train regime experts<br/>[train_experts.py]"]
end

subgraph group_inference["Prediction workflow"]
  node_predict["Future prediction"]
end

subgraph group_verification["Forecast verification"]
  node_evaluate_2026["Match and evaluate 2026<br/>[evaluate_2026.py]"]
  node_metrics_2026["2026 rainfall metrics"]
  node_historical_evaluation["Historical evaluation"]
  node_time_evaluation["Time-based evaluation"]
  node_time_metrics["Time-based event metrics"]
  node_final_evaluation["Final forecast assessment"]
end

subgraph group_data["Data and models"]
  node_training_data["Training observations"]
  node_classifier_model["Regime classifier and encoder"]
  node_expert_models["Regime expert models"]
  node_future_input["Future NWP input"]
  node_future_output["Corrected forecasts"]
  node_observations_2026["2026 observations"]
  node_evaluation_2026_output["2026 comparison data"]
  node_metrics_2026_output["2026 event metrics"]
end

node_operator(("Forecast operator"))

node_operator -->|"runs forecast"| node_predict
node_training_data -->|"trains from"| node_classifier_training
node_classifier_training -->|"saves classifier"| node_classifier_model
node_training_data -->|"trains from"| node_expert_training
node_expert_training -->|"saves experts"| node_expert_models
node_future_input -->|"supplies NWP"| node_predict
node_classifier_model -->|"classifies regimes"| node_predict
node_expert_models -->|"correct rainfall"| node_predict
node_predict -->|"writes forecasts"| node_future_output
node_future_output -->|"provides predictions"| node_evaluate_2026
node_observations_2026 -->|"provides observations"| node_evaluate_2026
node_evaluate_2026 -->|"saves comparison"| node_evaluation_2026_output
node_evaluation_2026_output -->|"provides comparison"| node_metrics_2026
node_metrics_2026 -->|"saves metrics"| node_metrics_2026_output
node_training_data -->|"provides test data"| node_historical_evaluation
node_classifier_model -->|"loads classifier"| node_historical_evaluation
node_expert_models -->|"loads experts"| node_historical_evaluation
node_training_data -->|"provides time series"| node_time_evaluation
node_time_evaluation -->|"writes test results"| node_time_metrics
node_time_evaluation -->|"writes test results"| node_final_evaluation

click node_training_data "https://github.com/udithkumar-tech/meghova/blob/main/ML/data/meghova_training_data.csv"
click node_classifier_training "https://github.com/udithkumar-tech/meghova/blob/main/ML/regime_classifier.py"
click node_classifier_model "https://github.com/udithkumar-tech/meghova/blob/main/ML/regime_classifier.pkl"
click node_expert_training "https://github.com/udithkumar-tech/meghova/blob/main/ML/train_experts.py"
click node_expert_models "https://github.com/udithkumar-tech/meghova/tree/main/ML/experts"
click node_future_input "https://github.com/udithkumar-tech/meghova/blob/main/ML/data/future_nwp_input.csv"
click node_predict "https://github.com/udithkumar-tech/meghova/blob/main/ML/future_prediction.py"
click node_future_output "https://github.com/udithkumar-tech/meghova/blob/main/ML/meghova_future_predictions.csv"
click node_observations_2026 "https://github.com/udithkumar-tech/meghova/blob/main/ML/data/karnataka_nwp_forecast_2026%20(1).csv"
click node_evaluate_2026 "https://github.com/udithkumar-tech/meghova/blob/main/ML/evaluate_2026.py"
click node_evaluation_2026_output "https://github.com/udithkumar-tech/meghova/blob/main/ML/results/meghova_2026_evaluation.csv"
click node_metrics_2026 "https://github.com/udithkumar-tech/meghova/blob/main/ML/evaluate_2026_all_metrics.py"
click node_metrics_2026_output "https://github.com/udithkumar-tech/meghova/blob/main/ML/results/meghova_2026_all_metrics.csv"
click node_historical_evaluation "https://github.com/udithkumar-tech/meghova/blob/main/ML/evaluate_meghova.py"
click node_time_evaluation "https://github.com/udithkumar-tech/meghova/blob/main/ML/time_based_evaluation.py"
click node_time_metrics "https://github.com/udithkumar-tech/meghova/blob/main/ML/time_based_rainfall_metrics.py"
click node_final_evaluation "https://github.com/udithkumar-tech/meghova/blob/main/ML/final_evaluation.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_classifier_training,node_expert_training toneBlue
class node_predict toneAmber
class node_evaluate_2026,node_metrics_2026,node_historical_evaluation,node_time_evaluation,node_time_metrics,node_final_evaluation toneMint
class node_training_data,node_classifier_model,node_expert_models,node_future_input,node_future_output,node_observations_2026,node_evaluation_2026_output,node_metrics_2026_output toneRose
class node_operator toneIndigo
```

## Components

### Model training

- [Train regime classifier](https://github.com/udithkumar-tech/meghova/blob/main/ML/regime_classifier.py): `ML/regime_classifier.py`
- [Train regime experts](https://github.com/udithkumar-tech/meghova/blob/main/ML/train_experts.py): `ML/train_experts.py`

### Prediction workflow

- [Future prediction](https://github.com/udithkumar-tech/meghova/blob/main/ML/future_prediction.py): `ML/future_prediction.py`

### Forecast verification

- [Match and evaluate 2026](https://github.com/udithkumar-tech/meghova/blob/main/ML/evaluate_2026.py): `ML/evaluate_2026.py`
- [2026 rainfall metrics](https://github.com/udithkumar-tech/meghova/blob/main/ML/evaluate_2026_all_metrics.py): `ML/evaluate_2026_all_metrics.py`
- [Historical evaluation](https://github.com/udithkumar-tech/meghova/blob/main/ML/evaluate_meghova.py): `ML/evaluate_meghova.py`
- [Time-based evaluation](https://github.com/udithkumar-tech/meghova/blob/main/ML/time_based_evaluation.py): `ML/time_based_evaluation.py`
- [Time-based event metrics](https://github.com/udithkumar-tech/meghova/blob/main/ML/time_based_rainfall_metrics.py): `ML/time_based_rainfall_metrics.py`
- [Final forecast assessment](https://github.com/udithkumar-tech/meghova/blob/main/ML/final_evaluation.py): `ML/final_evaluation.py`

### Data and models

- [Training observations](https://github.com/udithkumar-tech/meghova/blob/main/ML/data/meghova_training_data.csv): `ML/data/meghova_training_data.csv`
- [Regime classifier and encoder](https://github.com/udithkumar-tech/meghova/blob/main/ML/regime_classifier.pkl): `ML/regime_classifier.pkl`
- [Regime expert models](https://github.com/udithkumar-tech/meghova/tree/main/ML/experts): `ML/experts`
- [Future NWP input](https://github.com/udithkumar-tech/meghova/blob/main/ML/data/future_nwp_input.csv): `ML/data/future_nwp_input.csv`
- [Corrected forecasts](https://github.com/udithkumar-tech/meghova/blob/main/ML/meghova_future_predictions.csv): `ML/meghova_future_predictions.csv`
- [2026 observations](https://github.com/udithkumar-tech/meghova/blob/main/ML/data/karnataka_nwp_forecast_2026%20(1).csv): `ML/data/karnataka_nwp_forecast_2026 (1).csv`
- [2026 comparison data](https://github.com/udithkumar-tech/meghova/blob/main/ML/results/meghova_2026_evaluation.csv): `ML/results/meghova_2026_evaluation.csv`
- [2026 event metrics](https://github.com/udithkumar-tech/meghova/blob/main/ML/results/meghova_2026_all_metrics.csv): `ML/results/meghova_2026_all_metrics.csv`

### Other components

- **Forecast operator**

## Connections

- Forecast operator → Future prediction: runs forecast
- Training observations → Train regime classifier: trains from
- Train regime classifier → Regime classifier and encoder: saves classifier
- Training observations → Train regime experts: trains from
- Train regime experts → Regime expert models: saves experts
- Future NWP input → Future prediction: supplies NWP
- Regime classifier and encoder → Future prediction: classifies regimes
- Regime expert models → Future prediction: correct rainfall
- Future prediction → Corrected forecasts: writes forecasts
- Corrected forecasts → Match and evaluate 2026: provides predictions
- 2026 observations → Match and evaluate 2026: provides observations
- Match and evaluate 2026 → 2026 comparison data: saves comparison
- 2026 comparison data → 2026 rainfall metrics: provides comparison
- 2026 rainfall metrics → 2026 event metrics: saves metrics
- Training observations → Historical evaluation: provides test data
- Regime classifier and encoder → Historical evaluation: loads classifier
- Regime expert models → Historical evaluation: loads experts
- Training observations → Time-based evaluation: provides time series
- Time-based evaluation → Time-based event metrics: writes test results
- Time-based evaluation → Final forecast assessment: writes test results
