@@ -53,21 +53,17 @@ def _check_frequency(frequency: str, which: str = "all") -> str:
53
53
def _calculate_time_availability (
54
54
availability : pd .DataFrame ,
55
55
by_turbine : bool = False ,
56
- turbine_id : list [str ] | None = None ,
57
56
) -> float | np .ndarray :
58
57
"""Calculates the availability ratio of the whole timeseries or the whole
59
58
timeseries, by turbine.
60
59
61
60
Parameters
62
61
----------
63
62
availability : pd.DataFrame
64
- Timeseries array of operating ratios.
63
+ Timeseries array of operating ratios for all turbines .
65
64
by_turbine : bool, optional
66
65
If True, calculates the availability rate of each column, otherwise across the
67
66
whole array, by default False.
68
- turbine_id : list[str], optional
69
- A list of turbine IDs that is required if :py:attr:`by_turbine` is ``True``, by
70
- default None.
71
67
72
68
Returns
73
69
-------
@@ -77,8 +73,8 @@ def _calculate_time_availability(
77
73
"""
78
74
availability = availability > 0
79
75
if by_turbine :
80
- return availability [ turbine_id ] .values .sum (axis = 0 ) / availability .shape [0 ]
81
- return availability .windfarm . values .sum () / availability . windfarm .size
76
+ return availability .values .sum (axis = 0 ) / availability .shape [0 ]
77
+ return availability .values .sum () / availability .size
82
78
83
79
84
80
class Metrics :
@@ -375,15 +371,13 @@ def time_based_availability(self, frequency: str, by: str) -> pd.DataFrame:
375
371
for sub , val in self .substation_turbine_map .items ():
376
372
turbine_operations [val ["turbines" ]] *= self .operations [[sub ]].values
377
373
378
- hourly = turbine_operations .loc [:, [ "windfarm" ] + self .turbine_id ]
374
+ hourly = turbine_operations .loc [:, self .turbine_id ]
379
375
380
376
# TODO: The below should be better summarized as:
381
377
# (availability > 0).groupby().sum() / groupby().count()
382
378
383
379
if frequency == "project" :
384
- availability = _calculate_time_availability (
385
- hourly , by_turbine = by_turbine , turbine_id = self .turbine_id
386
- )
380
+ availability = _calculate_time_availability (hourly , by_turbine = by_turbine )
387
381
if not by_turbine :
388
382
return pd .DataFrame ([availability ], columns = ["windfarm" ])
389
383
@@ -401,7 +395,6 @@ def time_based_availability(self, frequency: str, by: str) -> pd.DataFrame:
401
395
_calculate_time_availability (
402
396
hourly [date_time .year == year ],
403
397
by_turbine = by_turbine ,
404
- turbine_id = self .turbine_id ,
405
398
)
406
399
for year in counts .index
407
400
]
@@ -414,7 +407,6 @@ def time_based_availability(self, frequency: str, by: str) -> pd.DataFrame:
414
407
_calculate_time_availability (
415
408
hourly [date_time .month == month ],
416
409
by_turbine = by_turbine ,
417
- turbine_id = self .turbine_id ,
418
410
)
419
411
for month in counts .index
420
412
]
@@ -427,7 +419,6 @@ def time_based_availability(self, frequency: str, by: str) -> pd.DataFrame:
427
419
_calculate_time_availability (
428
420
hourly [(date_time .year == year ) & (date_time .month == month )],
429
421
by_turbine = by_turbine ,
430
- turbine_id = self .turbine_id ,
431
422
)
432
423
for year , month in counts .index
433
424
]
0 commit comments