Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
f235998
update models
JPXKQX Feb 13, 2026
4a3e142
.
JPXKQX Feb 13, 2026
9dba030
update workflow
JPXKQX Feb 13, 2026
129bdd4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 13, 2026
a910dec
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 13, 2026
9ede2cf
pre-commit
JPXKQX Feb 13, 2026
3652dcc
fix: unit tests
JPXKQX Feb 13, 2026
152c4b1
tests schemas
JPXKQX Feb 13, 2026
5d7ec3d
fix: configs
JPXKQX Feb 13, 2026
203937d
update hierarchical
JPXKQX Feb 13, 2026
9b570f2
update plotting
JPXKQX Feb 13, 2026
d79a2e7
fix: integration test
JPXKQX Feb 13, 2026
1388b00
fix
JPXKQX Feb 16, 2026
bb11369
updated
JPXKQX Feb 16, 2026
0e24869
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 16, 2026
09e37bc
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 16, 2026
ae01d1e
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 17, 2026
abdabac
move hidden nodes name to model config
JPXKQX Feb 17, 2026
63608a0
schemas
JPXKQX Feb 17, 2026
e9c96fc
fix
JPXKQX Feb 17, 2026
6177a1e
update
JPXKQX Feb 17, 2026
0daf8e3
fix: tests
JPXKQX Feb 17, 2026
6cac9c9
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 18, 2026
85a3769
nodes_name
JPXKQX Feb 18, 2026
d48f097
update schema
JPXKQX Feb 18, 2026
ac31369
update schema
JPXKQX Feb 18, 2026
adbbdf4
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 19, 2026
ea11dbf
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 19, 2026
c97a569
update test
JPXKQX Feb 19, 2026
a8ea455
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 20, 2026
54602fb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 20, 2026
3b2d9e7
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 20, 2026
0476fad
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 24, 2026
41bd9c9
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 24, 2026
ba8fef1
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 24, 2026
550fbcb
Merge branch 'main' into feat/expand-graph-config
JPXKQX Feb 26, 2026
db30844
Merge branch 'main' into feat/expand-graph-config
JPXKQX Mar 2, 2026
0c564f6
Merge branch 'main' into feat/expand-graph-config
JPXKQX Mar 6, 2026
03c66ac
update config
JPXKQX Mar 6, 2026
d2fa4ae
multi config
JPXKQX Mar 6, 2026
b05122c
update boolean mask
JPXKQX Mar 6, 2026
f7eb9bf
update schema
JPXKQX Mar 6, 2026
94066a7
update lam integration test config
JPXKQX Mar 7, 2026
87e873d
fix: diffusion processor_kwargs
JPXKQX Mar 7, 2026
6c639e8
fix: use batch_ens_size
JPXKQX Mar 8, 2026
5eb08bb
update trainable parameters key
JPXKQX Mar 8, 2026
9296eab
update node attributes
JPXKQX Mar 8, 2026
6f6de32
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 8, 2026
f4e3b70
update
JPXKQX Mar 8, 2026
b7bfa2c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 8, 2026
cc9249a
fix: aicon
JPXKQX Mar 8, 2026
7a92c6c
Merge branch 'feat/expand-graph-config' of https://github.com/ecmwf/a…
JPXKQX Mar 8, 2026
9154334
update node_attributes
JPXKQX Mar 9, 2026
a7e1198
fix: hierarchical configs
JPXKQX Mar 9, 2026
036af51
add migration checkpoint
JPXKQX Mar 9, 2026
b931c23
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 9, 2026
caa35df
Merge branch 'main' into feat/expand-graph-config
JPXKQX Mar 9, 2026
de80e6e
docs: update graph documentation
JPXKQX Mar 9, 2026
93a024b
Merge branch 'main' into feat/expand-graph-config
JPXKQX Mar 9, 2026
f11a389
Merge branch 'feat/expand-graph-config' of https://github.com/ecmwf/a…
JPXKQX Mar 9, 2026
ffe8c5a
Merge branch 'main' into feat/expand-graph-config
JPXKQX Mar 10, 2026
900c452
update config entry
JPXKQX Mar 11, 2026
6dfedd6
Merge branch 'main' into feat/expand-graph-config
JPXKQX Mar 11, 2026
923834d
Merge remote-tracking branch 'origin/feat/expand-graph-config' into f…
icedoom888 Mar 11, 2026
5421f00
Updated dat acreation and configs
icedoom888 Mar 11, 2026
54cd734
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 11, 2026
7bb524c
Updated and working
icedoom888 Mar 12, 2026
a878757
Merge branch 'feat/auto_data_graph_creation' of github.com:ecmwf/anem…
icedoom888 Mar 12, 2026
fd103ae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2026
4de5106
Updated node attributes
icedoom888 Mar 12, 2026
ede7639
Merge branch 'feat/auto_data_graph_creation' of github.com:ecmwf/anem…
icedoom888 Mar 12, 2026
d46a85f
gpc passed
icedoom888 Mar 12, 2026
2062bfc
tried something
icedoom888 Mar 12, 2026
7932b26
Revert
icedoom888 Mar 12, 2026
04b06b6
Merge branch 'main' into feat/auto_data_graph_creation
icedoom888 Mar 12, 2026
8fba12f
Fixe dmissing import
icedoom888 Mar 12, 2026
ce99a94
Created graph utils
icedoom888 Mar 12, 2026
02f7c85
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2026
eed77ac
tmp print
icedoom888 Mar 12, 2026
2919052
Merge branch 'feat/auto_data_graph_creation' of github.com:ecmwf/anem…
icedoom888 Mar 12, 2026
219b41b
relaxed config access for attributes
icedoom888 Mar 12, 2026
ca7dbb7
Fixed default
icedoom888 Mar 12, 2026
d2452b3
Fixed default
icedoom888 Mar 12, 2026
af48de8
Merge branch 'main' into feat/auto_data_graph_creation
icedoom888 Mar 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions graphs/src/anemoi/graphs/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# (C) Copyright 2025 Anemoi contributors.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
from .compile import NodesAxis
from .compile import concat_edges
from .compile import get_distributed_device
from .compile import get_edge_attributes
from .compile import get_grid_reference_distance
from .compile import get_nearest_neighbour
from .compile import haversine_distance

__all__ = [
"get_distributed_device",
"get_nearest_neighbour",
"get_grid_reference_distance",
"concat_edges",
"haversine_distance",
"NodesAxis",
"get_edge_attributes",
]
84 changes: 84 additions & 0 deletions graphs/src/anemoi/graphs/utils/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# (C) Copyright 2026- Anemoi contributors.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

import logging

from omegaconf import DictConfig
from omegaconf import OmegaConf

LOGGER = logging.getLogger(__name__)

DEFAULT_DATASET_NAME = "data"
DEFAULT_NODE_ATTR = {
"area_weight": {
"_target_": "anemoi.graphs.nodes.attributes.SphericalAreaWeights",
"norm": "unit-max",
"fill_value": 0,
}
}
Comment on lines +18 to +24
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR also introduces yet another place where defaults are stored (DEFAULT_NODE_ATTR). Are these defaults actually necessary or would it be possible to set these defaults simply as the default python argument values of anemoi.graphs.nodes.AnemoiDatasetNodes?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree, these global variables seem unecessary

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the time being "area_weight" is a necessary attribute for any data nodes, this isn't enforced in the code, and test will fail if not provided.
I could try and find another workaround by enforcing creation somewhere else, but not sure where. Suggestions?



def get_multiple_datasets_config(config: DictConfig, default_dataset_name: str = DEFAULT_DATASET_NAME) -> dict:
"""Get multiple datasets configuration for old configs.
Use /'data/' as the default dataset name.
"""
if "datasets" in config:
if isinstance(config, dict):
return config["datasets"]
return config.datasets

return OmegaConf.create({default_dataset_name: config})


def integrate_data_nodes_in_config(config: DictConfig):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how it's handled elsewhere in the code, but I would suggest noting here that config is actually modified. Thus I would also recommend considering returning nothing in this function.


# Introduce Data Nodes in graph config
train_configs = get_multiple_datasets_config(config.dataloader.training)

val_configs = {}
if hasattr(config.dataloader, "validation"):
val_configs = get_multiple_datasets_config(config.dataloader.validation)

test_configs = {}
if hasattr(config.dataloader, "test"):
test_configs = get_multiple_datasets_config(config.dataloader.test)

dataset_configs = {
**train_configs,
**val_configs,
**test_configs,
}

for dataset_name, dataset_config in dataset_configs.items():
if dataset_name not in config.graph.nodes:
LOGGER.info("Creating graph node entry for dataset '%s'", dataset_name)
dataset_reader_config = dataset_config.dataset_config
if isinstance(dataset_reader_config, (DictConfig, dict)):
if "dataset" not in dataset_reader_config:
msg = f"Dataset '{dataset_name}' is missing 'dataset' key."
raise ValueError(msg)
dataset_source = dataset_reader_config["dataset"]
else:
dataset_source = dataset_reader_config

if dataset_source is None:
msg = f"Dataset source is None for dataset '{dataset_name}'. Check dataloader.dataset_config.dataset."
raise ValueError(msg)

# Add dataset nodes from dataloader into graph recepe
config.graph.nodes[dataset_name] = {
"node_builder": {"_target_": "anemoi.graphs.nodes.AnemoiDatasetNodes", "dataset": dataset_source},
"attributes": (
config.graph.attributes.nodes if hasattr(config.graph, "attributes") else DEFAULT_NODE_ATTR
),
}
else:
LOGGER.info("Graph node entry for dataset '%s' is already specified in the config.", dataset_name)

return config
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
overwrite: True

nodes:
# Data nodes
data:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes # options: AnemoiDatasetNodes, NPZFileNodes
dataset: ${dataloader.training.datasets.data.dataset_config}
attributes: ${graph.attributes.nodes} # options: l1, l2, unit-max, unit-sum, unit-std
# Hidden nodes
hidden:
node_builder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ overwrite: True


nodes:
# Data nodes
data:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes
dataset: ${dataloader.training.datasets.data.dataset_config}
attributes: ${graph.attributes.nodes}
# Hidden nodes
hidden_1:
node_builder:
_target_: anemoi.graphs.nodes.TriNodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
overwrite: True

nodes:
# Data nodes
data:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes
dataset: ${dataloader.training.datasets.data.dataset_config}
attributes: ${graph.attributes.nodes}
# Hidden nodes
hidden_1:
node_builder:
_target_: anemoi.graphs.nodes.TriNodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ overwrite: True


nodes:
# Data nodes
data:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes
dataset: ${dataloader.training.datasets.data.dataset_config}
attributes: ${graph.attributes.nodes}
# Hidden nodes
hidden_1:
node_builder:
_target_: anemoi.graphs.nodes.TriNodes
Expand Down
6 changes: 0 additions & 6 deletions training/src/anemoi/training/config/graph/limited_area.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
overwrite: True

nodes:
# Data nodes
data:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes
dataset: ${dataloader.training.datasets.data.dataset_config}
attributes: ${graph.attributes.nodes}
# Hidden nodes
hidden:
node_builder:
Expand Down
11 changes: 1 addition & 10 deletions training/src/anemoi/training/config/graph/multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@
overwrite: True

nodes:
era5:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes
dataset: ${dataloader.training.datasets.era5.dataset_config}
attributes: ${graph.attributes.nodes}
cerra:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes
dataset: ${dataloader.training.datasets.cerra.dataset_config}
attributes: ${graph.attributes.nodes}
# Hidden Nodes
hidden:
node_builder:
_target_: anemoi.graphs.nodes.TriNodes
Expand Down
6 changes: 0 additions & 6 deletions training/src/anemoi/training/config/graph/multi_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
overwrite: True

nodes:
# Data nodes
data:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes # options: AnemoiDatasetNodes, NPZFileNodes
dataset: ${dataloader.training.datasets.data.dataset_config}
attributes: ${graph.attributes.nodes}
# Hidden nodes
hidden:
node_builder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ overwrite: True


nodes:
data:
node_builder:
_target_: anemoi.graphs.nodes.AnemoiDatasetNodes
dataset: ${dataloader.training.datasets.data.dataset_config}
attributes: ${graph.attributes.nodes}
# Hidden Nodes
hidden:
node_builder:
_target_: anemoi.graphs.nodes.StretchedTriNodes
Expand Down
4 changes: 4 additions & 0 deletions training/src/anemoi/training/train/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from pytorch_lightning.utilities.rank_zero import rank_zero_only
from torch_geometric.data import HeteroData

from anemoi.graphs.utils.config import integrate_data_nodes_in_config
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from anemoi.graphs.utils.config import integrate_data_nodes_in_config
from anemoi.models.utils.config import get_multiple_datasets_config

Is it possible to re-use the existent copy of this function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this was done to remove dependency of graphs from models!

from anemoi.models.utils.compile import mark_for_compilation
from anemoi.training.data.datamodule import AnemoiDatasetsDataModule
from anemoi.training.diagnostics.callbacks import get_callbacks
Expand Down Expand Up @@ -166,6 +167,9 @@ def graph_data(self) -> HeteroData:
else:
graph_filename = None

# Introduce Data Nodes in graph config
self.config = integrate_data_nodes_in_config(self.config)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you manipulating the global config object here? Which version of the config is logged to MLflow?

Did you consider adding a flag to the configuration that explicitly enables the automatic generation of AnemoiDatasetNodes nodes? I think this would help catching config errors where the the user specification of custom note builders is dismissed due to a typo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point @MeraX, will look into this!


# Create new graph
from anemoi.graphs.create import GraphCreator

Expand Down
1 change: 1 addition & 0 deletions training/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def global_config(
"node_weights",
"output_steps",
]

return cfg, url, model_architecture


Expand Down
Loading