Metrics#
Spatial metrics of turbine layouts. See Spatial metrics for definitions and examples.
|
Number of turbines in the layout, from a Farm or an |
Nearest-neighbor distance in meters per turbine, shape |
|
Mean nearest-neighbor distance in meters between turbine positions. |
|
Coefficient of variation of the nearest-neighbor distances. |
|
|
Convex-hull area in square meters of the positions, ignoring any boundary. |
|
Study-region area in square meters, from the boundary or else the hull. |
|
Turbines per square meter over the study region. |
|
Clark-Evans ratio R of the mean nearest-neighbor distance to its CSR value. |
|
Square root of the largest over the smallest position covariance eigenvalue. |
Diagonal length in meters of the axis-aligned bounding box of the positions. |
|
|
Ripley's K(r) in square meters at the given radii in meters. |
|
Ripley's L(r) = sqrt(K(r) / pi) in meters, shape |
|
Study-region polygon and hexagon side length for the quadrat test. |
|
Closed vertex ring |
|
Centers |
|
Point count per hexagon, shape |
|
Chi-square CSR p-value from hexagonal quadrat counts. |
|
Ordered |
Registry mapping public scalar metric names to their implementations. |
|
Metric names included by default in |
Spatial metrics for generated wind-farm layouts.
Each metric accepts a Farm or an (N, 2) array of
turbine positions, N zero included, and a metric undefined for so few
turbines is nan. Area-based metrics use Farm.boundary when available and
fall back to the convex hull of the turbines. Pass an explicit boundary, a
Boundary or a Shapely polygon, to override, or
boundary=False to force the hull fallback.
- oowl.metrics.DEFAULT_SUMMARY_METRICS = ('n_turbines', 'nearest_neighbor_mean', 'nearest_neighbor_variation', 'density', 'region_area')#
Metric names included by default in
summary().
- oowl.metrics.SCALAR_METRICS = {'aspect_ratio': <function aspect_ratio>, 'bounding_box_diagonal': <function bounding_box_diagonal>, 'clark_evans': <function clark_evans>, 'density': <function density>, 'hull_area': <function hull_area>, 'n_turbines': <function n_turbines>, 'nearest_neighbor_mean': <function nearest_neighbor_mean>, 'nearest_neighbor_variation': <function nearest_neighbor_variation>, 'quadrat_p_value': <function quadrat_p_value>, 'region_area': <function region_area>}#
Registry mapping public scalar metric names to their implementations.
Each entry takes a single Farm or
(N, 2)array, and boundary-aware metrics resolve the Farm’s boundary automatically. Ripley’s K and L takeradii, so they are not scalar and are not included.
- oowl.metrics.aspect_ratio(obj)[source]#
Square root of the largest over the smallest position covariance eigenvalue.
This is the ratio of the spreads along the principal axes, 1 for an isotropic layout and large for an elongated one.
nanfor a single turbine or a degenerate spread, such as a straight row.
- oowl.metrics.bounding_box_diagonal(obj)[source]#
Diagonal length in meters of the axis-aligned bounding box of the positions.
nanfor a layout without turbines.
- oowl.metrics.clark_evans(obj, boundary=None)[source]#
Clark-Evans ratio R of the mean nearest-neighbor distance to its CSR value.
Under complete spatial randomness (CSR) the expected mean is
0.5 * sqrt(A / N)withAthe study-region area.R > 1indicates regularity,R < 1clustering andR ~ 1CSR.nanwhen the area is not positive or there are no turbines.See Clark and Evans (1954), Ecology 35(4), https://doi.org/10.2307/1931034.
- oowl.metrics.hexagon_centers(polygon, side_length)[source]#
Centers
(M, 2)of a flat-top hexagon lattice insidepolygon.The cells tessellate, so nearest-center assignment equals hexagon membership. Raises
TypeErrorfor apolygonthat is no Shapely geometry, andValueErrorfor aside_lengththat is not finite and positive or that would lay out more than ten million hexagons over the polygon’s box.
- oowl.metrics.hexagon_vertices(center_x, center_y, side_length)[source]#
Closed vertex ring
(7, 2)of a flat-top hexagon centered at the point.
- oowl.metrics.hull_area(obj)[source]#
Convex-hull area in square meters of the positions, ignoring any boundary.
nanwhen the hull encloses no area.
- oowl.metrics.n_turbines(obj)[source]#
Number of turbines in the layout, from a Farm or an
(N, 2)array.
- oowl.metrics.nearest_neighbor_distances(obj)[source]#
Nearest-neighbor distance in meters per turbine, shape
(N,).nanfor a single turbine, which has no neighbor.
- oowl.metrics.nearest_neighbor_mean(obj)[source]#
Mean nearest-neighbor distance in meters between turbine positions.
nanfor fewer than two turbines.
- oowl.metrics.nearest_neighbor_variation(obj)[source]#
Coefficient of variation of the nearest-neighbor distances.
Near 0 for a regular layout, larger for irregular or clustered ones.
nanwhen the mean distance is zero or undefined.
- oowl.metrics.quadrat_counts(obj, centers)[source]#
Point count per hexagon, shape
(len(centers),), by nearest cell center.
- oowl.metrics.quadrat_p_value(obj, boundary=None, hexagon_fraction=0.15, buffer_factor=1.0)[source]#
Chi-square CSR p-value from hexagonal quadrat counts.
Cells come from
quadrat_window()andhexagon_centers(). Each cell’s expected count is proportional to its area inside the study region, and cells with no such area are dropped.A low value rejects complete spatial randomness, as under clustering. A high value only fails to reject it and is not evidence of regularity.
nanwhen fewer than two usable cells remain or no turbine lies in them.
- oowl.metrics.quadrat_window(obj, boundary=None, hexagon_fraction=0.15, buffer_factor=1.0)[source]#
Study-region polygon and hexagon side length for the quadrat test.
The hexagon side length is
hexagon_fraction * sqrt(region area)in meters, so the grid depends on the region and not on turbine count. The region is buffered outward bybuffer_factorside lengths so the lattice covers every turbine.hexagon_fractionmust be finite and > 0, andbuffer_factorfinite and >= 0. Returns(polygon, side_length). A region without area, such as the hull of collinear turbines, gives ananor zero side length and is not buffered.
- oowl.metrics.region_area(obj, boundary=None)[source]#
Study-region area in square meters, from the boundary or else the hull.
- oowl.metrics.ripley_k(obj, radii, boundary=None)[source]#
Ripley’s K(r) in square meters at the given radii in meters.
K(r) = A / N^2 * sum_{i != j} 1[d_ij <= r]withAthe study-region area. No edge correction is applied, so with the bounding box of the positions asboundaryit matchespointpats.distance_statistics.k.radiimust be one-dimensional. Returns shape(len(radii),), allnanfor fewer than two turbines.See Ripley (1977), Journal of the Royal Statistical Society B 39(2), https://doi.org/10.1111/j.2517-6161.1977.tb01615.x.
- oowl.metrics.ripley_l(obj, radii, boundary=None)[source]#
Ripley’s L(r) = sqrt(K(r) / pi) in meters, shape
(len(radii),).L(r) - r > 0indicates clustering and< 0regularity.
- oowl.metrics.summary(obj, metrics=None)[source]#
Ordered
name -> valuedict of scalar metrics for a farm or array.metricsnames entries ofSCALAR_METRICS, defaulting toDEFAULT_SUMMARY_METRICS. A string instead of a collection of names, or a name that is not a string, raisesTypeError. Unknown names raiseValueError.