Skip to content

Conversation

ukmo-ccbunney
Copy link
Contributor

🚀 Pull Request

Closes: #6244

Description


Consult Iris pull request check list


Add any of the below labels to trigger actions on this PR:

  • benchmark_this Request that this pull request be benchmarked to check if it introduces performance shifts

 - Add `checksum` to _DimensionalMetadata xml.
 - New `masked_count` attr added to cube and _DimensionalMetadata xml.
@ukmo-ccbunney ukmo-ccbunney requested a review from bjlittle October 9, 2025 13:07
@bjlittle bjlittle moved this to 🚀 In Progress in 🦌 Iris 3.14 Oct 9, 2025
Copy link
Member

@bjlittle bjlittle left a comment

Choose a reason for hiding this comment

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

@ukmo-ccbunney Lookin' good.

Just some initial comments to consider 👍



def array_checksum(data: np.typing.ArrayLike) -> str:
"""Calculate a checksum for a numpy array."""
Copy link
Member

Choose a reason for hiding this comment

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

@ukmo-ccbunney Minor, but perhaps mention the type of checksum being performed?

I guess you also need to add the usual numpydoc docstring for parameters et al

if hasattr(data, "to_xml_attr"):
result = data._values.to_xml_attr()
else:
result = iris.util.format_array(data)
Copy link
Member

Choose a reason for hiding this comment

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

@ukmo-ccbunney Should we consider deprecating format_array now?

Don't think it's used anywhere else and I guess we're now dropping use of it ourselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suddenly realised that the changes I was making would affect the the cube.xml() function which is part of the public API. Therefore I'll need to keep this for now (and maybe add a deprecation warning to cube.xml) to keep it working as-is.

if np.ma.isMaskedArray(self._values):
element.setAttribute(
"masked_count", str(np.count_nonzero(self._values.mask))
)
Copy link
Member

Choose a reason for hiding this comment

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

@ukmo-ccbunney How aligned with the Cube XML attributes should we be here?

i.e., are state (for lazy payload) and masked_order applicable here too?

@github-project-automation github-project-automation bot moved this from 🚀 In Progress to 👀 In Review in 🦌 Iris 3.14 Oct 9, 2025
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 27.08333% with 105 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.93%. Comparing base (0a881ee) to head (68c4ea8).

Files with missing lines Patch % Lines
lib/iris/util.py 29.06% 60 Missing and 1 partial ⚠️
lib/iris/coords.py 16.12% 22 Missing and 4 partials ⚠️
lib/iris/cube.py 33.33% 16 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6743      +/-   ##
==========================================
- Coverage   90.29%   89.93%   -0.36%     
==========================================
  Files          91       91              
  Lines       24475    24597     +122     
  Branches     4571     4596      +25     
==========================================
+ Hits        22100    22122      +22     
- Misses       1607     1702      +95     
- Partials      768      773       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In Review

Development

Successfully merging this pull request may close these issues.

Rationalise CML Testing

2 participants