plot_contour(x=contour_tz_lowest,
             y=contour_hs_lowest,
             ax=ax,
             contour_label=str(return_period_lowest) + '-yr contour',
             line_style='r-')

# Plot the 1-year contour.
plot_contour(x=contour_tz_1,
             y=contour_hs_1,
             ax=ax,
             contour_label=str(return_period_1) + '-yr contour',
             line_style='r-')

# Plot the 20-year contour and the sample.
plotted_sample = PlottedSample(x=np.asarray(sample_tz),
                               y=np.asarray(sample_hs),
                               ax=ax,
                               return_period=return_period_20)
plot_contour(x=contour_tz_20,
             y=contour_hs_20,
             ax=ax,
             contour_label=str(return_period_20) + '-yr contour',
             x_label=label_tz,
             y_label=label_hs,
             line_style='r-',
             plotted_sample=plotted_sample,
             x_lim=(0, 19),
             upper_ylim=9)
plt.title('Dataset ' + DATASET_CHAR)
plt.show()
ax = fig.add_subplot(111)

# Plot the 1-year contour.
plot_contour(x=contour_tz_1,
             y=contour_hs_1,
             ax=ax,
             contour_label=str(return_period_1) + '-yr contour',
             x_label=label_tz,
             y_label=label_hs,
             line_style='b--')

# Plot the 20-year contour and the sample.
plotted_sample = PlottedSample(x=np.asarray(sample_tz),
                               y=np.asarray(sample_hs),
                               ax=ax,
                               x_inside=tz_inside,
                               y_inside=hs_inside,
                               x_outside=tz_outside,
                               y_outside=hs_outside,
                               return_period=return_period_20)
plot_contour(x=contour_tz_20,
             y=contour_hs_20,
             ax=ax,
             contour_label=str(return_period_20) + '-yr contour',
             x_label=label_tz,
             y_label=label_hs,
             line_style='b-',
             plotted_sample=plotted_sample)
plt.title('Dataset ' + DATASET_CHAR)
plt.show()
Esempio n. 3
0
plot_contour(x=contour_v_1,
             y=contour_hs_1,
             ax=ax,
             line_style='r-')

# Compute the median hs conditonal on v.
x = np.linspace(0, 35, 100)
d1 = fit.mul_var_dist.distributions[1]
a = d1.scale.a
b = d1.scale.b
c = d1.scale.c
y = a + b * np.power(x, c)

# Plot the 50-year contour and the sample.
plotted_sample = PlottedSample(x=np.asarray(sample_v),
                               y=np.asarray(sample_hs),
                               ax=ax)
plot_contour(x=contour_v_50,
             y=contour_hs_50,
             ax=ax,
             contour_label='Constant density',
             x_label=label_v,
             y_label=label_hs,
             line_style='r-',
             plotted_sample=plotted_sample,
             x_lim=(0, 35),
             upper_ylim=20,
             median_x=x,
             median_y=y,
             median_label='Median of $H_s | V$',
             median_style='b--')
Esempio n. 4
0
        medians.append(median(samples_in_interval))

    else:
        # For case that too few fitting data for the step were found
        # the step is deleted.
        deleted_centers.append(i)  # Add index of unused center.
# Delete interval centers that were not used.
interval_centers = np.delete(interval_centers, deleted_centers)

# Create Figure 1 of the paper.
fig = plt.figure(figsize=(10, 5), dpi=150)

# Plot dataset A and the 20-year contour.
ax = fig.add_subplot(121)
plotted_sample_a = PlottedSample(x=np.asarray(a_tz),
                                 y=np.asarray(a_hs),
                                 ax=ax,
                                 return_period=return_period_20)
plot_contour(x=contour_tz_20,
             y=contour_hs_20,
             ax=ax,
             contour_label=str(return_period_20) + '-yr contour',
             x_label=label_tz,
             y_label=label_hs,
             line_style='b-',
             plotted_sample=plotted_sample_a)
plt.legend(['20-year contour', '10 years of observations'],
           loc='upper left',
           frameon=False)
plt.title('Dataset A')

# Plot dataset D and the 50-year contour.
Esempio n. 5
0
file_name_bottom = determine_file_name_e2('John', 'Doe', NR_OF_YEARS_TO_DRAW,
                                          'bottom')
file_name_upper = determine_file_name_e2('John', 'Doe', NR_OF_YEARS_TO_DRAW,
                                         'upper')
(contour_v_median,
 contour_hs_median) = read_contour(folder_name + file_name_median)
(contour_v_bottom,
 contour_hs_bottom) = read_contour(folder_name + file_name_bottom)
(contour_v_upper,
 contour_hs_upper) = read_contour(folder_name + file_name_upper)

# Plot the sample, the median contour and the confidence interval.
fig = plt.figure(figsize=(5, 5), dpi=150)
ax = fig.add_subplot(111)
plotted_sample = PlottedSample(x=np.asarray(dataset_d_v),
                               y=np.asarray(dataset_d_hs),
                               ax=ax,
                               label='dataset D')
contour_labels = [
    '50th percentile contour', '2.5th percentile contour',
    '97.5th percentile contour'
]
plot_confidence_interval(x_median=contour_v_median,
                         y_median=contour_hs_median,
                         x_bottom=contour_v_bottom,
                         y_bottom=contour_hs_bottom,
                         x_upper=contour_v_upper,
                         y_upper=contour_hs_upper,
                         ax=ax,
                         x_label=label_v,
                         y_label=label_hs,
                         contour_labels=contour_labels,
ax = fig.add_subplot(111)

# Plot the 1-year contour.
plot_contour(x=contour_v_1,
             y=contour_hs_1,
             ax=ax,
             contour_label=str(T1) + '-yr contour',
             x_label=label_v,
             y_label=label_hs,
             line_style='b--')

# Plot the 50-year contour and the sample.
plotted_sample = PlottedSample(x=np.asarray(sample_v),
                               y=np.asarray(sample_hs),
                               ax=ax,
                               x_inside=v_inside,
                               y_inside=hs_inside,
                               x_outside=v_outside,
                               y_outside=hs_outside,
                               return_period=T50)
plot_contour(x=contour_v_50,
             y=contour_hs_50,
             ax=ax,
             contour_label=str(T50) + '-yr contour',
             x_label=label_v,
             y_label=label_hs,
             line_style='b-',
             plotted_sample=plotted_sample)
plt.title('Dataset ' + DATASET_CHAR)
plt.show()
plt.savefig('../results/figures/hannesdottir_asta_dataset_'+DATASET_CHAR+'_1_50.png', dpi=300)
Esempio n. 7
0
    fig = plt.figure(figsize=(5, 5), dpi=150)
    ax = fig.add_subplot(111)

    # Plot the 1-year contour.
    plot_contour(x=contour_x_1,
                 y=contour_y_1,
                 ax=ax,
                 contour_label='1-yr contour',
                 line_style='b--')

    # Plot the 20/50-year contour and the sample.
    plotted_sample = PlottedSample(x=np.asarray(sample_x),
                                   y=np.asarray(sample_y),
                                   ax=ax,
                                   x_inside=x_inside,
                                   y_inside=y_inside,
                                   x_outside=x_outside,
                                   y_outside=y_outside,
                                   return_period=return_period_long_tr)
    plot_contour(
        x=contour_x_long,
        y=contour_y_long,
        ax=ax,
        contour_label=str(return_period_long_tr) + '-yr contour',
        x_label=label_x,
        y_label=label_y,
        line_style='b-',
        plotted_sample=plotted_sample,
    )
    plt.title('Dataset ' + dataset_char)