Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Integrate variables into DataTree #41

Merged
merged 43 commits into from
Jun 16, 2022
Merged

Conversation

TomNicholas
Copy link
Member

@TomNicholas TomNicholas commented Sep 22, 2021

Began sketching out how we might move to integrate variables and children to exist at the same level within a DataTree node. Would eventually close #38, and would close #2.

@TomNicholas TomNicholas marked this pull request as draft September 22, 2021 21:06
@TomNicholas TomNicholas added this to the 0.1 milestone Apr 27, 2022
@TomNicholas TomNicholas added enhancement New feature or request design question labels May 18, 2022
@TomNicholas TomNicholas mentioned this pull request May 19, 2022
@TomNicholas TomNicholas marked this pull request as ready for review May 23, 2022 19:57
@TomNicholas
Copy link
Member Author

Not sure why this is happening only on some test runs

_______________ ERROR collecting datatree/tests/test_treenode.py _______________
ImportError while importing test module '/home/runner/work/datatree/datatree/datatree/tests/test_treenode.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/share/miniconda/envs/datatree/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
datatree/__init__.py:7: in <module>
    from .datatree import DataTree
datatree/datatree.py:29: in <module>
    from xarray.core.variable import Variable, calculate_dimensions
E   ImportError: cannot import name 'calculate_dimensions' from 'xarray.core.variable' (/usr/share/miniconda/envs/datatree/lib/python3.9/site-packages/xarray/core/variable.py)

@TomNicholas TomNicholas mentioned this pull request May 31, 2022
3 tasks
datatree/datatree.py Outdated Show resolved Hide resolved
ci/doc.yml Outdated Show resolved Hide resolved
@TomNicholas
Copy link
Member Author

TomNicholas commented Jun 9, 2022

That passes 🍾

Will I need to change something in the conda-forge recipe to ensure that conda installations of datatree point to the pre-release of xarray now?

EDIT: I definitely have to change this line somehow

@malmans2
Copy link
Member

That passes 🍾

Will I need to change something in the conda-forge recipe to ensure that conda installations of datatree point to the pre-release of xarray now?

EDIT: I definitely have to change this line somehow

Yes, after releasing a new version of xarray-datatree on PyPI, https://github.com/regro-cf-autotick-bot will open a PR and I'm pretty sure that you'll have to edit that line before merging.

@TomNicholas TomNicholas merged commit c2b6400 into main Jun 16, 2022
@TomNicholas TomNicholas deleted the initial_integration_refactor branch June 16, 2022 15:27
@TomNicholas TomNicholas restored the initial_integration_refactor branch June 16, 2022 15:28
@TomNicholas TomNicholas deleted the initial_integration_refactor branch June 16, 2022 15:28
@TomNicholas TomNicholas mentioned this pull request Jun 17, 2022
flamingbear pushed a commit to flamingbear/rewritten-datatree that referenced this pull request Jan 19, 2024
* sketching out changes needed to integrate variables into DataTree

* fixed some other basic conflicts

* fix mypy errors

* can create basic datatree node objects again

* child-variable name collisions dectected correctly

* in-progres

* add _replace method

* updated tests to assert identical instead of check .ds is expected_ds

* refactor .ds setter to use _replace

* refactor init to use _replace

* refactor test tree to avoid init

* attempt at copy methods

* rewrote implementation of .copy method

* xfailing test for deepcopying

* pseudocode implementation of DatasetView

* Revert "pseudocode implementation of DatasetView"

This reverts commit 52ef23baaa4b6892cad2d69c61b43db831044630.

* removed duplicated implementation of copy

* reorganise API docs

* expose data_vars, coords etc. properties

* try except with calculate_dimensions private import

* add keys/values/items methods

* don't use has_data when .variables would do

* explanation of basic properties

* add data structures page to index

* revert adding documentation in favour of that going in a different PR

* correct deepcopy tests

* use .data_vars in copy tests

* make imports depend on most recent version of xarray

Co-authored-by: Mattia Almansi <m.almansi@bopen.eu>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove try except for internal import

* depend on latest pre-release of xarray

* correct name of version

* xarray pre-release under pip in ci envs

* correct methods

* whatsnews

* improve docstrings

Co-authored-by: Mattia Almansi <m.almansi@bopen.eu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
design question enhancement New feature or request
Projects
None yet
3 participants