mllam / neural-lam

Neural Weather Prediction for Limited Area Modeling
MIT License
64 stars 24 forks source link

Introduce graph classes for graph-based models #65

Open joeloskarsson opened 4 days ago

joeloskarsson commented 4 days ago

Describe your changes

The actual graph constructions (mesh graphs + m2g and g2m edges) currently take the form as a set of tensors in the code. All these tensors are passed around and used in the different model classes in a somewhat unstructured way. See for example: https://github.com/mllam/neural-lam/blob/066efe0a77f1ed741d9eb2f303ee920927d79ad2/neural_lam/models/base_hi_graph_model.py#L43-L45

This also means that there are some more or less hacky ways that we differentiate between hierarchical and "flat" graphs (see utils.load_graph): https://github.com/mllam/neural-lam/blob/066efe0a77f1ed741d9eb2f303ee920927d79ad2/neural_lam/utils.py#L111

The idea of this change is to keep the full representation of a graph together in one object. This means that all tensors (edge_index and features) related to the graph sits together in a coherent structure.

At the moment this loads the graph tensors from the same kind of saved .pt files as in the current implementation. There has been some discussion about just directly serializing these graph objects, and then using them also in https://github.com/mllam/weather-model-graphs.

Some TODOs:

Issue Link

Does not directly solve an issue, but should be used in #4.

Type of change

Checklist before requesting a review

Each PR comes with its own improvements and flaws. The reviewer should check the following:

Author checklist after completed review

Checklist for assignee