file_name_20 = determine_file_name_e1('John', 'Doe', DATASET_CHAR,
                                      return_period_20)
write_contour(iform_contour_20.coordinates[0][0],
              iform_contour_20.coordinates[0][1],
              folder_name + file_name_20,
              label_x=label_hs,
              label_y=label_tz)

# Read the contours from the csv files.
(contour_hs_1, contour_tz_1) = read_contour(folder_name + file_name_1)
(contour_hs_20, contour_tz_20) = read_contour(folder_name + file_name_20)

# Find datapoints that exceed the 20-yr contour.
hs_outside, tz_outside, hs_inside, tz_inside = \
    points_outside(contour_hs_20,
                   contour_tz_20,
                   np.asarray(sample_hs),
                   np.asarray(sample_tz))
print('Number of points outside the contour: ' + str(len(hs_outside)))

fig = plt.figure(figsize=(5, 5), dpi=150)
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--')
file_name_20 = determine_file_name_e1('Asta', 'Hannesdottir', DATASET_CHAR,
                                      T20)
write_contour(x1_20,
              x0_20,
              folder_name + file_name_20,
              label_x=df.columns[1],
              label_y=df.columns[2])

# Read the contours from the csv files.
(contour_hs_1, contour_tz_1) = read_contour(folder_name + file_name_1)
(contour_hs_20, contour_tz_20) = read_contour(folder_name + file_name_20)

# Find datapoints that exceed the 20-yr contour.
hs_outside, tz_outside, hs_inside, tz_inside = \
    points_outside(contour_hs_20,
                   contour_tz_20,
                   np.asarray(df[df.columns[1]].values),
                   np.asarray(df[df.columns[2]].values))
print('Number of points outside the contour: ' + str(len(hs_outside)))
#%%
nan_mask = np.isnan(contour_tz_20)

fig = plt.figure(figsize=(5, 5), dpi=150)
ax = fig.add_subplot(111)

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,
              label_y=label_v)
file_name_50 = determine_file_name_e1('John', 'Doe', DATASET_CHAR, return_period_50)
write_contour(iform_contour_50.coordinates[0][0],
              iform_contour_50.coordinates[0][1],
              folder_name + file_name_50,
              label_x=label_hs,
              label_y=label_v)

# Read the contour coordinates from the created csv files.
(contour_hs_1, contour_v_1) = read_contour(folder_name + file_name_1)
(contour_hs_50, contour_v_50) = read_contour(folder_name + file_name_50)

# Find datapoints that exceed the contour.
hs_outside, v_outside, hs_inside, v_inside = \
    points_outside(contour_hs_50,
                   contour_v_50,
                   np.asarray(sample_hs),
                   np.asarray(sample_v))
print('Number of points outside the contour: ' +  str(len(hs_outside)))

fig = plt.figure(figsize=(5, 5), dpi=150)
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(return_period_1) + '-yr contour',
             x_label=label_v,
             y_label=label_hs,
             line_style='b--')
Ejemplo n.º 4
0
    (contour_x_1, contour_y_1) = read_contour(folder_name + file_name_1)
    (contour_x_long,
     contour_y_long) = read_contour(folder_name + file_name_long_tr)

    # Switch the order of variables for plotting Hs over Tz.
    if dataset_char in ('A', 'B', 'C'):
        sample_x, sample_y = sample_y, sample_x
        label_x, label_y = label_y, label_x
        contour_x_1, contour_y_1 = contour_y_1, contour_x_1
        contour_x_long, contour_y_long = contour_y_long, contour_x_long

    # Find datapoints that exceed the 20/50-yr contour.
    x_outside, y_outside, x_inside, y_inside = \
        points_outside(contour_x_long,
                       contour_y_long,
                       np.asarray(sample_x),
                       np.asarray(sample_y))
    print('Number of points outside the contour: ' + str(len(x_outside)))

    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),