foxes 1.1.1__py3-none-any.whl → 1.2.1__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 (155) hide show
  1. docs/source/conf.py +3 -1
  2. examples/abl_states/run.py +5 -5
  3. examples/dyn_wakes/run.py +2 -2
  4. examples/induction/run.py +5 -5
  5. examples/random_timeseries/run.py +13 -13
  6. examples/scan_row/run.py +12 -7
  7. examples/sector_management/run.py +11 -7
  8. examples/single_state/run.py +5 -5
  9. examples/tab_file/run.py +1 -1
  10. examples/timelines/run.py +1 -1
  11. examples/timeseries/run.py +5 -5
  12. examples/timeseries_slurm/run.py +5 -5
  13. examples/wind_rose/run.py +1 -1
  14. examples/yawed_wake/run.py +5 -5
  15. foxes/__init__.py +13 -2
  16. foxes/algorithms/downwind/downwind.py +21 -6
  17. foxes/algorithms/downwind/models/init_farm_data.py +5 -2
  18. foxes/algorithms/downwind/models/point_wakes_calc.py +0 -1
  19. foxes/algorithms/iterative/iterative.py +1 -1
  20. foxes/algorithms/sequential/sequential.py +5 -4
  21. foxes/config/__init__.py +1 -0
  22. foxes/config/config.py +134 -0
  23. foxes/constants.py +15 -6
  24. foxes/core/algorithm.py +46 -30
  25. foxes/core/axial_induction_model.py +18 -0
  26. foxes/core/data.py +2 -1
  27. foxes/core/engine.py +43 -49
  28. foxes/core/farm_controller.py +22 -3
  29. foxes/core/farm_data_model.py +6 -2
  30. foxes/core/ground_model.py +19 -0
  31. foxes/core/model.py +2 -1
  32. foxes/core/partial_wakes_model.py +9 -21
  33. foxes/core/point_data_model.py +22 -2
  34. foxes/core/rotor_model.py +9 -21
  35. foxes/core/states.py +2 -17
  36. foxes/core/turbine_model.py +2 -18
  37. foxes/core/turbine_type.py +2 -18
  38. foxes/core/vertical_profile.py +8 -20
  39. foxes/core/wake_frame.py +9 -25
  40. foxes/core/wake_model.py +24 -20
  41. foxes/core/wake_superposition.py +19 -0
  42. foxes/data/__init__.py +1 -1
  43. foxes/data/static_data.py +0 -7
  44. foxes/engines/dask.py +4 -3
  45. foxes/engines/single.py +1 -1
  46. foxes/input/__init__.py +1 -1
  47. foxes/input/farm_layout/from_csv.py +3 -1
  48. foxes/input/farm_layout/from_file.py +10 -10
  49. foxes/input/farm_layout/from_json.py +4 -3
  50. foxes/input/farm_layout/grid.py +3 -3
  51. foxes/input/states/__init__.py +1 -1
  52. foxes/input/states/create/random_abl_states.py +5 -3
  53. foxes/input/states/field_data_nc.py +36 -15
  54. foxes/input/states/multi_height.py +26 -15
  55. foxes/input/states/one_point_flow.py +6 -5
  56. foxes/input/states/{scan_ws.py → scan.py} +42 -52
  57. foxes/input/states/single.py +15 -6
  58. foxes/input/states/slice_data_nc.py +18 -12
  59. foxes/input/states/states_table.py +17 -10
  60. foxes/input/yaml/__init__.py +3 -0
  61. foxes/input/yaml/dict.py +381 -0
  62. foxes/input/yaml/windio/__init__.py +4 -0
  63. foxes/input/{windio → yaml/windio}/get_states.py +7 -7
  64. foxes/input/{windio → yaml/windio}/read_attributes.py +61 -40
  65. foxes/input/{windio → yaml/windio}/read_farm.py +34 -43
  66. foxes/input/{windio → yaml/windio}/read_fields.py +11 -10
  67. foxes/input/yaml/windio/read_outputs.py +147 -0
  68. foxes/input/yaml/windio/windio.py +269 -0
  69. foxes/input/yaml/yaml.py +103 -0
  70. foxes/models/partial_wakes/axiwake.py +7 -6
  71. foxes/models/partial_wakes/centre.py +3 -2
  72. foxes/models/partial_wakes/segregated.py +5 -2
  73. foxes/models/point_models/set_uniform_data.py +5 -3
  74. foxes/models/rotor_models/centre.py +2 -2
  75. foxes/models/rotor_models/grid.py +5 -5
  76. foxes/models/rotor_models/levels.py +6 -6
  77. foxes/models/turbine_models/kTI_model.py +3 -1
  78. foxes/models/turbine_models/lookup_table.py +7 -4
  79. foxes/models/turbine_models/power_mask.py +14 -8
  80. foxes/models/turbine_models/sector_management.py +4 -2
  81. foxes/models/turbine_models/set_farm_vars.py +53 -23
  82. foxes/models/turbine_models/table_factors.py +8 -7
  83. foxes/models/turbine_models/yaw2yawm.py +0 -1
  84. foxes/models/turbine_models/yawm2yaw.py +0 -1
  85. foxes/models/turbine_types/CpCt_file.py +6 -3
  86. foxes/models/turbine_types/CpCt_from_two.py +6 -3
  87. foxes/models/turbine_types/PCt_file.py +7 -6
  88. foxes/models/turbine_types/PCt_from_two.py +11 -2
  89. foxes/models/turbine_types/TBL_file.py +3 -4
  90. foxes/models/turbine_types/wsrho2PCt_from_two.py +19 -11
  91. foxes/models/turbine_types/wsti2PCt_from_two.py +19 -11
  92. foxes/models/vertical_profiles/abl_log_neutral_ws.py +1 -1
  93. foxes/models/vertical_profiles/abl_log_stable_ws.py +1 -1
  94. foxes/models/vertical_profiles/abl_log_unstable_ws.py +1 -1
  95. foxes/models/vertical_profiles/abl_log_ws.py +1 -1
  96. foxes/models/wake_frames/dynamic_wakes.py +17 -9
  97. foxes/models/wake_frames/farm_order.py +4 -3
  98. foxes/models/wake_frames/rotor_wd.py +3 -1
  99. foxes/models/wake_frames/seq_dynamic_wakes.py +14 -7
  100. foxes/models/wake_frames/streamlines.py +9 -6
  101. foxes/models/wake_frames/timelines.py +21 -14
  102. foxes/models/wake_frames/yawed_wakes.py +3 -1
  103. foxes/models/wake_models/induction/vortex_sheet.py +0 -1
  104. foxes/models/wake_models/ti/crespo_hernandez.py +2 -1
  105. foxes/models/wake_models/wind/bastankhah14.py +3 -2
  106. foxes/models/wake_models/wind/bastankhah16.py +2 -1
  107. foxes/models/wake_models/wind/turbopark.py +9 -7
  108. foxes/models/wake_superpositions/ws_product.py +0 -1
  109. foxes/output/__init__.py +2 -1
  110. foxes/output/calc_points.py +7 -4
  111. foxes/output/farm_layout.py +30 -18
  112. foxes/output/farm_results_eval.py +61 -38
  113. foxes/output/grids.py +8 -7
  114. foxes/output/output.py +9 -20
  115. foxes/output/plt.py +19 -0
  116. foxes/output/results_writer.py +10 -11
  117. foxes/output/rose_plot.py +448 -224
  118. foxes/output/rotor_point_plots.py +7 -3
  119. foxes/output/slice_data.py +1 -1
  120. foxes/output/state_turbine_map.py +5 -1
  121. foxes/output/state_turbine_table.py +7 -3
  122. foxes/output/turbine_type_curves.py +7 -2
  123. foxes/utils/__init__.py +1 -2
  124. foxes/utils/dict.py +107 -3
  125. foxes/utils/geopandas_utils.py +3 -2
  126. foxes/utils/subclasses.py +69 -0
  127. {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/METADATA +18 -18
  128. {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/RECORD +145 -145
  129. {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/WHEEL +1 -1
  130. foxes-1.2.1.dist-info/entry_points.txt +3 -0
  131. tests/0_consistency/iterative/test_iterative.py +65 -67
  132. tests/0_consistency/partial_wakes/test_partial_wakes.py +58 -61
  133. tests/1_verification/flappy_0_6/PCt_files/test_PCt_files.py +56 -53
  134. tests/1_verification/flappy_0_6/abl_states/test_abl_states.py +41 -41
  135. tests/1_verification/flappy_0_6/partial_top_hat/test_partial_top_hat.py +34 -34
  136. tests/1_verification/flappy_0_6/row_Jensen_linear_centre/test_row_Jensen_linear_centre.py +57 -52
  137. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/test_row_Jensen_linear_tophat.py +58 -54
  138. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/test_row_Jensen_linear_tophat_IECTI_2005.py +80 -76
  139. tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/test_row_Jensen_linear_tophat_IECTI_2019.py +80 -76
  140. tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py +58 -51
  141. tests/1_verification/flappy_0_6_2/grid_rotors/test_grid_rotors.py +101 -103
  142. tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/test_row_Bastankhah_Crespo.py +67 -64
  143. tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py +58 -54
  144. examples/windio/run.py +0 -29
  145. foxes/data/states/windio_timeseries_5000.nc +0 -0
  146. foxes/data/windio/DTU_10MW_turbine.yaml +0 -10
  147. foxes/data/windio/__init__.py +0 -0
  148. foxes/data/windio/windio_5turbines_timeseries.yaml +0 -79
  149. foxes/input/windio/__init__.py +0 -11
  150. foxes/input/windio/read_outputs.py +0 -172
  151. foxes/input/windio/runner.py +0 -183
  152. foxes/input/windio/windio.py +0 -193
  153. foxes/utils/windrose_plot.py +0 -152
  154. {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/LICENSE +0 -0
  155. {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/top_level.txt +0 -0
@@ -1,152 +0,0 @@
1
- import numpy as np
2
- import pandas as pd
3
- import matplotlib.pyplot as plt
4
- from windrose import WindroseAxes
5
-
6
- FIGSIZE_DEFAULT = (8, 8)
7
- DPI_DEFAULT = 80
8
-
9
-
10
- class TabWindroseAxes(WindroseAxes):
11
- """
12
- A derivate of the wind rose axes that runs
13
- on stochastic data (bins with weights) instead
14
- of time series data
15
-
16
- :group: utils
17
-
18
- """
19
-
20
- @staticmethod
21
- def from_ax(
22
- ax=None,
23
- fig=None,
24
- figsize=None,
25
- rect=None,
26
- *args,
27
- **kwargs,
28
- ):
29
- """
30
- Return a WindroseAxes object for the figure `fig`.
31
- """
32
- if ax is None:
33
- if fig is None:
34
- fig = plt.figure(
35
- figsize=FIGSIZE_DEFAULT if figsize is None else figsize,
36
- dpi=DPI_DEFAULT,
37
- facecolor="w",
38
- edgecolor="w",
39
- )
40
- if rect is None:
41
- rect = [0.1, 0.1, 0.8, 0.8]
42
- ax = TabWindroseAxes(fig, rect, *args, **kwargs)
43
- fig.add_axes(ax)
44
- return ax
45
- else:
46
- return ax
47
-
48
- def _init_plot(self, direction, var, **kwargs):
49
-
50
- # self.clear()
51
- kwargs.pop("zorder", None)
52
- weights = kwargs.pop("weights")
53
-
54
- # Init of the bins array if not set
55
- if "bin_min_var" in kwargs:
56
- bins = list(kwargs.pop("bin_min_var"))
57
- bins.append(max(kwargs.pop("bin_max_var")))
58
- else:
59
- bins = kwargs.pop("bins", None)
60
- if bins is None:
61
- bins = np.linspace(np.min(var), np.max(var), 6)
62
- if isinstance(bins, int):
63
- bins = np.linspace(np.min(var), np.max(var), bins)
64
- bins = np.asarray(bins).tolist()
65
- nbins = len(bins)
66
- bins.append(np.inf)
67
-
68
- # Sets the colors table based on the colormap or the "colors" argument
69
- colors = kwargs.pop("colors", None)
70
- cmap = kwargs.pop("cmap", None)
71
- if colors is not None:
72
- if isinstance(colors, str):
73
- colors = [colors] * nbins
74
- if isinstance(colors, (tuple, list)):
75
- if len(colors) != nbins:
76
- raise ValueError("colors and bins must have same length")
77
- else:
78
- if cmap is None:
79
- cmap = plt.get_cmap()
80
- colors = self._colors(cmap, nbins)
81
-
82
- if "bin_min_dir" in kwargs:
83
- angles = 90 - np.sort(np.unique(direction))
84
- angles[angles > 180] -= 360
85
- angles *= np.pi / 180
86
-
87
- dir_min = kwargs.pop("bin_min_dir")
88
- dir_edges = np.mod(dir_min, 360.0).tolist()
89
-
90
- dir_bins = dir_min.copy().tolist()
91
- if dir_bins[0] < 0:
92
- dir_bins.append(360 + dir_bins[0])
93
- dir_bins[0] = 0
94
- dir_bins.append(360 + dir_bins[1])
95
-
96
- nsector = len(angles)
97
-
98
- else:
99
- nsector = kwargs.pop("nsector", None)
100
- if nsector is None:
101
- nsector = 16
102
- angles = np.arange(0, -2 * np.pi, -2 * np.pi / nsector) + np.pi / 2
103
-
104
- angle = 360.0 / nsector
105
- dir_bins = np.arange(-angle / 2, 360.0 + angle, angle, dtype=float)
106
- dir_edges = dir_bins.tolist()
107
-
108
- dir_edges.pop(-1)
109
- dir_edges[0] = dir_edges.pop(-1)
110
- dir_bins[0] = 0.0
111
-
112
- table = np.histogram2d(
113
- x=var, y=direction, bins=[bins, dir_bins], density=False, weights=weights
114
- )[0]
115
- table[:, 0] = table[:, 0] + table[:, -1]
116
- table = table[:, :-1]
117
-
118
- self._info["dir"], self._info["bins"], self._info["table"] = (
119
- dir_edges,
120
- bins,
121
- table,
122
- )
123
- return bins, nbins, nsector, colors, angles, kwargs
124
-
125
- def legend(self, loc="upper right", *args, **kwargs):
126
- return super().legend(loc, *args, **kwargs)
127
-
128
-
129
- if __name__ == "__main__":
130
-
131
- import numpy as np
132
- import pandas as pd
133
- from foxes import StaticData, STATES
134
-
135
- sdata = StaticData()
136
- fpath = sdata.get_file_path(STATES, "wind_rose_bremen.csv")
137
- print(fpath)
138
- data = pd.read_csv(fpath, index_col=0)
139
- print(data)
140
-
141
- wd = data["wd"].to_numpy()
142
- ws = data["ws"].to_numpy()
143
- weights = data["weight"].to_numpy()
144
-
145
- ax = TabWindroseAxes.from_ax()
146
- # ax.contourf(wd, ws, weights=weights, bins=[0,3,8,13], cmap=plt.cm.Blues)
147
- # ax.contour(wd, ws, weights=weights, bins=[0,3,8,13], colors='black')
148
- ax.bar(
149
- wd, ws, weights=weights, bins=[0, 3, 5, 8, 10, 13, 16, 20], cmap=plt.cm.Blues
150
- )
151
- ax.set_legend()
152
- plt.show()
File without changes