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.
- docs/source/conf.py +3 -1
- examples/abl_states/run.py +5 -5
- examples/dyn_wakes/run.py +2 -2
- examples/induction/run.py +5 -5
- examples/random_timeseries/run.py +13 -13
- examples/scan_row/run.py +12 -7
- examples/sector_management/run.py +11 -7
- examples/single_state/run.py +5 -5
- examples/tab_file/run.py +1 -1
- examples/timelines/run.py +1 -1
- examples/timeseries/run.py +5 -5
- examples/timeseries_slurm/run.py +5 -5
- examples/wind_rose/run.py +1 -1
- examples/yawed_wake/run.py +5 -5
- foxes/__init__.py +13 -2
- foxes/algorithms/downwind/downwind.py +21 -6
- foxes/algorithms/downwind/models/init_farm_data.py +5 -2
- foxes/algorithms/downwind/models/point_wakes_calc.py +0 -1
- foxes/algorithms/iterative/iterative.py +1 -1
- foxes/algorithms/sequential/sequential.py +5 -4
- foxes/config/__init__.py +1 -0
- foxes/config/config.py +134 -0
- foxes/constants.py +15 -6
- foxes/core/algorithm.py +46 -30
- foxes/core/axial_induction_model.py +18 -0
- foxes/core/data.py +2 -1
- foxes/core/engine.py +43 -49
- foxes/core/farm_controller.py +22 -3
- foxes/core/farm_data_model.py +6 -2
- foxes/core/ground_model.py +19 -0
- foxes/core/model.py +2 -1
- foxes/core/partial_wakes_model.py +9 -21
- foxes/core/point_data_model.py +22 -2
- foxes/core/rotor_model.py +9 -21
- foxes/core/states.py +2 -17
- foxes/core/turbine_model.py +2 -18
- foxes/core/turbine_type.py +2 -18
- foxes/core/vertical_profile.py +8 -20
- foxes/core/wake_frame.py +9 -25
- foxes/core/wake_model.py +24 -20
- foxes/core/wake_superposition.py +19 -0
- foxes/data/__init__.py +1 -1
- foxes/data/static_data.py +0 -7
- foxes/engines/dask.py +4 -3
- foxes/engines/single.py +1 -1
- foxes/input/__init__.py +1 -1
- foxes/input/farm_layout/from_csv.py +3 -1
- foxes/input/farm_layout/from_file.py +10 -10
- foxes/input/farm_layout/from_json.py +4 -3
- foxes/input/farm_layout/grid.py +3 -3
- foxes/input/states/__init__.py +1 -1
- foxes/input/states/create/random_abl_states.py +5 -3
- foxes/input/states/field_data_nc.py +36 -15
- foxes/input/states/multi_height.py +26 -15
- foxes/input/states/one_point_flow.py +6 -5
- foxes/input/states/{scan_ws.py → scan.py} +42 -52
- foxes/input/states/single.py +15 -6
- foxes/input/states/slice_data_nc.py +18 -12
- foxes/input/states/states_table.py +17 -10
- foxes/input/yaml/__init__.py +3 -0
- foxes/input/yaml/dict.py +381 -0
- foxes/input/yaml/windio/__init__.py +4 -0
- foxes/input/{windio → yaml/windio}/get_states.py +7 -7
- foxes/input/{windio → yaml/windio}/read_attributes.py +61 -40
- foxes/input/{windio → yaml/windio}/read_farm.py +34 -43
- foxes/input/{windio → yaml/windio}/read_fields.py +11 -10
- foxes/input/yaml/windio/read_outputs.py +147 -0
- foxes/input/yaml/windio/windio.py +269 -0
- foxes/input/yaml/yaml.py +103 -0
- foxes/models/partial_wakes/axiwake.py +7 -6
- foxes/models/partial_wakes/centre.py +3 -2
- foxes/models/partial_wakes/segregated.py +5 -2
- foxes/models/point_models/set_uniform_data.py +5 -3
- foxes/models/rotor_models/centre.py +2 -2
- foxes/models/rotor_models/grid.py +5 -5
- foxes/models/rotor_models/levels.py +6 -6
- foxes/models/turbine_models/kTI_model.py +3 -1
- foxes/models/turbine_models/lookup_table.py +7 -4
- foxes/models/turbine_models/power_mask.py +14 -8
- foxes/models/turbine_models/sector_management.py +4 -2
- foxes/models/turbine_models/set_farm_vars.py +53 -23
- foxes/models/turbine_models/table_factors.py +8 -7
- foxes/models/turbine_models/yaw2yawm.py +0 -1
- foxes/models/turbine_models/yawm2yaw.py +0 -1
- foxes/models/turbine_types/CpCt_file.py +6 -3
- foxes/models/turbine_types/CpCt_from_two.py +6 -3
- foxes/models/turbine_types/PCt_file.py +7 -6
- foxes/models/turbine_types/PCt_from_two.py +11 -2
- foxes/models/turbine_types/TBL_file.py +3 -4
- foxes/models/turbine_types/wsrho2PCt_from_two.py +19 -11
- foxes/models/turbine_types/wsti2PCt_from_two.py +19 -11
- foxes/models/vertical_profiles/abl_log_neutral_ws.py +1 -1
- foxes/models/vertical_profiles/abl_log_stable_ws.py +1 -1
- foxes/models/vertical_profiles/abl_log_unstable_ws.py +1 -1
- foxes/models/vertical_profiles/abl_log_ws.py +1 -1
- foxes/models/wake_frames/dynamic_wakes.py +17 -9
- foxes/models/wake_frames/farm_order.py +4 -3
- foxes/models/wake_frames/rotor_wd.py +3 -1
- foxes/models/wake_frames/seq_dynamic_wakes.py +14 -7
- foxes/models/wake_frames/streamlines.py +9 -6
- foxes/models/wake_frames/timelines.py +21 -14
- foxes/models/wake_frames/yawed_wakes.py +3 -1
- foxes/models/wake_models/induction/vortex_sheet.py +0 -1
- foxes/models/wake_models/ti/crespo_hernandez.py +2 -1
- foxes/models/wake_models/wind/bastankhah14.py +3 -2
- foxes/models/wake_models/wind/bastankhah16.py +2 -1
- foxes/models/wake_models/wind/turbopark.py +9 -7
- foxes/models/wake_superpositions/ws_product.py +0 -1
- foxes/output/__init__.py +2 -1
- foxes/output/calc_points.py +7 -4
- foxes/output/farm_layout.py +30 -18
- foxes/output/farm_results_eval.py +61 -38
- foxes/output/grids.py +8 -7
- foxes/output/output.py +9 -20
- foxes/output/plt.py +19 -0
- foxes/output/results_writer.py +10 -11
- foxes/output/rose_plot.py +448 -224
- foxes/output/rotor_point_plots.py +7 -3
- foxes/output/slice_data.py +1 -1
- foxes/output/state_turbine_map.py +5 -1
- foxes/output/state_turbine_table.py +7 -3
- foxes/output/turbine_type_curves.py +7 -2
- foxes/utils/__init__.py +1 -2
- foxes/utils/dict.py +107 -3
- foxes/utils/geopandas_utils.py +3 -2
- foxes/utils/subclasses.py +69 -0
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/METADATA +18 -18
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/RECORD +145 -145
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/WHEEL +1 -1
- foxes-1.2.1.dist-info/entry_points.txt +3 -0
- tests/0_consistency/iterative/test_iterative.py +65 -67
- tests/0_consistency/partial_wakes/test_partial_wakes.py +58 -61
- tests/1_verification/flappy_0_6/PCt_files/test_PCt_files.py +56 -53
- tests/1_verification/flappy_0_6/abl_states/test_abl_states.py +41 -41
- tests/1_verification/flappy_0_6/partial_top_hat/test_partial_top_hat.py +34 -34
- tests/1_verification/flappy_0_6/row_Jensen_linear_centre/test_row_Jensen_linear_centre.py +57 -52
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat/test_row_Jensen_linear_tophat.py +58 -54
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2005/test_row_Jensen_linear_tophat_IECTI_2005.py +80 -76
- tests/1_verification/flappy_0_6/row_Jensen_linear_tophat_IECTI2019/test_row_Jensen_linear_tophat_IECTI_2019.py +80 -76
- tests/1_verification/flappy_0_6/row_Jensen_quadratic_centre/test_row_Jensen_quadratic_centre.py +58 -51
- tests/1_verification/flappy_0_6_2/grid_rotors/test_grid_rotors.py +101 -103
- tests/1_verification/flappy_0_6_2/row_Bastankhah_Crespo/test_row_Bastankhah_Crespo.py +67 -64
- tests/1_verification/flappy_0_6_2/row_Bastankhah_linear_centre/test_row_Bastankhah_linear_centre.py +58 -54
- examples/windio/run.py +0 -29
- foxes/data/states/windio_timeseries_5000.nc +0 -0
- foxes/data/windio/DTU_10MW_turbine.yaml +0 -10
- foxes/data/windio/__init__.py +0 -0
- foxes/data/windio/windio_5turbines_timeseries.yaml +0 -79
- foxes/input/windio/__init__.py +0 -11
- foxes/input/windio/read_outputs.py +0 -172
- foxes/input/windio/runner.py +0 -183
- foxes/input/windio/windio.py +0 -193
- foxes/utils/windrose_plot.py +0 -152
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/LICENSE +0 -0
- {foxes-1.1.1.dist-info → foxes-1.2.1.dist-info}/top_level.txt +0 -0
foxes/utils/windrose_plot.py
DELETED
|
@@ -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
|
|
File without changes
|