Skip to content

str representation of numpy scalars in cube summary#6966

Merged
ESadek-MO merged 2 commits intoSciTools:mainfrom
ukmo-ccbunney:cube_summary_numpy_scalars
Mar 4, 2026
Merged

str representation of numpy scalars in cube summary#6966
ESadek-MO merged 2 commits intoSciTools:mainfrom
ukmo-ccbunney:cube_summary_numpy_scalars

Conversation

@ukmo-ccbunney
Copy link
Contributor

🚀 Pull Request

Fixes: #6692

Updates cube_summary.py to use str representation for numpy scalar attribute values in Cube and Coord summaries.

For a cube attribute like this:

cube.attributes['numpy_scalar'] = np.float32(123.456)

The cube summary will look like this:

<snip>
Attributes:
        scalar                      123.456

rather than this:

<snip>
Attributes:
        scalar                      np.float32(123.456)

@ukmo-ccbunney ukmo-ccbunney requested a review from ESadek-MO March 3, 2026 16:32
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.11%. Comparing base (955e247) to head (cc870f1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6966   +/-   ##
=======================================
  Coverage   90.11%   90.11%           
=======================================
  Files          91       91           
  Lines       24912    24912           
  Branches     4675     4675           
=======================================
  Hits        22449    22449           
  Misses       1684     1684           
  Partials      779      779           

☔ 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.

Copy link
Contributor

@ESadek-MO ESadek-MO left a comment

Choose a reason for hiding this comment

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

LGTM thanks @ukmo-ccbunney

@ESadek-MO ESadek-MO merged commit bf992a8 into SciTools:main Mar 4, 2026
24 checks passed
trexfeathers added a commit to trexfeathers/iris that referenced this pull request Mar 4, 2026
ukmo-ccbunney pushed a commit that referenced this pull request Mar 4, 2026
* Correction for #6816 What's New entry.

* Fix indents for #6966 entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Cube attributes with numbers are decorated with np.int and np.float instead of plain number

3 participants