foxes 0.8.2__py3-none-any.whl → 1.1.0.2__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.

Files changed (215) hide show
  1. docs/source/conf.py +353 -0
  2. examples/abl_states/run.py +160 -0
  3. examples/compare_rotors_pwakes/run.py +217 -0
  4. examples/compare_wakes/run.py +241 -0
  5. examples/dyn_wakes/run.py +311 -0
  6. examples/field_data_nc/run.py +121 -0
  7. examples/induction/run.py +201 -0
  8. examples/multi_height/run.py +113 -0
  9. examples/power_mask/run.py +249 -0
  10. examples/random_timeseries/run.py +210 -0
  11. examples/scan_row/run.py +193 -0
  12. examples/sector_management/run.py +162 -0
  13. examples/sequential/run.py +209 -0
  14. examples/single_state/run.py +201 -0
  15. examples/states_lookup_table/run.py +137 -0
  16. examples/streamline_wakes/run.py +138 -0
  17. examples/tab_file/run.py +142 -0
  18. examples/timelines/run.py +267 -0
  19. examples/timeseries/run.py +190 -0
  20. examples/timeseries_slurm/run.py +185 -0
  21. examples/wind_rose/run.py +141 -0
  22. examples/windio/run.py +29 -0
  23. examples/yawed_wake/run.py +196 -0
  24. foxes/__init__.py +4 -8
  25. foxes/algorithms/__init__.py +1 -1
  26. foxes/algorithms/downwind/downwind.py +247 -111
  27. foxes/algorithms/downwind/models/farm_wakes_calc.py +12 -7
  28. foxes/algorithms/downwind/models/init_farm_data.py +2 -2
  29. foxes/algorithms/downwind/models/point_wakes_calc.py +6 -7
  30. foxes/algorithms/downwind/models/reorder_farm_output.py +1 -2
  31. foxes/algorithms/downwind/models/set_amb_farm_results.py +1 -1
  32. foxes/algorithms/downwind/models/set_amb_point_results.py +5 -3
  33. foxes/algorithms/iterative/iterative.py +74 -34
  34. foxes/algorithms/iterative/models/farm_wakes_calc.py +12 -7
  35. foxes/algorithms/iterative/models/urelax.py +3 -3
  36. foxes/algorithms/sequential/models/plugin.py +5 -5
  37. foxes/algorithms/sequential/models/seq_state.py +1 -1
  38. foxes/algorithms/sequential/sequential.py +126 -255
  39. foxes/constants.py +22 -7
  40. foxes/core/__init__.py +1 -0
  41. foxes/core/algorithm.py +632 -147
  42. foxes/core/data.py +252 -20
  43. foxes/core/data_calc_model.py +15 -291
  44. foxes/core/engine.py +640 -0
  45. foxes/core/farm_controller.py +38 -10
  46. foxes/core/farm_data_model.py +16 -1
  47. foxes/core/ground_model.py +2 -2
  48. foxes/core/model.py +249 -182
  49. foxes/core/partial_wakes_model.py +1 -1
  50. foxes/core/point_data_model.py +17 -2
  51. foxes/core/rotor_model.py +27 -21
  52. foxes/core/states.py +17 -1
  53. foxes/core/turbine_type.py +28 -0
  54. foxes/core/wake_frame.py +30 -34
  55. foxes/core/wake_model.py +5 -5
  56. foxes/core/wake_superposition.py +1 -1
  57. foxes/data/windio/windio_5turbines_timeseries.yaml +31 -15
  58. foxes/engines/__init__.py +17 -0
  59. foxes/engines/dask.py +982 -0
  60. foxes/engines/default.py +75 -0
  61. foxes/engines/futures.py +72 -0
  62. foxes/engines/mpi.py +38 -0
  63. foxes/engines/multiprocess.py +71 -0
  64. foxes/engines/numpy.py +167 -0
  65. foxes/engines/pool.py +249 -0
  66. foxes/engines/ray.py +79 -0
  67. foxes/engines/single.py +141 -0
  68. foxes/input/farm_layout/__init__.py +1 -0
  69. foxes/input/farm_layout/from_csv.py +4 -0
  70. foxes/input/farm_layout/from_json.py +2 -2
  71. foxes/input/farm_layout/grid.py +2 -2
  72. foxes/input/farm_layout/ring.py +65 -0
  73. foxes/input/farm_layout/row.py +2 -2
  74. foxes/input/states/__init__.py +7 -0
  75. foxes/input/states/create/random_abl_states.py +1 -1
  76. foxes/input/states/field_data_nc.py +158 -33
  77. foxes/input/states/multi_height.py +128 -14
  78. foxes/input/states/one_point_flow.py +577 -0
  79. foxes/input/states/scan_ws.py +74 -3
  80. foxes/input/states/single.py +1 -1
  81. foxes/input/states/slice_data_nc.py +681 -0
  82. foxes/input/states/states_table.py +204 -35
  83. foxes/input/windio/__init__.py +2 -2
  84. foxes/input/windio/get_states.py +44 -23
  85. foxes/input/windio/read_attributes.py +48 -17
  86. foxes/input/windio/read_farm.py +116 -102
  87. foxes/input/windio/read_fields.py +16 -6
  88. foxes/input/windio/read_outputs.py +71 -24
  89. foxes/input/windio/runner.py +31 -17
  90. foxes/input/windio/windio.py +41 -23
  91. foxes/models/farm_models/turbine2farm.py +1 -1
  92. foxes/models/ground_models/wake_mirror.py +10 -6
  93. foxes/models/model_book.py +58 -20
  94. foxes/models/partial_wakes/axiwake.py +3 -3
  95. foxes/models/partial_wakes/rotor_points.py +3 -3
  96. foxes/models/partial_wakes/top_hat.py +2 -2
  97. foxes/models/point_models/set_uniform_data.py +1 -1
  98. foxes/models/point_models/tke2ti.py +1 -1
  99. foxes/models/point_models/wake_deltas.py +1 -1
  100. foxes/models/rotor_models/centre.py +4 -0
  101. foxes/models/rotor_models/grid.py +24 -25
  102. foxes/models/rotor_models/levels.py +4 -5
  103. foxes/models/turbine_models/calculator.py +4 -6
  104. foxes/models/turbine_models/kTI_model.py +22 -6
  105. foxes/models/turbine_models/lookup_table.py +30 -4
  106. foxes/models/turbine_models/rotor_centre_calc.py +4 -3
  107. foxes/models/turbine_models/set_farm_vars.py +103 -34
  108. foxes/models/turbine_types/PCt_file.py +27 -3
  109. foxes/models/turbine_types/PCt_from_two.py +27 -3
  110. foxes/models/turbine_types/TBL_file.py +80 -0
  111. foxes/models/turbine_types/__init__.py +2 -0
  112. foxes/models/turbine_types/lookup.py +316 -0
  113. foxes/models/turbine_types/null_type.py +51 -1
  114. foxes/models/turbine_types/wsrho2PCt_from_two.py +29 -5
  115. foxes/models/turbine_types/wsti2PCt_from_two.py +31 -7
  116. foxes/models/vertical_profiles/__init__.py +1 -1
  117. foxes/models/vertical_profiles/data_profile.py +1 -1
  118. foxes/models/wake_frames/__init__.py +1 -0
  119. foxes/models/wake_frames/dynamic_wakes.py +424 -0
  120. foxes/models/wake_frames/farm_order.py +25 -5
  121. foxes/models/wake_frames/rotor_wd.py +6 -4
  122. foxes/models/wake_frames/seq_dynamic_wakes.py +61 -74
  123. foxes/models/wake_frames/streamlines.py +21 -22
  124. foxes/models/wake_frames/timelines.py +330 -129
  125. foxes/models/wake_frames/yawed_wakes.py +7 -4
  126. foxes/models/wake_models/dist_sliced.py +2 -4
  127. foxes/models/wake_models/induction/rankine_half_body.py +5 -5
  128. foxes/models/wake_models/induction/rathmann.py +78 -24
  129. foxes/models/wake_models/induction/self_similar.py +78 -28
  130. foxes/models/wake_models/induction/vortex_sheet.py +86 -48
  131. foxes/models/wake_models/ti/crespo_hernandez.py +6 -4
  132. foxes/models/wake_models/ti/iec_ti.py +40 -21
  133. foxes/models/wake_models/top_hat.py +1 -1
  134. foxes/models/wake_models/wind/bastankhah14.py +8 -6
  135. foxes/models/wake_models/wind/bastankhah16.py +17 -16
  136. foxes/models/wake_models/wind/jensen.py +4 -3
  137. foxes/models/wake_models/wind/turbopark.py +16 -13
  138. foxes/models/wake_superpositions/ti_linear.py +1 -1
  139. foxes/models/wake_superpositions/ti_max.py +1 -1
  140. foxes/models/wake_superpositions/ti_pow.py +1 -1
  141. foxes/models/wake_superpositions/ti_quadratic.py +1 -1
  142. foxes/models/wake_superpositions/ws_linear.py +8 -7
  143. foxes/models/wake_superpositions/ws_max.py +8 -7
  144. foxes/models/wake_superpositions/ws_pow.py +8 -7
  145. foxes/models/wake_superpositions/ws_product.py +5 -5
  146. foxes/models/wake_superpositions/ws_quadratic.py +8 -7
  147. foxes/output/__init__.py +4 -1
  148. foxes/output/farm_layout.py +16 -12
  149. foxes/output/farm_results_eval.py +1 -1
  150. foxes/output/flow_plots_2d/__init__.py +0 -1
  151. foxes/output/flow_plots_2d/flow_plots.py +70 -30
  152. foxes/output/grids.py +92 -22
  153. foxes/output/results_writer.py +2 -2
  154. foxes/output/rose_plot.py +3 -3
  155. foxes/output/seq_plugins/__init__.py +2 -0
  156. foxes/output/{flow_plots_2d → seq_plugins}/seq_flow_ani_plugin.py +64 -22
  157. foxes/output/seq_plugins/seq_wake_debug_plugin.py +145 -0
  158. foxes/output/slice_data.py +131 -111
  159. foxes/output/state_turbine_map.py +19 -14
  160. foxes/output/state_turbine_table.py +19 -19
  161. foxes/utils/__init__.py +1 -1
  162. foxes/utils/abl/neutral.py +2 -2
  163. foxes/utils/abl/stable.py +2 -2
  164. foxes/utils/abl/unstable.py +2 -2
  165. foxes/utils/data_book.py +1 -1
  166. foxes/utils/dev_utils.py +42 -0
  167. foxes/utils/dict.py +24 -1
  168. foxes/utils/exec_python.py +1 -1
  169. foxes/utils/factory.py +176 -53
  170. foxes/utils/geom2d/circle.py +1 -1
  171. foxes/utils/geom2d/polygon.py +1 -1
  172. foxes/utils/geopandas_utils.py +2 -2
  173. foxes/utils/load.py +2 -2
  174. foxes/utils/pandas_helpers.py +3 -2
  175. foxes/utils/wind_dir.py +0 -2
  176. foxes/utils/xarray_utils.py +24 -14
  177. foxes/variables.py +39 -2
  178. {foxes-0.8.2.dist-info → foxes-1.1.0.2.dist-info}/METADATA +75 -33
  179. foxes-1.1.0.2.dist-info/RECORD +309 -0
  180. {foxes-0.8.2.dist-info → foxes-1.1.0.2.dist-info}/WHEEL +1 -1
  181. foxes-1.1.0.2.dist-info/top_level.txt +4 -0
  182. tests/0_consistency/iterative/test_iterative.py +92 -0
  183. tests/0_consistency/partial_wakes/test_partial_wakes.py +90 -0
  184. tests/1_verification/flappy_0_6/PCt_files/flappy/run.py +85 -0
  185. tests/1_verification/flappy_0_6/PCt_files/test_PCt_files.py +103 -0
  186. tests/1_verification/flappy_0_6/abl_states/flappy/run.py +85 -0
  187. tests/1_verification/flappy_0_6/abl_states/test_abl_states.py +87 -0
  188. tests/1_verification/flappy_0_6/partial_top_hat/flappy/run.py +82 -0
  189. tests/1_verification/flappy_0_6/partial_top_hat/test_partial_top_hat.py +82 -0
  190. tests/1_verification/flappy_0_6/row_Jensen_linear_centre/flappy/run.py +92 -0
  191. tests/1_verification/flappy_0_6/row_Jensen_linear_centre/test_row_Jensen_linear_centre.py +93 -0
  192. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/flappy/run.py +92 -0
  193. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/test_row_Jensen_linear_tophat.py +96 -0
  194. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/flappy/run.py +94 -0
  195. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/test_row_Jensen_linear_tophat_IECTI_2005.py +122 -0
  196. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/flappy/run.py +94 -0
  197. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/test_row_Jensen_linear_tophat_IECTI_2019.py +122 -0
  198. tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/flappy/run.py +92 -0
  199. tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py +93 -0
  200. tests/1_verification/flappy_0_6_2/grid_rotors/flappy/run.py +85 -0
  201. tests/1_verification/flappy_0_6_2/grid_rotors/test_grid_rotors.py +130 -0
  202. tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/flappy/run.py +96 -0
  203. tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/test_row_Bastankhah_Crespo.py +116 -0
  204. tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/flappy/run.py +93 -0
  205. tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py +99 -0
  206. tests/3_examples/test_examples.py +34 -0
  207. foxes/VERSION +0 -1
  208. foxes/output/flow_plots_2d.py +0 -0
  209. foxes/utils/geopandas_helpers.py +0 -294
  210. foxes/utils/runners/__init__.py +0 -1
  211. foxes/utils/runners/runners.py +0 -280
  212. foxes-0.8.2.dist-info/RECORD +0 -247
  213. foxes-0.8.2.dist-info/top_level.txt +0 -1
  214. foxes-0.8.2.dist-info/zip-safe +0 -1
  215. {foxes-0.8.2.dist-info → foxes-1.1.0.2.dist-info}/LICENSE +0 -0
@@ -140,9 +140,9 @@ class Bastankhah2014(GaussianWakeModel):
140
140
  downwind_index=downwind_index,
141
141
  upcast=True,
142
142
  )
143
-
143
+
144
144
  # select targets:
145
- st_sel = (x > 0) & (ct > 0)
145
+ st_sel = (x > 1e-8) & (ct > 1e-8)
146
146
  if np.any(st_sel):
147
147
  # apply selection:
148
148
  x = x[st_sel]
@@ -157,8 +157,9 @@ class Bastankhah2014(GaussianWakeModel):
157
157
  fdata=fdata,
158
158
  tdata=tdata,
159
159
  downwind_index=downwind_index,
160
- upcast=True,
161
- )[st_sel]
160
+ upcast=False,
161
+ selection=st_sel,
162
+ )
162
163
 
163
164
  # get k:
164
165
  k = self.wake_k(
@@ -167,8 +168,9 @@ class Bastankhah2014(GaussianWakeModel):
167
168
  fdata=fdata,
168
169
  tdata=tdata,
169
170
  downwind_index=downwind_index,
170
- upcast=True,
171
- )[st_sel]
171
+ upcast=False,
172
+ selection=st_sel,
173
+ )
172
174
 
173
175
  # calculate sigma:
174
176
  # beta = 0.5 * (1 + np.sqrt(1.0 - ct)) / np.sqrt(1.0 - ct)
@@ -146,13 +146,13 @@ class Bastankhah2016Model(Model):
146
146
  The k parameter values, shape: (n_states, n_targets)
147
147
 
148
148
  """
149
-
150
149
  # store parameters:
151
150
  out = {self.PARS: self.pars}
152
151
  out[self.CHECK] = (
153
- mdata[FC.STATE][0],
152
+ mdata.states_i0(counter=True),
153
+ mdata.n_states,
154
154
  downwind_index,
155
- x.shape,
155
+ hash(x.tobytes()),
156
156
  )
157
157
 
158
158
  # get D:
@@ -180,7 +180,7 @@ class Bastankhah2016Model(Model):
180
180
  )
181
181
 
182
182
  # select targets:
183
- st_sel = (x > 0) & (ct > 0.0)
183
+ st_sel = (x > 1e-8) & (ct > 1e-8)
184
184
  if np.any(st_sel):
185
185
  # get ws:
186
186
  ws = super().get_data(
@@ -191,7 +191,8 @@ class Bastankhah2016Model(Model):
191
191
  fdata=fdata,
192
192
  tdata=tdata,
193
193
  downwind_index=downwind_index,
194
- upcast=True,
194
+ upcast=False,
195
+ selection=st_sel,
195
196
  )
196
197
 
197
198
  # get TI:
@@ -203,7 +204,8 @@ class Bastankhah2016Model(Model):
203
204
  fdata=fdata,
204
205
  tdata=tdata,
205
206
  downwind_index=downwind_index,
206
- upcast=True,
207
+ upcast=False,
208
+ selection=st_sel,
207
209
  )
208
210
 
209
211
  # get alpha:
@@ -215,7 +217,8 @@ class Bastankhah2016Model(Model):
215
217
  fdata=fdata,
216
218
  tdata=tdata,
217
219
  downwind_index=downwind_index,
218
- upcast=True,
220
+ upcast=False,
221
+ selection=st_sel,
219
222
  )
220
223
 
221
224
  # get beta:
@@ -227,19 +230,16 @@ class Bastankhah2016Model(Model):
227
230
  fdata=fdata,
228
231
  tdata=tdata,
229
232
  downwind_index=downwind_index,
230
- upcast=True,
233
+ upcast=False,
234
+ selection=st_sel,
231
235
  )
232
236
 
233
237
  # apply filter:
234
238
  x = x[st_sel]
235
239
  D = D[st_sel]
236
240
  ct = ct[st_sel]
237
- ws = ws[st_sel]
238
- ti = ti[st_sel]
239
241
  k = k[st_sel]
240
242
  gamma = gamma[st_sel]
241
- alpha = alpha[st_sel]
242
- beta = beta[st_sel]
243
243
 
244
244
  # calc theta_c0, Eq. (6.12):
245
245
  cosg = np.cos(gamma)
@@ -329,7 +329,7 @@ class Bastankhah2016Model(Model):
329
329
 
330
330
  # update mdata:
331
331
  out[self.ST_SEL] = st_sel
332
- mdata[self.MDATA_KEY] = out
332
+ mdata.add(self.MDATA_KEY, out, None)
333
333
 
334
334
  def has_data(self, mdata, downwind_index, x):
335
335
  """
@@ -352,9 +352,10 @@ class Bastankhah2016Model(Model):
352
352
 
353
353
  """
354
354
  check = (
355
- mdata[FC.STATE][0],
355
+ mdata.states_i0(counter=True),
356
+ mdata.n_states,
356
357
  downwind_index,
357
- x.shape,
358
+ hash(x.tobytes()),
358
359
  )
359
360
  return self.MDATA_KEY in mdata and mdata[self.MDATA_KEY][self.CHECK] == check
360
361
 
@@ -551,7 +552,7 @@ class Bastankhah2016(DistSlicedWakeModel):
551
552
  upcast=True,
552
553
  downwind_index=downwind_index,
553
554
  )
554
- gamma *= np.pi / 180
555
+ gamma = gamma * np.pi / 180
555
556
 
556
557
  # get k:
557
558
  k = self.wake_k(
@@ -88,7 +88,7 @@ class JensenWake(TopHatWakeModel):
88
88
  fdata=fdata,
89
89
  tdata=tdata,
90
90
  downwind_index=downwind_index,
91
- upcast=False,
91
+ upcast=True,
92
92
  )
93
93
 
94
94
  k = self.wake_k(
@@ -156,8 +156,9 @@ class JensenWake(TopHatWakeModel):
156
156
  fdata=fdata,
157
157
  tdata=tdata,
158
158
  downwind_index=downwind_index,
159
- upcast=True,
160
- )[st_sel]
159
+ upcast=False,
160
+ selection=st_sel,
161
+ )
161
162
  / 2
162
163
  )
163
164
 
@@ -160,7 +160,7 @@ class TurbOParkWake(GaussianWakeModel):
160
160
  )
161
161
 
162
162
  # select targets:
163
- st_sel = (x > 1e-5) & (ct > 0.0)
163
+ st_sel = (x > 1e-8) & (ct > 1e-8)
164
164
  if np.any(st_sel):
165
165
  # apply selection:
166
166
  x = x[st_sel]
@@ -175,8 +175,9 @@ class TurbOParkWake(GaussianWakeModel):
175
175
  fdata=fdata,
176
176
  tdata=tdata,
177
177
  downwind_index=downwind_index,
178
- upcast=True,
179
- )[st_sel]
178
+ upcast=False,
179
+ selection=st_sel,
180
+ )
180
181
 
181
182
  # get TI:
182
183
  ati = self.get_data(
@@ -187,7 +188,8 @@ class TurbOParkWake(GaussianWakeModel):
187
188
  fdata=fdata,
188
189
  tdata=tdata,
189
190
  downwind_index=downwind_index,
190
- upcast=True,
191
+ upcast=False,
192
+ selection=st_sel,
191
193
  )
192
194
 
193
195
  # get k:
@@ -197,11 +199,10 @@ class TurbOParkWake(GaussianWakeModel):
197
199
  fdata=fdata,
198
200
  tdata=tdata,
199
201
  downwind_index=downwind_index,
200
- upcast=True,
201
202
  amb_ti=ati,
202
- )[st_sel]
203
-
204
- ati = ati[st_sel]
203
+ upcast=False,
204
+ selection=st_sel,
205
+ )
205
206
 
206
207
  # calculate sigma:
207
208
  # beta = np.sqrt(0.5 * (1 + np.sqrt(1.0 - ct)) / np.sqrt(1.0 - ct))
@@ -443,7 +444,7 @@ class TurbOParkWakeIX(GaussianWakeModel):
443
444
  )
444
445
 
445
446
  # select targets:
446
- st_sel = (x > 1e-5) & (ct > 0.0)
447
+ st_sel = (x > 1e-8) & (ct > 1e-8)
447
448
  if np.any(st_sel):
448
449
  # apply selection:
449
450
  # x = x[st_sel]
@@ -458,8 +459,9 @@ class TurbOParkWakeIX(GaussianWakeModel):
458
459
  fdata=fdata,
459
460
  tdata=tdata,
460
461
  downwind_index=downwind_index,
461
- upcast=True,
462
- )[st_sel]
462
+ upcast=False,
463
+ selection=st_sel,
464
+ )
463
465
 
464
466
  # get k:
465
467
  k = self.wake_k(
@@ -468,8 +470,9 @@ class TurbOParkWakeIX(GaussianWakeModel):
468
470
  fdata=fdata,
469
471
  tdata=tdata,
470
472
  downwind_index=downwind_index,
471
- upcast=True,
472
- )[st_sel]
473
+ upcast=False,
474
+ selection=st_sel,
475
+ )
473
476
 
474
477
  # calculate sigma:
475
478
  # beta = np.sqrt(0.5 * (1 + np.sqrt(1.0 - ct)) / np.sqrt(1.0 - ct))
@@ -63,7 +63,7 @@ class TILinear(WakeSuperposition):
63
63
  The target point data
64
64
  downwind_index: int
65
65
  The index of the wake causing turbine
66
- in the downwnd order
66
+ in the downwind order
67
67
  st_sel: numpy.ndarray of bool
68
68
  The selection of targets, shape: (n_states, n_targets)
69
69
  variable: str
@@ -63,7 +63,7 @@ class TIMax(WakeSuperposition):
63
63
  The target point data
64
64
  downwind_index: int
65
65
  The index of the wake causing turbine
66
- in the downwnd order
66
+ in the downwind order
67
67
  st_sel: numpy.ndarray of bool
68
68
  The selection of targets, shape: (n_states, n_targets)
69
69
  variable: str
@@ -70,7 +70,7 @@ class TIPow(WakeSuperposition):
70
70
  The target point data
71
71
  downwind_index: int
72
72
  The index of the wake causing turbine
73
- in the downwnd order
73
+ in the downwind order
74
74
  st_sel: numpy.ndarray of bool
75
75
  The selection of targets, shape: (n_states, n_targets)
76
76
  variable: str
@@ -63,7 +63,7 @@ class TIQuadratic(WakeSuperposition):
63
63
  The target point data
64
64
  downwind_index: int
65
65
  The index of the wake causing turbine
66
- in the downwnd order
66
+ in the downwind order
67
67
  st_sel: numpy.ndarray of bool
68
68
  The selection of targets, shape: (n_states, n_targets)
69
69
  variable: str
@@ -7,7 +7,7 @@ import foxes.constants as FC
7
7
 
8
8
  class WSLinear(WakeSuperposition):
9
9
  """
10
- Linear supersposition of wind deficit results
10
+ Linear superposition of wind deficit results
11
11
 
12
12
  Attributes
13
13
  ----------
@@ -94,7 +94,7 @@ class WSLinear(WakeSuperposition):
94
94
  The target point data
95
95
  downwind_index: int
96
96
  The index of the wake causing turbine
97
- in the downwnd order
97
+ in the downwind order
98
98
  st_sel: numpy.ndarray of bool
99
99
  The selection of targets, shape: (n_states, n_targets)
100
100
  variable: str
@@ -121,14 +121,15 @@ class WSLinear(WakeSuperposition):
121
121
  if np.any(st_sel):
122
122
  scale = self.get_data(
123
123
  FV.AMB_REWS if self.scale_amb else FV.REWS,
124
- FC.STATE_TARGET,
124
+ FC.STATE_TARGET_TPOINT,
125
125
  lookup="w",
126
126
  algo=algo,
127
127
  fdata=fdata,
128
128
  tdata=tdata,
129
129
  downwind_index=downwind_index,
130
- upcast=True,
131
- )[st_sel, None]
130
+ upcast=False,
131
+ selection=st_sel,
132
+ )
132
133
 
133
134
  wake_delta[st_sel] += scale * wake_model_result
134
135
 
@@ -182,7 +183,7 @@ class WSLinear(WakeSuperposition):
182
183
 
183
184
  class WSLinearLocal(WakeSuperposition):
184
185
  """
185
- Local linear supersposition of wind deficit results
186
+ Local linear superposition of wind deficit results
186
187
 
187
188
  Attributes
188
189
  ----------
@@ -261,7 +262,7 @@ class WSLinearLocal(WakeSuperposition):
261
262
  The target point data
262
263
  downwind_index: int
263
264
  The index of the wake causing turbine
264
- in the downwnd order
265
+ in the downwind order
265
266
  st_sel: numpy.ndarray of bool
266
267
  The selection of targets, shape: (n_states, n_targets)
267
268
  variable: str
@@ -7,7 +7,7 @@ import foxes.constants as FC
7
7
 
8
8
  class WSMax(WakeSuperposition):
9
9
  """
10
- Max supersposition of wind deficit results
10
+ Max superposition of wind deficit results
11
11
 
12
12
  Attributes
13
13
  ----------
@@ -94,7 +94,7 @@ class WSMax(WakeSuperposition):
94
94
  The target point data
95
95
  downwind_index: int
96
96
  The index of the wake causing turbine
97
- in the downwnd order
97
+ in the downwind order
98
98
  st_sel: numpy.ndarray of bool
99
99
  The selection of targets, shape: (n_states, n_targets)
100
100
  variable: str
@@ -121,14 +121,15 @@ class WSMax(WakeSuperposition):
121
121
  if np.any(st_sel):
122
122
  scale = self.get_data(
123
123
  FV.AMB_REWS if self.scale_amb else FV.REWS,
124
- FC.STATE_TARGET,
124
+ FC.STATE_TARGET_TPOINT,
125
125
  lookup="w",
126
126
  algo=algo,
127
127
  fdata=fdata,
128
128
  tdata=tdata,
129
129
  downwind_index=downwind_index,
130
- upcast=True,
131
- )[st_sel, None]
130
+ upcast=False,
131
+ selection=st_sel,
132
+ )
132
133
 
133
134
  wake_model_result = np.abs(scale * wake_model_result)
134
135
  odelta = wake_delta[st_sel]
@@ -185,7 +186,7 @@ class WSMax(WakeSuperposition):
185
186
 
186
187
  class WSMaxLocal(WakeSuperposition):
187
188
  """
188
- Local max supersposition of wind deficit results
189
+ Local max superposition of wind deficit results
189
190
 
190
191
  Attributes
191
192
  ----------
@@ -264,7 +265,7 @@ class WSMaxLocal(WakeSuperposition):
264
265
  The target point data
265
266
  downwind_index: int
266
267
  The index of the wake causing turbine
267
- in the downwnd order
268
+ in the downwind order
268
269
  st_sel: numpy.ndarray of bool
269
270
  The selection of targets, shape: (n_states, n_targets)
270
271
  variable: str
@@ -7,7 +7,7 @@ import foxes.constants as FC
7
7
 
8
8
  class WSPow(WakeSuperposition):
9
9
  """
10
- Power supersposition of wind deficit results
10
+ Power superposition of wind deficit results
11
11
 
12
12
  Attributes
13
13
  ----------
@@ -99,7 +99,7 @@ class WSPow(WakeSuperposition):
99
99
  The target point data
100
100
  downwind_index: int
101
101
  The index of the wake causing turbine
102
- in the downwnd order
102
+ in the downwind order
103
103
  st_sel: numpy.ndarray of bool
104
104
  The selection of targets, shape: (n_states, n_targets)
105
105
  variable: str
@@ -126,14 +126,15 @@ class WSPow(WakeSuperposition):
126
126
  if np.any(st_sel):
127
127
  scale = self.get_data(
128
128
  FV.AMB_REWS if self.scale_amb else FV.REWS,
129
- FC.STATE_TARGET,
129
+ FC.STATE_TARGET_TPOINT,
130
130
  lookup="w",
131
131
  algo=algo,
132
132
  fdata=fdata,
133
133
  tdata=tdata,
134
134
  downwind_index=downwind_index,
135
- upcast=True,
136
- )[st_sel, None]
135
+ upcast=False,
136
+ selection=st_sel,
137
+ )
137
138
 
138
139
  wake_delta[st_sel] += np.abs(scale * wake_model_result) ** self.pow
139
140
 
@@ -187,7 +188,7 @@ class WSPow(WakeSuperposition):
187
188
 
188
189
  class WSPowLocal(WakeSuperposition):
189
190
  """
190
- Local power supersposition of wind deficit results
191
+ Local power superposition of wind deficit results
191
192
 
192
193
  Attributes
193
194
  ----------
@@ -272,7 +273,7 @@ class WSPowLocal(WakeSuperposition):
272
273
  The target point data
273
274
  downwind_index: int
274
275
  The index of the wake causing turbine
275
- in the downwnd order
276
+ in the downwind order
276
277
  st_sel: numpy.ndarray of bool
277
278
  The selection of targets, shape: (n_states, n_targets)
278
279
  variable: str
@@ -7,7 +7,7 @@ import foxes.constants as FC
7
7
 
8
8
  class WSProduct(WakeSuperposition):
9
9
  """
10
- Product supersposition of wind deficit results
10
+ Product superposition of wind deficit results
11
11
 
12
12
  This is based on the idea that the dimensionless
13
13
  wind deficit should be rescaled with the wake
@@ -95,7 +95,7 @@ class WSProduct(WakeSuperposition):
95
95
  The target point data
96
96
  downwind_index: int
97
97
  The index of the wake causing turbine
98
- in the downwnd order
98
+ in the downwind order
99
99
  st_sel: numpy.ndarray of bool
100
100
  The selection of targets, shape: (n_states, n_targets)
101
101
  variable: str
@@ -119,10 +119,10 @@ class WSProduct(WakeSuperposition):
119
119
  f"Superposition '{self.name}': Expecting wind speed variable, got {variable}"
120
120
  )
121
121
 
122
- if np.any(st_sel):
123
- if np.max(np.abs(wake_delta)) < 1e-14:
124
- wake_delta[:] = 1
122
+ if np.max(np.abs(wake_delta)) < 1e-14:
123
+ wake_delta[:] = 1
125
124
 
125
+ if np.any(st_sel):
126
126
  wake_delta[st_sel] *= 1 + wake_model_result
127
127
 
128
128
  return wake_delta
@@ -7,7 +7,7 @@ import foxes.constants as FC
7
7
 
8
8
  class WSQuadratic(WakeSuperposition):
9
9
  """
10
- Quadratic supersposition of wind deficit results
10
+ Quadratic superposition of wind deficit results
11
11
 
12
12
  Attributes
13
13
  ----------
@@ -94,7 +94,7 @@ class WSQuadratic(WakeSuperposition):
94
94
  The target point data
95
95
  downwind_index: int
96
96
  The index of the wake causing turbine
97
- in the downwnd order
97
+ in the downwind order
98
98
  st_sel: numpy.ndarray of bool
99
99
  The selection of targets, shape: (n_states, n_targets)
100
100
  variable: str
@@ -121,14 +121,15 @@ class WSQuadratic(WakeSuperposition):
121
121
  if np.any(st_sel):
122
122
  scale = self.get_data(
123
123
  FV.AMB_REWS if self.scale_amb else FV.REWS,
124
- FC.STATE_TARGET,
124
+ FC.STATE_TARGET_TPOINT,
125
125
  lookup="w",
126
126
  algo=algo,
127
127
  fdata=fdata,
128
128
  tdata=tdata,
129
129
  downwind_index=downwind_index,
130
- upcast=True,
131
- )[st_sel, None]
130
+ upcast=False,
131
+ selection=st_sel,
132
+ )
132
133
 
133
134
  wake_delta[st_sel] += (scale * wake_model_result) ** 2
134
135
 
@@ -182,7 +183,7 @@ class WSQuadratic(WakeSuperposition):
182
183
 
183
184
  class WSQuadraticLocal(WakeSuperposition):
184
185
  """
185
- Local quadratic supersposition of wind deficit results
186
+ Local quadratic superposition of wind deficit results
186
187
 
187
188
  Attributes
188
189
  ----------
@@ -261,7 +262,7 @@ class WSQuadraticLocal(WakeSuperposition):
261
262
  The target point data
262
263
  downwind_index: int
263
264
  The index of the wake causing turbine
264
- in the downwnd order
265
+ in the downwind order
265
266
  st_sel: numpy.ndarray of bool
266
267
  The selection of targets, shape: (n_states, n_targets)
267
268
  variable: str
foxes/output/__init__.py CHANGED
@@ -16,5 +16,8 @@ from .slice_data import SliceData
16
16
  from .rotor_point_plots import RotorPointPlot
17
17
  from .state_turbine_table import StateTurbineTable
18
18
 
19
- from .flow_plots_2d import FlowPlots2D, SeqFlowAnimationPlugin
19
+ from .flow_plots_2d import FlowPlots2D
20
+ from .seq_plugins import SeqFlowAnimationPlugin, SeqWakeDebugPlugin
21
+
20
22
  from . import grids
23
+ from . import seq_plugins
@@ -138,7 +138,7 @@ class FarmLayoutOutput(Output):
138
138
  ----------
139
139
  color_by: str, optional
140
140
  Set scatter color by variable results.
141
- Use "mean_REWS" etc for means, also
141
+ Use "mean_REWS", etc, for means, also
142
142
  min, max, sum. All wrt states
143
143
  fontsize: int, optional
144
144
  Size of the turbine numbers
@@ -288,8 +288,6 @@ class FarmLayoutOutput(Output):
288
288
  """
289
289
  Writes the layout plot to file.
290
290
 
291
- The kwargs are forwarded to self.get_figure
292
-
293
291
  Parameters
294
292
  ----------
295
293
  file_path: str
@@ -297,6 +295,8 @@ class FarmLayoutOutput(Output):
297
295
  for default
298
296
  fontsize: int
299
297
  Size of the turbine numbers
298
+ kwargs: dict, optional
299
+ Additional arguments for get_figure()
300
300
 
301
301
  """
302
302
 
@@ -325,7 +325,7 @@ class FarmLayoutOutput(Output):
325
325
  fname = file_path if file_path is not None else self.farm.name + ".xyh"
326
326
  np.savetxt(fname, data, header="x y h")
327
327
 
328
- def write_csv(self, file_path=None):
328
+ def write_csv(self, file_path=None, type_col=None, algo=None):
329
329
  """
330
330
  Writes csv layout file.
331
331
 
@@ -334,6 +334,10 @@ class FarmLayoutOutput(Output):
334
334
  file_path: str
335
335
  The file into which to plot, or None
336
336
  for default
337
+ type_col: str, optional
338
+ Name of the turbine type column
339
+ algo: foxes.core.Algorithm, optional
340
+ The algorithm, needed for turbine types
337
341
 
338
342
  """
339
343
 
@@ -341,17 +345,17 @@ class FarmLayoutOutput(Output):
341
345
 
342
346
  fname = file_path if file_path is not None else self.farm.name + ".csv"
343
347
 
344
- lyt = pd.DataFrame(
345
- index=range(len(data)), columns=["id", "name", "x", "y", "h", "D"]
346
- )
348
+ lyt = pd.DataFrame(index=range(len(data)), columns=["name", "x", "y", "h", "D"])
347
349
  lyt.index.name = "index"
348
- lyt["id"] = [t.info["id"] for t in self.farm.turbines]
349
- lyt["name"] = [t.info["name"] for t in self.farm.turbines]
350
- lyt["x"] = data[:, 0]
351
- lyt["y"] = data[:, 1]
352
- lyt["h"] = data[:, 2]
350
+ lyt["name"] = [t.name for t in self.farm.turbines]
351
+ lyt["x"] = np.round(data[:, 0], 4)
352
+ lyt["y"] = np.round(data[:, 1], 4)
353
+ lyt["h"] = np.round(data[:, 2], 4)
353
354
  lyt["D"] = [t.D for t in self.farm.turbines]
354
355
 
356
+ if type_col is not None:
357
+ lyt[type_col] = [m.name for m in algo.farm_controller.turbine_types]
358
+
355
359
  lyt.to_csv(fname)
356
360
 
357
361
  def write_json(self, file_path=None):
@@ -381,7 +381,7 @@ class FarmResultsEval(Output):
381
381
  algo: foxes.core.Algorithm, optional
382
382
  The algorithm, for P_nominal lookup
383
383
  annual: bool, optional
384
- Flag for returing annual results, by default False
384
+ Flag for returning annual results, by default False
385
385
  ambient: bool, optional
386
386
  Flag for ambient power, by default False
387
387
  hours: int, optional
@@ -1,3 +1,2 @@
1
1
  from .flow_plots import FlowPlots2D
2
- from .seq_flow_ani_plugin import SeqFlowAnimationPlugin
3
2
  from .get_fig import get_fig