'dependency': (0, None, 0),  #Shape, Location, Scale
    'functions': ('exp3', None, 'power3'),  #Shape, Location, Scale
    'min_datapoints_for_fit': 50
}

# Fit the model to the data.
fit = Fit((sample_hs, sample_tz), (dist_description_hs, dist_description_tz))
dist0 = fit.mul_var_dist.distributions[0]

fig = plt.figure(figsize=(12.5, 3.5), dpi=150)
ax1 = fig.add_subplot(131)
ax2 = fig.add_subplot(132)
ax3 = fig.add_subplot(133)
plot_marginal_fit(sample_hs,
                  dist0,
                  fig=fig,
                  ax=ax1,
                  label='$h_s$ (m)',
                  dataset_char=DATASET_CHAR)
plot_dependence_functions(fit=fit,
                          fig=fig,
                          ax1=ax2,
                          ax2=ax3,
                          unconditonal_variable_label=label_hs)
fig.suptitle('Dataset ' + DATASET_CHAR)
fig.subplots_adjust(wspace=0.25, bottom=0.15)

# Compute highest density contours with return periods of 0.01, 0.1 and 20 years.
ts = 1  # Sea state duration in hours.
limits = [(0, 20), (0, 20)]  # Limits of the computational domain.
deltas = [0.2, 0.2]  # Dimensions of the grid cells.
    'name': 'Lognormal_SigmaMu',
    'dependency': (0, None, 0),  #Shape, Location, Scale
    'functions': ('exp3', None, 'power3')  #Shape, Location, Scale
}

# Fit the model to the data.
fit = Fit((sample_hs, sample_tz), (dist_description_hs, dist_description_tz))
dist0 = fit.mul_var_dist.distributions[0]
print('First variable: ' + dist0.name + ' with ' + ' scale: ' +
      str(dist0.scale) + ', ' + ' shape: ' + str(dist0.shape) + ', ' +
      ' location: ' + str(dist0.loc))
print('Second variable: ' + str(fit.mul_var_dist.distributions[1]))

fig = plt.figure(figsize=(10, 5), dpi=150)
plot_marginal_fit(sample_hs,
                  dist0,
                  fig=fig,
                  label='Significant wave height (m)')
fig.suptitle('Dataset ' + DATASET_CHAR)

fig = plt.figure(figsize=(6, 5), dpi=150)
plot_dependence_functions(fit=fit,
                          fig=fig,
                          unconditonal_variable_label=label_hs)
fig.suptitle('Dataset ' + DATASET_CHAR)

# Compute IFORM-contours with return periods of 1 and 20 years.
return_period_1 = 1
iform_contour_1 = IFormContour(fit.mul_var_dist, return_period_1, 1, 100)
return_period_20 = 20
iform_contour_20 = IFormContour(fit.mul_var_dist, return_period_20, 1, 100)
예제 #3
0
                       # shape, location, scale, shape2
                       'min_datapoints_for_fit': 50,
                       'do_use_weights_for_dependence_function': True}


# Fit the model to the data.
fit = Fit((sample_v, sample_hs),
          (dist_description_v, dist_description_hs))

dist0 = fit.mul_var_dist.distributions[0]

fig = plt.figure(figsize=(12.5, 3.5), dpi=150)
ax1 = fig.add_subplot(131)
ax2 = fig.add_subplot(132)
ax3 = fig.add_subplot(133)
plot_marginal_fit(sample_v, dist0, fig=fig, ax=ax1, label='$v$ (m s$^{-1}$)',
                  dataset_char=DATASET_CHAR)
plot_dependence_functions(fit=fit, fig=fig, ax1=ax2, ax2=ax3, unconditonal_variable_label=label_v)
fig.suptitle('Dataset ' + DATASET_CHAR)
fig.subplots_adjust(wspace=0.25, bottom=0.15)

# Compute highest density contours with return periods of 0.01, 1 and 50 years.
ts = 1 # Sea state duration in hours.
limits = [(0, 45), (0, 20)] # Limits of the computational domain.
deltas = [0.05, 0.05] # Dimensions of the grid cells.

return_period_lowest = 0.01
hdc_contour_lowest = HDC(fit.mul_var_dist, return_period_lowest, ts, limits, deltas)
return_period_1 = 1
hdc_contour_1 = HDC(fit.mul_var_dist, return_period_1, ts, limits, deltas)
return_period_50 = 50
hdc_contour_50 = HDC(fit.mul_var_dist, return_period_50, ts, limits, deltas)