Skip to content

Commit

Permalink
use geovista.common.VTK_CELL_IDS (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle authored Jan 28, 2025
1 parent 1df75b5 commit 58bb7ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/geovista/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def from_cartesian(
pole_submesh = mesh.extract_points(pole_pids)
pole_pids = set(pole_pids)
# get the cids (cell-indices) of mesh cells with polar vertices
pole_cids = np.unique(pole_submesh["vtkOriginalCellIds"])
pole_cids = np.unique(pole_submesh[VTK_CELL_IDS])
for cid in pole_cids:
# get the pids (point-indices) of the polar cell points
# NOTE: pyvista 0.38.0: cell_point_ids(cid) -> get_cell(cid).point_ids
Expand Down Expand Up @@ -496,8 +496,7 @@ def from_cartesian(
mesh.extract_points(poi_pids)
)
cell_pids = [
mesh.get_cell(cid).point_ids
for cid in poi_cells["vtkOriginalCellIds"]
mesh.get_cell(cid).point_ids for cid in poi_cells[VTK_CELL_IDS]
]
mask_positive = lons[cell_pids] > 0
if np.any(mask_positive):
Expand Down
6 changes: 3 additions & 3 deletions src/geovista/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import lazy_loader as lazy

from .common import MixinStrEnum, to_cartesian
from .common import VTK_CELL_IDS, MixinStrEnum, to_cartesian
from .crs import WGS84, from_wkt
from .transform import transform_points

Expand Down Expand Up @@ -350,7 +350,7 @@ def find_cell_neighbours(mesh: pv.PolyData, cid: CellIDLike) -> CellIDs:
# determine the unique points
pids = np.unique(list(pids))
# get the cell-ids of cells containing at least one common point
result = set(mesh.extract_points(pids)["vtkOriginalCellIds"])
result = set(mesh.extract_points(pids)[VTK_CELL_IDS])
# remove the original cell/s
result -= set(cid)

Expand Down Expand Up @@ -412,7 +412,7 @@ def find_nearest_cell(

if poi_is_vertex:
pid = pids[mask][0]
result = sorted(mesh.extract_points(pid)["vtkOriginalCellIds"])
result = sorted(mesh.extract_points(pid)[VTK_CELL_IDS])
else:
result = [cid]

Expand Down

0 comments on commit 58bb7ab

Please sign in to comment.