Skip to content

Text repr: remove "Dimensions without coordinates" section #10489

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 0 additions & 11 deletions xarray/computation/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ def cross(
>>> xr.cross(a, b, dim="dim_0")
<xarray.DataArray (dim_0: 3)> Size: 24B
array([-3, 6, -3])
Dimensions without coordinates: dim_0

Vector cross-product with 3 dimensions but zeros at the last axis
yields the same results as with 2 dimensions:
Expand All @@ -355,7 +354,6 @@ def cross(
>>> xr.cross(a, b, dim="dim_0")
<xarray.DataArray (dim_0: 3)> Size: 24B
array([ 0, 0, -3])
Dimensions without coordinates: dim_0

Multiple vector cross-products. Note that the direction of the
cross product vector is defined by the right-hand rule:
Expand Down Expand Up @@ -397,7 +395,6 @@ def cross(
>>> c.to_dataset(dim="cartesian")
<xarray.Dataset> Size: 24B
Dimensions: (dim_0: 1)
Dimensions without coordinates: dim_0
Data variables:
x (dim_0) int64 8B -3
y (dim_0) int64 8B 6
Expand Down Expand Up @@ -526,7 +523,6 @@ def dot(
array([[0, 1],
[2, 3],
[4, 5]])
Dimensions without coordinates: a, b

>>> da_b
<xarray.DataArray (a: 3, b: 2, c: 2)> Size: 96B
Expand All @@ -538,36 +534,30 @@ def dot(
<BLANKLINE>
[[ 8, 9],
[10, 11]]])
Dimensions without coordinates: a, b, c

>>> da_c
<xarray.DataArray (c: 2, d: 3)> Size: 48B
array([[0, 1, 2],
[3, 4, 5]])
Dimensions without coordinates: c, d

>>> xr.dot(da_a, da_b, dim=["a", "b"])
<xarray.DataArray (c: 2)> Size: 16B
array([110, 125])
Dimensions without coordinates: c

>>> xr.dot(da_a, da_b, dim=["a"])
<xarray.DataArray (b: 2, c: 2)> Size: 32B
array([[40, 46],
[70, 79]])
Dimensions without coordinates: b, c

>>> xr.dot(da_a, da_b, da_c, dim=["b", "c"])
<xarray.DataArray (a: 3, d: 3)> Size: 72B
array([[ 9, 14, 19],
[ 93, 150, 207],
[273, 446, 619]])
Dimensions without coordinates: a, d

>>> xr.dot(da_a, da_b)
<xarray.DataArray (c: 2)> Size: 16B
array([110, 125])
Dimensions without coordinates: c

>>> xr.dot(da_a, da_b, dim=...)
<xarray.DataArray ()> Size: 8B
Expand Down Expand Up @@ -715,7 +705,6 @@ def where(cond, x, y, keep_attrs=None):
<xarray.DataArray (x: 2, y: 2)> Size: 32B
array([[1, 2],
[0, 0]])
Dimensions without coordinates: x, y

See Also
--------
Expand Down
7 changes: 0 additions & 7 deletions xarray/computation/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ def construct(
[nan, 4., 5.],
[ 4., 5., 6.],
[ 5., 6., 7.]]])
Dimensions without coordinates: a, b, window_dim

>>> rolling = da.rolling(b=3, center=True)
>>> rolling.construct("window_dim")
Expand All @@ -406,7 +405,6 @@ def construct(
[ 4., 5., 6.],
[ 5., 6., 7.],
[ 6., 7., nan]]])
Dimensions without coordinates: a, b, window_dim

"""

Expand Down Expand Up @@ -536,20 +534,17 @@ def reduce(
[nan, 4., 5.],
[ 4., 5., 6.],
[ 5., 6., 7.]]])
Dimensions without coordinates: a, b, window_dim

>>> rolling.reduce(np.sum)
<xarray.DataArray (a: 2, b: 4)> Size: 64B
array([[nan, nan, 3., 6.],
[nan, nan, 15., 18.]])
Dimensions without coordinates: a, b

>>> rolling = da.rolling(b=3, min_periods=1)
>>> rolling.reduce(np.nansum)
<xarray.DataArray (a: 2, b: 4)> Size: 64B
array([[ 0., 1., 3., 6.],
[ 4., 9., 15., 18.]])
Dimensions without coordinates: a, b
"""

keep_attrs = self._get_keep_attrs(keep_attrs)
Expand Down Expand Up @@ -1144,7 +1139,6 @@ def construct(
<xarray.DataArray (year: 2, month: 12)> Size: 192B
array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
[12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]])
Dimensions without coordinates: year, month

See Also
--------
Expand Down Expand Up @@ -1299,7 +1293,6 @@ def reduce(
<xarray.DataArray (a: 2, b: 2)> Size: 32B
array([[ 1, 5],
[ 9, 13]])
Dimensions without coordinates: a, b
"""
wrapped_func = self._reduce_method(func)
return wrapped_func(self, keep_attrs=keep_attrs, **kwargs)
Expand Down
6 changes: 0 additions & 6 deletions xarray/computation/rolling_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def mean(self, keep_attrs: bool | None = None) -> T_DataWithCoords:
>>> da.rolling_exp(x=2, window_type="span").mean()
<xarray.DataArray (x: 5)> Size: 40B
array([1. , 1. , 1.69230769, 1.9 , 1.96694215])
Dimensions without coordinates: x
"""

import numbagg
Expand Down Expand Up @@ -146,7 +145,6 @@ def sum(self, keep_attrs: bool | None = None) -> T_DataWithCoords:
>>> da.rolling_exp(x=2, window_type="span").sum()
<xarray.DataArray (x: 5)> Size: 40B
array([1. , 1.33333333, 2.44444444, 2.81481481, 2.9382716 ])
Dimensions without coordinates: x
"""

import numbagg
Expand Down Expand Up @@ -179,7 +177,6 @@ def std(self) -> T_DataWithCoords:
>>> da.rolling_exp(x=2, window_type="span").std()
<xarray.DataArray (x: 5)> Size: 40B
array([ nan, 0. , 0.67936622, 0.42966892, 0.25389527])
Dimensions without coordinates: x
"""

import numbagg
Expand Down Expand Up @@ -209,7 +206,6 @@ def var(self) -> T_DataWithCoords:
>>> da.rolling_exp(x=2, window_type="span").var()
<xarray.DataArray (x: 5)> Size: 40B
array([ nan, 0. , 0.46153846, 0.18461538, 0.06446281])
Dimensions without coordinates: x
"""
dim_order = self.obj.dims
import numbagg
Expand Down Expand Up @@ -237,7 +233,6 @@ def cov(self, other: T_DataWithCoords) -> T_DataWithCoords:
>>> da.rolling_exp(x=2, window_type="span").cov(da**2)
<xarray.DataArray (x: 5)> Size: 40B
array([ nan, 0. , 1.38461538, 0.55384615, 0.19338843])
Dimensions without coordinates: x
"""

dim_order = self.obj.dims
Expand Down Expand Up @@ -267,7 +262,6 @@ def corr(self, other: T_DataWithCoords) -> T_DataWithCoords:
>>> da.rolling_exp(x=2, window_type="span").corr(da.shift(x=1))
<xarray.DataArray (x: 5)> Size: 40B
array([ nan, nan, nan, 0.4330127 , 0.48038446])
Dimensions without coordinates: x
"""

dim_order = self.obj.dims
Expand Down
20 changes: 0 additions & 20 deletions xarray/core/_aggregations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,6 @@ def cumsum(
<xarray.DataTree>
Group: /
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
foo (time) float64 48B 1.0 3.0 6.0 6.0 8.0 8.0

Expand All @@ -1208,7 +1207,6 @@ def cumsum(
<xarray.DataTree>
Group: /
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
foo (time) float64 48B 1.0 3.0 6.0 6.0 8.0 nan
"""
Expand Down Expand Up @@ -1303,7 +1301,6 @@ def cumprod(
<xarray.DataTree>
Group: /
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
foo (time) float64 48B 1.0 2.0 6.0 0.0 0.0 0.0

Expand All @@ -1313,7 +1310,6 @@ def cumprod(
<xarray.DataTree>
Group: /
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
foo (time) float64 48B 1.0 2.0 6.0 0.0 0.0 nan
"""
Expand Down Expand Up @@ -2412,7 +2408,6 @@ def cumsum(
>>> ds.cumsum()
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 3.0 6.0 6.0 8.0 8.0

Expand All @@ -2421,7 +2416,6 @@ def cumsum(
>>> ds.cumsum(skipna=False)
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 3.0 6.0 6.0 8.0 nan
"""
Expand Down Expand Up @@ -2510,7 +2504,6 @@ def cumprod(
>>> ds.cumprod()
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 6.0 0.0 0.0 0.0

Expand All @@ -2519,7 +2512,6 @@ def cumprod(
>>> ds.cumprod(skipna=False)
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 6.0 0.0 0.0 nan
"""
Expand Down Expand Up @@ -5012,7 +5004,6 @@ def cumsum(
>>> ds.groupby("labels").cumsum()
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 3.0 3.0 4.0 1.0

Expand All @@ -5021,7 +5012,6 @@ def cumsum(
>>> ds.groupby("labels").cumsum(skipna=False)
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 3.0 3.0 4.0 nan
"""
Expand Down Expand Up @@ -5116,7 +5106,6 @@ def cumprod(
>>> ds.groupby("labels").cumprod()
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 3.0 0.0 4.0 1.0

Expand All @@ -5125,7 +5114,6 @@ def cumprod(
>>> ds.groupby("labels").cumprod(skipna=False)
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 3.0 0.0 4.0 nan
"""
Expand Down Expand Up @@ -6510,7 +6498,6 @@ def cumsum(
>>> ds.resample(time="3ME").cumsum()
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 5.0 5.0 2.0 2.0

Expand All @@ -6519,7 +6506,6 @@ def cumsum(
>>> ds.resample(time="3ME").cumsum(skipna=False)
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 5.0 5.0 2.0 nan
"""
Expand Down Expand Up @@ -6614,7 +6600,6 @@ def cumprod(
>>> ds.resample(time="3ME").cumprod()
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 6.0 0.0 2.0 2.0

Expand All @@ -6623,7 +6608,6 @@ def cumprod(
>>> ds.resample(time="3ME").cumprod(skipna=False)
<xarray.Dataset> Size: 48B
Dimensions: (time: 6)
Dimensions without coordinates: time
Data variables:
da (time) float64 48B 1.0 2.0 6.0 0.0 2.0 nan
"""
Expand Down Expand Up @@ -9297,7 +9281,6 @@ def cumsum(
array([1., 2., 5., 5., 2., 2.])
Coordinates:
labels (time) <U1 24B 'a' 'b' 'c' 'c' 'b' 'a'
Dimensions without coordinates: time

Use ``skipna`` to control whether NaNs are ignored.

Expand All @@ -9306,7 +9289,6 @@ def cumsum(
array([ 1., 2., 5., 5., 2., nan])
Coordinates:
labels (time) <U1 24B 'a' 'b' 'c' 'c' 'b' 'a'
Dimensions without coordinates: time
"""
return self.reduce(
duck_array_ops.cumsum,
Expand Down Expand Up @@ -9397,7 +9379,6 @@ def cumprod(
array([1., 2., 6., 0., 2., 2.])
Coordinates:
labels (time) <U1 24B 'a' 'b' 'c' 'c' 'b' 'a'
Dimensions without coordinates: time

Use ``skipna`` to control whether NaNs are ignored.

Expand All @@ -9406,7 +9387,6 @@ def cumprod(
array([ 1., 2., 6., 0., 2., nan])
Coordinates:
labels (time) <U1 24B 'a' 'b' 'c' 'c' 'b' 'a'
Dimensions without coordinates: time
"""
return self.reduce(
duck_array_ops.cumprod,
Expand Down
Loading
Loading