mpas_tools.ocean.coastal_tools.compute_cell_width¶
-
mpas_tools.ocean.coastal_tools.
compute_cell_width
(D, cell_width, lon, lat, dx_min, trans_start, trans_width, restrict_box, plot_option=False, plot_box=[], coastlines=[], call=None)[source]¶ Blend cell widths from the input field with the new resolution in the refined region determined by the distance to the coastline contour.
- Parameters
D (ndarray) – A len(lat) x len(lon) array of distances in meters on the lon/lat grid to the closest point in the (smoothed) coastline contour returned from
distance_to_coast()
cell_width (ndarray) – A len(lat) x len(lon) array of cell widths in meters
lon (ndarray) – A 1D array of longitudes in degrees in the range from -180 to 180
lat (ndarray) – A 1D array of latitudes in degrees in the range from -90 to 90
dx_min (float) – The resolution in meters of the new refined region.
trans_start (float) – The approximate value of
D
in meters at which the transition in resolution should starttrans_width (float) – The approximate width in meters over which the transition in resolution should take place
restrict_box (dict of lists of ndarrays) – A region of made up of quadrilaterals to
include
andexclude
that defines where resolution may be altered. Outside of therestrict_box
, the resolution remains unchanged.plot_option (bool, optional) – Whether to plot the resulting coastline points and the plot to files named
cell_width###.png
andtrans_func###.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
coastlines (ndarray) – An n x 2 array of (longitude, latitude) points along the coastline contours returned from
extract_coastlines()
used in plotting ifplot_option=True
call (int, optional) – The number of times the function has been called, used to give the plot a unique name.
- Returns
cell_width (ndarray) – A len(lat) x len(lon) array of the new cell widths in meters