Skip to content

Commit

Permalink
Fix typos in docs and code
Browse files Browse the repository at this point in the history
  • Loading branch information
Armavica committed Oct 18, 2024
1 parent 80010c8 commit 097e549
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DATATREE_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ A number of other API changes have been made, which should only require minor mo
- The method `DataTree.to_dataset()` still exists but now has different options for controlling which variables are present on the resulting `Dataset`, e.g. `inherit=True/False`.
- `DataTree.copy()` also has a new `inherit` keyword argument for controlling whether or not coordinates defined on parents are copied (only relevant when copying a non-root node).
- The `DataTree.parent` property is now read-only. To assign a ancestral relationships directly you must instead use the `.children` property on the parent node, which remains settable.
- Similarly the `parent` kwarg has been removed from the `DataTree.__init__` constuctor.
- Similarly the `parent` kwarg has been removed from the `DataTree.__init__` constructor.
- DataTree objects passed to the `children` kwarg in `DataTree.__init__` are now shallow-copied.
- `DataTree.as_array` has been replaced by `DataTree.to_dataarray`.
- A number of methods which were not well tested have been (temporarily) disabled. In general we have tried to only keep things that are known to work, with the plan to increase API surface incrementally after release.
Expand Down
6 changes: 3 additions & 3 deletions doc/user-guide/data-structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ We have created a tree with three nodes in it:
Consistency checks are enforced. For instance, if we try to create a ``cycle``,
where the root node is also a child of a decendent, the constructor will raise
where the root node is also a child of a descendent, the constructor will raise
an (:py:class:`~xarray.InvalidTreeError`):

.. ipython:: python
Expand Down Expand Up @@ -710,8 +710,8 @@ inherited dimensions, but DataTree's inheritance is slightly stricter yet
easier to reason about.

The constraint that this puts on a DataTree is that dimensions and indices that
are inherited must be aligned with any direct decendent node's existing
dimension or index. This allows decendents to use dimensions defined in
are inherited must be aligned with any direct descendent node's existing
dimension or index. This allows descendents to use dimensions defined in
ancestor nodes, without duplicating that information. But as a consequence, if
a dimension-name is defined in on a node and that same dimension-name
exists in one of its ancestors, they must align (have the same index and
Expand Down
4 changes: 2 additions & 2 deletions doc/user-guide/hierarchical-data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Let's use a different example of a tree to discuss more complex relationships be
"/Bony Skeleton/Four Limbs/Amniotic Egg/Two Fenestrae/Dinosaurs"
]
We have used the :py:meth:`~xarray.DataTree.from_dict` constructor method as a prefered way to quickly create a whole tree,
We have used the :py:meth:`~xarray.DataTree.from_dict` constructor method as a preferred way to quickly create a whole tree,
and :ref:`filesystem paths` (to be explained shortly) to select two nodes of interest.

.. ipython:: python
Expand Down Expand Up @@ -658,7 +658,7 @@ Data Alignment
~~~~~~~~~~~~~~

The data in different datatree nodes are not totally independent. In particular dimensions (and indexes) in child nodes must be exactly aligned with those in their parent nodes.
Exact aligment means that shared dimensions must be the same length, and indexes along those dimensions must be equal.
Exact alignment means that shared dimensions must be the same length, and indexes along those dimensions must be equal.

.. note::
If you were a previous user of the prototype `xarray-contrib/datatree <https://github.com/xarray-contrib/datatree>`_ package, this is different from what you're used to!
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ def reset_coords(
return self._replace(coords=dataset._variables)
if self.name is None:
raise ValueError(
"cannot reset_coords with drop=False on an unnamed DataArrray"
"cannot reset_coords with drop=False on an unnamed DataArray"
)
dataset[self.name] = self.variable
return dataset
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ def group_by_index(
return index_coords

def to_pandas_indexes(self) -> Indexes[pd.Index]:
"""Returns an immutable proxy for Dataset or DataArrary pandas indexes.
"""Returns an immutable proxy for Dataset or DataArray pandas indexes.
Raises an error if this proxy contains indexes that cannot be coerced to
pandas.Index objects.
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3797,7 +3797,7 @@ def test_to_dataset_retains_keys(self) -> None:

array = DataArray([1, 2, 3], coords=[("x", dates)], attrs={"a": 1})

# convert to dateset and back again
# convert to dataset and back again
result = array.to_dataset("x").to_dataarray(dim="x")

assert_equal(array, result)
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3206,7 +3206,7 @@ def test_rename_multiindex(self) -> None:
with pytest.raises(ValueError, match=r"'b' conflicts"):
original.rename({"a": "b"})

def test_rename_perserve_attrs_encoding(self) -> None:
def test_rename_preserve_attrs_encoding(self) -> None:
# test propagate attrs/encoding to new variable(s) created from Index object
original = Dataset(coords={"x": ("x", [0, 1, 2])})
expected = Dataset(coords={"y": ("y", [0, 1, 2])})
Expand Down

0 comments on commit 097e549

Please sign in to comment.