Skip to content
Snippets Groups Projects
Commit 4b1b113a authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

fix coverage

parent 4123d28e
No related branches found
No related tags found
1 merge request!269allow TI as WindFarmModel call argument + add call arguments to SimulationResult
Pipeline #21223 passed
......@@ -440,6 +440,28 @@ def test_time_series_operating():
npt.assert_array_equal(sim_res.Power.values[operating != 0] > 0, True)
def test_time_series_operating_wrong_shape():
from py_wake.wind_turbines.power_ct_functions import PowerCtFunctionList, PowerCtTabular
d = np.load(os.path.dirname(examples.__file__) + "/data/time_series.npz")
wd, ws, ws_std = [d[k][:6 * 24] for k in ['wd', 'ws', 'ws_std']]
ws += 3
t = np.arange(6 * 24)
wt = V80()
site = Hornsrev1Site()
# replace powerCtFunction
wt.powerCtFunction = PowerCtFunctionList(
key='operating',
powerCtFunction_lst=[PowerCtTabular(ws=[0, 100], power=[0, 0], power_unit='w', ct=[0, 0]), # 0=No power and ct
wt.powerCtFunction], # 1=Normal operation
default_value=1)
wfm = NOJ(site, wt)
x, y = site.initial_position.T
operating = (t < 48) | (t > 72)
with pytest.raises(ValueError, match=r"Argument, operating\(shape=\(1, 144\)\), has unsupported shape."):
wfm(x, y, ws=ws, wd=wd, time=t, operating=[operating])
def test_aep_wind_atlas_method():
site = Hornsrev1Site()
......
......@@ -481,7 +481,6 @@ class PropagateDownwind(EngineeringWindFarmModel):
return v[i_wd_l]
else:
valid_shapes = f"(), ({I}), ({I},{L}), ({I},{L},{K}), ({L}), ({L},{K})"
raise ValueError(
f"Argument, {k}(shape={v.shape}), has unsupported shape. Valid shapes are {valid_shapes}")
keys = self.windTurbines.powerCtFunction.required_inputs + self.windTurbines.powerCtFunction.optional_inputs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment