Skip to content

Commit 94a8e1c

Browse files
committed
Update sgrid __eq__ methods
1 parent 997df5c commit 94a8e1c

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/parcels/_core/utils/sgrid.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,7 @@ def __repr__(self) -> str:
111111
def __eq__(self, other: Any) -> bool:
112112
if not isinstance(other, Grid2DMetadata):
113113
return NotImplemented
114-
return (
115-
self.cf_role == other.cf_role
116-
and self.topology_dimension == other.topology_dimension
117-
and self.node_dimensions == other.node_dimensions
118-
and self.face_dimensions == other.face_dimensions
119-
and self.vertical_dimensions == other.vertical_dimensions
120-
)
114+
return self.to_attrs() == other.to_attrs()
121115

122116
@classmethod
123117
def from_attrs(cls, attrs):
@@ -203,12 +197,7 @@ def __repr__(self) -> str:
203197
def __eq__(self, other: Any) -> bool:
204198
if not isinstance(other, Grid3DMetadata):
205199
return NotImplemented
206-
return (
207-
self.cf_role == other.cf_role
208-
and self.topology_dimension == other.topology_dimension
209-
and self.node_dimensions == other.node_dimensions
210-
and self.volume_dimensions == other.volume_dimensions
211-
)
200+
return self.to_attrs() == other.to_attrs()
212201

213202
@classmethod
214203
def from_attrs(cls, attrs):

0 commit comments

Comments
 (0)