home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 596859274

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/3846#issuecomment-596859274 https://api.github.com/repos/pydata/xarray/issues/3846 596859274 MDEyOklzc3VlQ29tbWVudDU5Njg1OTI3NA== 14808389 2020-03-10T01:45:22Z 2020-03-10T01:45:22Z MEMBER

The tool is at https://github.com/keewis/black-doctest. It is still experimental and is missing a lot of the features black has (e.g. no CLI, yet) but here's the output for dataarray.py:

changes for xarray/core/dataarray.py ```diff diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 7a95aedc..0fafd69b 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -875,8 +875,7 @@ class DataArray(AbstractArray, DataWithCoords): Shallow versus deep copy - >>> array = xr.DataArray([1, 2, 3], dims='x', - ... coords={'x': ['a', 'b', 'c']}) + >>> array = xr.DataArray([1, 2, 3], dims="x", coords={"x": ["a", "b", "c"]}) >>> array.copy() <xarray.DataArray (x: 3)> array([1, 2, 3]) @@ -1344,7 +1343,7 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> da = xr.DataArray([1, 3], [('x', np.arange(2))]) + >>> da = xr.DataArray([1, 3], [("x", np.arange(2))]) >>> da.interp(x=0.5) <xarray.DataArray ()> array(2.0) @@ -1475,8 +1474,9 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = xr.DataArray(data=[0, 1], dims="x", - coords={"x": ["a", "b"], "y": ("x", [0, 1])}) + >>> arr = xr.DataArray( + ... data=[0, 1], dims="x", coords={"x": ["a", "b"], "y": ("x", [0, 1])} + ... ) >>> arr <xarray.DataArray (x: 2)> array([0, 1]) @@ -1589,12 +1589,11 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = xr.DataArray(data=np.ones((2, 3)), - ... dims=['x', 'y'], - ... coords={'x': - ... range(2), 'y': - ... range(3), 'a': ('x', [3, 4]) - ... }) + >>> arr = xr.DataArray( + ... data=np.ones((2, 3)), + ... dims=["x", "y"], + ... coords={"x": range(2), "y": range(3), "a": ("x", [3, 4])}, + ... ) >>> arr <xarray.DataArray (x: 2, y: 3)> array([[1., 1., 1.], @@ -1603,7 +1602,7 @@ class DataArray(AbstractArray, DataWithCoords): * x (x) int64 0 1 * y (y) int64 0 1 2 a (x) int64 3 4 - >>> arr.set_index(x='a') + >>> arr.set_index(x="a") <xarray.DataArray (x: 2, y: 3)> array([[1., 1., 1.], [1., 1., 1.]]) @@ -1718,8 +1717,9 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = DataArray(np.arange(6).reshape(2, 3), - ... coords=[('x', ['a', 'b']), ('y', [0, 1, 2])]) + >>> arr = DataArray( + ... np.arange(6).reshape(2, 3), coords=[("x", ["a", "b"]), ("y", [0, 1, 2])] + ... ) >>> arr <xarray.DataArray (x: 2, y: 3)> array([[0, 1, 2], @@ -1727,8 +1727,8 @@ class DataArray(AbstractArray, DataWithCoords): Coordinates: * x (x) |S1 'a' 'b' * y (y) int64 0 1 2 - >>> stacked = arr.stack(z=('x', 'y')) - >>> stacked.indexes['z'] + >>> stacked = arr.stack(z=("x", "y")) + >>> stacked.indexes["z"] MultiIndex(levels=[['a', 'b'], [0, 1, 2]], codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]], names=['x', 'y']) @@ -1768,8 +1768,9 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = DataArray(np.arange(6).reshape(2, 3), - ... coords=[('x', ['a', 'b']), ('y', [0, 1, 2])]) + >>> arr = DataArray( + ... np.arange(6).reshape(2, 3), coords=[("x", ["a", "b"]), ("y", [0, 1, 2])] + ... ) >>> arr <xarray.DataArray (x: 2, y: 3)> array([[0, 1, 2], @@ -1777,8 +1778,8 @@ class DataArray(AbstractArray, DataWithCoords): Coordinates: * x (x) |S1 'a' 'b' * y (y) int64 0 1 2 - >>> stacked = arr.stack(z=('x', 'y')) - >>> stacked.indexes['z'] + >>> stacked = arr.stack(z=("x", "y")) + >>> stacked.indexes["z"] MultiIndex(levels=[['a', 'b'], [0, 1, 2]], codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]], names=['x', 'y']) @@ -1817,9 +1818,10 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- >>> import xarray as xr - >>> arr = DataArray(np.arange(6).reshape(2, 3), - ... coords=[('x', ['a', 'b']), ('y', [0, 1, 2])]) - >>> data = xr.Dataset({'a': arr, 'b': arr.isel(y=0)}) + >>> arr = DataArray( + ... np.arange(6).reshape(2, 3), coords=[("x", ["a", "b"]), ("y", [0, 1, 2])] + ... ) + >>> data = xr.Dataset({"a": arr, "b": arr.isel(y=0)}) >>> data <xarray.Dataset> Dimensions: (x: 2, y: 3) @@ -1829,12 +1831,12 @@ class DataArray(AbstractArray, DataWithCoords): Data variables: a (x, y) int64 0 1 2 3 4 5 b (x) int64 0 3 - >>> stacked = data.to_stacked_array("z", ['y']) - >>> stacked.indexes['z'] + >>> stacked = data.to_stacked_array("z", ["y"]) + >>> stacked.indexes["z"] MultiIndex(levels=[['a', 'b'], [0, 1, 2]], labels=[[0, 0, 0, 1], [0, 1, 2, -1]], names=['variable', 'y']) - >>> roundtripped = stacked.to_unstacked_dataset(dim='z') + >>> roundtripped = stacked.to_unstacked_dataset(dim="z") >>> data.identical(roundtripped) True @@ -2694,13 +2696,13 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = xr.DataArray([5, 5, 6, 6], [[1, 2, 3, 4]], ['x']) - >>> arr.diff('x') + >>> arr = xr.DataArray([5, 5, 6, 6], [[1, 2, 3, 4]], ["x"]) + >>> arr.diff("x") <xarray.DataArray (x: 3)> array([0, 1, 0]) Coordinates: * x (x) int64 2 3 4 - >>> arr.diff('x', 2) + >>> arr.diff("x", 2) <xarray.DataArray (x: 2)> array([ 1, -1]) Coordinates: @@ -2750,7 +2752,7 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = xr.DataArray([5, 6, 7], dims='x') + >>> arr = xr.DataArray([5, 6, 7], dims="x") >>> arr.shift(x=1) <xarray.DataArray (x: 3)> array([ nan, 5., 6.]) @@ -2800,7 +2802,7 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = xr.DataArray([5, 6, 7], dims='x') + >>> arr = xr.DataArray([5, 6, 7], dims="x") >>> arr.roll(x=1) <xarray.DataArray (x: 3)> array([7, 5, 6]) @@ -2849,9 +2851,9 @@ class DataArray(AbstractArray, DataWithCoords): -------- >>> da_vals = np.arange(6 * 5 * 4).reshape((6, 5, 4)) - >>> da = DataArray(da_vals, dims=['x', 'y', 'z']) + >>> da = DataArray(da_vals, dims=["x", "y", "z"]) >>> dm_vals = np.arange(4) - >>> dm = DataArray(dm_vals, dims=['z']) + >>> dm = DataArray(dm_vals, dims=["z"]) >>> dm.dims ('z') @@ -2909,9 +2911,11 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> da = xr.DataArray(np.random.rand(5), - ... coords=[pd.date_range('1/1/2000', periods=5)], - ... dims='time') + >>> da = xr.DataArray( + ... np.random.rand(5), + ... coords=[pd.date_range("1/1/2000", periods=5)], + ... dims="time", + ... ) >>> da <xarray.DataArray (time: 5)> array([ 0.965471, 0.615637, 0.26532 , 0.270962, 0.552878]) @@ -3052,8 +3056,8 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> arr = xr.DataArray([5, 6, 7], dims='x') - >>> arr.rank('x') + >>> arr = xr.DataArray([5, 6, 7], dims="x") + >>> arr.rank("x") <xarray.DataArray (x: 3)> array([ 1., 2., 3.]) Dimensions without coordinates: x @@ -3093,8 +3097,11 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> da = xr.DataArray(np.arange(12).reshape(4, 3), dims=['x', 'y'], - ... coords={'x': [0, 0.1, 1.1, 1.2]}) + >>> da = xr.DataArray( + ... np.arange(12).reshape(4, 3), + ... dims=["x", "y"], + ... coords={"x": [0, 0.1, 1.1, 1.2]}, + ... ) >>> da <xarray.DataArray (x: 4, y: 3)> array([[ 0, 1, 2], @@ -3105,7 +3112,7 @@ class DataArray(AbstractArray, DataWithCoords): * x (x) float64 0.0 0.1 1.1 1.2 Dimensions without coordinates: y >>> - >>> da.differentiate('x') + >>> da.differentiate("x") <xarray.DataArray (x: 4, y: 3)> array([[30. , 30. , 30. ], [27.545455, 27.545455, 27.545455], @@ -3147,8 +3154,11 @@ class DataArray(AbstractArray, DataWithCoords): Examples -------- - >>> da = xr.DataArray(np.arange(12).reshape(4, 3), dims=['x', 'y'], - ... coords={'x': [0, 0.1, 1.1, 1.2]}) + >>> da = xr.DataArray( + ... np.arange(12).reshape(4, 3), + ... dims=["x", "y"], + ... coords={"x": [0, 0.1, 1.1, 1.2]}, + ... ) >>> da <xarray.DataArray (x: 4, y: 3)> array([[ 0, 1, 2], @@ -3159,7 +3169,7 @@ class DataArray(AbstractArray, DataWithCoords): * x (x) float64 0.0 0.1 1.1 1.2 Dimensions without coordinates: y >>> - >>> da.integrate('x') + >>> da.integrate("x") <xarray.DataArray (y: 3)> array([5.4, 6.6, 7.8]) Dimensions without coordinates: y ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  577283480
Powered by Datasette · Queries took 0.905ms · About: xarray-datasette