import numpy as np import matplotlib.pyplot as plt import WDRT.shortTermExtreme as ste import os # load response time series responseData = os.path.join('data','data.csv') data = ste.loadtxt(responseData, delimiter=',') t = data['t'] response = data['data'] # find global peaks t_peaks, peaks = ste.globalPeaks(t, response) # plot plt.figure() plt.plot(t, response, 'k-') plt.plot(t_peaks, peaks, 'go') plt.plot([0, t[-1]], [0, 0], 'k--') plt.xlabel('Time, $t$ [s]') plt.ylabel('Response, $x$') plt.grid(True) plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # get the 1-hour extreme distribution using the Weibull tail fit method x_e = np.linspace(0, 2 * np.max(peaks), 10000) t_x = (t[-1] - t[0]) t_st = 1. * 60. * 60. stextreme_dist, peaks_dist, _, _, _ = ste.extremeDistribution_WeibullTailFit(x=peaks, x_e=x_e, t_x=t_x, t_st=t_st) # plot
Hs_sample = np.array(envFile['Samples_ContourApproach/Hs_SampleCA']) T_sample = np.array(envFile['Samples_ContourApproach/T_SampleCA']) # Load data from modeling modResFile = h5py.File(os.path.join('data', 'longTerm_contourApproach.h5'), 'r') t = np.array(modResFile['time']) tSim = t[-1] n = len(modResFile['x']) peaks = [] mmax = [] x = [] for ii in range(n): ss = 'ss_%03d' % ii x.append(np.array(modResFile['/x/' + ss])) peaks.append(ste.globalPeaks(t, x[ii])[1]) mmax.append(np.max(peaks[ii])) # Short-term extreme response at each sea state tPer = 1 * 60 * 60 # storm period x_t = np.linspace(0, 1.5 * np.max(mmax), 100) edist = [] ev = [] r975 = [] for ii in range(n): edist.append( ste.extremeDistribution_WeibullTailFit(x=peaks[ii], x_e=x_t, t_x=tSim, t_st=tPer)[0]) ev.append(edist[ii].getExpVal())
import numpy as np import matplotlib.pyplot as plt import WDRT.shortTermExtreme as ecm import WDRT.fatigue as fatigue # load response time series data = ecm.loadtxt('data/data.csv',delimiter=',') t = data['t'] response = data['data'] # find global peaks t_peaks, peaks = ecm.globalPeaks(t, response) # plot plt.figure() plt.hold(True) plt.plot(t, response, 'k-') plt.plot(t_peaks, peaks, 'go') plt.plot([0, t[-1]], [0, 0], 'k--') plt.xlabel('Time, $t$ [s]') plt.ylabel('Response, $x$') plt.grid(True) plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # get the 1-hour extreme distribution using the Weibull tail fit method x_e = np.linspace(0, 2 * np.max(peaks), 10000) t_x = (t[-1] - t[0]) t_st = 1. * 60. * 60. stextreme_dist, peaks_dist, _, _, _ = ecm.extremeDistribution_WeibullTailFit(x=peaks, x_e=x_e, t_x=t_x, t_st=t_st)
Hs_sample = np.array(envFile['Hs_sampleCA']) T_sample = np.array(envFile['T_sampleCA']) # Load data from modeling modResFile = h5py.File(os.path.join( 'data', 'longTerm_contourApproach.h5'), 'r') t = np.array(modResFile['time']) tSim = t[-1] n = len(modResFile['x']) peaks = [] mmax = [] x = [] for ii in range(n): ss = 'ss_%03d' % ii x.append(np.array(modResFile['/x/' + ss])) peaks.append(ste.globalPeaks(t, x[ii])[1]) mmax.append(np.max(peaks[ii])) # Short-term extreme response at each sea state tPer = 1 * 60 * 60 # storm period x_t = np.linspace(0, 1.5 * np.max(mmax), 100) edist = [] ev = [] r975 = [] for ii in range(n): edist.append(ste.extremeDistribution_WeibullTailFit( x=peaks[ii], x_e=x_t, t_x=tSim, t_st=tPer)[0]) ev.append(edist[ii].getExpVal()) # Find largest response mi = np.argmax(ev)
import numpy as np import matplotlib.pyplot as plt import WDRT.shortTermExtreme as ecm import WDRT.fatigue as fatigue # load response time series data = ecm.loadtxt('data/data.csv', delimiter=',') t = data['t'] response = data['data'] # find global peaks t_peaks, peaks = ecm.globalPeaks(t, response) # plot plt.figure() plt.hold(True) plt.plot(t, response, 'k-') plt.plot(t_peaks, peaks, 'go') plt.plot([0, t[-1]], [0, 0], 'k--') plt.xlabel('Time, $t$ [s]') plt.ylabel('Response, $x$') plt.grid(True) plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # get the 1-hour extreme distribution using the Weibull tail fit method x_e = np.linspace(0, 2 * np.max(peaks), 10000) t_x = (t[-1] - t[0]) t_st = 1. * 60. * 60. stextreme_dist, peaks_dist, _, _, _ = ecm.extremeDistribution_WeibullTailFit( x=peaks, x_e=x_e, t_x=t_x, t_st=t_st)