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

compatibility with xr.DataTree #607

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

Conversation

mathause
Copy link
Member

  • Closes #xxx
  • Tests added
  • Fully documented, including CHANGELOG.rst

Adds compatibility with xr.DataTree. Works (at least locally) but is not finished and needs some ugly workarounds due to some design decisions in the new version... The new code path is only tested in upstream-dev ci.

I am not sure we should support both, datatree and xarray datatree, but this was actually the smaller part of the whole operation.

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 80.32787% with 12 lines in your changes missing coverage. Please review.

Project coverage is 80.26%. Comparing base (681fa61) to head (db63955).

Files with missing lines Patch % Lines
mesmer/core/_datatreecompat.py 40.00% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #607      +/-   ##
==========================================
- Coverage   80.40%   80.26%   -0.14%     
==========================================
  Files          49       50       +1     
  Lines        3082     3121      +39     
==========================================
+ Hits         2478     2505      +27     
- Misses        604      616      +12     
Flag Coverage Δ
unittests 80.26% <80.32%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@mathause mathause closed this Jan 31, 2025
@mathause mathause reopened this Jan 31, 2025
@mathause
Copy link
Member Author

The upstream packages seem flaky

Copy link
Collaborator

@veni-vidi-vici-dormivi veni-vidi-vici-dormivi left a comment

Choose a reason for hiding this comment

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

Wow thanks, that is a lot of work! I think it's okay not to support xarray-datatree at all then, since it is not recommended to use it anyway.

tests/integration/test_calibrate_mesmer_newcodepath.py Outdated Show resolved Hide resolved
Copy link
Member Author

@mathause mathause left a comment

Choose a reason for hiding this comment

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

Thanks. It was mostly annoying because 98 % I did not understand what is happening 🤷‍♂️

As long as we need to patch xr.map_over_datasets we can just as well support datatree (because we need to import from _datatreecompat anyway.

It's annoying that the new version has become so bothersome to work with 😒


# https://github.com/pydata/xarray/issues/10013
# tas_anoms = dt - ref.ds
tas_anoms = map_over_datasets(operator.sub, dt, ref.ds)
Copy link
Member Author

Choose a reason for hiding this comment

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

This takes all the fun out of using xr.DataTree and cannot be expected from a user. The other 'issues' (missing methods) will probably be fixed in time but this seems to be a design decision. 👎

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes I agree.

tests/integration/test_calibrate_mesmer_newcodepath.py Outdated Show resolved Hide resolved
@mathause
Copy link
Member Author

mathause commented Feb 3, 2025

I have not yet updated the example scripts and we need to fix the pin for xarray (so it's not only tested in upstream-dev ci).

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

Successfully merging this pull request may close these issues.

2 participants