From bec0b5a98ca07ccf755ed6452558e0528b43b0d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de>
Date: Sat, 4 May 2024 00:52:03 +0200
Subject: [PATCH] grid: compatible unstructured grids should have same cells
 either way

---
 src/finam/data/grid_base.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/finam/data/grid_base.py b/src/finam/data/grid_base.py
index 89769bba..b45bc979 100644
--- a/src/finam/data/grid_base.py
+++ b/src/finam/data/grid_base.py
@@ -220,10 +220,14 @@ class Grid(GridBase):
         ):
             return False
 
-        if self.data_shape != other.data_shape:
+        if check_location and self.data_shape != other.data_shape:
             return False
 
-        return np.allclose(self.data_points, other.data_points)
+        return (
+            np.allclose(self.points, other.points)
+            and self.cells == other.cells
+            and self.cell_types == other.cell_types
+        )
 
     def __eq__(self, other):
         return self.compatible_with(other)
@@ -424,7 +428,7 @@ class StructuredGrid(Grid):
         ):
             return False
 
-        if self.data_shape != (
+        if check_location and self.data_shape != (
             other.data_shape[::-1]
             if self.axes_reversed != other.axes_reversed
             else other.data_shape
-- 
GitLab