mpas_tools.ocean.coastal_tools.extract_coastlines¶
- mpas_tools.ocean.coastal_tools.extract_coastlines(nc_file, nc_vars, region_box, z_contour=0, n_longest=10, point_list=None, plot_option=False, plot_box=None, call=None)[source]¶
Extracts a set of coastline contours
- Parameters
nc_file (str) – A bathymetry dataset on a lon/lat grid in NetCDF format
nc_vars (list of str) – The names of the longitude (nc_vars[0]), latitude (nc_vars[1]) and bathymetry (nc_vars[2]) variables.
region_box (dict of list of ndarrays) – A region made up of a list of quadrilaterals to
include
and another list toexclude
. The quadrilaterals are either bounding rectangles (min lon, max lon, min lat, max lat) or lists of 4 (lon, lat) points.z_contour (float, optional) – The isocontour of the bathymetry dataset to extract
n_longest (int, optional) – The maximum number of contours to keep, after sorting from the longest to the shortest
point_list (ndarray, optional) – A list of points to add to the coastline
plot_option (bool, optional) – Whether to plot the resulting coastline points and the plot to a file named
bathy_coastlines###.png
, where###
is given bycall
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
coastlines (ndarray) – An n x 2 array of (longitude, latitude) points along the coastline contours