Skip to content

Commit

Permalink
merge-back v0.4.x with conflict resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle committed Jan 10, 2024
2 parents 681c9be + 484f306 commit 5314c8f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion requirements/geovista.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
- pooch
- pykdtree
- pyproj >=3.3
- pyvista >=0.40,<0.42.2
- pyvista >=0.43.1

# pantry dependencies (core)
- netcdf4
Expand Down
2 changes: 1 addition & 1 deletion requirements/pypi-core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ platformdirs
pooch
pykdtree
pyproj>=3.3
pyvista>=0.40,<0.42.2
pyvista>=0.43.1
2 changes: 1 addition & 1 deletion src/geovista/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,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
20 changes: 10 additions & 10 deletions src/geovista/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def add_texture_coords(
u_coord = (lons + 180) / 360
v_coord = (lats + 90) / 180
t_coord = np.vstack([u_coord, v_coord]).T
mesh.active_t_coords = t_coord
mesh.active_texture_coordinates = t_coord

return mesh

Expand All @@ -325,10 +325,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 @@ -342,7 +342,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 @@ -384,15 +384,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 @@ -413,9 +413,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
6 changes: 5 additions & 1 deletion src/geovista/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,18 @@ def remesh(
if not triangulated(poly0):
poly0.triangulate(inplace=True)

# Ensure to explicitly use default direction=(0, 0, 1) for
# the plane with a post x-axis rotation of 90 degrees.
# See https://github.com/bjlittle/geovista/issues/447
poly1 = pv.Plane(
center=(radius / 2, 0, 0),
i_resolution=1,
j_resolution=1,
i_size=radius,
j_size=radius * 2,
direction=(0, 1, 0),
direction=(0, 0, 1),
)
poly1.rotate_x(90, inplace=True)
poly1.rotate_z(meridian, inplace=True)
poly1.triangulate(inplace=True)

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 @@ -22,7 +22,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 5314c8f

Please sign in to comment.