From ebf6f5c1d72a5436aac5bdd6a4e0ff20f62f861a Mon Sep 17 00:00:00 2001 From: Emma Marshall Date: Fri, 3 Jun 2022 10:23:08 -0600 Subject: [PATCH 01/15] added example to xarray.Datast.thin() --- xarray/core/dataset.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 38e4d2eadef..e8d569508cd 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2615,6 +2615,21 @@ def thin( The keyword arguments form of ``indexers``. One of indexers or indexers_kwargs must be provided. + Examples + ---------- + #make sample data + >>> x_ls = list(string.ascii_lowercase) + >>> x_arr = np.reshape(np.array(x_ls + ['a'+ letter for letter in x_ls]), (4,13)) + >>> x = xr.DataArray( + x_arr, + dims = ('x',y'), + name = 'alphabet_data', + coords = {'x':[0,2,4,6], 'y':[i for i in range(0,13)]} + ) + + >>> x.thin(3) + >>> x.thin({'x':2,'y':5}) + See Also -------- Dataset.head From bcb6418b951ed275aeb4210d5084499bedc302f1 Mon Sep 17 00:00:00 2001 From: Emma Marshall Date: Fri, 3 Jun 2022 15:38:50 -0600 Subject: [PATCH 02/15] adding tail example to dataarray.py --- xarray/core/dataarray.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index ee4516147de..4a883b9470d 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1474,6 +1474,41 @@ def thin( """Return a new DataArray whose data is given by each `n` value along the specified dimension(s). + Examples + ---------- + >>> x_arr = np.arange(0, 26) + >>> x_arr + 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, 24, 25]) + >>> x = xr.DataArray( + ... np.reshape(x_arr, (2,13)), + ... dims = ('x','y'), + ... coords = {'x':[0,1], 'y':np.arange(0,13)} + ... ) + >>> x_arr + 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, 24, 25]) + >>> x + + 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, 24, 25]]) + Coordinates: + * x (x) int64 0 1 + * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 + >>> + >>> x.thin(3) + + array([[ 0, 3, 6, 9, 12]]) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 3 6 9 12 + >>> x.thin({'x':2,'y':5}) + + array([[ 0, 5, 10]]) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 5 10 + See Also -------- Dataset.thin From dc3efd5820502fcd591976105b50b9b5667b9e82 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 21:43:16 +0000 Subject: [PATCH 03/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/core/dataarray.py | 16 ++++++++-------- xarray/core/dataset.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 4a883b9470d..c837f650d96 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1475,15 +1475,15 @@ def thin( along the specified dimension(s). Examples - ---------- + ---------- >>> x_arr = np.arange(0, 26) >>> x_arr 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, 24, 25]) >>> x = xr.DataArray( - ... np.reshape(x_arr, (2,13)), - ... dims = ('x','y'), - ... coords = {'x':[0,1], 'y':np.arange(0,13)} + ... np.reshape(x_arr, (2, 13)), + ... dims=("x", "y"), + ... coords={"x": [0, 1], "y": np.arange(0, 13)}, ... ) >>> x_arr array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, @@ -1495,20 +1495,20 @@ def thin( Coordinates: * x (x) int64 0 1 * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 - >>> + >>> >>> x.thin(3) array([[ 0, 3, 6, 9, 12]]) Coordinates: * x (x) int64 0 * y (y) int64 0 3 6 9 12 - >>> x.thin({'x':2,'y':5}) + >>> x.thin({"x": 2, "y": 5}) array([[ 0, 5, 10]]) Coordinates: * x (x) int64 0 - * y (y) int64 0 5 10 - + * y (y) int64 0 5 10 + See Also -------- Dataset.thin diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index e8d569508cd..f0e6bc8585f 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2616,7 +2616,7 @@ def thin( One of indexers or indexers_kwargs must be provided. Examples - ---------- + ---------- #make sample data >>> x_ls = list(string.ascii_lowercase) >>> x_arr = np.reshape(np.array(x_ls + ['a'+ letter for letter in x_ls]), (4,13)) @@ -2626,7 +2626,7 @@ def thin( name = 'alphabet_data', coords = {'x':[0,2,4,6], 'y':[i for i in range(0,13)]} ) - + >>> x.thin(3) >>> x.thin({'x':2,'y':5}) From b4fcb921e6fe008c2787425bcad766f6111d0654 Mon Sep 17 00:00:00 2001 From: Emma Marshall Date: Fri, 3 Jun 2022 15:53:44 -0600 Subject: [PATCH 04/15] added tail example --- xarray/core/dataset.py | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index f0e6bc8585f..02fa163b8f3 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2617,18 +2617,39 @@ def thin( Examples ---------- - #make sample data - >>> x_ls = list(string.ascii_lowercase) - >>> x_arr = np.reshape(np.array(x_ls + ['a'+ letter for letter in x_ls]), (4,13)) + >>> x_arr = np.arange(0, 26) + >>> x_arr + 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, 24, 25]) >>> x = xr.DataArray( - x_arr, - dims = ('x',y'), - name = 'alphabet_data', - coords = {'x':[0,2,4,6], 'y':[i for i in range(0,13)]} - ) + ... np.reshape(x_arr, (2, 13)), + ... dims=("x", "y"), + ... coords={"x": [0, 1], "y": np.arange(0, 13)}, + ... ) + >>> x_ds = xr.Dataset({'foo': x}) + >>> x_ds + + Dimensions: (x: 2, y: 13) + Coordinates: + * x (x) int64 0 1 + * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 + Data variables: + foo (x, y) int64 0 1 2 3 4 5 6 7 8 9 ... 16 17 18 19 20 21 22 23 24 25 - >>> x.thin(3) + >>> x_ds.thin(3) + + Dimensions: (x: 1, y: 5) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 3 6 9 12 + Data variables: + foo (x, y) int64 0 3 6 9 12 >>> x.thin({'x':2,'y':5}) + + array([[ 0, 5, 10]]) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 5 10 See Also -------- From 8644c8f848d53883be93c0ff30cdab620e8f0535 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 21:55:43 +0000 Subject: [PATCH 05/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/core/dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 02fa163b8f3..c84f5438df0 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2626,7 +2626,7 @@ def thin( ... dims=("x", "y"), ... coords={"x": [0, 1], "y": np.arange(0, 13)}, ... ) - >>> x_ds = xr.Dataset({'foo': x}) + >>> x_ds = xr.Dataset({"foo": x}) >>> x_ds Dimensions: (x: 2, y: 13) @@ -2644,7 +2644,7 @@ def thin( * y (y) int64 0 3 6 9 12 Data variables: foo (x, y) int64 0 3 6 9 12 - >>> x.thin({'x':2,'y':5}) + >>> x.thin({"x": 2, "y": 5}) array([[ 0, 5, 10]]) Coordinates: From 5af7a328d214ef41fa49e08f9415166441ee1e8e Mon Sep 17 00:00:00 2001 From: Emma Marshall Date: Fri, 3 Jun 2022 16:00:19 -0600 Subject: [PATCH 06/15] edited whats-new.rst --- doc/whats-new.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index b922e7f3949..c1141f0b073 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -141,6 +141,9 @@ Documentation examples. (:issue:`6333`, :pull:`6334`) By `Stan West `_. +- Added examples to :py:meth:`Dataset.thin` and :py:meth:`DataArray.thin` + By `Emma Marshall `_. + Performance ~~~~~~~~~~~ From 9e37d043a5a3ce0295293fa83c60b8e27a705c39 Mon Sep 17 00:00:00 2001 From: Emma Marshall <55526386+e-marshall@users.noreply.github.com> Date: Fri, 3 Jun 2022 16:20:52 -0600 Subject: [PATCH 07/15] Update xarray/core/dataarray.py Co-authored-by: Deepak Cherian --- xarray/core/dataarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index c837f650d96..00f52a2b8ea 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1475,7 +1475,7 @@ def thin( along the specified dimension(s). Examples - ---------- + -------- >>> x_arr = np.arange(0, 26) >>> x_arr array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, From ae98a6d3ecbe37f0333b655b931e3a4ae0ae0aa8 Mon Sep 17 00:00:00 2001 From: Emma Marshall Date: Fri, 3 Jun 2022 16:32:53 -0600 Subject: [PATCH 08/15] small formatting change --- xarray/core/dataarray.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index c837f650d96..9e97508cb46 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1479,15 +1479,12 @@ def thin( >>> x_arr = np.arange(0, 26) >>> x_arr 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, 24, 25]) + 17, 18, 19, 20, 21, 22, 23, 24, 25]) >>> x = xr.DataArray( ... np.reshape(x_arr, (2, 13)), ... dims=("x", "y"), ... coords={"x": [0, 1], "y": np.arange(0, 13)}, ... ) - >>> x_arr - 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, 24, 25]) >>> x array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], From 5617c067b0f8f0fa9b5c00ba3ebaa128a3dc1d9c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 22:35:49 +0000 Subject: [PATCH 09/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/core/dataarray.py | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index d1d4b640c03..e9a1732714c 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1472,45 +1472,45 @@ def thin( **indexers_kwargs: Any, ) -> T_DataArray: """Return a new DataArray whose data is given by each `n` value - along the specified dimension(s). - - Examples - -------- - >>> x_arr = np.arange(0, 26) - >>> x_arr - 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, 24, 25]) - >>> x = xr.DataArray( - ... np.reshape(x_arr, (2, 13)), - ... dims=("x", "y"), - ... coords={"x": [0, 1], "y": np.arange(0, 13)}, - ... ) - >>> x - - 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, 24, 25]]) - Coordinates: - * x (x) int64 0 1 - * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 - >>> - >>> x.thin(3) - - array([[ 0, 3, 6, 9, 12]]) - Coordinates: - * x (x) int64 0 - * y (y) int64 0 3 6 9 12 - >>> x.thin({"x": 2, "y": 5}) - - array([[ 0, 5, 10]]) - Coordinates: - * x (x) int64 0 - * y (y) int64 0 5 10 - - See Also - -------- - Dataset.thin - DataArray.head - DataArray.tail + along the specified dimension(s). + + Examples + -------- + >>> x_arr = np.arange(0, 26) + >>> x_arr + 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, 24, 25]) + >>> x = xr.DataArray( + ... np.reshape(x_arr, (2, 13)), + ... dims=("x", "y"), + ... coords={"x": [0, 1], "y": np.arange(0, 13)}, + ... ) + >>> x + + 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, 24, 25]]) + Coordinates: + * x (x) int64 0 1 + * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 + >>> + >>> x.thin(3) + + array([[ 0, 3, 6, 9, 12]]) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 3 6 9 12 + >>> x.thin({"x": 2, "y": 5}) + + array([[ 0, 5, 10]]) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 5 10 + + See Also + -------- + Dataset.thin + DataArray.head + DataArray.tail """ ds = self._to_temp_dataset().thin(indexers, **indexers_kwargs) return self._from_temp_dataset(ds) From 6e6fdcfe31982320aa220d5098b9f2526072864b Mon Sep 17 00:00:00 2001 From: Emma Marshall <55526386+e-marshall@users.noreply.github.com> Date: Fri, 3 Jun 2022 17:25:12 -0600 Subject: [PATCH 10/15] Update xarray/core/dataset.py Co-authored-by: Deepak Cherian --- xarray/core/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index c84f5438df0..80e4ea8d9ab 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2620,7 +2620,7 @@ def thin( >>> x_arr = np.arange(0, 26) >>> x_arr 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, 24, 25]) + 17, 18, 19, 20, 21, 22, 23, 24, 25]) >>> x = xr.DataArray( ... np.reshape(x_arr, (2, 13)), ... dims=("x", "y"), From 3c6cc6f9b4b78bc42bccf6bbffdb4d788d4ba7e7 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 3 Jun 2022 17:34:57 -0600 Subject: [PATCH 11/15] Update xarray/core/dataarray.py --- xarray/core/dataarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index e9a1732714c..d76453bcbb9 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1479,7 +1479,7 @@ def thin( >>> x_arr = np.arange(0, 26) >>> x_arr 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, 24, 25]) + 17, 18, 19, 20, 21, 22, 23, 24, 25]) >>> x = xr.DataArray( ... np.reshape(x_arr, (2, 13)), ... dims=("x", "y"), From 541998d50f5439b07a13fea29340a8d8dd9cadf2 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 3 Jun 2022 17:35:02 -0600 Subject: [PATCH 12/15] Update xarray/core/dataset.py --- xarray/core/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 80e4ea8d9ab..915aaf46cc4 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2616,7 +2616,7 @@ def thin( One of indexers or indexers_kwargs must be provided. Examples - ---------- + -------- >>> x_arr = np.arange(0, 26) >>> x_arr array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, From bbfc624447c4e80c6bd5980ea0a0eb26f003ccde Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 23:36:50 +0000 Subject: [PATCH 13/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xarray/core/dataarray.py | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index d76453bcbb9..57c756e055c 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1472,45 +1472,45 @@ def thin( **indexers_kwargs: Any, ) -> T_DataArray: """Return a new DataArray whose data is given by each `n` value - along the specified dimension(s). - - Examples - -------- - >>> x_arr = np.arange(0, 26) - >>> x_arr - 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, 24, 25]) - >>> x = xr.DataArray( - ... np.reshape(x_arr, (2, 13)), - ... dims=("x", "y"), - ... coords={"x": [0, 1], "y": np.arange(0, 13)}, - ... ) - >>> x - - 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, 24, 25]]) - Coordinates: - * x (x) int64 0 1 - * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 - >>> - >>> x.thin(3) - - array([[ 0, 3, 6, 9, 12]]) - Coordinates: - * x (x) int64 0 - * y (y) int64 0 3 6 9 12 - >>> x.thin({"x": 2, "y": 5}) - - array([[ 0, 5, 10]]) - Coordinates: - * x (x) int64 0 - * y (y) int64 0 5 10 - - See Also - -------- - Dataset.thin - DataArray.head - DataArray.tail + along the specified dimension(s). + + Examples + -------- + >>> x_arr = np.arange(0, 26) + >>> x_arr + 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, 24, 25]) + >>> x = xr.DataArray( + ... np.reshape(x_arr, (2, 13)), + ... dims=("x", "y"), + ... coords={"x": [0, 1], "y": np.arange(0, 13)}, + ... ) + >>> x + + 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, 24, 25]]) + Coordinates: + * x (x) int64 0 1 + * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 + >>> + >>> x.thin(3) + + array([[ 0, 3, 6, 9, 12]]) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 3 6 9 12 + >>> x.thin({"x": 2, "y": 5}) + + array([[ 0, 5, 10]]) + Coordinates: + * x (x) int64 0 + * y (y) int64 0 5 10 + + See Also + -------- + Dataset.thin + DataArray.head + DataArray.tail """ ds = self._to_temp_dataset().thin(indexers, **indexers_kwargs) return self._from_temp_dataset(ds) From d7c4045bb7eb82b66f027f2d96a91c7eecc0087f Mon Sep 17 00:00:00 2001 From: Emma Marshall Date: Mon, 6 Jun 2022 10:55:44 -0600 Subject: [PATCH 14/15] changes to dataset.py --- xarray/core/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index c84f5438df0..e9445cc751d 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2616,7 +2616,7 @@ def thin( One of indexers or indexers_kwargs must be provided. Examples - ---------- + -------- >>> x_arr = np.arange(0, 26) >>> x_arr array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, From 3d19136b4c01a8575a5ba558785161f2040b9107 Mon Sep 17 00:00:00 2001 From: Emma Marshall Date: Mon, 6 Jun 2022 12:16:04 -0600 Subject: [PATCH 15/15] fixed formatting errors in dataarray.py and dataset.py --- xarray/core/dataarray.py | 15 ++++++++------- xarray/core/dataset.py | 12 ++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 57c756e055c..87f35a5c2bd 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1488,23 +1488,24 @@ def thin( >>> x 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, 24, 25]]) + [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]]) Coordinates: - * x (x) int64 0 1 - * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 + * x (x) int64 0 1 + * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 + >>> >>> x.thin(3) array([[ 0, 3, 6, 9, 12]]) Coordinates: - * x (x) int64 0 - * y (y) int64 0 3 6 9 12 + * x (x) int64 0 + * y (y) int64 0 3 6 9 12 >>> x.thin({"x": 2, "y": 5}) array([[ 0, 5, 10]]) Coordinates: - * x (x) int64 0 - * y (y) int64 0 5 10 + * x (x) int64 0 + * y (y) int64 0 5 10 See Also -------- diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 915aaf46cc4..54b99836d42 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2631,8 +2631,8 @@ def thin( Dimensions: (x: 2, y: 13) Coordinates: - * x (x) int64 0 1 - * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 + * x (x) int64 0 1 + * y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 Data variables: foo (x, y) int64 0 1 2 3 4 5 6 7 8 9 ... 16 17 18 19 20 21 22 23 24 25 @@ -2640,16 +2640,16 @@ def thin( Dimensions: (x: 1, y: 5) Coordinates: - * x (x) int64 0 - * y (y) int64 0 3 6 9 12 + * x (x) int64 0 + * y (y) int64 0 3 6 9 12 Data variables: foo (x, y) int64 0 3 6 9 12 >>> x.thin({"x": 2, "y": 5}) array([[ 0, 5, 10]]) Coordinates: - * x (x) int64 0 - * y (y) int64 0 5 10 + * x (x) int64 0 + * y (y) int64 0 5 10 See Also --------