mpas_tools.ocean.coastal_tools.distance_to_coast

mpas_tools.ocean.coastal_tools.distance_to_coast(coastlines, lon_grd, lat_grd, nn_search='kdtree', smooth_window=0, plot_option=False, plot_box=[], call=None, workers=-1)[source]

Extracts a set of coastline contours

Parameters
  • coastlines (ndarray) – An n x 2 array of (longitude, latitude) points along the coastline contours returned from extract_coastlines()

  • lon_grd (ndarray) – A 1D array of longitudes in degrees in the range from -180 to 180

  • lat_grd (ndarray) – A 1D array of latitudes in degrees in the range from -90 to 90

  • nn_search ({'kdtree'}, optional) – The algorithm to use for the nearest neightbor search.

  • smooth_window (int, optional) – The number of adjacent coastline points to average together to smooth the coastal contours. Use 0 to indicate no smoothing.

  • plot_option (bool, optional) – Whether to plot the resulting coastline points and the plot to a file named bathy_coastlines###.png, where ### is given by call and is meant to indicate how many times this function has been called during mesh creation.

  • plot_box (list of float, optional) – The extent of the plot if plot_option=True

  • call (int, optional) – The number of times the function has been called, used to give the plot a unique name.

  • workers (int, optional) – The number of threads used for finding nearest neighbors. The default is all available threads (workers=-1)

Returns

D (ndarray) – A len(lat_grd) x len(lon_grd) array of distances in meters on the lon/lat grid to the closest point in the (smoothed) coastline contour.