Skip to content

Commit 18e0909

Browse files
committed
Wave: Ensure capture width bins are valid before sending to python
1 parent b7468e4 commit 18e0909

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

mhkit/wave/performance/power_performance_workflow.m

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

102102
% Need to set our Hm0 and Te bins for the capture length matrix
103-
Hm0_bins = -0.5:0.5:max(fix(Hm0))+0.5; % Input is min, max, and n indecies for vector
104-
Hm0_bins = Hm0_bins+0.25 ;
105-
Te_bins = 0:1:max(fix(Te));
103+
Hm0_max = max(fix(Hm0));
104+
if Hm0_max < 1
105+
Hm0_max = 1; % Ensure at least 2 bin edges
106+
end
107+
Hm0_bins = -0.5:0.5:Hm0_max+0.5;
108+
Hm0_bins = Hm0_bins+0.25;
109+
110+
Te_max = max(fix(Te));
111+
if Te_max < 1
112+
Te_max = 1; % Ensure at least 2 bin edges
113+
end
114+
Te_bins = 0:1:Te_max;
106115
Te_bins = Te_bins+0.5;
107116

108117
% Calculate the necessary capture length matrices for each statistic based

0 commit comments

Comments
 (0)