Skip to content

Commit

Permalink
Simplify gate
Browse files Browse the repository at this point in the history
This makes the if-statement match the comment above it. By removing a couple of levels if indentation due to the if-statements, the full condition is more clear
  • Loading branch information
rafmudaf committed Feb 3, 2024
1 parent 077a951 commit 2f84b5c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions floris/tools/floris_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,21 @@ def reinitialize(
# turbulence_intensities is None
# len(turbulence intensity) != len(wind_directions)
# turbulence_intensities is uniform
# in this case, automatically resize turbulence intensity
# This is the case where user is assuming same ti across all findex
if ((wind_speeds is not None) or (wind_directions is not None)) and (
turbulence_intensities is None
# In this case, automatically resize turbulence intensity
# This is the case where user is assuming same TI across all findex
if (
(wind_speeds is not None or wind_directions is not None)
and turbulence_intensities is None
and (
len(flow_field_dict["turbulence_intensities"])
!= len(flow_field_dict["wind_directions"])
)
and len(np.unique(flow_field_dict["turbulence_intensities"])) == 1
):
if len(flow_field_dict["turbulence_intensities"]) != len(
flow_field_dict["wind_directions"]
):
if len(np.unique(flow_field_dict["turbulence_intensities"])) == 1:
flow_field_dict["turbulence_intensities"] = flow_field_dict[
"turbulence_intensities"
][0] * np.ones_like(flow_field_dict["wind_directions"])
flow_field_dict["turbulence_intensities"] = (
flow_field_dict["turbulence_intensities"][0]
* np.ones_like(flow_field_dict["wind_directions"])
)

## Farm
if layout_x is not None:
Expand Down

0 comments on commit 2f84b5c

Please sign in to comment.