# maximilianfricke/baltic-sea-forecasting architecture

> Architecture diagram of the GitHub repository maximilianfricke/baltic-sea-forecasting, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maximilianfricke/baltic-sea-forecasting
- Repository: https://github.com/maximilianfricke/baltic-sea-forecasting

## Overview

Neural-LAM is a graph-neural-network weather forecasting toolkit for limited-area modeling, with deterministic and probabilistic models, hierarchical forecasting, and a GraphCast reimplementation. The main workflow is to configure data and a compatible graph, train or evaluate a selected model, and produce forecasts and metrics. Datastores and graph construction are modular; graph viewing and model-weight analysis provide a separate inspection capability. The map follows README statements and sampled references; edges are limited to relationships shown in those sources.

Main entry points: [`neural_lam/train_model.py`](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/train_model.py) (Train and evaluate), [`neural_lam/create_graph.py`](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_graph.py) (Regional graph builder), [`neural_lam/datastore/base.py`](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/datastore/base.py) (Datastore interface), [`neural_lam/create_global_graph.py`](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_global_graph.py) (Global graph builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Weather data"]
  node_datastore["Datastore interface<br/>[base.py]"]
  node_mdp["MDP datastore<br/>[mdp.py]"]
  node_weather_dataset["Weather samples<br/>[weather_dataset.py]"]
end

subgraph group_graphs["Graph structures"]
  node_regional_graph["Regional graph builder<br/>[create_graph.py]"]
  node_global_graph["Global graph builder"]
  node_aux_graph["Auxiliary graph builder"]
  node_graph_generators["Mesh generators"]
  node_graph_storage["Graph save and load<br/>[saving.py]"]
  node_graph_utils["Graph features<br/>[utils.py]"]
end

subgraph group_models["Forecast models"]
  node_ar_model["Autoregressive model<br/>[ar_model.py]"]
  node_prob_model["Probabilistic model<br/>[ar_prob_model.py]"]
  node_graph_efm["Graph-EFM<br/>[graph_efm.py]"]
  node_graph_diff["Graph diffusion<br/>[graph_diff.py]"]
  node_interaction_net["Interaction network<br/>[interaction_net.py]"]
end

subgraph group_runtime["Training and evaluation"]
  node_config["Model configuration<br/>[config.py]"]
  node_train["Train and evaluate<br/>[train_model.py]"]
  node_metrics["Forecast metrics<br/>[metrics.py]"]
  node_visualization["Forecast visualization<br/>[vis.py]"]
end

subgraph group_inspection["Graph inspection"]
  node_graph_viewer["Graph viewer<br/>[viewer.py]"]
  node_graph_costs["Graph costs<br/>[costs.py]"]
  node_graph_weights["Measure model weights<br/>[measure_weights.py]"]
end

node_user(("Weather researcher"))

node_user -->|"configures"| node_config
node_config -->|"initializes"| node_mdp
node_mdp -->|"implements"| node_datastore
node_weather_dataset -->|"reads"| node_datastore
node_user -->|"runs"| node_train
node_train -->|"loads"| node_config
node_train -->|"uses"| node_weather_dataset
node_train -->|"selects"| node_ar_model
node_ar_model -->|"extends"| node_prob_model
node_graph_efm -->|"extends"| node_prob_model
node_graph_diff -->|"uses"| node_ar_model
node_graph_diff -->|"uses"| node_interaction_net
node_train -->|"evaluates with"| node_metrics
node_train -->|"uses"| node_visualization
node_regional_graph -->|"reads grid"| node_datastore
node_regional_graph -->|"builds with"| node_graph_generators
node_regional_graph -->|"saves"| node_graph_storage
node_regional_graph -->|"uses"| node_graph_utils
node_global_graph -->|"reads grid"| node_datastore
node_global_graph -->|"saves"| node_graph_storage
node_global_graph -->|"uses"| node_graph_utils
node_graph_viewer -->|"uses"| node_graph_costs
node_graph_weights -->|"uses"| node_graph_costs
node_graph_weights -->|"loads model"| node_train

click node_config "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/config.py"
click node_datastore "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/datastore/base.py"
click node_mdp "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/datastore/mdp.py"
click node_weather_dataset "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/weather_dataset.py"
click node_regional_graph "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_graph.py"
click node_global_graph "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_global_graph.py"
click node_aux_graph "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_auxiliary_graph.py"
click node_graph_generators "https://github.com/maximilianfricke/baltic-sea-forecasting/tree/main/neural_lam/graphs"
click node_graph_storage "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graphs/saving.py"
click node_graph_utils "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graphs/utils.py"
click node_ar_model "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/ar_model.py"
click node_prob_model "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/ar_prob_model.py"
click node_graph_efm "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/graph_efm.py"
click node_graph_diff "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/graph_diff.py"
click node_interaction_net "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/interaction_net.py"
click node_train "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/train_model.py"
click node_metrics "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/metrics.py"
click node_visualization "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/vis.py"
click node_graph_viewer "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graph_viewer/viewer.py"
click node_graph_costs "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graph_viewer/costs.py"
click node_graph_weights "https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graph_viewer/measure_weights.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_datastore,node_mdp,node_weather_dataset toneBlue
class node_regional_graph,node_global_graph,node_aux_graph,node_graph_generators,node_graph_storage,node_graph_utils toneAmber
class node_ar_model,node_prob_model,node_graph_efm,node_graph_diff,node_interaction_net toneMint
class node_config,node_train,node_metrics,node_visualization toneRose
class node_graph_viewer,node_graph_costs,node_graph_weights,node_user toneIndigo
```

## Components

### Weather data

- [Datastore interface](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/datastore/base.py): `neural_lam/datastore/base.py`
- [MDP datastore](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/datastore/mdp.py): `neural_lam/datastore/mdp.py`
- [Weather samples](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/weather_dataset.py): `neural_lam/weather_dataset.py`

### Graph structures

- [Regional graph builder](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_graph.py): `neural_lam/create_graph.py`
- [Global graph builder](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_global_graph.py): `neural_lam/create_global_graph.py`
- [Auxiliary graph builder](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/create_auxiliary_graph.py): `neural_lam/create_auxiliary_graph.py`
- [Mesh generators](https://github.com/maximilianfricke/baltic-sea-forecasting/tree/main/neural_lam/graphs): `neural_lam/graphs`
- [Graph save and load](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graphs/saving.py): `neural_lam/graphs/saving.py`
- [Graph features](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graphs/utils.py): `neural_lam/graphs/utils.py`

### Forecast models

- [Autoregressive model](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/ar_model.py): `neural_lam/models/ar_model.py`
- [Probabilistic model](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/ar_prob_model.py): `neural_lam/models/ar_prob_model.py`
- [Graph-EFM](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/graph_efm.py): `neural_lam/models/graph_efm.py`
- [Graph diffusion](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/models/graph_diff.py): `neural_lam/models/graph_diff.py`
- [Interaction network](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/interaction_net.py): `neural_lam/interaction_net.py`

### Training and evaluation

- [Model configuration](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/config.py): `neural_lam/config.py`
- [Train and evaluate](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/train_model.py): `neural_lam/train_model.py`
- [Forecast metrics](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/metrics.py): `neural_lam/metrics.py`
- [Forecast visualization](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/vis.py): `neural_lam/vis.py`

### Graph inspection

- [Graph viewer](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graph_viewer/viewer.py): `neural_lam/graph_viewer/viewer.py`
- [Graph costs](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graph_viewer/costs.py): `neural_lam/graph_viewer/costs.py`
- [Measure model weights](https://github.com/maximilianfricke/baltic-sea-forecasting/blob/main/neural_lam/graph_viewer/measure_weights.py): `neural_lam/graph_viewer/measure_weights.py`

### Other components

- **Weather researcher**

## Connections

- Weather researcher → Model configuration: configures (evidence: `neural_lam/config.py`)
- Model configuration → MDP datastore: initializes (evidence: `neural_lam/config.py`)
- MDP datastore → Datastore interface: implements (evidence: `neural_lam/datastore/mdp.py`)
- Weather samples → Datastore interface: reads (evidence: `neural_lam/weather_dataset.py`)
- Weather researcher → Train and evaluate: runs (evidence: `neural_lam/train_model.py`)
- Train and evaluate → Model configuration: loads (evidence: `neural_lam/train_model.py`)
- Train and evaluate → Weather samples: uses (evidence: `neural_lam/train_model.py`)
- Train and evaluate → Autoregressive model: selects (evidence: `neural_lam/train_model.py`)
- Autoregressive model → Probabilistic model: extends (evidence: `neural_lam/models/ar_prob_model.py`)
- Graph-EFM → Probabilistic model: extends (evidence: `neural_lam/models/graph_efm.py`)
- Graph diffusion → Autoregressive model: uses (evidence: `neural_lam/models/graph_diff.py`)
- Graph diffusion → Interaction network: uses (evidence: `neural_lam/models/graph_diff.py`)
- Train and evaluate → Forecast metrics: evaluates with (evidence: `neural_lam/train_model.py`)
- Train and evaluate → Forecast visualization: uses (evidence: `neural_lam/train_model.py`)
- Regional graph builder → Datastore interface: reads grid (evidence: `neural_lam/create_graph.py`)
- Regional graph builder → Mesh generators: builds with (evidence: `neural_lam/create_graph.py`)
- Regional graph builder → Graph save and load: saves (evidence: `neural_lam/create_graph.py`)
- Regional graph builder → Graph features: uses (evidence: `neural_lam/create_graph.py`)
- Global graph builder → Datastore interface: reads grid (evidence: `neural_lam/create_global_graph.py`)
- Global graph builder → Graph save and load: saves (evidence: `neural_lam/create_global_graph.py`)
- Global graph builder → Graph features: uses (evidence: `neural_lam/create_global_graph.py`)
- Graph viewer → Graph costs: uses (evidence: `neural_lam/graph_viewer/viewer.py`)
- Measure model weights → Graph costs: uses (evidence: `neural_lam/graph_viewer/measure_weights.py`)
- Measure model weights → Train and evaluate: loads model (evidence: `neural_lam/graph_viewer/measure_weights.py`)
