Closed paulf81 closed 3 years ago
I have refactored this PR and it is now ready to be merged into main
. Important changes:
Major changes
energy_ratio
now accepts user-specified bin occurrences frequencies/probability distributions. This must be passed as an interpolant to the energy_ratio
class. This need not necessarily be a normalized quantity: it will normalize the bin occurrences within energy_ratio
after interpolation, such that the total of bin occurrences/frequencies over all wind speeds for one single wind direction bin sums up to 1.0
.energy_ratio_suite.py
now can balance the bins between dataframes. This option defaults to True. What it does is that it calculates the bin_counts for all dataframes assigned to energy_ratio_suite and then determines the minimum bin count for each WD/WS bin among all dataframes. This is the frequency of occurrence for that particular bin. Once this balanced bin count has been established for all WD/WS bins, it is passed to energy_ratio
as a nearest-neighbor interpolant (see previous point). Bin balancing ensures we are comparing "apples to apples", so to speak.energy_ratio.py
, rather than be calculated in the table generation function. This additional information is returned by energy_ratio
if the user specifies return_detailed_output=True
. Additional information includes: mean and standard deviation of the reference power, test power, wind direction, wind speed and optionally TI for every WD/WS bin. It also includes total energy produced (balanced and unbalanced), bin count/frequency of occurrence (balanced and unbalanced), energy ratios (balanced and unbalanced).energy_ratio_suite
currently does not work for more than one test_turbine at a time.Minor changes:
wd_step/2.0
(or wd_bin_width/2.0
, whichever is smaller), and end at 360.0
. This means that the lower bound of the first bin is 0.0
, rather than starting the bin center at 0.0
and having the left bound be a negative number, and would then effectively only have data points in half of the first bin's bounds. Note that to include the case where the measurement is exactly 0.0
, we need to make sure the left bound of each bin is closed (wd_min <= wd < wd_max
), rather than the right bound (wd_min < wd <= wd_max
). I have changed this accordingly.energy_ratio
functions.As for validation:
energy_table_for_two_df.py
from Pauls original pull request matches that produced by the current code.@paulf81 can you review this and let me know if any further changes are needed? If not, let me know and I'll merge it into the main repo. Thanks!
Really not ready to merge, just wanted to show the idea I've been building up in a notebook.
I think it's possible there is an error in the calculation, the energy ratios look too deep in some places and I don't think the directions make sense yet. But hopefully it makes an impression of this might work.