From d0114af3633c04afc001f99a4549017518567b06 Mon Sep 17 00:00:00 2001 From: dung-manh-nguyen Date: Fri, 15 Mar 2024 10:33:06 +0100 Subject: [PATCH] update interval in Hs-Tp joint distribution --- metocean_stats/stats/extreme_stats.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/metocean_stats/stats/extreme_stats.py b/metocean_stats/stats/extreme_stats.py index bc48c75..6a4a54a 100644 --- a/metocean_stats/stats/extreme_stats.py +++ b/metocean_stats/stats/extreme_stats.py @@ -920,6 +920,8 @@ def Tp_correction(Tp): ### Tp_correction df['tp'] = Tp_correction(df.tp.values) + interval = ((df.index[-1]-df.index[0]).days + 1)*24/df.shape[0] # in hours + import scipy.stats as stats from scipy.signal import find_peaks from matplotlib import pyplot as plt @@ -1040,7 +1042,7 @@ def Gauss4(x, b2, b3): def Hs_Tp_curve(data,pdf_Hs,pdf_Hs_Tp,f_Hs_Tp,h,t,X=100): # RVE of X years - period=X*365.2422*24/3 + period=X*365.2422*24/interval shape, loc, scale = stats.weibull_min.fit(data) # shape, loc, scale rve_X = stats.weibull_min.isf(1/period, shape, loc, scale) @@ -1085,7 +1087,7 @@ def Hs_Tp_curve(data,pdf_Hs,pdf_Hs_Tp,f_Hs_Tp,h,t,X=100): def DVN_steepness(df,h,t): ## steepness X = 500 # get max 500 year - period=X*365.2422*24/3 + period=X*365.2422*24/interval shape, loc, scale = stats.weibull_min.fit(df.hs.values) # shape, loc, scale rve_X = stats.weibull_min.isf(1/period, shape, loc, scale) @@ -1124,7 +1126,7 @@ def find_percentile(data,pdf_Hs_Tp,h,t,p=50): ## find pecentile # RVE of X years X = 500 # get max 500 year - period=X*365.2422*24/3 + period=X*365.2422*24/interval shape, loc, scale = stats.weibull_min.fit(data) # shape, loc, scale rve_X = stats.weibull_min.isf(1/period, shape, loc, scale) epsilon = abs(h - rve_X)