From 2ff6b6ad3da97bbcc69f14eebdce51a2de75d0aa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 12:49:28 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- cf_xarray/geometry.py | 2 +- cf_xarray/tests/test_geometry.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cf_xarray/geometry.py b/cf_xarray/geometry.py index 8095e6b4..3e7a8105 100644 --- a/cf_xarray/geometry.py +++ b/cf_xarray/geometry.py @@ -357,7 +357,7 @@ def cf_to_lines(ds: xr.Dataset): if indexes.shape == (0, 2): geoms[i] = LineString(xy[j : j + n, :]) else: - geoms[i] = MultiLineString([xy[ii[0]: ii[1], :] for ii in indexes]) + geoms[i] = MultiLineString([xy[ii[0] : ii[1], :] for ii in indexes]) j += n return xr.DataArray(geoms, dims=part_node_count.dims, coords=part_node_count.coords) diff --git a/cf_xarray/tests/test_geometry.py b/cf_xarray/tests/test_geometry.py index 4e4df43c..dac90e52 100644 --- a/cf_xarray/tests/test_geometry.py +++ b/cf_xarray/tests/test_geometry.py @@ -51,7 +51,7 @@ def geometry_ds(): @pytest.fixture def geometry_line_ds(): - from shapely.geometry import MultiLineString, LineString + from shapely.geometry import LineString, MultiLineString # empty/fill workaround to avoid numpy deprecation(warning) due to the array interface of shapely geometries. geoms = np.empty(3, dtype=object) @@ -70,8 +70,12 @@ def geometry_line_ds(): shp_ds = ds.assign(geometry=xr.DataArray(geoms, dims=("index",))) cf_ds = ds.assign( - x=xr.DataArray([0, 1, 4, 5, 0, 1, 1, 1.0, 2.0, 1.7], dims=("node",), attrs={"axis": "X"}), - y=xr.DataArray([0, 2, 4, 6, 0, 0, 1, 1.0, 2.0, 9.5], dims=("node",), attrs={"axis": "Y"}), + x=xr.DataArray( + [0, 1, 4, 5, 0, 1, 1, 1.0, 2.0, 1.7], dims=("node",), attrs={"axis": "X"} + ), + y=xr.DataArray( + [0, 2, 4, 6, 0, 0, 1, 1.0, 2.0, 9.5], dims=("node",), attrs={"axis": "Y"} + ), part_node_count=xr.DataArray([4, 3, 3], dims=("index",)), node_count=xr.DataArray([2, 2, 3, 3], dims=("counter",)), crd_x=xr.DataArray([1.0, 3.0, 4.0], dims=("index",), attrs={"nodes": "x"}),