Skip to content
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

Adds a warning for iris.coord_categorisation.add_season_membership that this is not saveable as a boolean coordinate. #6305

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

HGWright
Copy link
Contributor

@HGWright HGWright commented Feb 5, 2025

🚀 Pull Request

Description

This addresses #5909, by raising a warning that since this adds a boolean, the result will not be saveable to a Netcdf file since it contains a boolean coordinate.

Note for reviewer:
I was not 100% sure on the type of error to raise either iris.warnings.IrisSaveWarning or iris.warnings.IrisCfSaveWarning since this a problem with Netcdf files.

Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.80%. Comparing base (d1b66b8) to head (cf32555).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6305   +/-   ##
=======================================
  Coverage   89.80%   89.80%           
=======================================
  Files          90       90           
  Lines       23752    23755    +3     
  Branches     4418     4418           
=======================================
+ Hits        21331    21334    +3     
  Misses       1672     1672           
  Partials      749      749           

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

@trexfeathers trexfeathers self-assigned this Feb 12, 2025
Copy link
Contributor

@trexfeathers trexfeathers left a comment

Choose a reason for hiding this comment

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

Thanks @HGWright; I think we can increase this warning's value by widening its scope.

"The 'season_membership' coordinate is a boolean and will not be"
"saveable to a NetCDF file. If you need to save the file you can"
"convert them to integers using coord.points = coord.points.astype(int)",
category=iris.warnings.IrisCfSaveWarning,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
category=iris.warnings.IrisCfSaveWarning,
category=iris.warnings.IrisSaveWarning,

This does not relate to CF itself, but to the NetCDF file format.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please can you add a What's New entry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

iris.coord_categorisation.add_season_membership creates a boolean coordinate that cannot be saved to netcdf
2 participants