From 4624c5e7fd42613d5ad7d4e0af7e8607cfe88bc6 Mon Sep 17 00:00:00 2001 From: Rafael M Mudafort Date: Thu, 30 Nov 2023 22:21:25 -0600 Subject: [PATCH] Add a Numpy array converter to ABC attributes --- floris/simulation/grid.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/floris/simulation/grid.py b/floris/simulation/grid.py index 68d836fe2..77f14e350 100644 --- a/floris/simulation/grid.py +++ b/floris/simulation/grid.py @@ -20,8 +20,13 @@ import attrs import numpy as np -from attrs import define, field +from attrs import ( + cmp_using, + define, + field, +) +from floris.simulation import BaseClass from floris.type_dec import ( floris_array_converter, floris_float_type, @@ -36,7 +41,7 @@ @define -class Grid(ABC): +class Grid(ABC, BaseClass): """ Grid should establish domain bounds based on given criteria, and develop three arrays to contain components of the grid @@ -66,7 +71,7 @@ class Grid(ABC): time_series (:py:obj:`bool`): Flag to indicate whether the supplied wind data is a time series. """ - turbine_coordinates: NDArrayFloat = field() + turbine_coordinates: NDArrayFloat = field(converter=floris_array_converter) turbine_diameters: NDArrayFloat = field(converter=floris_array_converter) grid_resolution: int | Iterable = field() wind_directions: NDArrayFloat = field(converter=floris_array_converter)