-
Notifications
You must be signed in to change notification settings - Fork 297
Stricter array summary in CML output #6743
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
base: main
Are you sure you want to change the base?
Conversation
- Add `checksum` to _DimensionalMetadata xml. - New `masked_count` attr added to cube and _DimensionalMetadata xml.
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.
@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.""" |
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.
@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) |
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.
@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.
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 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)) | ||
) |
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.
@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?
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
🚀 Pull Request
Closes: #6244
Description
Consult Iris pull request check list
Add any of the below labels to trigger actions on this PR: