-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flexible options to archetype graphs #19
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joeloskarsson for this PR, making the graph creation process even more modular and flexbile.
- Why is the default radius
d=0.51
, is that obvious or should we document it?
PS: Just used weather-model-graphs for the first time, loving the Docs notebooks @leifdenby 🫶
g2m_connectivity="within_radius", | ||
m2g_connectivity="nearest_neighbours", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that these are "historical" graphs, but what is the rational behind having a different connectivity in g2m and m2g? (Mostly asking for educatory purposes, I think the code is fine).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I have ever read a thorough explanation, but mostly used this for historical reasons as well. One motivation could be based on what we think g2m and m2g does. g2m is supposed to aggregate grid information up to the mesh. It could then be useful to include a large area around each mesh node as the "information aggregation window", and overlaps in this are not a problem. For m2g, its purpose is to extract the information from the mesh to determine the final prediction in each grid node. At this point we expect this information to be localised to the closest mesh nodes, so in a sense m2g only performs a fancy interpolation between the closest mesh nodes. If we connect to the closest mesh nodes we don't expect mesh nodes further away to contribute with more infromation.
graph : networkx.Graph | ||
Graph to check for levels | ||
attr : str | ||
Attribute to split on existance of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this sentence, could you clarify existance of what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified this
Co-authored-by: sadamov <[email protected]>
Very happy with these changes @joeloskarsson! They are a great addition 🚀 |
@sadamov I added an explanation about why the g2m default radius is 0.51, with a link to this visualization: https://www.desmos.com/calculator/sqqz0ka4ho |
@TomasLandelius @leifdenby do you want to look over this more before we merge this, or are you happy with Simon's review? Would be nice to get merged so I can continue building on it (will still build on this on new branches, but easier to PR those new branches later if this is merged). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes all the mistakes I made with the archetype graphs implementations and adds so many small improvements too! Thank you again for doing this work ❤️ It was a joy to review
The only missing element is an update to the changelog then this is good to go in :) |
I just noticed one more thing: It would be good to clear the output for the example notebooks. For example https://github.com/joeloskarsson/weather-model-graphs/blob/archetype_changes/docs/creating_the_graph.ipynb is > 10Mb in your PR. I should work out how to clear the content with pre-commit before the notebooks are committed. The rendered content is created automatically when the gh-action builds the documentation site and pushes to the https://mllam.github.io/weather-model-graphs site |
OK with me. |
Happy that you like these changes! Yes, I wasn't entirely sure how to work with the documentation. When I originally committed the notebooks with output the diff become so large that it was completely unreadable. I first thought that was a quite big downside to having docs in jupyter notebooks, but I see now that once you clear the output the diff actually becomes as readable as a diff for any other code 😄 And it makes a lot of sense to not commit the notebook output. I've now updated also the changelog so will go ahead and merge this. |
Describe your changes
This PR is a collection of modifications and new options to the existing graph archetypes. The motivation for this change is
Specifically, the changes included in this PR are:
rel_max_dist
when connecting graphs usingwithin_radius
method.rel_max_dist
specifies the radius as a relative distance to the maximum edge length in the mesh graph. Specifically, for multi-scale and hierarchical graphs this is the maximum edge length of the bottom level intra-level edges.refinement_factor
argument into two: agrid_refinement_factor
describing the refinement between grid nodes and the bottom mesh level and alevel_refinement_factor
describing the refinement factor between levels in the graph hierarchy. Naturally flat graphs only havegrid_refinement_factor
.Minor:
Issue Link
Fixes #17 in archetype docstrings. Perhaps a similar clarification should be done in the actual documentation, before closing #17? Not sure if that is within scope of this PR. Comment below what you thing.
(Somewhat unintentionally) this also seems to fix #12 😄 I think that is just because of the changes to the flat (Keisler) graph creation, that is a bit more robust now.
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
reflecting type of change (add section where missing):
Checklist for assignee