Open joeloskarsson opened 1 month ago
I agree that there is a need for checks w.r.t. the dimensions of the graph and feature tensors. The work I started on https://github.com/mllam/neural-lam/tree/graph_classes does contain quite a lot of this that I think will be useful, e.g.
This PR is now mainly waiting on #32 to be merged
To get this to actually work with neural-lam (or in particular with https://github.com/mllam/neural-lam/pull/84) I had to introduce some sorting of nodes and sub-graphs after splitting. Otherwise I was getting arbitrary node indices.
@sadamov @leifdenby could you please have a look at https://github.com/mllam/weather-model-graphs/pull/34/commits/350e0c0b8166594f57d20aabc39c92d59d72b82b and check that you don't see any problem with this.
To clarify here: We don't need all nodes to be in some very specific ordering. What we do need is that nodes in one specific sub-graph (e.g. "mesh-level 1") all have subsequent indices.
@joeloskarsson to me this restriction seems justified. It's also an easy to understand requirement for folks who want to create their graphs outside of WMG. Just make sure to add it to both README's here and in NL. (and thanks for your work on this! :handshake:)
Good suggestions all around @SimonKamuk ! Was there something specific introduced by this PR that you think should be added to the readme? I was thinking that the example in the readme can continue to use default parameters, which is decode_mask=None
.
Otherwise this is the plan for this PR now:
Well, it's not strictly necessary, and I think it's actually better suited for the documentation notebooks rather than the readme, but I just thought it would be nice to describe this feature with an example to make it easier for people to find. But again, it might not be necessary 😄
I do agree though that it could be nice to have a documentation notebook with an example of using this. Will see if I can put together something small.
Describe your changes
For LAM forecasting it is reasonable to not always predict values in nodes that are considered part of the boundary forcing. This is in particular a change planned for neural-lam. When we consider the graphs involved, this means that the g2m edges should only connect to a subset of the grid nodes.
This PR introduces an option
decode_mask
that allows for specifying an Iterable of booleans (e.g. a numpy-array) specifying which of the grid nodes should be included in the decoding-part of the graph (m2g). This allows in the LAM case to specify such a mask with True for the inner region nodes.This builds on #32, which should be merged first. Here is a diff for only this PR in the meantime: https://github.com/joeloskarsson/weather-model-graphs/compare/general_coordinates...decoding_mask
Type of change
Checklist before requesting a review
pull
with--rebase
option if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
Checklist for assignee