Skip to content

Commit

Permalink
Fix issue with sorting last point in transect
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Nov 3, 2020
1 parent 75d5324 commit 5b768df
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions conda_package/mpas_tools/viz/transects.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def find_transect_cells_and_weights(lonTransect, latTransect, dsTris, dsMesh,
x, y, z = _lon_lat_to_cartesian(lonTransect, latTransect, earth_radius,
degrees)

nTriangles = dsTris.sizes['nTriangles']
nNodes = dsTris.sizes['nNodes']
nodeCellWeights = dsTris.nodeCellWeights.values
nodeCellIndices = dsTris.nodeCellIndices.values
Expand Down Expand Up @@ -283,7 +282,7 @@ def find_transect_cells_and_weights(lonTransect, latTransect, dsTris, dsMesh,
while len(indices) < len(sortIndices):
index = len(indices)
currentTri = trisSorted[indices[-1]]
if nodesAreSame[index]:
if index < len(nodesAreSame) and nodesAreSame[index]:
# the next two nodes are the same, so we need to know which
# corresponds to the current triangle
if trisSorted[index] == currentTri:
Expand Down

0 comments on commit 5b768df

Please sign in to comment.