Strings#

Ordered line guides and their composable modifiers. String modifiers are documented with the shared Modifiers API because they follow the same .modify(...) protocol as boundary and layout modifiers.

StringGuide(strings)

One or more ordered logical strings made from continuous segments.

Straight([length, rotation, center])

A straight string guide.

Arc([radius, span, rotation, center])

A circular arc whose chord is horizontal before rotation.

Organic([length, roughness, n_harmonics, ...])

A smooth random guide constructed from low-frequency harmonics.

Polyline(coordinates)

One string through given vertices, in the order given.

Composite(base, modifiers)

A base guide with an ordered chain of geometry modifiers.

Multi(strings)

Several guides combined into one guide for one farm.

Parallel(string, n_strings, *[, ...])

Parallel copies of one logical string, centered on the original.

Scattered(n_strings, *[, length, ...])

Randomly oriented organic strings scattered without touching.

Composable guide geometry for turbine-string layouts.

class oowl.strings.Arc(radius=1.0, *, span=90.0, rotation=0.0, center=(0.0, 0.0))[source]#

A circular arc whose chord is horizontal before rotation.

span is the arc’s angle in degrees. A positive span bends toward +y and a negative one toward -y. The arc’s midpoint sits at center, and rotation turns it counterclockwise in degrees.

Parameters:
class oowl.strings.Composite(base, modifiers)[source]#

A base guide with an ordered chain of geometry modifiers.

Parameters:
modify(*modifiers)[source]#

Return a new composite with modifiers appended to this chain.

Parameters:

modifiers (StringModifier)

Return type:

Composite

class oowl.strings.Multi(strings)[source]#

Several guides combined into one guide for one farm.

Parameters:

strings (Sequence[StringGuide])

class oowl.strings.Organic(length=1.0, *, roughness=0.25, n_harmonics=4, rotation=0.0, center=(0.0, 0.0), seed=None)[source]#

A smooth random guide constructed from low-frequency harmonics.

The lateral offset along the normalized length \(s\) is

\[y(s)=\sum_{k=1}^{n} a_k \frac{\sin(k\pi s)}{k^2},\]

with standard normal \(a_k\) and n = n_harmonics. It is scaled so the peak offset is roughness * length. rotation and center place it as in Straight. Without seed, a String layout draws a new shape for every farm.

Parameters:
class oowl.strings.Parallel(string, n_strings, *, relative_spacing=0.2, rotation_spread=0.0, longitudinal_jitter=0.0, spacing_jitter=0.0, seed=None)[source]#

Parallel copies of one logical string, centered on the original.

Neighboring copies sit relative_spacing times the string length apart, normal to its chord, and each gap varies uniformly by up to spacing_jitter of itself. Each copy shifts along the chord by up to longitudinal_jitter times the length and turns about the string’s centroid by a normal angle with rotation_spread degrees of standard deviation.

Parameters:
class oowl.strings.Polyline(coordinates)[source]#

One string through given vertices, in the order given.

coordinates is an (N, 2) array of at least two points, such as a cable route or a measured turbine row. It is kept as given, since a String layout sets the scale and position. As in Polygon, input is never repaired, so a point repeated consecutively is refused rather than dropped. Scalar or non-numeric coordinates raise TypeError. A wrong shape, fewer than two points, non-finite values, a repeated point or a length that overflows raise ValueError. Like the exterior of Polygon, the repr lists up to four vertices and gives a longer array by its shape.

Parameters:

coordinates (ArrayLike)

class oowl.strings.Scattered(n_strings, *, length=1.0, length_variation=0.35, roughness=0.25, n_harmonics=4, relative_spacing=0.15, seed=None)[source]#

Randomly oriented organic strings scattered without touching.

Each of n_strings Organic strings, with the given roughness and n_harmonics, is length times a uniform factor within 1 ± length_variation, and keeps at least relative_spacing * length from the others. Strings are placed uniformly in a square that grows whenever a string does not fit, and the result is centered on the origin.

Parameters:
  • n_strings (int)

  • length (float)

  • length_variation (float)

  • roughness (float)

  • n_harmonics (int)

  • relative_spacing (float)

  • seed (int | np.random.Generator | None)

class oowl.strings.Straight(length=1.0, *, rotation=0.0, center=(0.0, 0.0))[source]#

A straight string guide.

The line of length runs along x, turns counterclockwise by rotation degrees and is centered on center.

Parameters:
class oowl.strings.StringGuide(strings)[source]#

One or more ordered logical strings made from continuous segments.

A guide only fixes the shape and relative size of turbine strings. String places turbines along it and sets the scale. Guides combine with Multi and Parallel and change with modify(). A random guide or modifier given no seed draws one, and a String layout redraws it from its own seed, so every sampled farm gets its own guide. A given seed keeps its shape.

Parameters:

strings (tuple[_LogicalString, ...])

property geometry: LineString | MultiLineString#

Shapely geometry of every segment.

metadata()[source]#

JSON-compatible record of this guide’s type and resolved seed.

Return type:

dict

modify(*modifiers)[source]#

Return a composite guide with modifiers applied in order.

Parameters:

modifiers (StringModifier)

Return type:

Composite

property n_strings: int#

Number of logical strings in this guide.

plot(ax=None, **kwargs)[source]#

Plot the guide and return its Matplotlib axes.

Parameters:
Return type:

matplotlib.axes.Axes