deltametrics.plan.compute_shoreline_distance

deltametrics.plan.compute_shoreline_distance(shore_mask, origin=[0, 0], return_distances=False)

Compute mean and stddev distance from the delta apex to the shoreline.

Algorithm computes the mean distance from the delta apex/origin to all shoreline points.

Important

This calculation is subtly different than the “mean delta radius”, because the measurements are not sampled evenly along the opening angle of the delta.

Note

uses np.nanmean and np.nanstd.

Parameters:
  • shore_mask (ShorelineMask, ndarray) – Shoreline mask. Can be a ShorelineMask object, or a binarized array.

  • origin (list, np.ndarray, optional) – Determines the location from where the distance to all shoreline points is computed.

  • return_distances (bool) – Whether to return the sorted line as a second argument. If True, a Nx2 array of x-y points is returned. Default is False.

Returns:

  • mean (float) – Mean shoreline distance.

  • stddev (float) – Standard deviation of shoreline distance.

  • distances (np.ndarray) – If return_distances is True, then distance to each point along the shoreline is also returned as an array (i.e., 3 arguments are returned).

Examples

golf = dm.sample_data.golf()

sm = dm.mask.ShorelineMask(
    golf['eta'][-1, :, :],
    elevation_threshold=0,
    elevation_offset=-0.5)

# compute mean and stddev distance
mean, stddev = dm.plan.compute_shoreline_distance(
    sm, origin=[golf.meta['CTR'].data, golf.meta['L0'].data])

# make the plot
fig, ax = plt.subplots()
golf.quick_show('eta', idx=-1, ticks=True, ax=ax)
ax.set_title('mean = {:.2f}'.format(mean))
plt.show()

(png, hires.png)

../_images/deltametrics-plan-compute_shoreline_distance-1.png