Skip to content

Modifications to support cold start without a primary input for realization clustering - #2455

Merged
gavinevans merged 3 commits into
metoppv:masterfrom
gavinevans:mobt_1290_realization_clustering_cold_start
Sep 30, 2026
Merged

gavinevans merged 3 commits into
metoppv:masterfrom
gavinevans:mobt_1290_realization_clustering_cold_start

Conversation

@gavinevans

Copy link
Copy Markdown
Contributor

Addresses https://github.com/metoppv/mo-blue-team/issues/1290

Description
This PR removes the exception that was noted on https://github.com/MetOffice/improver_suite/pull/2840 as problematic in a cold start situation where the primary input is not yet available. This PR removes the exception and replaces it with a warning, which therefore returns None.

Testing:

  • Ran tests and they passed OK
  • Added new tests for the new feature(s)

@maxwhitemet maxwhitemet left a comment

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.

Hi @gavinevans. I have added a few light comments

Comment on lines +1506 to +1507
None: If no primary cube is found for the configured primary input,
indicating a cold-start or no-primary condition that should be skipped.

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.

Please could you clarify what a 'cold-start' and 'no-primary' condition is and when it would arise. I'm wondering if this is specific to our suite setup

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.

I've removed this jargon in favour of some simpler wording.

output_path,
]

with pytest.warns(UserWarning, match=r"No primary cube found"):

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 don't think the raw string formatting is required here or in the warning matching below, however this is safe long-term.

Suggested change
with pytest.warns(UserWarning, match=r"No primary cube found"):
with pytest.warns(UserWarning, match="No primary cube found"):

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.

Removed.

def test_clusterandmatch_process_no_primary_cube():
"""Test that ValueError is raised if no primary cube is found with the specified model_id_attr."""
# Only secondary input cubes, no primary input
"""Test that a missing primary cube is treated as a cold-start no-op."""

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.

Please could 'cold-start no-op' be defined?

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.

I've simplified this docstring.

@gavinevans gavinevans assigned maxwhitemet and unassigned mo-jbeaver Sep 29, 2026

@maxwhitemet maxwhitemet left a comment

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.

Thanks @gavinevans. Happy to approve.

@mo-jbeaver mo-jbeaver left a comment

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.

Happy to approve, all tests ran successfully.

@gavinevans
gavinevans merged commit 64df373 into metoppv:master Sep 30, 2026
7 checks passed
@gavinevans
gavinevans deleted the mobt_1290_realization_clustering_cold_start branch September 30, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants