-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove unvetted DataTree methods #9585
base: main
Are you sure you want to change the base?
Changes from all commits
be1e0f9
2ddf241
7b4178e
b3be878
4259f1e
9d1a1d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -725,17 +725,18 @@ Manipulate the contents of all nodes in a ``DataTree`` simultaneously. | |
:toctree: generated/ | ||
|
||
DataTree.copy | ||
DataTree.assign_coords | ||
DataTree.merge | ||
DataTree.rename | ||
DataTree.rename_vars | ||
DataTree.rename_dims | ||
DataTree.swap_dims | ||
DataTree.expand_dims | ||
DataTree.drop_vars | ||
DataTree.drop_dims | ||
DataTree.set_coords | ||
DataTree.reset_coords | ||
|
||
.. DataTree.assign_coords | ||
.. DataTree.merge | ||
.. DataTree.rename | ||
.. DataTree.rename_vars | ||
.. DataTree.rename_dims | ||
.. DataTree.swap_dims | ||
.. DataTree.expand_dims | ||
.. DataTree.drop_vars | ||
.. DataTree.drop_dims | ||
.. DataTree.set_coords | ||
.. DataTree.reset_coords | ||
|
||
DataTree Node Contents | ||
---------------------- | ||
|
@@ -760,129 +761,129 @@ Compare one ``DataTree`` object to another. | |
DataTree.equals | ||
DataTree.identical | ||
|
||
Indexing | ||
-------- | ||
|
||
Index into all nodes in the subtree simultaneously. | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
DataTree.isel | ||
DataTree.sel | ||
DataTree.drop_sel | ||
DataTree.drop_isel | ||
DataTree.head | ||
DataTree.tail | ||
DataTree.thin | ||
DataTree.squeeze | ||
DataTree.interp | ||
DataTree.interp_like | ||
DataTree.reindex | ||
DataTree.reindex_like | ||
DataTree.set_index | ||
DataTree.reset_index | ||
DataTree.reorder_levels | ||
DataTree.query | ||
|
||
.. | ||
|
||
Missing: | ||
``DataTree.loc`` | ||
|
||
|
||
Missing Value Handling | ||
---------------------- | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
DataTree.isnull | ||
DataTree.notnull | ||
DataTree.combine_first | ||
DataTree.dropna | ||
DataTree.fillna | ||
DataTree.ffill | ||
DataTree.bfill | ||
DataTree.interpolate_na | ||
DataTree.where | ||
DataTree.isin | ||
|
||
Computation | ||
----------- | ||
|
||
Apply a computation to the data in all nodes in the subtree simultaneously. | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
DataTree.map | ||
DataTree.reduce | ||
DataTree.diff | ||
DataTree.quantile | ||
DataTree.differentiate | ||
DataTree.integrate | ||
DataTree.map_blocks | ||
DataTree.polyfit | ||
DataTree.curvefit | ||
|
||
Aggregation | ||
----------- | ||
|
||
Aggregate data in all nodes in the subtree simultaneously. | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
DataTree.all | ||
DataTree.any | ||
DataTree.argmax | ||
DataTree.argmin | ||
DataTree.idxmax | ||
DataTree.idxmin | ||
DataTree.max | ||
DataTree.min | ||
DataTree.mean | ||
DataTree.median | ||
DataTree.prod | ||
DataTree.sum | ||
DataTree.std | ||
DataTree.var | ||
DataTree.cumsum | ||
DataTree.cumprod | ||
|
||
ndarray methods | ||
--------------- | ||
|
||
Methods copied from :py:class:`numpy.ndarray` objects, here applying to the data in all nodes in the subtree. | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
DataTree.argsort | ||
DataTree.astype | ||
DataTree.clip | ||
DataTree.conj | ||
DataTree.conjugate | ||
DataTree.round | ||
DataTree.rank | ||
|
||
Reshaping and reorganising | ||
-------------------------- | ||
|
||
Reshape or reorganise the data in all nodes in the subtree. | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
DataTree.transpose | ||
DataTree.stack | ||
DataTree.unstack | ||
DataTree.shift | ||
DataTree.roll | ||
DataTree.pad | ||
DataTree.sortby | ||
DataTree.broadcast_like | ||
.. Indexing | ||
.. -------- | ||
|
||
.. Index into all nodes in the subtree simultaneously. | ||
|
||
.. .. autosummary:: | ||
.. :toctree: generated/ | ||
|
||
.. DataTree.isel | ||
.. DataTree.sel | ||
.. DataTree.drop_sel | ||
.. DataTree.drop_isel | ||
.. DataTree.head | ||
.. DataTree.tail | ||
.. DataTree.thin | ||
.. DataTree.squeeze | ||
.. DataTree.interp | ||
.. DataTree.interp_like | ||
.. DataTree.reindex | ||
.. DataTree.reindex_like | ||
.. DataTree.set_index | ||
.. DataTree.reset_index | ||
Comment on lines
+782
to
+785
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclear to me whether these methods would count as "manipulating structure" or "manipulating data"... |
||
.. DataTree.reorder_levels | ||
.. DataTree.query | ||
|
||
.. .. | ||
|
||
.. Missing: | ||
.. ``DataTree.loc`` | ||
Comment on lines
+791
to
+792
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are some other methods mentioned in the API docs page as "Missing:" - these references should also be commented out or deleted. |
||
|
||
|
||
.. Missing Value Handling | ||
.. ---------------------- | ||
|
||
.. .. autosummary:: | ||
.. :toctree: generated/ | ||
|
||
.. DataTree.isnull | ||
.. DataTree.notnull | ||
.. DataTree.combine_first | ||
.. DataTree.dropna | ||
.. DataTree.fillna | ||
.. DataTree.ffill | ||
.. DataTree.bfill | ||
.. DataTree.interpolate_na | ||
.. DataTree.where | ||
.. DataTree.isin | ||
|
||
.. Computation | ||
.. ----------- | ||
|
||
.. Apply a computation to the data in all nodes in the subtree simultaneously. | ||
|
||
.. .. autosummary:: | ||
.. :toctree: generated/ | ||
|
||
.. DataTree.map | ||
.. DataTree.reduce | ||
.. DataTree.diff | ||
.. DataTree.quantile | ||
.. DataTree.differentiate | ||
.. DataTree.integrate | ||
.. DataTree.map_blocks | ||
.. DataTree.polyfit | ||
.. DataTree.curvefit | ||
|
||
.. Aggregation | ||
.. ----------- | ||
|
||
.. Aggregate data in all nodes in the subtree simultaneously. | ||
|
||
.. .. autosummary:: | ||
.. :toctree: generated/ | ||
|
||
.. DataTree.all | ||
.. DataTree.any | ||
.. DataTree.argmax | ||
.. DataTree.argmin | ||
.. DataTree.idxmax | ||
.. DataTree.idxmin | ||
.. DataTree.max | ||
.. DataTree.min | ||
.. DataTree.mean | ||
.. DataTree.median | ||
.. DataTree.prod | ||
.. DataTree.sum | ||
.. DataTree.std | ||
.. DataTree.var | ||
.. DataTree.cumsum | ||
.. DataTree.cumprod | ||
|
||
.. ndarray methods | ||
.. --------------- | ||
|
||
.. Methods copied from :py:class:`numpy.ndarray` objects, here applying to the data in all nodes in the subtree. | ||
|
||
.. .. autosummary:: | ||
.. :toctree: generated/ | ||
|
||
.. DataTree.argsort | ||
.. DataTree.astype | ||
.. DataTree.clip | ||
.. DataTree.conj | ||
.. DataTree.conjugate | ||
.. DataTree.round | ||
.. DataTree.rank | ||
|
||
.. Reshaping and reorganising | ||
.. -------------------------- | ||
|
||
.. Reshape or reorganise the data in all nodes in the subtree. | ||
|
||
.. .. autosummary:: | ||
.. :toctree: generated/ | ||
|
||
.. DataTree.transpose | ||
.. DataTree.stack | ||
.. DataTree.unstack | ||
.. DataTree.shift | ||
.. DataTree.roll | ||
.. DataTree.pad | ||
.. DataTree.sortby | ||
.. DataTree.broadcast_like | ||
|
||
IO / Conversion | ||
=============== | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -314,19 +314,23 @@ And you can get a copy of just the node local values of :py:class:`~xarray.Datas | |||||||||||||||||||||||
ds_node_local = dt["simulation/coarse"].to_dataset(inherited=False) | ||||||||||||||||||||||||
ds_node_local | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Operations map over subtrees, so we can take a mean over the ``x`` dimension of both the ``fine`` and ``coarse`` groups just by: | ||||||||||||||||||||||||
We intend to eventually implement most :py:class:`~xarray.Dataset` methods | ||||||||||||||||||||||||
(indexing, aggregation, arithmetic, etc) on :py:class:`~xarray.DataTree` | ||||||||||||||||||||||||
objects, but many methods have not been implemented yet. | ||||||||||||||||||||||||
Comment on lines
+317
to
+319
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put this in a note
Suggested change
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
.. ipython:: python | ||||||||||||||||||||||||
.. Operations map over subtrees, so we can take a mean over the ``x`` dimension of both the ``fine`` and ``coarse`` groups just by: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
.. .. ipython:: python | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
avg = dt["simulation"].mean(dim="x") | ||||||||||||||||||||||||
avg | ||||||||||||||||||||||||
.. avg = dt["simulation"].mean(dim="x") | ||||||||||||||||||||||||
.. avg | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Here the ``"x"`` dimension used is always the one local to that subgroup. | ||||||||||||||||||||||||
.. Here the ``"x"`` dimension used is always the one local to that subgroup. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
You can do almost everything you can do with :py:class:`~xarray.Dataset` objects with :py:class:`~xarray.DataTree` objects | ||||||||||||||||||||||||
(including indexing and arithmetic), as operations will be mapped over every subgroup in the tree. | ||||||||||||||||||||||||
This allows you to work with multiple groups of non-alignable variables at once. | ||||||||||||||||||||||||
.. You can do almost everything you can do with :py:class:`~xarray.Dataset` objects with :py:class:`~xarray.DataTree` objects | ||||||||||||||||||||||||
.. (including indexing and arithmetic), as operations will be mapped over every subgroup in the tree. | ||||||||||||||||||||||||
.. This allows you to work with multiple groups of non-alignable variables at once. | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
.. note:: | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the decision here that these methods should act locally rather than mapping over the subtree? And the distinction being between methods which manipulate structure versus methods which manipulate data - the latter map over the whole tree?