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

Migrate datatree.py module into xarray.core. #8789

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ed47ffd
Migrate datatree.py module into xarray.core.
owenlittlejohns Feb 16, 2024
0784196
Add correct PR reference to whats-new.rst.
owenlittlejohns Feb 27, 2024
647582d
Revert to using Union in datatree.py.
owenlittlejohns Feb 28, 2024
26f3e61
Catch remaining unfixed import path.
owenlittlejohns Feb 28, 2024
5e575d7
Fix easier mypy annotations in datatree.py and test_datatree.py.
owenlittlejohns Feb 28, 2024
6b7a15f
Straggling mypy change in datatree.py.
owenlittlejohns Feb 28, 2024
738bf28
datatree.py comment clean-up.
owenlittlejohns Feb 28, 2024
6eaa021
More mypy corrections in datatree.py and test_datatree.py.
owenlittlejohns Feb 29, 2024
0397e67
Removes unnecessary dict wrapper.
flamingbear Mar 4, 2024
c45c56a
DAS-2062: renames as_array -> to_dataarray
flamingbear Mar 4, 2024
b333b1d
DAS-2062: Updates doc string for Datatree.to_zarr
flamingbear Mar 4, 2024
34e00bd
DAS-2062: reverts what-new.rst
flamingbear Mar 4, 2024
c171470
Merge branch 'main' into DAS-2062-migrate-datatree-module-pr
flamingbear Mar 5, 2024
a0d3702
DAS-2062: clarify wording in comment.
flamingbear Mar 5, 2024
869103b
Change Datatree.to_dataarray to call correctly
flamingbear Mar 5, 2024
379bc5c
Merge branch 'main' into DAS-2062-migrate-datatree-module-pr
flamingbear Mar 11, 2024
12590fb
Clarify DataTree's names are still strings now.
flamingbear Mar 14, 2024
8c3ba13
Merge branch 'main' into DAS-2062-migrate-datatree-module-pr
dcherian Mar 15, 2024
5cc7c41
Merge branch 'main' into DAS-2062-migrate-datatree-module-pr
flamingbear Mar 15, 2024
4a53979
DAS-2062: Cast k explicitly to str for typing.
flamingbear Mar 18, 2024
ffa5f71
Ignore mypy errors for DataTree.ds assignment.
owenlittlejohns Mar 19, 2024
881af78
Fix DataTree.update type hint.
owenlittlejohns Mar 19, 2024
3fc4796
Final mypy issue - ignore DataTree.get override.
owenlittlejohns Mar 20, 2024
14b5c02
Update contributors in whats-new.rst
owenlittlejohns Mar 21, 2024
3aaf837
Merge branch 'main' into DAS-2062-migrate-datatree-module-pr
owenlittlejohns Mar 21, 2024
ce68416
Fix GitHub handle.
owenlittlejohns Mar 21, 2024
0ae54cb
Merge branch 'main' into DAS-2062-migrate-datatree-module-pr
flamingbear Mar 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ New Features
Breaking changes
~~~~~~~~~~~~~~~~

- ``Datatree``'s ``as_array`` renamed ``to_dataarray`` to align with ``Dataset``. (:pull:`8789`)
Copy link
Contributor

Choose a reason for hiding this comment

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

@TomNicholas should this have been kept out of breaking changes? mostly because it's not actually released? Wasn't sure where I should keep it. reference

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we never had a need before for "breaking changes that aren't breaking yet but will be, but only relevant for previous users of another package" 😅

These datatree breaking changes really only need to be written down somewhere, even a GH issue, so that we can point to them all at once when it comes time to do the grand reveal.

Copy link
Contributor

Choose a reason for hiding this comment

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

#8807 and reverted. 😬

By `Owen Littlejohns <https://github.com/owenlittlejohns>`_ and `Matt Savoie
<https://github.com/flamingbear>`_


Deprecations
~~~~~~~~~~~~
Expand All @@ -58,7 +62,7 @@ Internal Changes
By `Matt Savoie <https://github.com/flamingbear>`_ and `Tom Nicholas
<https://github.com/TomNicholas>`_.
- Migrates ``datatree`` functionality into ``xarray/core``. (:pull: `8789`)
By `Owen Littlejohns <https://github.com/owenlittlejohns`_ and `Tom Nicholas
By `Owen Littlejohns <https://github.com/owenlittlejohns>`_ and `Tom Nicholas
<https://github.com/TomNicholas>`_.


Expand Down
2 changes: 1 addition & 1 deletion xarray/core/datatree.py

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks - I added these changes in: 2c5e54c

Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ def merge_child_nodes(self, *paths, new_path: T_Path) -> DataTree:

# TODO some kind of .collapse() or .flatten() method to merge a subtree

def as_dataarray(self) -> DataArray:
def to_dataarray(self) -> DataArray:
return self.ds.as_dataarray()

@property
Expand Down
Loading