Skip to content

Commit c47bcad

Browse files
committed
Fix issues where using built-in variable names
1 parent 1c16392 commit c47bcad

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

pyGMS/structures.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def plot_var(self, varname, ax=None, **kwds):
265265
ax = ax or plt.axes()
266266
ax.plot(self.vars[varname], self.z, **kwds)
267267

268-
def plot_grad(self, varname, scale=1, return_array=False, abs=False,
268+
def plot_grad(self, varname, scale=1, return_array=False, absolute=False,
269269
ax=None, **kwds):
270270
"""Plot the gradient of a variable.
271271
@@ -279,7 +279,7 @@ def plot_grad(self, varname, scale=1, return_array=False, abs=False,
279279
Multiply the gradient by this value.
280280
return_array : bool
281281
If `true` will return the gradient array.
282-
abs : bool
282+
absolute : bool
283283
Plot the absolute value of `varname`.
284284
ax : matplotlib.axes, optional
285285
An existing matplotlib.axes.
@@ -296,7 +296,7 @@ def plot_grad(self, varname, scale=1, return_array=False, abs=False,
296296
"""
297297
ax = ax or plt.axes()
298298
grad = self.grad(varname)
299-
if abs:
299+
if abssolute:
300300
grad = np.abs(grad)
301301
kwds.setdefault('label', 'grad('+varname+')')
302302
ax.plot(grad*scale, self.z, **kwds)
@@ -483,7 +483,6 @@ def _v_(self, message, level=1):
483483
def info(self):
484484
"""Display info about the pyGMS object."""
485485
self._info_()
486-
pass
487486

488487
@property
489488
def xlim(self):
@@ -1744,7 +1743,7 @@ def plot_topography(self, ax=None):
17441743
cmap=afrikakarte(), vmin=vmin, vmax=vmax)
17451744

17461745
def plot_profile(self, x0, y0, x1, y1, var='T', num=100, ax=None,
1747-
unit='m', type='filled', xaxis='dist', annotate=False,
1746+
unit='m', kind='filled', xaxis='dist', annotate=False,
17481747
**kwds):
17491748
"""Plot a profile.
17501749
@@ -1762,7 +1761,7 @@ def plot_profile(self, x0, y0, x1, y1, var='T', num=100, ax=None,
17621761
The axis to plot to
17631762
unit : {'m', 'km'}
17641763
Defines the unit of length.
1765-
type : str
1764+
kind : str
17661765
'filled' for a filled contour plot or 'lines', 'contours' for
17671766
contours
17681767
xaxis : str
@@ -1772,16 +1771,16 @@ def plot_profile(self, x0, y0, x1, y1, var='T', num=100, ax=None,
17721771
If `True` will annotate the contour lines.
17731772
kwds : dict
17741773
Keywords sent to matplotlib.pyplot.tricontour() or
1775-
matplotlib.pyplot.contourf(), depoending on `type`
1774+
matplotlib.pyplot.contourf(), depoending on `kind`
17761775
17771776
Returns
17781777
-------
17791778
mappable
17801779
17811780
"""
1782-
valid_types = ['filled', 'lines', 'contour']
1783-
if type not in valid_types:
1784-
raise ValueError('Invalid type', type)
1781+
valid_kinds = ['filled', 'lines', 'contour']
1782+
if kind not in valid_kinds:
1783+
raise ValueError('Invalid type', kind)
17851784

17861785
length_units = {'km': 1e-3, 'm': 1}
17871786
_ = length_units[unit]
@@ -1825,9 +1824,9 @@ def plot_profile(self, x0, y0, x1, y1, var='T', num=100, ax=None,
18251824
t = tri.Triangulation(d*self.n_layers, z)
18261825

18271826
# Print the contours
1828-
if type == 'filled':
1827+
if kind == 'filled':
18291828
obj = ax.tricontourf(t, v, **kwds)
1830-
elif type == 'lines' or type == 'contours':
1829+
elif kind == 'lines' or kind == 'contours':
18311830
obj = ax.tricontour(t, v, **kwds)
18321831
if annotate:
18331832
ax.clabel(obj, colors='black')

0 commit comments

Comments
 (0)