Skip to content

Commit

Permalink
api: Restore x_range and y_range arguments to get_wireframe()
Browse files Browse the repository at this point in the history
  • Loading branch information
pmav99 committed Oct 11, 2023
1 parent 50233ed commit 2260f5b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions thalassa/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,16 @@ def get_tiles(url: str = "http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png") -> g

def get_wireframe(
ds_or_trimesh: gv.TriMesh | xr.Dataset,
x_range: tuple[float, float] | None = None,
y_range: tuple[float, float] | None = None,
) -> gv.DynamicMap:
"""Return a ``DynamicMap`` with a wireframe of the mesh."""
trimesh = create_trimesh(ds_or_trimesh)
kwargs = dict(element=trimesh.edgepaths, precompute=True)
if x_range:
kwargs["x_range"] = x_range
if y_range:
kwargs["y_range"] = y_range
wireframe = rasterize(**kwargs).opts(tools=["hover"], cmap=["black"], title="Mesh")
wireframe = dynspread(wireframe)
return wireframe
Expand Down

0 comments on commit 2260f5b

Please sign in to comment.