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

Implement dataless cubes #6253

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

Implement dataless cubes #6253

wants to merge 58 commits into from

Conversation

ESadek-MO
Copy link
Contributor

@ESadek-MO ESadek-MO commented Dec 11, 2024

Closes #4447.

I plan to do this in four stages:

  • Ensure that cubes can handle data is None when handed a shape value, and can essentially round-trip removing and adding data. This shouldn't break existing tests. 71c7ae8
  • Create new tests for the above. b2fb2f8
  • Ensure that all DataManager methods all make sense and work with None data. DataManager.copy() is an example of a method that won't make sense with None data.
  • Create new tests for the above.

@ESadek-MO ESadek-MO marked this pull request as draft December 11, 2024 11:36
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 81.05263% with 18 lines in your changes missing coverage. Please review.

Project coverage is 89.74%. Comparing base (d135ebb) to head (f8c5d95).
Report is 38 commits behind head on main.

Files with missing lines Patch % Lines
lib/iris/_data_manager.py 91.52% 3 Missing and 2 partials ⚠️
lib/iris/_merge.py 0.00% 2 Missing and 2 partials ⚠️
lib/iris/cube.py 83.33% 1 Missing and 2 partials ⚠️
lib/iris/_concatenate.py 60.00% 1 Missing and 1 partial ⚠️
lib/iris/_lazy_data.py 50.00% 1 Missing and 1 partial ⚠️
lib/iris/exceptions.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6253      +/-   ##
==========================================
- Coverage   89.83%   89.74%   -0.10%     
==========================================
  Files          88       88              
  Lines       23347    23467     +120     
  Branches     4344     4383      +39     
==========================================
+ Hits        20974    21060      +86     
- Misses       1646     1664      +18     
- Partials      727      743      +16     

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

@ESadek-MO
Copy link
Contributor Author

Something is wrong with the _assert_axiom code now. I need to catch a bus, so will have to figure out why tomorrow.

@ESadek-MO
Copy link
Contributor Author

ESadek-MO commented Dec 23, 2024

Although the tests are passing, next time I look at this, I need to investigate the data setter. Currently, line 256 causes issues, as self._shape should be changable if self._shape = (), and it won't be.

That is to say, it works as expected, but I believe it hasn't been written in such a way as it SHOULD be.


@property
def shape(self):
"""The shape of the data being managed."""
return self.core_data().shape
return self._shape if self._shape else self.core_data().shape
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is defensive; it wouldn't cause any issues that I can think of to just have return self._shape, but this should protect us in case I've missed something.

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've actually removed this now.

() is falsy. I could have easily done ...if self._shape is not None, but I decided there's no point in adding redundant code. Easy undo if my reviewer disagrees!

state = is_lazy ^ is_real
assert state, emsg.format("" if is_lazy else "no ", "" if is_real else "no ")

if not (is_lazy ^ is_real):
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be clearer as if is_lazy == is_real.

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 did see this, but forgot to comment.
Personally, I think I prefer it as it is, but if there's significant desire for your suggestion, I don't mind.

lib/iris/_data_manager.py Outdated Show resolved Hide resolved
@pp-mo pp-mo requested a review from bjlittle February 7, 2025 14:29
@pp-mo pp-mo assigned bjlittle and unassigned bjlittle and HGWright Feb 7, 2025
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
Status: 👀 In Review
Development

Successfully merging this pull request may close these issues.

A Dataless Cube
4 participants