Possible bug in GridInterpolator (with suggested fix)
I think there is a possible bug in GridInterpolator
in v2.3.0
, but there is an easy fix
x = [np.array([0.0, 2.99999, 3.0, 3.5, 4.0, 4.5]),
np.array([0.84, 0.85, 0.86, 0.87, 0.88, ])
]
V = np.reshape(np.array(range(30)), (6, 5))
Instantiating the interpolator the first time works ok
GridInterpolator(x, V)
<py_wake.utils.grid_interpolator.GridInterpolator at 0x1bfdf918250>
But if instantiated twice in a row (such as with PowerCtNDTabular
), then an error occurs because the original x
has been changed
GridInterpolator(x, V)
ValueError: Lengths of x does not match shape of V
x
[array([0. , 2.99999, 3. , 3.5 , 4. , 4.5 , 5.5 ,
6.5 ]),
array([0.84, 0.85, 0.86, 0.87, 0.88])]
The simple fix for this is to edit the init
of GridInterpolator
such that it always works on a copy:
self.x = x.copy()
Edited by Ben Tomlinson