Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove plot api locking. #2218

Merged
merged 1 commit into from
Oct 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions lib/iris/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

import collections
import datetime
from functools import wraps
import threading

import cartopy.crs as ccrs
import cartopy.mpl.geoaxes
Expand Down Expand Up @@ -56,26 +54,6 @@

PlotDefn = collections.namedtuple('PlotDefn', ('coords', 'transpose'))

# Threading reentrant lock to ensure thread-safe plotting.
_lock = threading.RLock()


def _locker(func):
"""
Decorator that ensures a thread-safe atomic operation is
performed by the decorated function.

Uses a shared threading reentrant lock to provide thread-safe
plotting by public API functions.

"""
@wraps(func)
def decorated_func(*args, **kwargs):
with _lock:
result = func(*args, **kwargs)
return result
return decorated_func


def _get_plot_defn_custom_coords_picked(cube, coords, mode, ndims=2):
def names(coords):
Expand Down Expand Up @@ -686,7 +664,6 @@ def _map_common(draw_method_name, arg_func, mode, cube, plot_defn,
return plotfn(*new_args, **kwargs)


@_locker
def contour(cube, *args, **kwargs):
"""
Draws contour lines based on the given Cube.
Expand All @@ -711,7 +688,6 @@ def contour(cube, *args, **kwargs):
return result


@_locker
def contourf(cube, *args, **kwargs):
"""
Draws filled contours based on the given Cube.
Expand Down Expand Up @@ -838,7 +814,6 @@ def _fill_orography(cube, coords, mode, vert_plot, horiz_plot, style_args):
return result


@_locker
def orography_at_bounds(cube, facecolor='#888888', coords=None, axes=None):
"""Plots orography defined at cell boundaries from the given Cube."""

Expand Down Expand Up @@ -869,7 +844,6 @@ def horiz_plot(v_coord, orography, style_args):
horiz_plot, style_args)


@_locker
def orography_at_points(cube, facecolor='#888888', coords=None, axes=None):
"""Plots orography defined at sample points from the given Cube."""

Expand All @@ -891,7 +865,6 @@ def horiz_plot(v_coord, orography, style_args):
horiz_plot, style_args)


@_locker
def outline(cube, coords=None, color='k', linewidth=None, axes=None):
"""
Draws cell outlines based on the given Cube.
Expand Down Expand Up @@ -929,7 +902,6 @@ def outline(cube, coords=None, color='k', linewidth=None, axes=None):
return result


@_locker
def pcolor(cube, *args, **kwargs):
"""
Draws a pseudocolor plot based on the given Cube.
Expand All @@ -956,7 +928,6 @@ def pcolor(cube, *args, **kwargs):
return result


@_locker
def pcolormesh(cube, *args, **kwargs):
"""
Draws a pseudocolor plot based on the given Cube.
Expand All @@ -981,7 +952,6 @@ def pcolormesh(cube, *args, **kwargs):
return result


@_locker
def points(cube, *args, **kwargs):
"""
Draws sample point positions based on the given Cube.
Expand Down Expand Up @@ -1009,7 +979,6 @@ def _scatter_args(u, v, data, *args, **kwargs):
*args, **kwargs)


@_locker
def plot(*args, **kwargs):
"""
Draws a line plot based on the given cube(s) or coordinate(s).
Expand Down Expand Up @@ -1054,7 +1023,6 @@ def plot(*args, **kwargs):
return _draw_1d_from_points('plot', _plot_args, *args, **kwargs)


@_locker
def scatter(x, y, *args, **kwargs):
"""
Draws a scatter plot based on the given cube(s) or coordinate(s).
Expand Down Expand Up @@ -1090,7 +1058,6 @@ def scatter(x, y, *args, **kwargs):
show = plt.show


@_locker
def symbols(x, y, symbols, size, axes=None, units='inches'):
"""
Draws fixed-size symbols.
Expand Down Expand Up @@ -1154,7 +1121,6 @@ def symbols(x, y, symbols, size, axes=None, units='inches'):
axes.autoscale_view()


@_locker
def citation(text, figure=None, axes=None):
"""
Add a text citation to a plot.
Expand Down