Refine realization coordinate handling when clustering#2361
Open
gavinevans wants to merge 5 commits into
Open
Conversation
…nsion coordinate regardless of how the cubes are indexed.
…there is some meaning to these numbers, which means automatic renumbering isn't appropriate.
maxwhitemet
requested changes
Apr 20, 2026
Contributor
maxwhitemet
left a comment
There was a problem hiding this comment.
Thanks @gavinevans. I have suggested some minor changes
| random_state=42, | ||
| ).process(cubes) | ||
|
|
||
| assert "realization" in [coord.name() for coord in result.dim_coords] |
Contributor
There was a problem hiding this comment.
I recently came across this pattern
Suggested change
| assert "realization" in [coord.name() for coord in result.dim_coords] | |
| assert result.coords("realization", dim_coords=True) |
| n_clusters = len(result.coord("realization").points) | ||
| assert n_clusters == 3 | ||
| assert len(result.coord_dims("realization")) == 1 | ||
| assert "realization" in [coord.name() for coord in result.dim_coords] |
Contributor
There was a problem hiding this comment.
assert result.coords("realization", dim_coords=True)
| # Should have 3 clusters | ||
| assert len(result.coord("realization").points) == 3 | ||
| assert len(result.coord_dims("realization")) == 1 | ||
| assert "realization" in [coord.name() for coord in result.dim_coords] |
Contributor
There was a problem hiding this comment.
Suggested change
| assert "realization" in [coord.name() for coord in result.dim_coords] | |
| assert result.coords("realization", dim_coords=True) |
…ealization_is_dimension * upstream/master: Option to ignore grid dimensions hash check on SpotExtraction (metoppv#2360) Apply realization clustering result to any lead time (metoppv#2340)
47dc7f2 to
39e1675
Compare
Contributor
|
Thanks for the changes @gavinevans. Approved 👍 |
maxwhitemet
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to https://github.com/metoppv/mo-blue-team/issues/783
Description
This PR makes edits to the realization clustering code, so that the realization coordinate is handled correctly. The changes are:
Testing: