From 65a7d244f5815c2593d7461242aa3cd7c5dce09f Mon Sep 17 00:00:00 2001 From: Tom Nicholas Date: Fri, 19 Jan 2024 17:42:02 -0500 Subject: [PATCH] Add Pathlike methods to api docs https://github.com/xarray-contrib/datatree/pull/287 * move from_dict to creation methods * add section for pathlib-like interface * add suggestions for missing pathlib-like api --- xarray/datatree_/docs/source/api.rst | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/xarray/datatree_/docs/source/api.rst b/xarray/datatree_/docs/source/api.rst index 417b849575d..d325d24f4a4 100644 --- a/xarray/datatree_/docs/source/api.rst +++ b/xarray/datatree_/docs/source/api.rst @@ -10,10 +10,13 @@ DataTree Creating a DataTree ------------------- +Methods of creating a datatree. + .. autosummary:: :toctree: generated/ DataTree + DataTree.from_dict Tree Attributes --------------- @@ -66,7 +69,7 @@ This interface echoes that of ``xarray.Dataset``. DataTree.is_empty DataTree.is_hollow -Dictionary interface +Dictionary Interface -------------------- ``DataTree`` objects also have a dict-like interface mapping keys to either ``xarray.DataArray``s or to child ``DataTree`` nodes. @@ -102,6 +105,30 @@ For manipulating, traversing, navigating, or mapping over the tree structure. DataTree.match DataTree.filter +Pathlib-like Interface +---------------------- + +``DataTree`` objects deliberately echo some of the API of `pathlib.PurePath`. + +.. autosummary:: + :toctree: generated/ + + DataTree.name + DataTree.parent + DataTree.parents + DataTree.relative_to + +Missing: + +.. + + ``DataTree.glob`` + ``DataTree.joinpath`` + ``DataTree.with_name`` + ``DataTree.walk`` + ``DataTree.rename`` + ``DataTree.replace`` + DataTree Contents ----------------- @@ -276,13 +303,12 @@ Plotting I/O === -Create or +Open a datatree from an on-disk store or serialize the tree. .. autosummary:: :toctree: generated/ open_datatree - DataTree.from_dict DataTree.to_dict DataTree.to_netcdf DataTree.to_zarr