Skip to content

Commit

Permalink
Merge pull request #12 from MET-OM/tmp
Browse files Browse the repository at this point in the history
update interval in Hs-Tp joint distribution
  • Loading branch information
dung-manh-nguyen authored Mar 15, 2024
2 parents 9fa25f4 + d0114af commit fe92b3f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions metocean_stats/stats/extreme_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fe92b3f

Please sign in to comment.