Skip to content

Refactor min_spacing, min_spacing_m, and min_spacing_meters in wind_layout.py to reduce confusion #441

@johnjasa

Description

@johnjasa

John's comments:
It's unclear to me how these three parameters differ or if they serve different purposes. Rob has a great suggestion here; see if we can refactor this to reduce confusion.

Rob's comments:
I don't think I understand how min_spacing and min_spacing_m differ. In theory, it seems that we should set the min_spacing_m based on either direct input or a rotor diameter input. In that case, this could be removed, and the above update_min_spacing_with_rotor_diameter could be as follows. Just as a note, the "*" indicates that you must pass keyword arguments, which ensures the user doesn't just pass the wrong parameter.

def update_min_spacing(self, *, distance: Optional[float] = None, rotor_diamater: Optional[float] = None) -> None:
    if distance is not None and rotor_diameter is not None:
        raise ValueError("Cannot set both methods to update the turbine spacing, please choose one.")
    if distance is not None:
        self.min_spacing = distance
    if self.rotor_diameter is not None:
        self.min_spacing = rotor_diameter * self.min_spacing_D

Originally posted by @RHammond2 in #433 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions