Skip to content

Commit 1f57fe1

Browse files
committed
Add exception if grid have coordinates with 2D shape
1 parent 351d86c commit 1f57fe1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/py_eddy_tracker/dataset/grid.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,10 @@ def __init__(self, *args, **kwargs):
11501150
def setup_coordinates(self):
11511151
super().setup_coordinates()
11521152
self.x_size = self.x_c.shape[0]
1153+
if len(self.x_c.shape) != 1:
1154+
raise Exception(
1155+
"Coordinates in RegularGridDataset must be 1D array, or think to use UnRegularGridDataset"
1156+
)
11531157
self._x_step = (self.x_c[1:] - self.x_c[:-1]).mean()
11541158
self._y_step = (self.y_c[1:] - self.y_c[:-1]).mean()
11551159

0 commit comments

Comments
 (0)