Skip to content
Merged
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
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
repos:
- repo: https://github.com/psf/black
rev: 26.1.0
hooks:
- id: black
name: black
stages: [pre-commit]
language_version: python3

- repo: https://github.com/pycqa/isort
rev: 7.0.0
hooks:
Expand All @@ -20,14 +28,6 @@ repos:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/psf/black
rev: 26.1.0
hooks:
- id: black
name: black
stages: [pre-commit]
language_version: python3

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ All notable changes to this project will be documented in this file. If you make
- Fixes:
- Add a default value for `PlantData`'s `asset_distance_matrix` and `asset_direction_matrix` to
ensure projects not utilizing location data are compatible.
- Fix miscellaneous pandas warnings.
- Rerun pre-commit and update code styling for adherence to 3.10+ standards.
- Replace mutable default arguments with None and handle Nones internally.

## v3.1.4 - 2026-01-29

Expand Down
260 changes: 117 additions & 143 deletions examples/00_intro_to_plant_data.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/01_utils_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.13.11"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/02a_plant_aep_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.13.11"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/02b_plant_aep_analysis_cubico.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.13.11"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/02c_augmented_plant_aep_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.13.11"
},
"toc": {
"base_numbering": 1,
Expand Down
59 changes: 14 additions & 45 deletions examples/03_turbine_ideal_energy.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions examples/04_electrical_losses.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/05_eya_gap_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.13.11"
},
"toc": {
"base_numbering": 1,
Expand Down
6 changes: 3 additions & 3 deletions examples/06_wake_loss_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3458,9 +3458,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "oa-env",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "oa-env"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -3472,7 +3472,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.13.11"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/07_static_yaw_misalignment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2428,7 +2428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.13.11"
},
"toc": {
"base_numbering": 1,
Expand Down
1 change: 0 additions & 1 deletion examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pathlib import Path


example_data_path = Path(__file__).parents[0].resolve() / "data" / "la_haute_borne"
example_data_path_str = str(example_data_path)
1 change: 0 additions & 1 deletion examples/project_Cubico.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
from openoa.plant import PlantData
from openoa.logging import logging


logger = logging.getLogger()


Expand Down
4 changes: 2 additions & 2 deletions examples/project_ENGIE.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- Wind speed, wind direction, temperature, and density

"""

from __future__ import annotations

import re
Expand All @@ -45,7 +46,6 @@
from openoa.utils import filters, timeseries
from openoa.logging import logging


logger = logging.getLogger()


Expand Down Expand Up @@ -168,7 +168,7 @@ def prepare(
- use_cleansed (bool): Use previously prepared data if the the "cleansed" folder exists above the main `path`. Defaults to False.
"""

if type(path) == str:
if isinstance(path, str):
path = Path(path).resolve()

# Load the pre-cleaned data, if available
Expand Down
78 changes: 42 additions & 36 deletions openoa/analysis/aep.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from openoa.utils.machine_learning_setup import MachineLearningSetup
from openoa.analysis._analysis_validators import validate_reanalysis_selections


logger = logging.getLogger(__name__)

NDArrayFloat = npt.NDArray[np.float64]
Expand Down Expand Up @@ -1186,9 +1185,9 @@ def sample_long_term_reanalysis(self):
)

# Store result in dictionary
self.long_term_sampling[
(self._run.reanalysis_product, self._run.num_years_windiness)
] = long_term_reg_inputs
self.long_term_sampling[(self._run.reanalysis_product, self._run.num_years_windiness)] = (
long_term_reg_inputs
)

# Return result
return long_term_reg_inputs.copy()
Expand Down Expand Up @@ -1228,9 +1227,9 @@ def plot_normalized_monthly_reanalysis_windspeed(
xlim: tuple[datetime.datetime, datetime.datetime] = (None, None),
ylim: tuple[float, float] = (None, None),
return_fig: bool = False,
figure_kwargs: dict = {},
plot_kwargs: dict = {},
legend_kwargs: dict = {},
figure_kwargs: dict | None = None,
plot_kwargs: dict | None = None,
legend_kwargs: dict | None = None,
) -> None | tuple[plt.Figure, plt.Axes]:
"""Make a plot of the normalized annual average wind speeds from reanalysis data to show
general trends for each, and highlighting the period of record for the plant data.
Expand All @@ -1243,11 +1242,11 @@ def plot_normalized_monthly_reanalysis_windspeed(
Defaults to (None, None).
return_fig (:obj:`bool`, optional): Flag to return the figure and axes objects. Defaults to False.
figure_kwargs (:obj:`dict`, optional): Additional figure instantiation keyword arguments
that are passed to ``plt.figure()``. Defaults to {}.
that are passed to ``plt.figure()``. Defaults to None.
plot_kwargs (:obj:`dict`, optional): Additional plotting keyword arguments that are passed to
``ax.plot()``. Defaults to {}.
``ax.plot()``. Defaults to None.
legend_kwargs (:obj:`dict`, optional): Additional legend keyword arguments that are passed to
``ax.legend()``. Defaults to {}.
``ax.legend()``. Defaults to None.

Returns:
None | tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes]: If ``return_fig`` is
Expand All @@ -1271,9 +1270,9 @@ def plot_reanalysis_gross_energy_data(
xlim: tuple[float, float] = (None, None),
ylim: tuple[float, float] = (None, None),
return_fig: bool = False,
figure_kwargs: dict = {},
plot_kwargs: dict = {},
legend_kwargs: dict = {},
figure_kwargs: dict | None = None,
plot_kwargs: dict | None = None,
legend_kwargs: dict | None = None,
) -> None | tuple[plt.Figure, plt.Axes]:
"""
Makes a plot of the gross energy vs wind speed for each reanalysis product, with outliers
Expand All @@ -1290,16 +1289,23 @@ def plot_reanalysis_gross_energy_data(
Defaults to (None, None).
return_fig (:obj:`bool`, optional): Flag to return the figure and axes objects. Defaults to False.
figure_kwargs (:obj:`dict`, optional): Additional figure instantiation keyword arguments
that are passed to ``plt.figure()``. Defaults to {}.
that are passed to ``plt.figure()``. Defaults to None.
plot_kwargs (:obj:`dict`, optional): Additional plotting keyword arguments that are passed to
``ax.scatter()``. Defaults to {}.
``ax.scatter()``. Defaults to None.
legend_kwargs (:obj:`dict`, optional): Additional legend keyword arguments that are passed to
``ax.legend()``. Defaults to {}.
``ax.legend()``. Defaults to None.

Returns:
None | tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes]: If `return_fig` is True, then
the figure and axes objects are returned for further tinkering/saving.
"""
if figure_kwargs is None:
figure_kwargs = {}
if plot_kwargs is None:
plot_kwargs = {}
if legend_kwargs is None:
legend_kwargs = {}

figure_kwargs.setdefault("figsize", (9, 9))
figure_kwargs.setdefault("dpi", 200)
fig = plt.figure(**figure_kwargs)
Expand Down Expand Up @@ -1392,9 +1398,9 @@ def plot_aggregate_plant_data_timeseries(
ylim_energy: tuple[float, float] = (None, None),
ylim_loss: tuple[float, float] = (None, None),
return_fig: bool = False,
figure_kwargs: dict = {},
plot_kwargs: dict = {},
legend_kwargs: dict = {},
figure_kwargs: dict | None = None,
plot_kwargs: dict | None = None,
legend_kwargs: dict | None = None,
):
"""
Plot timeseries of monthly/daily gross energy, availability and curtailment.
Expand All @@ -1413,11 +1419,11 @@ def plot_aggregate_plant_data_timeseries(
limits for the loss plot (bottom figure). Defaults to (None, None).
return_fig (:obj:`bool`, optional): Flag to return the figure and axes objects. Defaults to False.
figure_kwargs (:obj:`dict`, optional): Additional figure instantiation keyword arguments
that are passed to ``plt.figure()``. Defaults to {}.
that are passed to ``plt.figure()``. Defaults to None.
plot_kwargs (:obj:`dict`, optional): Additional plotting keyword arguments that are passed to
``ax.scatter()``. Defaults to {}.
``ax.scatter()``. Defaults to None.
legend_kwargs (:obj:`dict`, optional): Additional legend keyword arguments that are passed to
``ax.legend()``. Defaults to {}.
``ax.legend()``. Defaults to None.

Returns:
None | tuple[matplotlib.pyplot.Figure, tuple[matplotlib.pyplot.Axes, matplotlib.pyplot.Axes]]:
Expand Down Expand Up @@ -1448,9 +1454,9 @@ def plot_result_aep_distributions(
ylim_availability: tuple[float, float] = (None, None),
ylim_curtail: tuple[float, float] = (None, None),
return_fig: bool = False,
figure_kwargs: dict = {},
plot_kwargs: dict = {},
annotate_kwargs: dict = {},
figure_kwargs: dict | None = None,
plot_kwargs: dict | None = None,
annotate_kwargs: dict | None = None,
) -> None | tuple[plt.Figure, plt.Axes]:
"""
Plot a distribution of AEP values from the Monte-Carlo OA method
Expand All @@ -1470,11 +1476,11 @@ def plot_result_aep_distributions(
y-axis plotting display limits for the curtailment subplot. Defaults to (None, None).
return_fig (:obj:`bool`, optional): Flag to return the figure and axes objects. Defaults to False.
figure_kwargs (:obj:`dict`, optional): Additional figure instantiation keyword arguments
that are passed to ``plt.figure()``. Defaults to {}.
that are passed to ``plt.figure()``. Defaults to None.
plot_kwargs (:obj:`dict`, optional): Additional plotting keyword arguments that are passed to
``ax.hist()``. Defaults to {}.
``ax.hist()``. Defaults to None.
annotate_kwargs (:obj:`dict`, optional): Additional annotation keyword arguments that are
passed to ``ax.annotate()``. Defaults to {}.
passed to ``ax.annotate()``. Defaults to None

Returns:
None | tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes]: If `return_fig` is True, then
Expand Down Expand Up @@ -1502,10 +1508,10 @@ def plot_aep_boxplot(
with_points: bool = False,
points_label: str = "Individual AEP Estimates",
return_fig: bool = False,
figure_kwargs: dict = {},
plot_kwargs_box: dict = {},
plot_kwargs_points: dict = {},
legend_kwargs: dict = {},
figure_kwargs: dict | None = None,
plot_kwargs_box: dict | None = None,
plot_kwargs_points: dict | None = None,
legend_kwargs: dict | None = None,
) -> None | tuple[plt.Figure, plt.Axes]:
"""Plot box plots of AEP results sliced by a specified Monte Carlo parameter

Expand All @@ -1520,13 +1526,13 @@ def plot_aep_boxplot(
Defaults to None.
return_fig (:obj:`bool`, optional): Flag to return the figure and axes objects. Defaults to False.
figure_kwargs (:obj:`dict`, optional): Additional figure instantiation keyword arguments
that are passed to ``plt.figure()``. Defaults to {}.
that are passed to ``plt.figure()``. Defaults to None.
plot_kwargs_box (:obj:`dict`, optional): Additional plotting keyword arguments that are passed to
``ax.boxplot()``. Defaults to {}.
``ax.boxplot()``. Defaults to None.
plot_kwargs_points (:obj:`dict`, optional): Additional plotting keyword arguments that are passed to
``ax.boxplot()``. Defaults to {}.
``ax.boxplot()``. Defaults to None.
legend_kwargs (:obj:`dict`, optional): Additional legend keyword arguments that are passed to
``ax.legend()``. Defaults to {}.
``ax.legend()``. Defaults to None.

Returns:
None | tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes, dict]: If `return_fig` is
Expand Down
Loading