text
stringlengths 0
828
|
|---|
The number of colors in the colormap. If None, the norm of the
|
:attr:`bounds` formatoption is used and, if necessary, the
|
given array `arr`
|
Returns
|
-------
|
matplotlib.colors.Colormap
|
The colormap returned by :func:`psy_simple.colors.get_cmap`""""""
|
N = N or None
|
if cmap is None:
|
cmap = self.value
|
if N is None:
|
try:
|
N = self.bounds.norm.Ncmap
|
except AttributeError:
|
if arr is not None and self.bounds.norm is not None:
|
N = len(np.unique(self.bounds.norm(arr.ravel())))
|
if N is not None:
|
return get_cmap(cmap, N)
|
return get_cmap(cmap)"
|
798,"def get_fmt_widget(self, parent, project):
|
""""""Open a :class:`psy_simple.widget.CMapFmtWidget`""""""
|
from psy_simple.widgets.colors import CMapFmtWidget
|
return CMapFmtWidget(parent, self, project)"
|
799,"def xcoord(self):
|
""""""The x coordinate :class:`xarray.Variable`""""""
|
return self.decoder.get_x(self.data, coords=self.data.coords)"
|
800,"def ycoord(self):
|
""""""The y coordinate :class:`xarray.Variable`""""""
|
return self.decoder.get_y(self.data, coords=self.data.coords)"
|
801,"def cell_nodes_x(self):
|
""""""The unstructured x-boundaries with shape (N, m) where m > 2""""""
|
decoder = self.decoder
|
xcoord = self.xcoord
|
data = self.data
|
xbounds = decoder.get_cell_node_coord(
|
data, coords=data.coords, axis='x')
|
if self.plotter.convert_radian:
|
xbounds = convert_radian(xbounds, xcoord, xbounds)
|
return xbounds.values"
|
802,"def cell_nodes_y(self):
|
""""""The unstructured y-boundaries with shape (N, m) where m > 2""""""
|
decoder = self.decoder
|
ycoord = self.ycoord
|
data = self.data
|
ybounds = decoder.get_cell_node_coord(
|
data, coords=data.coords, axis='y')
|
if self.plotter.convert_radian:
|
ybounds = convert_radian(ybounds, ycoord, ybounds)
|
return ybounds.values"
|
803,"def axis(self):
|
""""""axis of the colorbar with the ticks. Will be overwritten during
|
update process.""""""
|
return getattr(
|
self.colorbar.ax, self.axis_locations[self.position] + 'axis')"
|
804,"def default_formatters(self):
|
""""""Default locator of the axis of the colorbars""""""
|
if self._default_formatters:
|
return self._default_formatters
|
else:
|
self.set_default_formatters()
|
return self._default_formatters"
|
805,"def xcoord(self):
|
""""""The x coordinate :class:`xarray.Variable`""""""
|
v = next(self.raw_data.psy.iter_base_variables)
|
return self.decoder.get_x(v, coords=self.data.coords)"
|
806,"def ycoord(self):
|
""""""The y coordinate :class:`xarray.Variable`""""""
|
v = next(self.raw_data.psy.iter_base_variables)
|
return self.decoder.get_y(v, coords=self.data.coords)"
|
807,"def add2format_coord(self, x, y):
|
""""""Additional information for the :meth:`format_coord`""""""
|
u, v = self.data
|
uname, vname = self.data.coords['variable'].values
|
xcoord = self.xcoord
|
ycoord = self.ycoord
|
if self.decoder.is_triangular(self.raw_data[0]):
|
x, y, z1, z2 = self.get_xyz_tri(xcoord, x, ycoord, y, u, v)
|
elif xcoord.ndim == 1:
|
x, y, z1, z2 = self.get_xyz_1d(xcoord, x, ycoord, y, u, v)
|
elif xcoord.ndim == 2:
|
x, y, z1, z2 = self.get_xyz_2d(xcoord, x, ycoord, y, u, v)
|
speed = (z1**2 + z2**2)**0.5
|
xunit = xcoord.attrs.get('units', '')
|
if xunit:
|
xunit = ' ' + xunit
|
yunit = ycoord.attrs.get('units', '')
|
if yunit:
|
yunit = ' ' + yunit
|
zunit = u.attrs.get('units', '')
|
if zunit:
|
zunit = ' ' + zunit
|
return (', vector data: %s: %.4g%s, %s: %.4g%s, %s: %.4g%s, '
|
'%s: %.4g%s, absolute: %.4g%s') % (
|
xcoord.name, x, xunit, ycoord.name, y, yunit,
|
uname, z1, zunit, vname, z2, zunit,
|
speed, zunit)"
|
808,"def get_xyz_tri(self, xcoord, x, ycoord, y, u, v):
|
""""""Get closest x, y and z for the given `x` and `y` in `data` for
|
1d coords""""""
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.