Skip to content

Commit

Permalink
fix n_faces deprecation (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle authored Jan 9, 2024
1 parent ec80db6 commit 484f306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/geovista/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def point_cloud(mesh: pv.PolyData) -> bool:
.. versionadded:: 0.2.0
"""
return (mesh.n_points == mesh.n_faces) and (mesh.n_lines == 0)
return (mesh.n_points == mesh.n_cells) and (mesh.n_lines == 0)


def sanitize_data(
Expand Down
18 changes: 9 additions & 9 deletions src/geovista/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ def combine(
) -> pv.PolyData:
"""Combine two or more meshes into one mesh.
Only meshes with faces will be combined. Support is not yet provided for combining
Only meshes with cells will be combined. Support is not yet provided for combining
meshes that consist of only points or lines.
Note that, no check is performed to ensure that mesh faces do not overlap.
Note that, no check is performed to ensure that mesh cells do not overlap.
However, meshes may share coincident points. Coincident point data from the
first input mesh will overwrite all other mesh data sharing the same
coincident point in the resultant mesh.
Expand All @@ -334,7 +334,7 @@ def combine(
the resultant mesh.
clean : bool, default=False
Specify whether to merge duplicate points, remove unused points,
and/or remove degenerate faces in the resultant mesh.
and/or remove degenerate cells in the resultant mesh.
Returns
-------
Expand Down Expand Up @@ -376,15 +376,15 @@ def combine(

if mesh.n_lines:
emsg = (
f"Can only combine meshes with faces, input mesh #{i+1} "
f"Can only combine meshes with cells, input mesh #{i+1} "
"contains lines."
)
raise TypeError(emsg)

if mesh.n_faces == 0:
if mesh.n_cells == 0:
emsg = (
f"Can only combine meshes with faces, input mesh #{i+1} "
"has no faces."
f"Can only combine meshes with cells, input mesh #{i+1} "
"has no cells."
)
raise TypeError(emsg)

Expand All @@ -405,9 +405,9 @@ def combine(
faces[faces_n_offset[:-1]] = faces_n

combined_faces.append(faces)
# accumulate running totals of combined mesh points and faces
# accumulate running totals of combined mesh points and cells
n_points += mesh.n_points
n_faces += mesh.n_faces
n_faces += mesh.n_cells

if data:
# perform intersection to determine common names
Expand Down
2 changes: 1 addition & 1 deletion tests/bridge/test_from_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_defaults(lam_uk_sample, wgs84_wkt):
assert result[GV_FIELD_CRS] == wgs84_wkt
assert np.isclose(result[GV_FIELD_RADIUS], RADIUS)
assert result.n_points == lons.size
assert result.n_points == result.n_faces
assert result.n_points == result.n_cells


def test_to_cartesian_kwarg_pass_thru(mocker, lam_uk_sample):
Expand Down

0 comments on commit 484f306

Please sign in to comment.