13. Breakwater Database

class breakwater.database.database.BreakwaterDatabase(update=False)[source]

Breakwater Database

Import the breakwater database developed by (Allsop et al., 2009) consist of completed breakwater projects with data ranging from design wave height to contractor. The constructed breakwaters are classified by breakwater type, the following types are currently included: Rubble Mound, Composite, Berm, Caisson and Revetments.

The breakwater database is a separate module of breakwater and can be imported with the following command:

from breakwater.database import BreakwaterDatabase

Note

To use this module the Basemap package is required, this dependency is additional to the dependencies mentioned in Section 2.1. See the following link for an installation of Basemap

Parameters:update (bool, optional, default: False) – if False the data is not updated and the included data is loaded, if True the database is loaded from the source
df

DataFrame of the breakwater database

Type:pd.DataFrame
source

url of the source

Type:str
correlation(param1, param2, bw_type=None, method='pearson')[source]

Compute the correlation between two parameters

Parameters:
  • param1 (str) – name of parameter 1
  • param2 (str) – name of parameter 2
  • bw_type (str, optional, default: None) – if specified only the values of the given bw_type are considered
  • method ({pearson, spearman}, optional, default: pearson) – method of correlation
Returns:

tuple – correlation between the two parameters and the p-value

cross_section(id, B=None, Rc=None, h=None, slope=None)[source]

Plot a cross section of the breakwater

Method to plot a cross section of a breakwater in the database. The breakwater is selected by the id of the breakwater. In case data is missing to plot the breakwater it is possible to specify these as arguments.

Warning

plot function currently only supports Rubble Mound and caisson breakwaters

Parameters:
  • id (int) – id of the breakwater to plot
  • B (float, optional, default: None) – specify custom crest width
  • Rc (float, optional, default: None) – specify custom crest height
  • h (float, optional, default: None) – specify a custom water level
  • slope (tuple, optional, default: None) – specify a custom slope, must be specified as a tuple (V, H)
Raises:

ValueError – If data required to plot a cross section is missing

hist(param, show_unclassified=False, exclude=None, min_data=5, xmax=None, bins=10)[source]

Plot a histogram of a parameter

Parameters:
  • param (str) – name of the parameter
  • show_unclassified (bool, optional, default: False) – True is unclassified breakwaters with a coordinate must be plotted, False is unclassified breakwaters must not be plotted.
  • exclude (list, optional, default: None) – list of breakwater types to exclude from the plot
  • min_data (int, optional, default: 5) – minimum number of datapoints required for plotting, if the data for a bw type is less than this limit it will be skipped
  • xmax (float, optional, default: None) – maximum x coordinate of the histogram, by default this limit is automatically determined
  • bins (int, optional, default: 10) – number of bins
map(area=[], resolution='c', show_unclassified=False, exclude=None)[source]

Plot the breakwaters on a world map

Method to plot all breakwaters with coordinates on a map of the world, or part of the world if an area is specified. Method uses Basemap to generate the map.

Parameters:
  • area (list, optional, default: []) – specify the coordinates of the area to plot. Use following format [llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat]
  • resolution (str, optional, default: c) – resolution of the map to use. Can be c (crude), l (low), i (intermediate), h (high), f (full).
  • show_unclassified (bool, optional, default: False) – True is unclassified breakwaters with a coordinate must be plotted, False is unclassified breakwaters must not be plotted.
  • exclude (list, optional, default: None) – list of breakwater types to exclude from the plot
report(save=True, save_path='data_report.xlsx', decimals=3)[source]

Make a report of the data in the database

Method to generate a data report of the database. For each breakwater type the total and missing number of datapoints is determined. Furthermore, for numerical values the mean and standard deviation is also computed.

Parameters:
  • save (bool, optional, default: True) – If True an Excel version of the data report is generated, use save_path to specify a save path
  • save_path (str) – File path to save the Excel file to
  • decimals (int, optional, default: 3) – Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point.
Returns:

pd.DataFrame – if save is False a DataFrame of the report is returned

scatter(param1, param2, show_unclassified=False, exclude=None, min_data=5, xmax=None, ymax=None, bins_param1=10, bins_param2=10)[source]

Make a scatter plot of two parameters

Method to generate a scatter plot with histograms for two parameters in the database.

Parameters:
  • param1 (str) – name of parameter 1
  • param2 (str) – name of parameter 2
  • show_unclassified (bool, optional, default: False) – True is unclassified breakwaters with a coordinate must be plotted, False is unclassified breakwaters must not be plotted.
  • exclude (list, optional, default: None) – list of breakwater types to exclude from the plot
  • min_data (int, optional, default: 5) – minimum number of datapoints required for plotting, if the data for a bw type is less than this limit it will be skipped
  • xmax (float, optional, default: None) – maximum x coordinate of the scatter plot, by default this limit is automatically determined
  • ymax (float, optional, default: None) – maximum y coordinate of the scatter plot, by default this limit is automatically determined
  • bins_param1 (str) – number of bins for param2
  • bins_param2 (str) – number of bins for param2
unclassified

Get the number of unclassified breakwaters