Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not cmin: # if user left blank or initial values are empty
self.control.style.lower_limit.value = str(round(c_lim_lower, 5))
self.control.style.upper_limit.value = str(round(c_lim_upper, 5))
assign_opts = {dim: self.data[dim] for dim in sel_data.dims}
# Following tasks are happening here:
# 1. assign_opts: reassignment of coords(if not done result in
# errors for some of the selections in fields panel)
# 2. graph_opts: customise the plot according to selections in
# style and projection(if available)
# 3. color_range: customise the colormap range according to cmap
# lower and upper limits
# 4. active_tools: activate the tools required such as 'wheel_zoom',
# 'pan'
graph = sel_data.assign_coords(
**assign_opts).hvplot.quadmesh(
**graph_opts).redim.range(**color_range).opts(
active_tools=['wheel_zoom', 'pan'])
self.tap_stream.source = graph
if has_cartopy and is_geo:
graph = (
feature_map * graph
if self.kwargs['features'] != ['None'] else graph
)
if show_map:
graph = getattr(gv.tile_sources, base_map) * graph
self.create_selectors_players(graph)
# 0,1(min, max) to get a color balance graph
c_lim_lower, c_lim_upper = (
(float(cmin), float(cmax)) if cmin and cmax
else find_cmap_limits(sel_data))
color_range = {sel_data.name: (c_lim_lower, c_lim_upper)}
if not cmin: # if user left blank or initial values are empty
self.control.style.lower_limit.value = str(round(c_lim_lower, 5))
self.control.style.upper_limit.value = str(round(c_lim_upper, 5))
if use_all_data: # do the selection later
sel_data = sel_data.sel(**selection, drop=True)
assign_opts = {dim: self.data[dim] for dim in sel_data.dims}
graph = sel_data.assign_coords(
**assign_opts).hvplot.quadmesh(**graph_opts).redim.range(
**color_range).opts(active_tools=['wheel_zoom', 'pan'])
self.graph = graph
if len(self.data[self.var].dims) > 2 and self.kwargs['extract along']:
self.tap_stream.source = graph
self.taps_graph = hv.DynamicMap(
self.create_taps_graph,
streams=[self.tap_stream, self.clear_points])
self.output[0] = self.graph * self.taps_graph
self.clear_series_button.disabled = False
else:
self.output[0] = self.graph
self.clear_series_button.disabled = True