-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add timeline plot for wind-up input data #51
base: main
Are you sure you want to change the base?
Conversation
2302d07
to
74a48e4
Compare
Plot includes key milestones, analysis and exclusion periods. This provides a useful overview of the configuration used for an analysis.
74a48e4
to
6fc587f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the smarteole notebook needs re-running because I think this PR would add a new plot to it
*, | ||
figsize: tuple[int, int] = (12, 6), | ||
height_ratios: tuple[int, int] = (2, 1), | ||
save_to_folder: Path | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if save_to_folder
is None I would just return before doing anything, what do you think?
@@ -773,6 +774,10 @@ def run_wind_up_analysis( | |||
random_seed: int = RANDOM_SEED, | |||
) -> pd.DataFrame: | |||
"""Run a 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer avoiding implicit type conversion (ie here I would have done save_to_folder=inputs.plot_cfg.plots_dir if inputs.plot_cfg.save_plots is not None else None
) but I might be in the minority there
def plot_input_data_timeline( | ||
assessment_inputs: AssessmentInputs, | ||
*, | ||
figsize: tuple[int, int] = (12, 6), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to support wind farms with lots of turbines the figsize would want to be calculated, giving the figure more height when the number of turbines exceeds some number (say 10), and increasing the height of the figure up to some reasonable maximum. But I don't think it's essential for this PR.
Plot includes key milestones, analysis and exclusion periods. This provides a useful overview of the configuration used for an analysis.
How has it been tested?
Example plots used as test cases may be viewed in the files:
tests/plots/baseline_images/test_input_data/input_data_timeline_fig_toggle.png
tests/plots/baseline_images/test_input_data/input_data_timeline_fig_prepost.png
Design implementations to note?
Refactored the Smarteole
AssessmentInputs
into apytest.fixture
which is then used across the Smarteole test cases.