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],
              folder_name + file_name_1,
              label_x=label_hs,
              label_y=label_tz)
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.
Esempio n. 2
0
                                       do_search_for_optimal_start=True)
contour_hs_1 = c[0]
contour_tz_1 = c[1]

c = sort_points_to_form_continous_line(hdc_contour_20.coordinates[0][0],
                                       hdc_contour_20.coordinates[0][1],
                                       do_search_for_optimal_start=True)
contour_hs_20 = c[0]
contour_tz_20 = c[1]

# Save the contours as csv files in the required format.
folder_name = 'contour-coordinates/'
file_name_1 = determine_file_name_e1('Andreas', 'Haselsteiner', DATASET_CHAR, return_period_1)
write_contour(contour_hs_1,
              contour_tz_1,
              folder_name + file_name_1,
              label_x=label_hs,
              label_y=label_tz)
file_name_20 = determine_file_name_e1('Andreas', 'Haselsteiner', DATASET_CHAR, return_period_20)
write_contour(contour_hs_20,
              contour_tz_20,
              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 = \
Esempio n. 3
0
contour_v_1 = c[0]
contour_hs_1 = c[1]

c = sort_points_to_form_continous_line(hdc_contour_50.coordinates[0][0],
                                       hdc_contour_50.coordinates[0][1],
                                       do_search_for_optimal_start=True)
contour_v_50 = c[0]
contour_hs_50 = c[1]

# Save the contours as csv files in the required format.
folder_name = 'contour-coordinates/'
file_name_1 = determine_file_name_e1('Andreas', 'Haselsteiner', DATASET_CHAR,
                                     return_period_1)
write_contour(contour_v_1,
              contour_hs_1,
              folder_name + file_name_1,
              label_x=label_v,
              label_y=label_hs)
file_name_20 = determine_file_name_e1('Andreas', 'Haselsteiner', DATASET_CHAR,
                                      return_period_50)
write_contour(contour_v_50,
              contour_hs_50,
              folder_name + file_name_20,
              label_x=label_v,
              label_y=label_hs)

# Read the contours from the csv files.
(contour_v_1, contour_hs_1) = read_contour(folder_name + file_name_1)
(contour_v_50, contour_hs_50) = read_contour(folder_name + file_name_20)

# Find datapoints that exceed the 20-yr contour.
        sorted_v[:, j] = theta_v_ij[sorted_indices, j]
        sorted_hs[:, j] = theta_hs_ij[sorted_indices, j]
    percentile50_index = int(
        round((NR_OF_BOOTSTRAP_SAMPLES - 1) * (50.0 / 100.0)))
    bottom_percentile_index = int(
        round((NR_OF_BOOTSTRAP_SAMPLES - 1) * (BOTTOM_PERCENTILE / 100.0)))
    upper_percentile_index = int(
        round((NR_OF_BOOTSTRAP_SAMPLES - 1) * (UPPER_PERCENTILE / 100.0)))

    # Save the median, bottom and upper percentile contours.
    folder_name = 'contour-coordinates/'
    file_name_median = determine_file_name_e2('Andreas', 'Haselsteiner',
                                              NR_OF_YEARS_TO_DRAW, 'median')
    write_contour(sorted_v[percentile50_index, :],
                  sorted_hs[percentile50_index, :],
                  folder_name + file_name_median,
                  label_x=label_v,
                  label_y=label_hs)
    file_name_bottom = determine_file_name_e2('Andreas', 'Haselsteiner',
                                              NR_OF_YEARS_TO_DRAW, 'bottom')
    write_contour(sorted_v[bottom_percentile_index, :],
                  sorted_hs[bottom_percentile_index, :],
                  folder_name + file_name_bottom,
                  label_x=label_v,
                  label_y=label_hs)
    file_name_upper = determine_file_name_e2('Andreas', 'Haselsteiner',
                                             NR_OF_YEARS_TO_DRAW, 'upper')
    write_contour(sorted_v[upper_percentile_index, :],
                  sorted_hs[upper_percentile_index, :],
                  folder_name + file_name_upper,
                  label_x=label_v,
x0_1 = lognorm.ppf(norm.cdf(u0_1), sig_x1_1, loc=0, scale=np.exp(mu_x1_1))
x0_20 = lognorm.ppf(norm.cdf(u0_20), sig_x1_20, loc=0, scale=np.exp(mu_x1_20))
#%%
h = sns.jointplot(x=df.columns[2], y=df.columns[1], data=df, s=5)
h.x, h.y = x0_1, x1_1
h.plot_joint(plt.plot, color='C1')
h.x, h.y = x0_20, x1_20
h.plot_joint(plt.plot, color='C2')

#%% E1 requirements:
# Save the contours as csv files in the required format.
folder_name = 'contour_coordinates/'
file_name_1 = determine_file_name_e1('Asta', 'Hannesdottir', DATASET_CHAR, T1)
write_contour(
    x1_1,  #y-axis
    x0_1,
    folder_name + file_name_1,
    label_x=df.columns[1],
    label_y=df.columns[2])
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.