Skip to content

Commit

Permalink
add bootstrap_runs_override config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
aclerc committed Apr 30, 2024
1 parent 0a6171b commit fb89da2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "wind-up"
version = "0.1.2"
description = ""
description = "A tool to assess yield uplift of wind turbines"
authors = [
{ name = "Alex Clerc", email = "alex.clerc@res-group.com" }
]
Expand Down
6 changes: 6 additions & 0 deletions wind_up/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ class WindUpConfig(BaseModel):
examples=[1, 2],
)
ws_bin_width: float = Field(description="Wind speed bin width in m/s", gt=0, examples=[0.5, 1])
bootstrap_runs_override: int | None = Field(
description="Number of bootstrap runs to use, if None then calculated",
ge=0,
examples=[None, 1000],
default=None,
)
reanalysis_method: str = Field(
default="node_with_best_ws_corr",
description="Method to use for reanalysis (e.g. ERA5) selection",
Expand Down
2 changes: 1 addition & 1 deletion wind_up/pp_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def pre_post_pp_analysis_with_reversal_and_bootstrapping(
pre_df_dropna = pre_df.dropna(subset=[ws_col, pw_col, wd_col])
post_df_dropna = post_df.dropna(subset=[ws_col, pw_col, wd_col])

n_samples = round(40 * (1 / (1 - confidence_level)))
n_samples = cfg.bootstrap_runs_override if cfg.bootstrap_runs_override else round(40 * (1 / (1 - confidence_level)))
if plot_cfg is not None:
print(f"Running block bootstrapping uncertainty analysis n_samples = {n_samples}")
bootstrapped_uplifts = np.empty(n_samples)
Expand Down

0 comments on commit fb89da2

Please sign in to comment.