Skip to content

Commit

Permalink
Add CI branch for Python 3.8 and 3.10, update Ruff (#648)
Browse files Browse the repository at this point in the history
* Fix Ruff 0.0.265 formatting

* Use Python 3.10 in CI, add 3.8 for unit tests

Maintains a test with 3.9 for the unit tests
  • Loading branch information
rafmudaf authored May 7, 2023
1 parent 452425d commit 85dadb1
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-working-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
python-version: ["3.10"]
os: [ubuntu-latest] #, macos-latest, windows-latest]
fail-fast: False

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest] #, macos-latest, windows-latest]
fail-fast: False

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- uses: actions/checkout@v2

# Install dependencies
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality-metrics-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
python-version: ["3.10"]
os: [ubuntu-latest]
fail-fast: False

Expand Down
18 changes: 12 additions & 6 deletions examples/16_heterogeneous_inflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@
fig, ax_list = plt.subplots(3, 1, figsize=(10, 8))
ax_list = ax_list.flatten()
visualize_cut_plane(horizontal_plane_2d, ax=ax_list[0], title="Horizontal", color_bar=True)
ax_list[0].set_xlabel('x'); ax_list[0].set_ylabel('y')
ax_list[0].set_xlabel('x')
ax_list[0].set_ylabel('y')
visualize_cut_plane(y_plane_2d, ax=ax_list[1], title="Streamwise profile", color_bar=True)
ax_list[1].set_xlabel('x'); ax_list[1].set_ylabel('z')
ax_list[1].set_xlabel('x')
ax_list[1].set_ylabel('z')
visualize_cut_plane(
cross_plane_2d,
ax=ax_list[2],
title="Spanwise profile at 500m downstream",
color_bar=True
)
ax_list[2].set_xlabel('y'); ax_list[2].set_ylabel('z')
ax_list[2].set_xlabel('y')
ax_list[2].set_ylabel('z')


# Define the speed ups of the heterogeneous inflow, and their locations.
Expand Down Expand Up @@ -129,20 +132,23 @@
title="Horizontal",
color_bar=True
)
ax_list[0].set_xlabel('x'); ax_list[0].set_ylabel('y')
ax_list[0].set_xlabel('x')
ax_list[0].set_ylabel('y')
visualize_cut_plane(
y_plane_3d,
ax=ax_list[1],
title="Streamwise profile",
color_bar=True
)
ax_list[1].set_xlabel('x'); ax_list[1].set_ylabel('z')
ax_list[1].set_xlabel('x')
ax_list[1].set_ylabel('z')
visualize_cut_plane(
cross_plane_3d,
ax=ax_list[2],
title="Spanwise profile at 500m downstream",
color_bar=True
)
ax_list[2].set_xlabel('y'); ax_list[2].set_ylabel('z')
ax_list[2].set_xlabel('y')
ax_list[2].set_ylabel('z')

plt.show()
7 changes: 2 additions & 5 deletions floris/tools/optimization/legacy/scipy/cluster_turbines.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ def determine_if_in_wake(xt, yt):

# Get most downstream turbine
is_downstream[ii] = not any(
[
determine_if_in_wake(x_rot_srt[iii], y_rot_srt[iii])
for iii in range(n_turbs)
]
determine_if_in_wake(x_rot_srt[iii], y_rot_srt[iii]) for iii in range(n_turbs)
)
# Determine which turbines are affected by this turbine ('ii')
affecting_following_turbs = [
Expand Down Expand Up @@ -165,7 +162,7 @@ def determine_if_in_wake(xt, yt):
cj = ci + 1
merged_column = False
while cj < len(clusters):
if any([y in clusters[ci] for y in clusters[cj]]):
if any(y in clusters[ci] for y in clusters[cj]):
# Merge
clusters[ci] = np.hstack([clusters[ci], clusters[cj]])
clusters[ci] = np.array(np.unique(clusters[ci]), dtype=int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ def determine_if_in_wake(xt, yt):
return (yt < wake_profile_ub_turbii(xt)) & (yt > wake_profile_lb_turbii(xt))

is_downstream[ii] = not any(
[
determine_if_in_wake(x_rot_srt[iii], y_rot_srt[iii])
for iii in range(n_turbs)
]
determine_if_in_wake(x_rot_srt[iii], y_rot_srt[iii]) for iii in range(n_turbs)
)

if plot_lines:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ def determine_if_in_wake(xt, yt):
return (yt < wake_profile_ub_turbii(xt)) & (yt > wake_profile_lb_turbii(xt))

is_downstream[ii] = not any(
[
determine_if_in_wake(x_rot_srt[iii], y_rot_srt[iii])
for iii in range(n_turbs)
]
determine_if_in_wake(x_rot_srt[iii], y_rot_srt[iii]) for iii in range(n_turbs)
)

if plot_lines:
Expand Down

0 comments on commit 85dadb1

Please sign in to comment.