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

fix "outside area" error occurring when making a flow map with XRSite (which...

fix "outside area" error occurring when making a flow map with XRSite (which fails because local wind at (0,0) is requested
parent 7c8ea0f1
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ class LocalWind(xr.Dataset):
P : array_like
Probability/weight
"""
coords = {'wd': wd, 'ws': ws, }
coords = {'wd': wd, 'ws': np.atleast_1d(ws)}
assert len(np.atleast_1d(x_i)) == len(np.atleast_1d(y_i))
n_i = max(len(np.atleast_1d(x_i)), len(np.atleast_1d(h_i)))
coords['i'] = np.arange(n_i)
......
from abc import abstractmethod, ABC
from py_wake.site._site import Site
from py_wake.site._site import Site, UniformSite
from py_wake.wind_turbines import WindTurbines
import numpy as np
from py_wake.flow_map import FlowMap, HorizontalGrid, FlowBox, YZGrid, Grid
......@@ -45,7 +45,7 @@ class WindFarmModel(ABC):
type, h, _ = self.windTurbines.get_defaults(len(x), type, h)
if len(x) == 0:
lw = self.site.local_wind(x_i=[0], y_i=[0], h_i=[100], wd=wd, ws=ws)
lw = UniformSite([1], 0.1).local_wind(x_i=[0], y_i=[0], h_i=[100], wd=wd, ws=ws)
z = xr.DataArray(np.zeros((1, len(lw.wd), len(lw.ws))), coords=[('wt', [0]), ('wd', lw.wd), ('ws', lw.ws)])
return SimulationResult(self, lw, [0], yaw_ilk, z, z, z, z)
res = self.calc_wt_interaction(x_i=x, y_i=y, h_i=h, type_i=type, yaw_ilk=yaw_ilk, wd=wd, ws=ws)
......
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