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)

# Save the contours as csv files in the required format.
folder_name = 'contour_coordinates/'
file_name_1 = determine_file_name_e1('John', 'Doe', DATASET_CHAR,
                                     return_period_1)
write_contour(iform_contour_1.coordinates[0][0],
              iform_contour_1.coordinates[0][1],
コード例 #2
0
                       '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)