Skip to content

Commit f37256f

Browse files
committed
Wave: Offset mhkit-matlab bin edges to get same output as python v1.0.1
1 parent 18e0909 commit f37256f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

mhkit/wave/performance/power_performance_workflow.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,22 @@
100100
L = capture_length(P,J);
101101

102102
% Need to set our Hm0 and Te bins for the capture length matrix
103+
% mhkit-python 1.0.1 changed _performance_matrix to insert 0 as first edge
104+
% instead of -inf. Bin centers must be offset by +0.5 step to produce the
105+
% same internal edges [0, 0.5, 1, ...] as before.
103106
Hm0_max = max(fix(Hm0));
104107
if Hm0_max < 1
105108
Hm0_max = 1; % Ensure at least 2 bin edges
106109
end
107-
Hm0_bins = -0.5:0.5:Hm0_max+0.5;
108-
Hm0_bins = Hm0_bins+0.25;
110+
Hm0_bins = 0:0.5:Hm0_max+0.5;
111+
Hm0_bins = Hm0_bins + 0.25; % Offset so midpoints give edges [0, 0.5, 1, ...]
109112

110113
Te_max = max(fix(Te));
111114
if Te_max < 1
112115
Te_max = 1; % Ensure at least 2 bin edges
113116
end
114117
Te_bins = 0:1:Te_max;
115-
Te_bins = Te_bins+0.5;
118+
Te_bins = Te_bins + 0.5; % Offset so midpoints give edges [0, 1, 2, ...]
116119

117120
% Calculate the necessary capture length matrices for each statistic based
118121
% on IEC/TS 62600-100

0 commit comments

Comments
 (0)