Skip to content

Commit

Permalink
Merge pull request #354 from xylar/remove_unneeded_coastal_tools_args
Browse files Browse the repository at this point in the history
Remove unneeded arguments from coastal_tools funcs
  • Loading branch information
xylar authored Nov 13, 2020
2 parents 95e6998 + 1d4c493 commit 6196f45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
1 change: 0 additions & 1 deletion conda_package/docs/ocean/coastal_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ Next, the distance to the coastal contours is computed using
:py:func:`mpas_tools.ocean.coastal_tools.distance_to_coast()` with the
following values from ``params``:

* ``'origin'`` - A lon and lat point---no longer used in the code
* ``'nn_search'`` - Whether to use the ``'flann'`` or ``'kdtree'`` algorithm,
with the ``'flann'`` strongly recommended.
* ``'smooth_coastline'`` - The number of neighboring cells along the coastline
Expand Down
23 changes: 4 additions & 19 deletions conda_package/mpas_tools/ocean/coastal_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ def coastal_refined_mesh(params, cell_width=None, lon_grd=None, lat_grd=None):
coastlines,
lon_grd,
lat_grd,
params["origin"],
params["nn_search"],
params["smooth_coastline"],
params["plot_option"],
Expand All @@ -336,8 +335,6 @@ def coastal_refined_mesh(params, cell_width=None, lon_grd=None, lat_grd=None):
params["restrict_box"],
params["plot_option"],
params["plot_box"],
lon_grd,
lat_grd,
coastlines,
call_count)

Expand Down Expand Up @@ -609,8 +606,8 @@ def extract_coastlines(nc_file, nc_vars, region_box, z_contour=0, n_longest=10,
##############################################################


def distance_to_coast(coastlines, lon_grd, lat_grd, origin, nn_search,
smooth_window, plot_option=False, plot_box=[], call=None):
def distance_to_coast(coastlines, lon_grd, lat_grd, nn_search, smooth_window,
plot_option=False, plot_box=[], call=None):
# {{{
"""
Extracts a set of coastline contours
Expand All @@ -627,9 +624,6 @@ def distance_to_coast(coastlines, lon_grd, lat_grd, origin, nn_search,
lat_grd : ndarray
A 1D array of latitudes in degrees in the range from -90 to 90
origin : ndarray
A lon/lat point defining the origin, not currently used by the code
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
Expand Down Expand Up @@ -740,8 +734,7 @@ def distance_to_coast(coastlines, lon_grd, lat_grd, origin, nn_search,

def compute_cell_width(D, cell_width, lon, lat, dx_min, trans_start,
trans_width, restrict_box, plot_option=False,
plot_box=[], lon_grd=[], lat_grd=[], coastlines=[],
call=None): # {{{
plot_box=[], coastlines=[], call=None): # {{{
"""
Blend cell widths from the input field with the new resolution in the
refined region determined by the distance to the coastline contour.
Expand Down Expand Up @@ -787,14 +780,6 @@ def compute_cell_width(D, cell_width, lon, lat, dx_min, trans_start,
plot_box : list of float, optional
The extent of the plot if ``plot_option=True``
lon_grd : ndarray
A 1D array of longitudes in degrees in the range from -180 to 180 used
in plotting if ``plot_option=True`` (the same as ``lon``)
lat_grd : ndarray
A 1D array of latitudes in degrees in the range from -90 to 90 used
in plotting if ``plot_option=True`` (the same as ``lat``)
coastlines : ndarray
An n x 2 array of (longitude, latitude) points along the coastline
contours returned from ``extract_coastlines()`` used in plotting if
Expand Down Expand Up @@ -854,7 +839,7 @@ def compute_cell_width(D, cell_width, lon, lat, dx_min, trans_start,

# Find coordinates and data inside plotting box
lon_plot, lat_plot, cell_width_plot = get_data_inside_box(
lon_grd, lat_grd, cell_width / km, plot_box)
lon, lat, cell_width / km, plot_box)

# Plot cell width
fig = plt.figure()
Expand Down

0 comments on commit 6196f45

Please sign in to comment.