Skip to content

Copilot makes a decomp - #161

Open
Andrew Clark (arjclark) wants to merge 2 commits into
MetOffice:mainfrom
arjclark:copilot_makes_a_decomp
Open

Copilot makes a decomp#161
Andrew Clark (arjclark) wants to merge 2 commits into
MetOffice:mainfrom
arjclark:copilot_makes_a_decomp

Conversation

@arjclark

Copy link
Copy Markdown
Collaborator

Closes #

To be completed prior to review request and updated as required during the review process.

If the answer to an item on the list is not applicable, feel free to replace the checkbox with 'N/A' to give extra clarity.

All developers are reminded to follow the ancil working practices


Branch

Related branches (e.g. ancillary-file-science):

[please link any related branches here]

ANTS rose stem logs

[please enter the workflow name here as it has been run e.g. ants-trunk/run5]

ancillary-file-science rose stem logs

[please enter the workflow name here as it has been run e.g. ancillary-file-science/run1]


Testing

For core ANTS only tests, the bare minimum that will be accepted is the group=unittests but many, if not most, changes will need to test other groups to ensure they meet reviewer expectations. In general, it should be possible and is advised to run the group=all group prior to review submission as this will catch any consequential issues. Additionally you must run the ancillary-file-science tests, pointing at your branch, with group=all to capture any behaviour changes affecting Science codes.

If your change will alter existing science results, you will need to seek appropriate Scientific validation and confirm that the model has been initialised with your new development. Inspecting a change in xconv/pyplot/visualiser of choice is not sufficient to demonstrate the model can be initialised from your file.


Impact of change

  • This will maintain results for ANTS cylc vip ./rose-stem -z group=all tests
  • This will this maintain results for ancillary-file-science cylc vip ./rose-stem -z group=all tests
  • If this change adds a new capability, evidence has been supplied to show testing of ancillary generation across different resolutions e.g. For global ancillary generation capabilities for use in NWP n1280e is expected to have been tested
  • This change has significantly impacted required resources (runtime and memory) in existing ancillary generation (if yes, give details)
  • This change alters existing ancils
Add further comments/details for your reviewers here on the impacts of the change......

Approvals for this change

  • I have approval from the ANTS core development team for these changes

New functionality further testing

  • If adding new functionality to existing codes, I confirm that the new code doesn't change results when it is switched off and ''works'' when switched on
  • Unittests have been added
  • Rose stem tests have been added for any new functionality
  • If adding new functionality please confirm that the new code compares across different standard decompositions.
  • I have not encountered any failures in my rose-stem output(s)
    These tasks must succeed for your ticket to pass review.
  • I have remembered to run the code style check tasks/tools
Add details of any further testing here.

Other

  • I have read the Contributor Licence Agreement
  • I have added my name and affiliation to the Contributors list if I am not already on there in this PR.
  • The issue labels, milestones, etc. are correct
  • Links to all related issues have been provided in the pull request description
  • I have requested a code reviewer
  • Source data has been added or changed - please include a link to the license
I confirm that all code is my own and that my contributions are not subject to copyright or license restrictions (see Contributor Licence Agreement). your name
I confirm I have not knowingly violated intellectual property rights (IPR) and have taken sensible measures to prevent doing so, including appropriate attribution for usage of Generative AI. I confirm that this work is my own, and I understand that it is my responsibility to ensure I am not violating others’ IPR. This includes taking reasonable steps to ensure that all tools used while creating this contribution did not infringe IPR. your name
Please add any further notes here. If Generative AI tools have been used, a brief summary (e.g. "Github copilot used to add extra unittests") should be provided.

Rose stem logs

Please copy in the contents of your trac_status.log file(s) below (found in the cylc-run directory for your rose stem run) to your rose-stem testing here. Note: if your changes lead to a change in answers, you must run cylc vip ./rose-stem -z group=all to help ensure all affected configurations has been flagged up.

Add workflow_status.log contents for ANTS rose-stem here.

Add workflow_status.log contents for ancillary-file-science rose-stem here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new ants.decomposition.simple_split_and_process framework intended as a simpler, serial, in-memory alternative to the existing decompose workflow, along with a comprehensive test battery validating split vs non-split invariants across multiple domains and regridding modes.

Changes:

  • Added simple_split_and_process plus _ssp_* helper functions for splitting, source-region extraction (including wrap-around and mixed longitude conventions), and piece concatenation/dtype handling.
  • Added a new, parametrized test module covering unary ops, binary (linear + area-weighted) ops, mixed longitude conventions, and a dtype-concatenation regression.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
lib/ants/decomposition.py Adds the new simple_split_and_process decomposition path and its private _ssp_* helpers (splitting, extraction, concatenation).
lib/ants/tests/decomposition/test_simple_split_and_process.py New test suite validating correctness invariants across split configurations, domains, and regridding methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/ants/decomposition.py
Comment on lines +1131 to +1142
# With zero splits in both dimensions, apply the operation directly to the
# full datasets without any decomposition overhead.
if number_of_x_splits == 0 and number_of_y_splits == 0:
if target is not None:
return operation(source, target)
else:
return operation(source)

# Guess coordinate bounds on the full cubes before splitting. This must
# be done here (on the intact cubes) rather than inside the splitting
# loop: guessing bounds on a sub-region can produce slightly different
# spacing for circular grids, making the pieces inconsistent.
Comment thread lib/ants/decomposition.py
Comment on lines +721 to +726
x_coordinate, y_coordinate = ants.utils.cube.horizontal_grid(cube)
# coord_dims returns a tuple; for rectilinear grids each coordinate maps to
# exactly one dimension index.
x_dimension_index = cube.coord_dims(x_coordinate)[0]
y_dimension_index = cube.coord_dims(y_coordinate)[0]

Comment thread lib/ants/decomposition.py
Comment on lines +830 to +833
source_x_coordinate, source_y_coordinate = ants.utils.cube.horizontal_grid(source)
target_x_coordinate, target_y_coordinate = ants.utils.cube.horizontal_grid(
target_piece
)
Comment on lines +341 to +342
assert_decomposed_result_matches_reference(decomposed, reference)
def test_global_source_australia_target(
Comment on lines +357 to +358
assert_decomposed_result_matches_reference(decomposed, reference)
def test_global_source_new_zealand_target(
Comment on lines +101 to +103
The cube covers the full globe at approximately 5-degree resolution
(9 rows x 18 columns), finer than the 10-degree source but still small
enough for fast tests.
Comment on lines +123 to +124
The domain (-45 to -10 N, 110 to 155 E) lies entirely in the southern
hemisphere, well away from the wrap-around boundaries. Both -180:180 and
Comment on lines +134 to +135
The domain (-48 to -33 N, 165 to 180 E) lies near the International
Dateline at 180 degrees east. This tests that extraction near the eastern
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.

2 participants