From ad19be33a9124b3000b44047b701c520334feaad Mon Sep 17 00:00:00 2001 From: Florian Deconinck Date: Fri, 20 Dec 2024 14:16:00 -0500 Subject: [PATCH] Expose all SG metric terms in grid_data --- ndsl/grid/helper.py | 60 +++++++++++++++++++++++++++++++++++ ndsl/stencils/testing/grid.py | 50 +++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/ndsl/grid/helper.py b/ndsl/grid/helper.py index 745dce37..6cb6a374 100644 --- a/ndsl/grid/helper.py +++ b/ndsl/grid/helper.py @@ -284,10 +284,20 @@ class AngleGridData: sin_sg2: Quantity sin_sg3: Quantity sin_sg4: Quantity + sin_sg5: Quantity + sin_sg6: Quantity + sin_sg7: Quantity + sin_sg8: Quantity + sin_sg9: Quantity cos_sg1: Quantity cos_sg2: Quantity cos_sg3: Quantity cos_sg4: Quantity + cos_sg5: Quantity + cos_sg6: Quantity + cos_sg7: Quantity + cos_sg8: Quantity + cos_sg9: Quantity @classmethod def new_from_metric_terms(cls, metric_terms: MetricTerms) -> "AngleGridData": @@ -296,10 +306,20 @@ def new_from_metric_terms(cls, metric_terms: MetricTerms) -> "AngleGridData": sin_sg2=metric_terms.sin_sg2, sin_sg3=metric_terms.sin_sg3, sin_sg4=metric_terms.sin_sg4, + sin_sg5=metric_terms.sin_sg5, + sin_sg6=metric_terms.sin_sg6, + sin_sg7=metric_terms.sin_sg7, + sin_sg8=metric_terms.sin_sg8, + sin_sg9=metric_terms.sin_sg9, cos_sg1=metric_terms.cos_sg1, cos_sg2=metric_terms.cos_sg2, cos_sg3=metric_terms.cos_sg3, cos_sg4=metric_terms.cos_sg4, + cos_sg5=metric_terms.cos_sg5, + cos_sg6=metric_terms.cos_sg6, + cos_sg7=metric_terms.cos_sg7, + cos_sg8=metric_terms.cos_sg8, + cos_sg9=metric_terms.cos_sg9, ) @@ -618,6 +638,26 @@ def sin_sg3(self): def sin_sg4(self): return self._angle_data.sin_sg4 + @property + def sin_sg5(self): + return self._angle_data.sin_sg5 + + @property + def sin_sg6(self): + return self._angle_data.sin_sg6 + + @property + def sin_sg7(self): + return self._angle_data.sin_sg7 + + @property + def sin_sg8(self): + return self._angle_data.sin_sg8 + + @property + def sin_sg9(self): + return self._angle_data.sin_sg9 + @property def cos_sg1(self): return self._angle_data.cos_sg1 @@ -634,6 +674,26 @@ def cos_sg3(self): def cos_sg4(self): return self._angle_data.cos_sg4 + @property + def cos_sg5(self): + return self._angle_data.cos_sg5 + + @property + def cos_sg6(self): + return self._angle_data.cos_sg6 + + @property + def cos_sg7(self): + return self._angle_data.cos_sg7 + + @property + def cos_sg8(self): + return self._angle_data.cos_sg8 + + @property + def cos_sg9(self): + return self._angle_data.cos_sg9 + @dataclasses.dataclass(frozen=True) class DriverGridData: diff --git a/ndsl/stencils/testing/grid.py b/ndsl/stencils/testing/grid.py index 273a0f3d..fbee10a5 100644 --- a/ndsl/stencils/testing/grid.py +++ b/ndsl/stencils/testing/grid.py @@ -734,6 +734,31 @@ def grid_data(self) -> "GridData": dims=GridDefinitions.sin_sg4.dims, units=GridDefinitions.sin_sg4.units, ), + sin_sg5=self.quantity_factory.from_array( + data=self.sin_sg5, + dims=GridDefinitions.sin_sg5.dims, + units=GridDefinitions.sin_sg5.units, + ), + sin_sg6=self.quantity_factory.from_array( + data=self.sin_sg6, + dims=GridDefinitions.sin_sg6.dims, + units=GridDefinitions.sin_sg6.units, + ), + sin_sg7=self.quantity_factory.from_array( + data=self.sin_sg7, + dims=GridDefinitions.sin_sg7.dims, + units=GridDefinitions.sin_sg7.units, + ), + sin_sg8=self.quantity_factory.from_array( + data=self.sin_sg8, + dims=GridDefinitions.sin_sg8.dims, + units=GridDefinitions.sin_sg8.units, + ), + sin_sg9=self.quantity_factory.from_array( + data=self.sin_sg9, + dims=GridDefinitions.sin_sg9.dims, + units=GridDefinitions.sin_sg9.units, + ), cos_sg1=self.quantity_factory.from_array( data=self.cos_sg1, dims=GridDefinitions.cos_sg1.dims, @@ -754,6 +779,31 @@ def grid_data(self) -> "GridData": dims=GridDefinitions.cos_sg4.dims, units=GridDefinitions.cos_sg4.units, ), + cos_sg5=self.quantity_factory.from_array( + data=self.cos_sg5, + dims=GridDefinitions.cos_sg5.dims, + units=GridDefinitions.cos_sg5.units, + ), + cos_sg6=self.quantity_factory.from_array( + data=self.cos_sg6, + dims=GridDefinitions.cos_sg6.dims, + units=GridDefinitions.cos_sg6.units, + ), + cos_sg7=self.quantity_factory.from_array( + data=self.cos_sg7, + dims=GridDefinitions.cos_sg7.dims, + units=GridDefinitions.cos_sg7.units, + ), + cos_sg8=self.quantity_factory.from_array( + data=self.cos_sg8, + dims=GridDefinitions.cos_sg8.dims, + units=GridDefinitions.cos_sg8.units, + ), + cos_sg9=self.quantity_factory.from_array( + data=self.cos_sg9, + dims=GridDefinitions.cos_sg9.dims, + units=GridDefinitions.cos_sg9.units, + ), ) self._grid_data = GridData( horizontal_data=horizontal,