Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Pascal Bourgault <[email protected]>
  • Loading branch information
jsignell and aulemahal authored Jan 19, 2024
1 parent 37c8f19 commit f96948a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cf_xarray/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,12 @@ def polygons_to_cf(polygons: xr.DataArray | Sequence):
if coord is not None:
ds = ds.assign_coords({dim: coord})

# Special case when we have no MultiPolygons
# Special case when we have no MultiPolygons and no holes
if len(ds.part_node_count) == len(ds.node_count):

Check warning on line 503 in cf_xarray/geometry.py

View check run for this annotation

Codecov / codecov/patch

cf_xarray/geometry.py#L503

Added line #L503 was not covered by tests
ds = ds.drop_vars("part_node_count")
del ds.geometry_container.attrs["part_node_count"]

Check warning on line 505 in cf_xarray/geometry.py

View check run for this annotation

Codecov / codecov/patch

cf_xarray/geometry.py#L505

Added line #L505 was not covered by tests

# Special case when we have not holes
# Special case when we have no holes
if (ds.interior_ring == 0).all():

Check warning on line 508 in cf_xarray/geometry.py

View check run for this annotation

Codecov / codecov/patch

cf_xarray/geometry.py#L508

Added line #L508 was not covered by tests
ds = ds.drop_vars("interior_ring")
del ds.geometry_container.attrs["interior_ring"]

Check warning on line 510 in cf_xarray/geometry.py

View check run for this annotation

Codecov / codecov/patch

cf_xarray/geometry.py#L510

Added line #L510 was not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion cf_xarray/tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def geometry_polygon_without_multipolygons_ds():
Polygon(
([70, 50], [60, 65], [50, 50]),
[
([55, 55], [60, 60], [75, 55]),
([55, 55], [60, 60], [65, 55]),
],
),
]
Expand Down

0 comments on commit f96948a

Please sign in to comment.