foxes 1.3__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 +3 -3
- examples/abl_states/run.py +2 -2
- examples/compare_rotors_pwakes/run.py +1 -1
- examples/compare_wakes/run.py +1 -2
- examples/dyn_wakes/run.py +29 -6
- examples/field_data_nc/run.py +1 -1
- examples/induction/run.py +3 -3
- examples/multi_height/run.py +1 -1
- examples/power_mask/run.py +2 -2
- examples/quickstart/run.py +0 -1
- examples/random_timeseries/run.py +3 -4
- examples/scan_row/run.py +3 -3
- examples/sequential/run.py +33 -10
- examples/single_state/run.py +3 -4
- examples/states_lookup_table/run.py +3 -3
- examples/streamline_wakes/run.py +29 -6
- examples/tab_file/run.py +3 -3
- examples/timelines/run.py +29 -5
- examples/timeseries/run.py +3 -3
- examples/timeseries_slurm/run.py +3 -3
- examples/wind_rose/run.py +3 -3
- examples/yawed_wake/run.py +19 -9
- foxes/__init__.py +21 -17
- foxes/algorithms/__init__.py +6 -6
- foxes/algorithms/downwind/__init__.py +2 -2
- foxes/algorithms/downwind/downwind.py +49 -17
- foxes/algorithms/downwind/models/__init__.py +6 -6
- foxes/algorithms/downwind/models/farm_wakes_calc.py +11 -9
- foxes/algorithms/downwind/models/init_farm_data.py +58 -29
- foxes/algorithms/downwind/models/point_wakes_calc.py +7 -13
- foxes/algorithms/downwind/models/set_amb_farm_results.py +1 -1
- foxes/algorithms/downwind/models/set_amb_point_results.py +6 -6
- foxes/algorithms/iterative/__init__.py +7 -3
- foxes/algorithms/iterative/iterative.py +1 -2
- foxes/algorithms/iterative/models/__init__.py +7 -3
- foxes/algorithms/iterative/models/farm_wakes_calc.py +9 -5
- foxes/algorithms/sequential/__init__.py +3 -3
- foxes/algorithms/sequential/models/__init__.py +2 -2
- foxes/algorithms/sequential/sequential.py +3 -4
- foxes/config/__init__.py +5 -1
- foxes/constants.py +16 -0
- foxes/core/__init__.py +45 -22
- foxes/core/algorithm.py +5 -6
- foxes/core/data.py +94 -22
- foxes/core/data_calc_model.py +4 -2
- foxes/core/engine.py +42 -53
- foxes/core/farm_controller.py +2 -2
- foxes/core/farm_data_model.py +16 -13
- foxes/core/ground_model.py +4 -13
- foxes/core/model.py +24 -6
- foxes/core/partial_wakes_model.py +147 -10
- foxes/core/point_data_model.py +21 -17
- foxes/core/rotor_model.py +4 -3
- foxes/core/states.py +2 -3
- foxes/core/turbine.py +2 -1
- foxes/core/wake_deflection.py +130 -0
- foxes/core/wake_model.py +222 -9
- foxes/core/wake_superposition.py +122 -4
- foxes/core/wind_farm.py +6 -6
- foxes/data/__init__.py +7 -2
- 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/data/states/weibull_sectors_12.csv +13 -0
- foxes/data/states/weibull_sectors_12.nc +0 -0
- foxes/engines/__init__.py +14 -15
- foxes/engines/dask.py +42 -20
- foxes/engines/default.py +2 -2
- foxes/engines/numpy.py +11 -13
- foxes/engines/pool.py +20 -11
- foxes/engines/single.py +8 -6
- foxes/input/__init__.py +3 -3
- foxes/input/farm_layout/__init__.py +9 -8
- foxes/input/farm_layout/from_arrays.py +68 -0
- foxes/input/farm_layout/from_csv.py +1 -1
- foxes/input/farm_layout/ring.py +0 -1
- foxes/input/states/__init__.py +28 -12
- foxes/input/states/create/__init__.py +3 -2
- foxes/input/states/dataset_states.py +710 -0
- foxes/input/states/field_data.py +531 -0
- foxes/input/states/multi_height.py +11 -6
- foxes/input/states/one_point_flow.py +1 -4
- foxes/input/states/point_cloud_data.py +618 -0
- foxes/input/states/scan.py +2 -0
- foxes/input/states/single.py +3 -1
- foxes/input/states/states_table.py +23 -30
- foxes/input/states/weibull_sectors.py +330 -0
- foxes/input/states/wrg_states.py +8 -6
- foxes/input/yaml/__init__.py +9 -3
- foxes/input/yaml/dict.py +42 -41
- foxes/input/yaml/windio/__init__.py +10 -5
- foxes/input/yaml/windio/read_attributes.py +42 -29
- foxes/input/yaml/windio/read_farm.py +17 -15
- foxes/input/yaml/windio/read_fields.py +4 -2
- foxes/input/yaml/windio/read_outputs.py +25 -15
- foxes/input/yaml/windio/read_site.py +172 -11
- foxes/input/yaml/windio/windio.py +23 -11
- foxes/input/yaml/yaml.py +1 -0
- foxes/models/__init__.py +15 -14
- foxes/models/axial_induction/__init__.py +2 -2
- foxes/models/farm_controllers/__init__.py +1 -1
- foxes/models/farm_models/__init__.py +1 -1
- foxes/models/ground_models/__init__.py +3 -2
- foxes/models/ground_models/wake_mirror.py +3 -3
- foxes/models/model_book.py +190 -63
- foxes/models/partial_wakes/__init__.py +6 -6
- foxes/models/partial_wakes/axiwake.py +30 -5
- foxes/models/partial_wakes/centre.py +47 -0
- foxes/models/partial_wakes/rotor_points.py +41 -11
- foxes/models/partial_wakes/segregated.py +2 -25
- foxes/models/partial_wakes/top_hat.py +27 -2
- foxes/models/point_models/__init__.py +4 -4
- foxes/models/rotor_models/__init__.py +4 -3
- foxes/models/rotor_models/centre.py +1 -1
- foxes/models/rotor_models/direct_infusion.py +241 -0
- foxes/models/turbine_models/__init__.py +11 -11
- 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 -9
- 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 -6
- foxes/models/turbine_types/PCt_from_two.py +1 -2
- foxes/models/turbine_types/__init__.py +10 -9
- 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/models/vertical_profiles/__init__.py +7 -7
- foxes/models/wake_deflections/__init__.py +3 -0
- foxes/models/{wake_frames/yawed_wakes.py → wake_deflections/bastankhah2016.py} +32 -111
- foxes/models/wake_deflections/jimenez.py +277 -0
- foxes/models/wake_deflections/no_deflection.py +94 -0
- foxes/models/wake_frames/__init__.py +6 -7
- foxes/models/wake_frames/dynamic_wakes.py +12 -3
- foxes/models/wake_frames/rotor_wd.py +3 -1
- foxes/models/wake_frames/seq_dynamic_wakes.py +41 -7
- foxes/models/wake_frames/streamlines.py +8 -6
- foxes/models/wake_frames/timelines.py +9 -3
- foxes/models/wake_models/__init__.py +7 -7
- foxes/models/wake_models/dist_sliced.py +50 -84
- foxes/models/wake_models/gaussian.py +20 -0
- foxes/models/wake_models/induction/__init__.py +5 -5
- foxes/models/wake_models/induction/rankine_half_body.py +30 -71
- foxes/models/wake_models/induction/rathmann.py +65 -64
- foxes/models/wake_models/induction/self_similar.py +65 -68
- foxes/models/wake_models/induction/self_similar2020.py +0 -3
- foxes/models/wake_models/induction/vortex_sheet.py +71 -75
- foxes/models/wake_models/ti/__init__.py +2 -2
- foxes/models/wake_models/ti/crespo_hernandez.py +5 -3
- foxes/models/wake_models/ti/iec_ti.py +6 -4
- foxes/models/wake_models/top_hat.py +58 -7
- foxes/models/wake_models/wind/__init__.py +6 -4
- foxes/models/wake_models/wind/bastankhah14.py +25 -7
- foxes/models/wake_models/wind/bastankhah16.py +35 -3
- foxes/models/wake_models/wind/jensen.py +15 -2
- foxes/models/wake_models/wind/turbopark.py +28 -2
- foxes/models/wake_superpositions/__init__.py +18 -9
- foxes/models/wake_superpositions/ti_linear.py +4 -4
- foxes/models/wake_superpositions/ti_max.py +4 -4
- foxes/models/wake_superpositions/ti_pow.py +4 -4
- foxes/models/wake_superpositions/ti_quadratic.py +4 -4
- foxes/models/wake_superpositions/wind_vector.py +257 -0
- foxes/models/wake_superpositions/ws_linear.py +9 -10
- foxes/models/wake_superpositions/ws_max.py +8 -8
- foxes/models/wake_superpositions/ws_pow.py +8 -8
- foxes/models/wake_superpositions/ws_product.py +4 -4
- foxes/models/wake_superpositions/ws_quadratic.py +8 -8
- foxes/output/__init__.py +21 -19
- foxes/output/farm_layout.py +4 -2
- foxes/output/farm_results_eval.py +19 -16
- foxes/output/flow_plots_2d/__init__.py +2 -2
- foxes/output/flow_plots_2d/flow_plots.py +18 -0
- foxes/output/flow_plots_2d/get_fig.py +5 -2
- foxes/output/output.py +6 -1
- foxes/output/results_writer.py +1 -1
- foxes/output/rose_plot.py +13 -3
- foxes/output/rotor_point_plots.py +3 -0
- foxes/output/seq_plugins/__init__.py +2 -2
- foxes/output/seq_plugins/seq_flow_ani_plugin.py +0 -3
- foxes/output/seq_plugins/seq_wake_debug_plugin.py +0 -1
- foxes/output/state_turbine_map.py +3 -0
- foxes/output/turbine_type_curves.py +10 -8
- foxes/utils/__init__.py +37 -19
- foxes/utils/abl/__init__.py +4 -4
- foxes/utils/cubic_roots.py +1 -1
- foxes/utils/data_book.py +4 -3
- foxes/utils/dict.py +49 -37
- foxes/utils/exec_python.py +5 -5
- foxes/utils/factory.py +3 -5
- foxes/utils/geom2d/__init__.py +7 -5
- foxes/utils/geopandas_utils.py +2 -2
- foxes/utils/pandas_utils.py +4 -3
- foxes/utils/tab_files.py +0 -1
- foxes/utils/weibull.py +28 -0
- foxes/utils/wrg_utils.py +3 -1
- foxes/utils/xarray_utils.py +9 -2
- foxes/variables.py +67 -9
- {foxes-1.3.dist-info → foxes-1.5.dist-info}/METADATA +34 -63
- foxes-1.5.dist-info/RECORD +328 -0
- {foxes-1.3.dist-info → foxes-1.5.dist-info}/WHEEL +1 -1
- tests/1_verification/flappy_0_6/PCt_files/flappy/run.py +2 -3
- tests/1_verification/flappy_0_6/PCt_files/test_PCt_files.py +1 -1
- tests/1_verification/flappy_0_6/abl_states/flappy/run.py +0 -1
- tests/1_verification/flappy_0_6/partial_top_hat/flappy/run.py +0 -1
- tests/1_verification/flappy_0_6/partial_top_hat/test_partial_top_hat.py +0 -2
- tests/1_verification/flappy_0_6/row_Jensen_linear_centre/test_row_Jensen_linear_centre.py +0 -1
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/test_row_Jensen_linear_tophat.py +0 -1
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/test_row_Jensen_linear_tophat_IECTI_2005.py +0 -1
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/test_row_Jensen_linear_tophat_IECTI_2019.py +0 -1
- tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py +0 -1
- tests/1_verification/flappy_0_6_2/grid_rotors/flappy/run.py +0 -2
- tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/test_row_Bastankhah_Crespo.py +0 -1
- tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/flappy/run.py +0 -1
- tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py +0 -1
- foxes/input/states/field_data_nc.py +0 -847
- foxes/output/round.py +0 -10
- foxes/utils/pandas_helpers.py +0 -178
- foxes-1.3.dist-info/RECORD +0 -313
- {foxes-1.3.dist-info → foxes-1.5.dist-info}/entry_points.txt +0 -0
- {foxes-1.3.dist-info → foxes-1.5.dist-info/licenses}/LICENSE +0 -0
- {foxes-1.3.dist-info → foxes-1.5.dist-info}/top_level.txt +0 -0
foxes/engines/numpy.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from tqdm import tqdm
|
|
2
2
|
from xarray import Dataset
|
|
3
|
-
from tqdm import tqdm
|
|
4
3
|
|
|
5
4
|
from foxes.core import Engine
|
|
6
5
|
import foxes.constants as FC
|
|
@@ -50,7 +49,7 @@ class NumpyEngine(Engine):
|
|
|
50
49
|
self,
|
|
51
50
|
algo,
|
|
52
51
|
model,
|
|
53
|
-
model_data
|
|
52
|
+
model_data,
|
|
54
53
|
farm_data=None,
|
|
55
54
|
point_data=None,
|
|
56
55
|
out_vars=[],
|
|
@@ -72,9 +71,9 @@ class NumpyEngine(Engine):
|
|
|
72
71
|
should be run
|
|
73
72
|
model_data: xarray.Dataset
|
|
74
73
|
The initial model data
|
|
75
|
-
farm_data: xarray.Dataset
|
|
74
|
+
farm_data: xarray.Dataset, optional
|
|
76
75
|
The initial farm data
|
|
77
|
-
point_data: xarray.Dataset
|
|
76
|
+
point_data: xarray.Dataset, optional
|
|
78
77
|
The initial point data
|
|
79
78
|
out_vars: list of str, optional
|
|
80
79
|
Names of the output variables
|
|
@@ -109,9 +108,6 @@ class NumpyEngine(Engine):
|
|
|
109
108
|
coords = {}
|
|
110
109
|
if FC.STATE in out_coords and FC.STATE in model_data.coords:
|
|
111
110
|
coords[FC.STATE] = model_data[FC.STATE].to_numpy()
|
|
112
|
-
if farm_data is None:
|
|
113
|
-
farm_data = Dataset()
|
|
114
|
-
goal_data = farm_data if point_data is None else point_data
|
|
115
111
|
|
|
116
112
|
# DEBUG objec mem sizes:
|
|
117
113
|
# from foxes.utils import print_mem
|
|
@@ -146,8 +142,6 @@ class NumpyEngine(Engine):
|
|
|
146
142
|
for chunki_points in range(n_chunks_targets):
|
|
147
143
|
i1_targets = i0_targets + chunk_sizes_targets[chunki_points]
|
|
148
144
|
|
|
149
|
-
i = chunki_states * n_chunks_targets + chunki_points
|
|
150
|
-
|
|
151
145
|
# get this chunk's data:
|
|
152
146
|
data = self.get_chunk_input_data(
|
|
153
147
|
algo=algo,
|
|
@@ -164,10 +158,10 @@ class NumpyEngine(Engine):
|
|
|
164
158
|
results[key] = _run(
|
|
165
159
|
algo,
|
|
166
160
|
model,
|
|
167
|
-
data,
|
|
168
|
-
iterative,
|
|
169
|
-
chunk_store,
|
|
170
|
-
(i0_states, i0_targets),
|
|
161
|
+
*data,
|
|
162
|
+
iterative=iterative,
|
|
163
|
+
chunk_store=chunk_store,
|
|
164
|
+
i0_t0=(i0_states, i0_targets),
|
|
171
165
|
**calc_pars,
|
|
172
166
|
)
|
|
173
167
|
chunk_store.update(results[key][1])
|
|
@@ -180,7 +174,11 @@ class NumpyEngine(Engine):
|
|
|
180
174
|
|
|
181
175
|
i0_states = i1_states
|
|
182
176
|
|
|
177
|
+
if farm_data is None:
|
|
178
|
+
farm_data = Dataset()
|
|
179
|
+
goal_data = farm_data if point_data is None else point_data
|
|
183
180
|
del calc_pars, farm_data, point_data
|
|
181
|
+
|
|
184
182
|
if pbar is not None:
|
|
185
183
|
pbar.close()
|
|
186
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,
|
foxes/input/__init__.py
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Functions for adding turbines to the wind farm.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from .row import add_row
|
|
6
|
-
from .grid import add_grid
|
|
7
|
-
from .from_json import add_from_json
|
|
8
|
-
from .from_csv import add_from_csv
|
|
9
|
-
from .from_file import add_from_file
|
|
10
|
-
from .from_df import add_from_df
|
|
11
|
-
from .from_random import add_random
|
|
12
|
-
from .ring import add_ring
|
|
5
|
+
from .row import add_row as add_row
|
|
6
|
+
from .grid import add_grid as add_grid
|
|
7
|
+
from .from_json import add_from_json as add_from_json
|
|
8
|
+
from .from_csv import add_from_csv as add_from_csv
|
|
9
|
+
from .from_file import add_from_file as add_from_file
|
|
10
|
+
from .from_df import add_from_df as add_from_df
|
|
11
|
+
from .from_random import add_random as add_random
|
|
12
|
+
from .ring import add_ring as add_ring
|
|
13
|
+
from .from_arrays import add_from_arrays as add_from_arrays
|
|
@@ -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
|
+
)
|
|
@@ -86,7 +86,7 @@ def add_from_csv(
|
|
|
86
86
|
for i in data.index:
|
|
87
87
|
s = 1 if turbine_base_name_count_shift else 0
|
|
88
88
|
tname = (
|
|
89
|
-
f"{turbine_base_name}{i+s}" if col_name is None else data.loc[i, col_name]
|
|
89
|
+
f"{turbine_base_name}{i + s}" if col_name is None else data.loc[i, col_name]
|
|
90
90
|
)
|
|
91
91
|
txy = data.loc[i, [col_x, col_y]].values
|
|
92
92
|
|
foxes/input/farm_layout/ring.py
CHANGED
foxes/input/states/__init__.py
CHANGED
|
@@ -2,18 +2,34 @@
|
|
|
2
2
|
Atmospheric input states.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from .single import SingleStateStates
|
|
6
|
-
from .scan import ScanStates
|
|
7
|
-
from .
|
|
8
|
-
from .
|
|
9
|
-
from .
|
|
10
|
-
|
|
5
|
+
from .single import SingleStateStates as SingleStateStates
|
|
6
|
+
from .scan import ScanStates as ScanStates
|
|
7
|
+
from .wrg_states import WRGStates as WRGStates
|
|
8
|
+
from .weibull_sectors import WeibullSectors as WeibullSectors
|
|
9
|
+
from .dataset_states import DatasetStates as DatasetStates
|
|
10
|
+
|
|
11
|
+
from .states_table import StatesTable as StatesTable
|
|
12
|
+
from .states_table import Timeseries as Timeseries
|
|
13
|
+
from .states_table import TabStates as TabStates
|
|
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
|
+
|
|
21
|
+
from .multi_height import MultiHeightStates as MultiHeightStates
|
|
22
|
+
from .multi_height import MultiHeightTimeseries as MultiHeightTimeseries
|
|
23
|
+
from .multi_height import MultiHeightNCStates as MultiHeightNCStates
|
|
24
|
+
from .multi_height import MultiHeightNCTimeseries as MultiHeightNCTimeseries
|
|
25
|
+
|
|
26
|
+
from .one_point_flow import OnePointFlowStates as OnePointFlowStates
|
|
27
|
+
from .one_point_flow import OnePointFlowTimeseries as OnePointFlowTimeseries
|
|
28
|
+
from .one_point_flow import (
|
|
29
|
+
OnePointFlowMultiHeightTimeseries as OnePointFlowMultiHeightTimeseries,
|
|
30
|
+
)
|
|
11
31
|
from .one_point_flow import (
|
|
12
|
-
|
|
13
|
-
OnePointFlowTimeseries,
|
|
14
|
-
OnePointFlowMultiHeightTimeseries,
|
|
15
|
-
OnePointFlowMultiHeightNCTimeseries,
|
|
32
|
+
OnePointFlowMultiHeightNCTimeseries as OnePointFlowMultiHeightNCTimeseries,
|
|
16
33
|
)
|
|
17
|
-
from .wrg_states import WRGStates
|
|
18
34
|
|
|
19
|
-
from . import create
|
|
35
|
+
from . import create as create
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
from .random_abl_states import create_random_abl_states
|
|
2
|
-
from .
|
|
1
|
+
from .random_abl_states import create_random_abl_states as create_random_abl_states
|
|
2
|
+
from .random_abl_states import write_random_abl_states as write_random_abl_states
|
|
3
|
+
from .random_timeseries import random_timseries_data as random_timseries_data
|