Skip to content

Commit eb79b9d

Browse files
committed
fix typo
Scatter could use array
1 parent f1fc005 commit eb79b9d

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/py_eddy_tracker/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def split_line(x, y, i):
349349
@njit(cache=True)
350350
def wrap_longitude(x, y, ref, cut=False):
351351
"""
352-
Will wrap contiguous longitude with reference like west bound.
352+
Will wrap contiguous longitude with reference as west bound.
353353
354354
:param array x:
355355
:param array y:

src/py_eddy_tracker/observations/observation.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,18 @@ def __dir__(self):
257257
"""
258258
base = set(dir(type(self)))
259259
intern_name = set(self.elements)
260-
extern_name = set([VAR_DESCR[k]['nc_name'] for k in intern_name])
260+
extern_name = set([VAR_DESCR[k]["nc_name"] for k in intern_name])
261261
# Must be check in init not here
262262
if base & intern_name:
263-
logger.warning("Some variable name have a common name with class attrs: %s", base & intern_name)
263+
logger.warning(
264+
"Some variable name have a common name with class attrs: %s",
265+
base & intern_name,
266+
)
264267
if base & extern_name:
265-
logger.warning("Some variable name have a common name with class attrs: %s", base & extern_name)
268+
logger.warning(
269+
"Some variable name have a common name with class attrs: %s",
270+
base & extern_name,
271+
)
266272
return sorted(base.union(intern_name).union(extern_name))
267273

268274
def __getitem__(self, attr):
@@ -1524,9 +1530,9 @@ def extract_with_mask(self, mask):
15241530
def scatter(self, ax, name=None, ref=None, factor=1, **kwargs):
15251531
"""
15261532
:param matplotlib.axes.Axes ax: matplotlib axe used to draw
1527-
:param str, None name:
1533+
:param str,array,None name:
15281534
variable used to fill the contour, if None all elements have the same color
1529-
:param float, None ref: if define use like west bound ?
1535+
:param float,None ref: if define use like west bound ?
15301536
:param float factor: multiply value by
15311537
:param dict kwargs: look at :py:meth:`matplotlib.axes.Axes.scatter`
15321538
:return: scatter mappable
@@ -1538,7 +1544,8 @@ def scatter(self, ax, name=None, ref=None, factor=1, **kwargs):
15381544
x = (x - ref) % 360 + ref
15391545
kwargs = kwargs.copy()
15401546
if name is not None and "c" not in kwargs:
1541-
kwargs["c"] = self[name] * factor
1547+
v = self[name] if isinstance(name, str) else name
1548+
kwargs["c"] = v * factor
15421549
return ax.scatter(x, self.latitude, **kwargs)
15431550

15441551
def filled(
@@ -1556,7 +1563,7 @@ def filled(
15561563
):
15571564
"""
15581565
:param matplotlib.axes.Axes ax: matplotlib axe used to draw
1559-
:param str,array varname, None: variable used to fill the contours, or an array of same size than obs
1566+
:param str,array,None varname: variable used to fill the contours, or an array of same size than obs
15601567
:param float,None ref: if define use like west bound?
15611568
:param bool intern: if True draw speed contours instead of effective contours
15621569
:param str cmap: matplotlib colormap name

0 commit comments

Comments
 (0)