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. 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,
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_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,
'Asta', 'Hannesdottir', 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( 'Asta', 'Hannesdottir', 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, label_y=label_hs) # Read the contours from the csv files. (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,
NR_OF_YEARS_TO_DRAW = 1 # Must be 1, 5 or 25. # Read dataset D. file_path = '../datasets/D.txt' dataset_d_v, dataset_d_hs, label_v, label_hs = read_dataset(file_path) # Read the contours that have beem computed previously from csv files. folder_name = 'contour_coordinates/' file_name_median = determine_file_name_e2('John', 'Doe', NR_OF_YEARS_TO_DRAW, 'median') 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'
# Differentiate between sea state and wind wave contours. if dataset_char in ('A', 'B', 'C'): return_period_long_tr = 20 else: return_period_long_tr = 50 # Read the contours from the csv files. folder_name = 'contour-coordinates/' file_name_1 = determine_file_name_e1('Andreas', 'Haselsteiner', dataset_char, 1) file_name_long_tr = determine_file_name_e1('Andreas', 'Haselsteiner', dataset_char, return_period_long_tr) (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),