Skip to content

Commit

Permalink
fix to_pyvista
Browse files Browse the repository at this point in the history
  • Loading branch information
nbren12 committed Sep 16, 2024
1 parent 6c6bba8 commit bf77a02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions earth2grid/healpix.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ def to_pyvista(self):
# Make grid
nside = 2**self.level
pix = self._nest_ipix()
points = healpix_bare.corners(nside, torch.from_numpy(pix), True).numpy()
points = healpix_bare.corners(nside, pix, True).numpy()
out = einops.rearrange(points, "n d s -> (n s) d")
unique_points, inverse = np.unique(out, return_inverse=True, axis=0)
if unique_points.ndim != 2:
raise ValueError(f"unique_points.ndim should be 2, got {unique_points.ndim}.")
if unique_points.shape[1] != 3:
raise ValueError(f"unique_points.shape[1] should be 3, got {unique_points.shape[1]}.")
inverse = einops.rearrange(inverse, "(n s) -> n s", n=pix.size)
inverse = einops.rearrange(inverse, "(n s) -> n s", n=pix.numel())
n, s = inverse.shape
cells = np.ones_like(inverse, shape=(n, s + 1))
cells[:, 0] = s
Expand Down

0 comments on commit bf77a02

Please sign in to comment.