Skip to content

Commit

Permalink
code climate errors
Browse files Browse the repository at this point in the history
  • Loading branch information
anacmontoya committed Jul 26, 2024
1 parent 2b8392c commit 8a78a50
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/metpy/plots/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -1988,6 +1988,7 @@ def _build(self):
# Finally, draw the label
self._draw_label(label, lon, lat, fontcolor, fontoutline, offset)


@exporter.export
class PlotSurfaceAnalysis(MetPyHasTraits):
"""Plot Surface Analysis Features.
Expand All @@ -2008,7 +2009,7 @@ class PlotSurfaceAnalysis(MetPyHasTraits):
"""

feature = Union([Instance(collections.abc.Iterable), Unicode()],
allow_none=False)
allow_none=False)
feature.__doc__ = """Collection of names of features to be plotted.
Collection of strings, each corresponding one-to-one with geometries, such as the
Expand All @@ -2017,7 +2018,7 @@ class PlotSurfaceAnalysis(MetPyHasTraits):
"""

strength = Union([Instance(collections.abc.Iterable), Float()], default_value=[],
allow_none=True)
allow_none=True)
strength.__doc__ = """Collection of strengths corresponding to pressure systems.
Collection of floats, each corresponding one-to-one with pressure system features. Such
Expand Down Expand Up @@ -2081,22 +2082,22 @@ class PlotSurfaceAnalysis(MetPyHasTraits):
"""

TROF_linestyle = Union([Unicode()], default_value='dashed',
allow_none=True)
allow_none=True)
TROF_linestyle.__doc__ = """Linestyle of Trough lines.

Check failure on line 2086 in src/metpy/plots/declarative.py

View workflow job for this annotation

GitHub Actions / Flake8

[codespell] reported by reviewdog 🐶 Trough ==> Through Raw Output: ./src/metpy/plots/declarative.py:2086: Trough ==> Through
Single string, default value is 'dashed'.
Accept matplotlib linestyles: 'solid', 'dotted', 'dashdot'.
"""

label_fontsize = Union([Int(), Float(), Unicode()], default_value=10, allow_none=True)
label_fontsize = Union([Int(), Float(), Unicode()], default_value=10, allow_none=True)
label_fontsize.__doc__ = """Font sizes of pressure systems labels.
Accepts size in points or relative size. Allowed relative sizes are those of Matplotlib:
'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'.
"""

TROF_linewidth = Union([Float()], default_value=2,
allow_none=True)
allow_none=True)
TROF_linewidth.__doc__ = """Stroke width for trough lines.

Check failure on line 2101 in src/metpy/plots/declarative.py

View workflow job for this annotation

GitHub Actions / Flake8

[codespell] reported by reviewdog 🐶 trough ==> through Raw Output: ./src/metpy/plots/declarative.py:2101: trough ==> through
A single integer or floating point value representing the size of the stroke width.
Expand All @@ -2117,7 +2118,7 @@ class PlotSurfaceAnalysis(MetPyHasTraits):
'x-large', 'xx-large'.
"""

strength_offset = Union([Tuple()], default_value=(0,-1), allow_none=True)
strength_offset = Union([Tuple()], default_value=(0, -1), allow_none=True)
strength_offset.__doc__ = """Offset between label of pressure system and its
corresponding strength.
Expand All @@ -2138,10 +2139,10 @@ def _effect_map(self):


def _color_map(self):

Check failure on line 2141 in src/metpy/plots/declarative.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 E303 too many blank lines (2) Raw Output: ./src/metpy/plots/declarative.py:2141:5: E303 too many blank lines (2)
return {
'HIGH' : self.HIGH_color,
'LOW' : self.LOW_color,
'TROF' : self.TROF_color
return {
'HIGH': self.HIGH_color,
'LOW': self.LOW_color,
'TROF': self.TROF_color
}

def _linewidth_map(self):
Expand All @@ -2155,8 +2156,8 @@ def _linewidth_map(self):

def _label_map(self):
return {
'HIGH' : self.HIGH_label,
'LOW' : self.LOW_label
'HIGH': self.HIGH_label,
'LOW': self.LOW_label
}

@property
Expand Down Expand Up @@ -2186,18 +2187,17 @@ def _draw_strengths(self, text, lon, lat, color, offset=None):
import math
if offset is None:
offset = tuple(x * self.label_fontsize * 0.8 for x in self.strength_offset)
else:
offset = offset

self.parent.ax.add_artist(TextCollection([lon], [lat], [str(text)],
va='center',
ha='center',
color=color,
offset=offset,
weight='demi',
size = math.floor(self.label_fontsize * 0.7),
size=math.floor(self.label_fontsize * 0.7),
transform=ccrs.PlateCarree()))

def _draw_labels(self, text, lon, lat, color, offset=(0,0)):
def _draw_labels(self, text, lon, lat, color, offset=(0, 0)):
"""Draw labels in the plot.
Parameters
Expand Down Expand Up @@ -2257,14 +2257,14 @@ def _build(self):
kwargs.setdefault('facecolor', 'none')
kwargs.setdefault('crs', ccrs.PlateCarree())
kwargs.setdefault('path_effects', effect_map[feature])
if feature=='TROF':
if feature =='TROF':
kwargs.setdefault('edgecolor', color_map[feature])
kwargs.setdefault('linestyle', self.TROF_linestyle)
self.parent.ax.add_geometries([geo_obj], **kwargs)
elif isinstance(geo_obj, Point):
kwargs.setdefault('color', color_map[feature])
lon, lat = geo_obj.coords[0]
self._draw_labels(label_map[feature],lon,lat, **kwargs)
self._draw_labels(label_map[feature], lon, lat, **kwargs)
# Plot strengths if provided
if strengthvalues is not None:
self._draw_strengths(strengthvalues, lon, lat, **kwargs)

0 comments on commit 8a78a50

Please sign in to comment.