mpas_tools.ocean.coastal_tools.distance_to_coast

mpas_tools.ocean.coastal_tools.distance_to_coast(coastlines, lon_grd, lat_grd, nn_search, smooth_window, plot_option=False, plot_box=[], call=None)[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’, ‘flann’}) – The algorithm to use for the nearest neightbor search. ‘flann’ is strongly recommended, as it is faster and more memory efficient in our testing.

  • smooth_window (int) – 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.

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.