Skip to content

Commit d4c2738

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9e08940 commit d4c2738

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cf_xarray/geometry.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def cf_to_lines(ds: xr.Dataset):
387387
It has the same dimension as the ``part_node_count`` or the coordinates variables, or
388388
``'features'`` if those were not present in ``ds``.
389389
"""
390-
from shapely import from_ragged_array, GeometryType
390+
from shapely import GeometryType, from_ragged_array
391391

392392
# Shorthand for convenience
393393
geo = ds.geometry_container.attrs
@@ -419,15 +419,19 @@ def cf_to_lines(ds: xr.Dataset):
419419
part_node_count = xr.DataArray([1] * xy.shape[0], dims=(feat_dim,))
420420
if feat_dim in ds.coords:
421421
part_node_count = part_node_count.assign_coords({feat_dim: ds[feat_dim]})
422-
422+
423423
geoms = lines
424424
else:
425425
part_node_count = ds[part_node_count_name]
426426

427427
# get index of offset1 values that are edges for part_node_count
428-
offset2 = np.nonzero(np.isin(offset1, np.insert(np.cumsum(part_node_count), 0, 0)))[0]
429-
multilines = from_ragged_array(GeometryType.MULTILINESTRING, xy, offsets=(offset1, offset2))
430-
428+
offset2 = np.nonzero(
429+
np.isin(offset1, np.insert(np.cumsum(part_node_count), 0, 0))
430+
)[0]
431+
multilines = from_ragged_array(
432+
GeometryType.MULTILINESTRING, xy, offsets=(offset1, offset2)
433+
)
434+
431435
# get items from lines or multilines depending on number of segments
432436
geoms = np.where(np.diff(offset2) == 1, lines[offset2[:-1]], multilines)
433437

0 commit comments

Comments
 (0)