foxes 1.4__py3-none-any.whl → 1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of foxes might be problematic. Click here for more details.
- docs/source/conf.py +1 -1
- examples/field_data_nc/run.py +1 -1
- examples/streamline_wakes/run.py +2 -2
- examples/yawed_wake/run.py +3 -1
- foxes/algorithms/downwind/downwind.py +5 -5
- foxes/algorithms/downwind/models/init_farm_data.py +58 -28
- foxes/algorithms/downwind/models/set_amb_farm_results.py +1 -1
- foxes/core/algorithm.py +5 -5
- foxes/core/data.py +75 -4
- foxes/core/data_calc_model.py +4 -2
- foxes/core/engine.py +33 -40
- foxes/core/farm_data_model.py +16 -13
- foxes/core/model.py +19 -1
- foxes/core/point_data_model.py +19 -14
- foxes/core/rotor_model.py +1 -0
- foxes/core/wake_deflection.py +3 -3
- foxes/data/states/point_cloud_100.nc +0 -0
- foxes/data/states/weibull_cloud_4.nc +0 -0
- foxes/data/states/weibull_grid.nc +0 -0
- foxes/engines/dask.py +3 -6
- foxes/engines/default.py +2 -2
- foxes/engines/numpy.py +11 -10
- foxes/engines/pool.py +20 -11
- foxes/engines/single.py +8 -6
- foxes/input/farm_layout/__init__.py +1 -0
- foxes/input/farm_layout/from_arrays.py +68 -0
- foxes/input/states/__init__.py +7 -1
- foxes/input/states/dataset_states.py +710 -0
- foxes/input/states/field_data.py +531 -0
- foxes/input/states/multi_height.py +2 -0
- foxes/input/states/one_point_flow.py +1 -0
- foxes/input/states/point_cloud_data.py +618 -0
- foxes/input/states/scan.py +2 -0
- foxes/input/states/single.py +2 -0
- foxes/input/states/states_table.py +13 -23
- foxes/input/states/weibull_sectors.py +182 -77
- foxes/input/states/wrg_states.py +1 -1
- foxes/input/yaml/dict.py +25 -24
- foxes/input/yaml/windio/read_attributes.py +40 -27
- foxes/input/yaml/windio/read_farm.py +12 -10
- foxes/input/yaml/windio/read_outputs.py +25 -15
- foxes/input/yaml/windio/read_site.py +121 -12
- foxes/input/yaml/windio/windio.py +22 -10
- foxes/input/yaml/yaml.py +1 -0
- foxes/models/model_book.py +16 -15
- foxes/models/rotor_models/__init__.py +1 -0
- foxes/models/rotor_models/centre.py +1 -1
- foxes/models/rotor_models/direct_infusion.py +241 -0
- foxes/models/turbine_models/calculator.py +16 -3
- foxes/models/turbine_models/kTI_model.py +1 -0
- foxes/models/turbine_models/lookup_table.py +2 -0
- foxes/models/turbine_models/power_mask.py +1 -0
- foxes/models/turbine_models/rotor_centre_calc.py +2 -0
- foxes/models/turbine_models/sector_management.py +1 -0
- foxes/models/turbine_models/set_farm_vars.py +3 -8
- foxes/models/turbine_models/table_factors.py +2 -0
- foxes/models/turbine_models/thrust2ct.py +1 -0
- foxes/models/turbine_models/yaw2yawm.py +2 -0
- foxes/models/turbine_models/yawm2yaw.py +2 -0
- foxes/models/turbine_types/PCt_file.py +2 -4
- foxes/models/turbine_types/PCt_from_two.py +1 -0
- foxes/models/turbine_types/__init__.py +1 -0
- foxes/models/turbine_types/calculator_type.py +123 -0
- foxes/models/turbine_types/null_type.py +1 -0
- foxes/models/turbine_types/wsrho2PCt_from_two.py +2 -0
- foxes/models/turbine_types/wsti2PCt_from_two.py +3 -1
- foxes/output/farm_layout.py +2 -0
- foxes/output/farm_results_eval.py +4 -1
- foxes/output/flow_plots_2d/flow_plots.py +18 -0
- foxes/output/flow_plots_2d/get_fig.py +1 -0
- foxes/output/output.py +6 -1
- foxes/output/results_writer.py +1 -1
- foxes/output/rose_plot.py +10 -0
- foxes/output/rotor_point_plots.py +3 -0
- foxes/output/state_turbine_map.py +3 -0
- foxes/output/turbine_type_curves.py +3 -0
- foxes/utils/dict.py +46 -34
- foxes/utils/factory.py +2 -2
- {foxes-1.4.dist-info → foxes-1.5.dist-info}/METADATA +32 -52
- {foxes-1.4.dist-info → foxes-1.5.dist-info}/RECORD +84 -76
- foxes/input/states/field_data_nc.py +0 -833
- {foxes-1.4.dist-info → foxes-1.5.dist-info}/WHEEL +0 -0
- {foxes-1.4.dist-info → foxes-1.5.dist-info}/entry_points.txt +0 -0
- {foxes-1.4.dist-info → foxes-1.5.dist-info}/licenses/LICENSE +0 -0
- {foxes-1.4.dist-info → foxes-1.5.dist-info}/top_level.txt +0 -0
foxes/engines/dask.py
CHANGED
|
@@ -199,7 +199,6 @@ def _run_as_ufunc(
|
|
|
199
199
|
out_coords,
|
|
200
200
|
calc_pars,
|
|
201
201
|
init_vars,
|
|
202
|
-
ensure_variables,
|
|
203
202
|
calculate,
|
|
204
203
|
):
|
|
205
204
|
"""
|
|
@@ -314,7 +313,6 @@ def _run_as_ufunc(
|
|
|
314
313
|
data[1].dims[FV.WEIGHT] = data[0].dims[FV.WEIGHT]
|
|
315
314
|
|
|
316
315
|
# run model calculation:
|
|
317
|
-
ensure_variables(algo, *data)
|
|
318
316
|
results = calculate(algo, *data, **calc_pars)
|
|
319
317
|
|
|
320
318
|
# replace missing results by first input data with matching shape:
|
|
@@ -385,7 +383,7 @@ class XArrayEngine(DaskBaseEngine):
|
|
|
385
383
|
self,
|
|
386
384
|
algo,
|
|
387
385
|
model,
|
|
388
|
-
model_data
|
|
386
|
+
model_data,
|
|
389
387
|
farm_data=None,
|
|
390
388
|
point_data=None,
|
|
391
389
|
out_vars=[],
|
|
@@ -408,9 +406,9 @@ class XArrayEngine(DaskBaseEngine):
|
|
|
408
406
|
should be run
|
|
409
407
|
model_data: xarray.Dataset
|
|
410
408
|
The initial model data
|
|
411
|
-
farm_data: xarray.Dataset
|
|
409
|
+
farm_data: xarray.Dataset, optional
|
|
412
410
|
The initial farm data
|
|
413
|
-
point_data: xarray.Dataset
|
|
411
|
+
point_data: xarray.Dataset, optional
|
|
414
412
|
The initial point data
|
|
415
413
|
out_vars: list of str, optional
|
|
416
414
|
Names of the output variables
|
|
@@ -537,7 +535,6 @@ class XArrayEngine(DaskBaseEngine):
|
|
|
537
535
|
out_coords=out_coords,
|
|
538
536
|
calc_pars=calc_pars,
|
|
539
537
|
init_vars=ivars,
|
|
540
|
-
ensure_variables=model.ensure_variables,
|
|
541
538
|
calculate=model.calculate,
|
|
542
539
|
)
|
|
543
540
|
|
foxes/engines/default.py
CHANGED
|
@@ -60,7 +60,7 @@ class DefaultEngine(Engine):
|
|
|
60
60
|
self,
|
|
61
61
|
algo,
|
|
62
62
|
model,
|
|
63
|
-
model_data
|
|
63
|
+
model_data,
|
|
64
64
|
farm_data=None,
|
|
65
65
|
point_data=None,
|
|
66
66
|
**kwargs,
|
|
@@ -75,7 +75,7 @@ class DefaultEngine(Engine):
|
|
|
75
75
|
model: foxes.core.DataCalcModel
|
|
76
76
|
The model that whose calculate function
|
|
77
77
|
should be run
|
|
78
|
-
model_data: xarray.Dataset
|
|
78
|
+
model_data: xarray.Dataset
|
|
79
79
|
The initial model data
|
|
80
80
|
farm_data: xarray.Dataset, optional
|
|
81
81
|
The initial farm data
|
foxes/engines/numpy.py
CHANGED
|
@@ -49,7 +49,7 @@ class NumpyEngine(Engine):
|
|
|
49
49
|
self,
|
|
50
50
|
algo,
|
|
51
51
|
model,
|
|
52
|
-
model_data
|
|
52
|
+
model_data,
|
|
53
53
|
farm_data=None,
|
|
54
54
|
point_data=None,
|
|
55
55
|
out_vars=[],
|
|
@@ -71,9 +71,9 @@ class NumpyEngine(Engine):
|
|
|
71
71
|
should be run
|
|
72
72
|
model_data: xarray.Dataset
|
|
73
73
|
The initial model data
|
|
74
|
-
farm_data: xarray.Dataset
|
|
74
|
+
farm_data: xarray.Dataset, optional
|
|
75
75
|
The initial farm data
|
|
76
|
-
point_data: xarray.Dataset
|
|
76
|
+
point_data: xarray.Dataset, optional
|
|
77
77
|
The initial point data
|
|
78
78
|
out_vars: list of str, optional
|
|
79
79
|
Names of the output variables
|
|
@@ -108,9 +108,6 @@ class NumpyEngine(Engine):
|
|
|
108
108
|
coords = {}
|
|
109
109
|
if FC.STATE in out_coords and FC.STATE in model_data.coords:
|
|
110
110
|
coords[FC.STATE] = model_data[FC.STATE].to_numpy()
|
|
111
|
-
if farm_data is None:
|
|
112
|
-
farm_data = Dataset()
|
|
113
|
-
goal_data = farm_data if point_data is None else point_data
|
|
114
111
|
|
|
115
112
|
# DEBUG objec mem sizes:
|
|
116
113
|
# from foxes.utils import print_mem
|
|
@@ -161,10 +158,10 @@ class NumpyEngine(Engine):
|
|
|
161
158
|
results[key] = _run(
|
|
162
159
|
algo,
|
|
163
160
|
model,
|
|
164
|
-
data,
|
|
165
|
-
iterative,
|
|
166
|
-
chunk_store,
|
|
167
|
-
(i0_states, i0_targets),
|
|
161
|
+
*data,
|
|
162
|
+
iterative=iterative,
|
|
163
|
+
chunk_store=chunk_store,
|
|
164
|
+
i0_t0=(i0_states, i0_targets),
|
|
168
165
|
**calc_pars,
|
|
169
166
|
)
|
|
170
167
|
chunk_store.update(results[key][1])
|
|
@@ -177,7 +174,11 @@ class NumpyEngine(Engine):
|
|
|
177
174
|
|
|
178
175
|
i0_states = i1_states
|
|
179
176
|
|
|
177
|
+
if farm_data is None:
|
|
178
|
+
farm_data = Dataset()
|
|
179
|
+
goal_data = farm_data if point_data is None else point_data
|
|
180
180
|
del calc_pars, farm_data, point_data
|
|
181
|
+
|
|
181
182
|
if pbar is not None:
|
|
182
183
|
pbar.close()
|
|
183
184
|
|
foxes/engines/pool.py
CHANGED
|
@@ -7,7 +7,15 @@ from foxes.core import Engine
|
|
|
7
7
|
import foxes.constants as FC
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def _run(
|
|
10
|
+
def _run(
|
|
11
|
+
algo,
|
|
12
|
+
model,
|
|
13
|
+
*data,
|
|
14
|
+
iterative,
|
|
15
|
+
chunk_store,
|
|
16
|
+
i0_t0,
|
|
17
|
+
**cpars,
|
|
18
|
+
):
|
|
11
19
|
"""Helper function for running in a single process"""
|
|
12
20
|
algo.reset_chunk_store(chunk_store)
|
|
13
21
|
results = model.calculate(algo, *data, **cpars)
|
|
@@ -134,7 +142,7 @@ class PoolEngine(Engine):
|
|
|
134
142
|
self,
|
|
135
143
|
algo,
|
|
136
144
|
model,
|
|
137
|
-
model_data
|
|
145
|
+
model_data,
|
|
138
146
|
farm_data=None,
|
|
139
147
|
point_data=None,
|
|
140
148
|
out_vars=[],
|
|
@@ -156,9 +164,9 @@ class PoolEngine(Engine):
|
|
|
156
164
|
should be run
|
|
157
165
|
model_data: xarray.Dataset
|
|
158
166
|
The initial model data
|
|
159
|
-
farm_data: xarray.Dataset
|
|
167
|
+
farm_data: xarray.Dataset, optional
|
|
160
168
|
The initial farm data
|
|
161
|
-
point_data: xarray.Dataset
|
|
169
|
+
point_data: xarray.Dataset, optional
|
|
162
170
|
The initial point data
|
|
163
171
|
out_vars: list of str, optional
|
|
164
172
|
Names of the output variables
|
|
@@ -193,9 +201,6 @@ class PoolEngine(Engine):
|
|
|
193
201
|
coords = {}
|
|
194
202
|
if FC.STATE in out_coords and FC.STATE in model_data.coords:
|
|
195
203
|
coords[FC.STATE] = model_data[FC.STATE].to_numpy()
|
|
196
|
-
if farm_data is None:
|
|
197
|
-
farm_data = xr.Dataset()
|
|
198
|
-
goal_data = farm_data if point_data is None else point_data
|
|
199
204
|
|
|
200
205
|
# DEBUG objec mem sizes:
|
|
201
206
|
# from foxes.utils import print_mem
|
|
@@ -245,10 +250,10 @@ class PoolEngine(Engine):
|
|
|
245
250
|
_run,
|
|
246
251
|
algo,
|
|
247
252
|
model,
|
|
248
|
-
data,
|
|
249
|
-
iterative,
|
|
250
|
-
chunk_store,
|
|
251
|
-
(i0_states, i0_targets),
|
|
253
|
+
*data,
|
|
254
|
+
iterative=iterative,
|
|
255
|
+
chunk_store=chunk_store,
|
|
256
|
+
i0_t0=(i0_states, i0_targets),
|
|
252
257
|
**calc_pars,
|
|
253
258
|
)
|
|
254
259
|
del data
|
|
@@ -260,6 +265,10 @@ class PoolEngine(Engine):
|
|
|
260
265
|
|
|
261
266
|
i0_states = i1_states
|
|
262
267
|
|
|
268
|
+
if farm_data is None:
|
|
269
|
+
farm_data = xr.Dataset()
|
|
270
|
+
goal_data = farm_data if point_data is None else point_data
|
|
271
|
+
|
|
263
272
|
del calc_pars, farm_data, point_data
|
|
264
273
|
if pbar is not None:
|
|
265
274
|
pbar.close()
|
foxes/engines/single.py
CHANGED
|
@@ -73,7 +73,7 @@ class SingleChunkEngine(Engine):
|
|
|
73
73
|
self,
|
|
74
74
|
algo,
|
|
75
75
|
model,
|
|
76
|
-
model_data
|
|
76
|
+
model_data,
|
|
77
77
|
farm_data=None,
|
|
78
78
|
point_data=None,
|
|
79
79
|
out_vars=[],
|
|
@@ -95,9 +95,9 @@ class SingleChunkEngine(Engine):
|
|
|
95
95
|
should be run
|
|
96
96
|
model_data: xarray.Dataset
|
|
97
97
|
The initial model data
|
|
98
|
-
farm_data: xarray.Dataset
|
|
98
|
+
farm_data: xarray.Dataset, optional
|
|
99
99
|
The initial farm data
|
|
100
|
-
point_data: xarray.Dataset
|
|
100
|
+
point_data: xarray.Dataset, optional
|
|
101
101
|
The initial point data
|
|
102
102
|
out_vars: list of str, optional
|
|
103
103
|
Names of the output variables
|
|
@@ -133,9 +133,6 @@ class SingleChunkEngine(Engine):
|
|
|
133
133
|
coords = {}
|
|
134
134
|
if FC.STATE in out_coords and FC.STATE in model_data.coords:
|
|
135
135
|
coords[FC.STATE] = model_data[FC.STATE].to_numpy()
|
|
136
|
-
if farm_data is None:
|
|
137
|
-
farm_data = Dataset()
|
|
138
|
-
goal_data = farm_data if point_data is None else point_data
|
|
139
136
|
algo.reset_chunk_store(chunk_store)
|
|
140
137
|
|
|
141
138
|
# calculate:
|
|
@@ -157,6 +154,11 @@ class SingleChunkEngine(Engine):
|
|
|
157
154
|
|
|
158
155
|
results = {}
|
|
159
156
|
results[(0, 0)] = (model.calculate(algo, *data, **calc_pars), algo.chunk_store)
|
|
157
|
+
del data
|
|
158
|
+
|
|
159
|
+
if farm_data is None:
|
|
160
|
+
farm_data = Dataset()
|
|
161
|
+
goal_data = farm_data if point_data is None else point_data
|
|
160
162
|
|
|
161
163
|
return self.combine_results(
|
|
162
164
|
algo=algo,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from foxes.core import Turbine
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def add_from_arrays(
|
|
5
|
+
farm,
|
|
6
|
+
x,
|
|
7
|
+
y,
|
|
8
|
+
heights=None,
|
|
9
|
+
diameters=None,
|
|
10
|
+
ids=None,
|
|
11
|
+
names=None,
|
|
12
|
+
turbine_base_name="T",
|
|
13
|
+
turbine_base_name_count_shift=False,
|
|
14
|
+
verbosity=1,
|
|
15
|
+
**turbine_parameters,
|
|
16
|
+
):
|
|
17
|
+
"""
|
|
18
|
+
Add turbines to wind farm from direct one dimensional data arrays.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
farm: foxes.WindFarm
|
|
23
|
+
The wind farm
|
|
24
|
+
x: list or numpy.ndarray
|
|
25
|
+
The x-coordinates of the turbines
|
|
26
|
+
y: list or numpy.ndarray
|
|
27
|
+
The y-coordinates of the turbines
|
|
28
|
+
heights: list or numpy.ndarray, optional
|
|
29
|
+
The hub heights of the turbines, or None
|
|
30
|
+
diameters: list or numpy.ndarray, optional
|
|
31
|
+
The rotor diameters of the turbines, or None
|
|
32
|
+
ids: list or numpy.ndarray, optional
|
|
33
|
+
The ids of the turbines, or None
|
|
34
|
+
names: list or numpy.ndarray, optional
|
|
35
|
+
The names of the turbines, or None
|
|
36
|
+
turbine_base_name: str, optional
|
|
37
|
+
The turbine base name, only used
|
|
38
|
+
if col_name is None
|
|
39
|
+
turbine_base_name_count_shift: bool, optional
|
|
40
|
+
Start turbine names by 1 instead of 0
|
|
41
|
+
verbosity: int
|
|
42
|
+
The verbosity level, 0 = silent
|
|
43
|
+
turbine_parameters: dict, optional
|
|
44
|
+
Additional parameters are forwarded to the WindFarm.add_turbine().
|
|
45
|
+
|
|
46
|
+
:group: input.farm_layout
|
|
47
|
+
|
|
48
|
+
"""
|
|
49
|
+
tmodels = turbine_parameters.pop("turbine_models", [])
|
|
50
|
+
H = turbine_parameters.pop("H", None)
|
|
51
|
+
D = turbine_parameters.pop("D", None)
|
|
52
|
+
|
|
53
|
+
for i in range(len(x)):
|
|
54
|
+
s = 1 if turbine_base_name_count_shift else 0
|
|
55
|
+
tname = f"{turbine_base_name}{i + s}" if names is None else names[i]
|
|
56
|
+
|
|
57
|
+
farm.add_turbine(
|
|
58
|
+
Turbine(
|
|
59
|
+
name=tname,
|
|
60
|
+
index=ids[i] if ids is not None else i,
|
|
61
|
+
xy=[x[i], y[i]],
|
|
62
|
+
H=heights[i] if heights is not None else H,
|
|
63
|
+
D=diameters[i] if diameters is not None else D,
|
|
64
|
+
turbine_models=tmodels,
|
|
65
|
+
**turbine_parameters,
|
|
66
|
+
),
|
|
67
|
+
verbosity=verbosity,
|
|
68
|
+
)
|
foxes/input/states/__init__.py
CHANGED
|
@@ -4,14 +4,20 @@ Atmospheric input states.
|
|
|
4
4
|
|
|
5
5
|
from .single import SingleStateStates as SingleStateStates
|
|
6
6
|
from .scan import ScanStates as ScanStates
|
|
7
|
-
from .field_data_nc import FieldDataNC as FieldDataNC
|
|
8
7
|
from .wrg_states import WRGStates as WRGStates
|
|
9
8
|
from .weibull_sectors import WeibullSectors as WeibullSectors
|
|
9
|
+
from .dataset_states import DatasetStates as DatasetStates
|
|
10
10
|
|
|
11
11
|
from .states_table import StatesTable as StatesTable
|
|
12
12
|
from .states_table import Timeseries as Timeseries
|
|
13
13
|
from .states_table import TabStates as TabStates
|
|
14
14
|
|
|
15
|
+
from .field_data import FieldData as FieldData
|
|
16
|
+
from .field_data import WeibullField as WeibullField
|
|
17
|
+
|
|
18
|
+
from .point_cloud_data import WeibullPointCloud as WeibullPointCloud
|
|
19
|
+
from .point_cloud_data import PointCloudData as PointCloudData
|
|
20
|
+
|
|
15
21
|
from .multi_height import MultiHeightStates as MultiHeightStates
|
|
16
22
|
from .multi_height import MultiHeightTimeseries as MultiHeightTimeseries
|
|
17
23
|
from .multi_height import MultiHeightNCStates as MultiHeightNCStates
|