pycoastkit.vulnerability¶
Beach vulnerability to storms: erosion classes, a beach vulnerability index (BVI) and return periods of extreme erosion.
The BVI scores how strongly a storm affected the beach on a 1-5 scale:
===== =============================================== class meaning ===== =============================================== 1 no erosion (accretion or no change) 2-4 increasing erosion 5 severe erosion ===== ===============================================
Shoreline retreat and volume loss are each scored, then averaged.
erosion_class
¶
Score erosion on equal-width classes.
erosion <= 0 (accretion or no change) is class 1. Positive erosion
starts at class 2 and moves up one class every class_width, capped
at n_classes. With class_width=5 m: (0, 5) -> 2, [5, 10) -> 3,
[10, 15) -> 4, >= 15 -> 5. NaN stays NaN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
erosion
|
float or array - like
|
Erosion, positive = loss (e.g. |
required |
class_width
|
float
|
Width of each erosion class, in the units of |
required |
Source code in src/pycoastkit/vulnerability.py
classify_by_thresholds
¶
Score erosion with custom class boundaries.
With the default thresholds (m of shoreline retreat): <= 0 -> 1,
(0, 2) -> 2, [2, 4) -> 3, [4, 8) -> 4, >= 8 -> 5. Choose boundaries
from the local erosion distribution or return periods (see
:func:return_periods). NaN stays NaN.
Source code in src/pycoastkit/vulnerability.py
beach_vulnerability_index
¶
beach_vulnerability_index(shoreline_loss, volume_loss, shoreline_class_width=5.0, volume_class_width=10.0, n_classes=5)
Beach vulnerability index: mean of the shoreline and volume erosion classes (1-5).
Default class widths: 5 m of shoreline retreat and 10 m³/m of volume loss.
Source code in src/pycoastkit/vulnerability.py
add_vulnerability_index
¶
add_vulnerability_index(response, shoreline_column='shoreline_loss', volume_column='volume_loss', shoreline_class_width=5.0, volume_class_width=10.0)
Add vi_shoreline, vi_volume and bvi columns to a storm-response table
(the output of :func:pycoastkit.storm_beach_response).
Source code in src/pycoastkit/vulnerability.py
minmax_normalize
¶
Scale to 0-1 with (x - min) / (max - min).
Pass minimum/maximum from a reference period to score new data on
the same scale (values outside are clipped to 0-1).
Source code in src/pycoastkit/vulnerability.py
equal_width_classes
¶
Classes 1..n from values in 0-1 using equal-width bins (1 = lowest).
With 5 classes: [0, 0.2) -> 1, [0.2, 0.4) -> 2, ..., [0.8, 1] -> 5. NaN stays NaN.
Source code in src/pycoastkit/vulnerability.py
susceptibility_index
¶
Weighted morphological susceptibility index (1 = low, n_classes = high).
Combines pre-storm beach indicators (for example shoreline position, zone volumes, foreshore slope, bar height and depth) into one class, as in the Beach Erosion Susceptibility Number (BESN):
- Each indicator is min-max normalised over the table.
- If
direction[name] == -1(a larger value makes the beach less susceptible, e.g. a wide beach), it is flipped to1 - x. - Each indicator is scored 1..n with equal-width classes.
- The scores are averaged with
weights(normalised to sum to 1). - The weighted score is normalised again and classed 1..n.
Weights can come from expert judgement or from a feature-importance analysis of observed erosion. Indicators with a NaN are left out of the weighted mean for that row.
Returns a DataFrame with the per-indicator classes, score (weighted
mean class) and susceptibility (final class).
Source code in src/pycoastkit/vulnerability.py
return_periods
¶
Empirical return periods of annual maxima.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
Series
|
Time-indexed values (e.g. shoreline loss per storm, indexed by storm start). The maximum of each year is used; years without data are dropped. |
required |
plotting_position
|
('weibull', 'gringorten')
|
|
"weibull"
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|