# omkarbhattarai71/rain-nowcast-3dtwin architecture

> Architecture diagram of the GitHub repository omkarbhattarai71/rain-nowcast-3dtwin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/omkarbhattarai71/rain-nowcast-3dtwin
- Repository: https://github.com/omkarbhattarai71/rain-nowcast-3dtwin

## Overview

rain-nowcast-3dtwin is a minute-ahead rainfall forecasting product for DMI stations, with model comparisons, radar-enhanced inputs, link-attenuation estimates, and a real-time API. Its workflow validates observations, builds causal station and radar inputs, trains and evaluates forecast models, then derives attenuation and serves forecasts. The graph preserves the documented pipeline branches and the core model, feature, data, and serving layers. Some connections come from README descriptions or the SOURCE INDEX; unsampled implementation details are not asserted.

Main entry points: [`src/rainnow/serving.py`](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/serving.py) (Nowcast service), [`src/rainnow/dataset.py`](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/dataset.py) (Benchmark data), [`src/rainnow/pipeline/step02_truth.py`](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step02_truth.py) (Truth validation), [`src/rainnow/channels.py`](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/channels.py) (Causal channels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_inventory["Station inventory"]
  node_truth_step["Truth validation<br/>[step02_truth.py]"]
  node_channels_step["Station channels<br/>[step03_channels.py]"]
  node_radar_step["Radar inputs<br/>[step04_radar.py]"]
  node_tabular_step["Tabular preparation<br/>[step05_tabular.py]"]
end

subgraph group_forecast["Forecasting"]
  node_baseline["Baseline models<br/>[baselines.py]"]
  node_gbm["Gradient boosting<br/>[gbm.py]"]
  node_ssm["State-space models<br/>[ssm_classic.py]"]
  node_deep_train["Deep training<br/>[train.py]"]
  node_deep_nets["Sequence networks<br/>[nets.py]"]
  node_hybrids["Hybrid models<br/>[step10_hybrids.py]"]
end

subgraph group_evaluation["Evaluation outputs"]
  node_evaluate["Model evaluation<br/>[step11_evaluate.py]"]
  node_attenuation_step["Attenuation analysis"]
  node_leakage["Leakage audit"]
  node_store[("Forecast artifacts")]
end

subgraph group_serving["Real-time service"]
  node_api["Forecast API<br/>[app.py]"]
  node_service["Nowcast service<br/>[serving.py]"]
  node_feeder["DMI data feeder<br/>[feeder.py]"]
end

subgraph group_internal["Shared runtime"]
  node_truth["Rain truth<br/>[truth.py]"]
  node_channels["Causal channels<br/>[channels.py]"]
  node_radar["Radar processing<br/>[radar.py]"]
  node_stations["Station metadata<br/>[stations.py]"]
  node_dataset["Benchmark data<br/>[dataset.py]"]
  node_features["Tabular features<br/>[features.py]"]
  node_deep_blocks["Sequence blocks<br/>[blocks.py]"]
  node_deep_data["Sequence data<br/>[data.py]"]
  node_metrics["Forecast metrics<br/>[metrics.py]"]
  node_attenuation["Link attenuation<br/>[attenuation.py]"]
  node_config["Configuration<br/>[config.py]"]
end

node_operator(("Run pipeline"))
node_dmi(("DMI observations"))

node_operator -->|"runs steps"| node_inventory
node_inventory -->|"prepares data for"| node_truth_step
node_inventory -->|"uses metadata"| node_stations
node_inventory -.->|"downloads via"| node_truth_step
node_truth_step -->|"validates with"| node_truth
node_truth_step -->|"uses metadata"| node_stations
node_truth_step -->|"prepares inputs for"| node_channels_step
node_channels_step -->|"builds"| node_channels
node_channels_step -->|"reads truth"| node_truth
node_channels_step -->|"uses neighbors"| node_stations
node_radar_step -->|"processes radar"| node_radar
node_radar_step -->|"uses metadata"| node_stations
node_radar_step -.->|"merges channels"| node_channels
node_tabular_step -->|"builds evaluation index"| node_dataset
node_tabular_step -->|"computes features"| node_features
node_tabular_step -->|"loads channels"| node_dataset
node_features -->|"transforms"| node_channels
node_gbm -->|"uses features"| node_features
node_gbm -->|"uses shared base"| node_dataset
node_deep_train -->|"trains from"| node_deep_data
node_deep_train -->|"builds networks"| node_deep_nets
node_deep_nets -->|"uses blocks"| node_deep_blocks
node_deep_data -->|"uses channels"| node_channels
node_deep_data -->|"loads benchmark data"| node_dataset
node_hybrids -->|"uses state-space models"| node_ssm
node_evaluate -->|"loads evaluation data"| node_dataset
node_evaluate -->|"computes scores"| node_metrics
node_evaluate -->|"writes reports"| node_store
node_attenuation_step -->|"calculates impacts"| node_attenuation
node_attenuation_step -->|"loads forecasts"| node_dataset
node_attenuation_step -->|"scores attenuation"| node_metrics
node_leakage -->|"audits benchmark data"| node_dataset
node_leakage -->|"compares scores"| node_metrics
node_dmi -->|"supplies live data"| node_feeder
node_feeder -->|"sends observations"| node_api
node_api -->|"routes requests"| node_service
node_service -->|"builds causal inputs"| node_channels
node_service -->|"builds model features"| node_features
node_service -->|"loads station table"| node_stations
node_service -->|"computes link impact"| node_attenuation
node_service -->|"loads model artifacts"| node_store
node_service -->|"uses configuration"| node_config

click node_inventory "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step01_inventory.py"
click node_truth_step "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step02_truth.py"
click node_truth "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/truth.py"
click node_channels_step "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step03_channels.py"
click node_channels "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/channels.py"
click node_radar_step "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step04_radar.py"
click node_radar "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/radar.py"
click node_stations "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/stations.py"
click node_tabular_step "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step05_tabular.py"
click node_dataset "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/dataset.py"
click node_features "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/features.py"
click node_baseline "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/baselines.py"
click node_gbm "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/gbm.py"
click node_ssm "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/ssm_classic.py"
click node_deep_train "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/train.py"
click node_deep_nets "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/nets.py"
click node_deep_blocks "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/blocks.py"
click node_deep_data "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/data.py"
click node_hybrids "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step10_hybrids.py"
click node_evaluate "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step11_evaluate.py"
click node_metrics "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/metrics.py"
click node_attenuation_step "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step12_attenuation.py"
click node_attenuation "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/attenuation.py"
click node_leakage "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step13_leakage_audit.py"
click node_api "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/deploy/app.py"
click node_service "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/serving.py"
click node_feeder "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/deploy/feeder.py"
click node_config "https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/config.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_inventory,node_truth_step,node_channels_step,node_radar_step,node_tabular_step toneBlue
class node_baseline,node_gbm,node_ssm,node_deep_train,node_deep_nets,node_hybrids toneAmber
class node_evaluate,node_attenuation_step,node_leakage,node_store toneMint
class node_api,node_service,node_feeder toneRose
class node_truth,node_channels,node_radar,node_stations,node_dataset,node_features,node_deep_blocks,node_deep_data,node_metrics,node_attenuation,node_config,node_operator,node_dmi toneIndigo
```

## Components

### Data preparation

- [Station inventory](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step01_inventory.py): `src/rainnow/pipeline/step01_inventory.py`
- [Truth validation](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step02_truth.py): `src/rainnow/pipeline/step02_truth.py`
- [Station channels](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step03_channels.py): `src/rainnow/pipeline/step03_channels.py`
- [Radar inputs](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step04_radar.py): `src/rainnow/pipeline/step04_radar.py`
- [Tabular preparation](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step05_tabular.py): `src/rainnow/pipeline/step05_tabular.py`

### Forecasting

- [Baseline models](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/baselines.py): `src/rainnow/models/baselines.py`
- [Gradient boosting](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/gbm.py): `src/rainnow/models/gbm.py`
- [State-space models](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/ssm_classic.py): `src/rainnow/models/ssm_classic.py`
- [Deep training](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/train.py): `src/rainnow/models/deep/train.py`
- [Sequence networks](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/nets.py): `src/rainnow/models/deep/nets.py`
- [Hybrid models](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step10_hybrids.py): `src/rainnow/pipeline/step10_hybrids.py`

### Evaluation outputs

- [Model evaluation](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step11_evaluate.py): `src/rainnow/pipeline/step11_evaluate.py`
- [Attenuation analysis](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step12_attenuation.py): `src/rainnow/pipeline/step12_attenuation.py`
- [Leakage audit](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/pipeline/step13_leakage_audit.py): `src/rainnow/pipeline/step13_leakage_audit.py`
- **Forecast artifacts**

### Real-time service

- [Forecast API](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/deploy/app.py): `src/deploy/app.py`
- [Nowcast service](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/serving.py): `src/rainnow/serving.py`
- [DMI data feeder](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/deploy/feeder.py): `src/deploy/feeder.py`

### Shared runtime

- [Rain truth](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/truth.py): `src/rainnow/truth.py`
- [Causal channels](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/channels.py): `src/rainnow/channels.py`
- [Radar processing](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/radar.py): `src/rainnow/radar.py`
- [Station metadata](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/stations.py): `src/rainnow/stations.py`
- [Benchmark data](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/dataset.py): `src/rainnow/dataset.py`
- [Tabular features](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/features.py): `src/rainnow/features.py`
- [Sequence blocks](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/blocks.py): `src/rainnow/models/deep/blocks.py`
- [Sequence data](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/models/deep/data.py): `src/rainnow/models/deep/data.py`
- [Forecast metrics](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/metrics.py): `src/rainnow/metrics.py`
- [Link attenuation](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/attenuation.py): `src/rainnow/attenuation.py`
- [Configuration](https://github.com/omkarbhattarai71/rain-nowcast-3dtwin/blob/main/src/rainnow/config.py): `src/rainnow/config.py`

### Other components

- **Run pipeline**
- **DMI observations**

## Connections

- Run pipeline → Station inventory: runs steps (evidence: `README.md`)
- Station inventory → Truth validation: prepares data for (evidence: `README.md`)
- Station inventory → Station metadata: uses metadata (evidence: `src/rainnow/pipeline/step01_inventory.py`)
- Station inventory → Truth validation: downloads via
- Truth validation → Rain truth: validates with (evidence: `src/rainnow/pipeline/step02_truth.py`)
- Truth validation → Station metadata: uses metadata (evidence: `src/rainnow/pipeline/step02_truth.py`)
- Truth validation → Station channels: prepares inputs for (evidence: `README.md`)
- Station channels → Causal channels: builds (evidence: `src/rainnow/pipeline/step03_channels.py`)
- Station channels → Rain truth: reads truth (evidence: `src/rainnow/pipeline/step03_channels.py`)
- Station channels → Station metadata: uses neighbors (evidence: `src/rainnow/pipeline/step03_channels.py`)
- Radar inputs → Radar processing: processes radar (evidence: `src/rainnow/pipeline/step04_radar.py`)
- Radar inputs → Station metadata: uses metadata (evidence: `src/rainnow/pipeline/step04_radar.py`)
- Radar inputs → Causal channels: merges channels
- Tabular preparation → Benchmark data: builds evaluation index (evidence: `src/rainnow/pipeline/step05_tabular.py`)
- Tabular preparation → Tabular features: computes features (evidence: `src/rainnow/pipeline/step05_tabular.py`)
- Tabular preparation → Benchmark data: loads channels (evidence: `src/rainnow/pipeline/step05_tabular.py`)
- Tabular features → Causal channels: transforms (evidence: `src/rainnow/features.py`)
- Gradient boosting → Tabular features: uses features (evidence: `src/rainnow/models/gbm.py`)
- Gradient boosting → Benchmark data: uses shared base (evidence: `src/rainnow/models/gbm.py`)
- Deep training → Sequence data: trains from (evidence: `src/rainnow/models/deep/train.py`)
- Deep training → Sequence networks: builds networks (evidence: `src/rainnow/models/deep/train.py`)
- Sequence networks → Sequence blocks: uses blocks (evidence: `src/rainnow/models/deep/nets.py`)
- Sequence data → Causal channels: uses channels (evidence: `src/rainnow/models/deep/data.py`)
- Sequence data → Benchmark data: loads benchmark data (evidence: `src/rainnow/models/deep/data.py`)
- Hybrid models → State-space models: uses state-space models (evidence: `src/rainnow/pipeline/step10_hybrids.py`)
- Model evaluation → Benchmark data: loads evaluation data (evidence: `src/rainnow/pipeline/step11_evaluate.py`)
- Model evaluation → Forecast metrics: computes scores (evidence: `src/rainnow/pipeline/step11_evaluate.py`)
- Model evaluation → Forecast artifacts: writes reports (evidence: `README.md`)
- Attenuation analysis → Link attenuation: calculates impacts (evidence: `src/rainnow/pipeline/step12_attenuation.py`)
- Attenuation analysis → Benchmark data: loads forecasts (evidence: `src/rainnow/pipeline/step12_attenuation.py`)
- Attenuation analysis → Forecast metrics: scores attenuation (evidence: `src/rainnow/pipeline/step12_attenuation.py`)
- Leakage audit → Benchmark data: audits benchmark data (evidence: `src/rainnow/pipeline/step13_leakage_audit.py`)
- Leakage audit → Forecast metrics: compares scores (evidence: `src/rainnow/pipeline/step13_leakage_audit.py`)
- DMI observations → DMI data feeder: supplies live data (evidence: `README.md`)
- DMI data feeder → Forecast API: sends observations (evidence: `README.md`)
- Forecast API → Nowcast service: routes requests (evidence: `src/deploy/app.py`)
- Nowcast service → Causal channels: builds causal inputs (evidence: `src/rainnow/serving.py`)
- Nowcast service → Tabular features: builds model features (evidence: `src/rainnow/serving.py`)
- Nowcast service → Station metadata: loads station table (evidence: `src/rainnow/serving.py`)
- Nowcast service → Link attenuation: computes link impact (evidence: `src/rainnow/serving.py`)
- Nowcast service → Forecast artifacts: loads model artifacts (evidence: `README.md`)
- Nowcast service → Configuration: uses configuration (evidence: `src/deploy/app.py`)
