Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "res-wind-up"
version = "0.4.5"
version = "0.4.6"
authors = [
{ name = "Alex Clerc", email = "alex.clerc@res-group.com" }
]
Expand Down Expand Up @@ -97,7 +97,7 @@ max-complexity = 12 # try to bring this down to 10

[tool.ruff.lint.pylint]
max-branches = 14 # try to bring this down to 12
max-statements = 66 # try to bring this down to 50
max-statements = 68 # try to bring this down to 50
max-args = 17 # try to bring this down to 5

[tool.ruff.lint.per-file-ignores]
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion wind_up/main_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,12 @@ def _calc_test_ref_results(
random_seed=random_seed,
)

if cfg.write_pp_df_parquets:
(cfg.out_dir / "pp_df").mkdir(exist_ok=True)
pre_df.to_parquet(cfg.out_dir / "pp_df" / f"{test_wtg.name}_{ref_name}_pre_df.parquet")
post_df.to_parquet(cfg.out_dir / "pp_df" / f"{test_wtg.name}_{ref_name}_post_df.parquet")
_pp_df.to_parquet(cfg.out_dir / "pp_df" / f"{test_wtg.name}_{ref_name}_pp_df.parquet")

other_results = ref_info | {
"ref_ws_col": ref_ws_col,
"distance_m": distance_m,
Expand Down Expand Up @@ -799,7 +805,6 @@ def run_wind_up_analysis(
plot_input_data_timeline(
assessment_inputs=inputs,
save_to_folder=inputs.plot_cfg.plots_dir if inputs.plot_cfg.save_plots else None,
show_plots=inputs.plot_cfg.show_plots,
)

wf_df = inputs.wf_df
Expand Down
4 changes: 4 additions & 0 deletions wind_up/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ class WindUpConfig(BaseModel):
default=10 * 60,
description="Timebase in seconds for SCADA data, other data is converted to this timebase",
)
write_pp_df_parquets: bool = Field(
default=False,
description="If true the power performance parquet files are written along with other results and plots.",
)
ignore_turbine_anemometer_data: bool = Field(
default=False,
description="If true do not use turbine anemometer data for anything",
Expand Down
13 changes: 6 additions & 7 deletions wind_up/plots/input_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ def plot_input_data_timeline(
figsize: tuple[int, int] | None = None,
height_ratios: tuple[int, int] | None = None,
save_to_folder: Path | None = None,
show_plots: bool = True,
scada_data_column_for_power: str = DataColumns.active_power_mean,
scada_data_column_for_yaw_angle: str = DataColumns.yaw_angle_mean,
) -> plt.Figure:
) -> None:
"""Plot timeline of input data with key milestones and data exclusions.

This function does not do any data filtering itself, but instead only displays the data as it is provided.
Expand All @@ -93,7 +92,6 @@ def plot_input_data_timeline(
:param figsize: size of the plot figure, if `None` it will be auto-sized based on the number of turbines
:param height_ratios: ratios for the two subplots, if `None` it will be auto-sized based on the number of turbines
:param save_to_folder: directory in which to save the plot
:param show_plots: whether to show the interactive plot or not
:param scada_data_column_for_power: column name in the wind farm DataFrame to use for power data coverage plotting
:param scada_data_column_for_yaw_angle: column name in the wind farm DataFrame to use for yaw data coverage plotting
:return: figure object
Expand Down Expand Up @@ -281,14 +279,15 @@ def plot_input_data_timeline(
box = a.get_position()
a.set_position([box.x0, box.y0, box.width * 0.8, box.height]) # type: ignore[arg-type]
handles, labels = a.get_legend_handles_labels()
# remove duplicate labels
handles_by_label = dict(zip(labels, handles, strict=True)) # type:ignore[call-overload]
handles = list(handles_by_label.values())
labels = list(handles_by_label.keys())
a.legend(handles[::-1], labels[::-1], bbox_to_anchor=(1.04, 1), borderaxespad=0)

if save_to_folder is not None:
if not save_to_folder.is_dir():
save_to_folder.mkdir(parents=True, exist_ok=True)
fig.savefig(save_to_folder / "input_data_timeline_fig.png")

if not show_plots:
plt.close(fig)

return fig
plt.close(fig)
Loading