Thats the working code I actually use. Due to the missing Data it’s not a working example.
df_masked=pd.concat([df['X'], df['Y'], s_GlQ0_WD, s_GlQp5_WD, s_GlQm10_WD, s_GlQm20_WD, s_GlQm30_WD,
s_GlQ0_SV, s_GlQp5_SV, s_GlQm10_SV, s_GlQm20_SV, s_GlQm30_SV,
s_GlQ0_BF, s_GlQp5_BF, s_GlQm10_BF, s_GlQm20_BF, s_GlQm30_BF], axis=1)
vdims = ['s_GlQ0_WD', 's_GlQp5_WD', 's_GlQm10_WD', 's_GlQm20_WD', 's_GlQm30_WD', 's_GlQ0_SV', 's_GlQp5_SV', 's_GlQm10_SV', 's_GlQm20_SV', 's_GlQm30_SV', 's_GlQ0_BF', 's_GlQp5_BF', 's_GlQm10_BF', 's_GlQm20_BF', 's_GlQm30_BF']
cmap_sel={'viridis':'viridis', 'rainbow_r':'rainbow_r', 'cwr_r':'cwr_r','BrBG':'BrBG', 'coolwarm_r':'coolwarm_r'}
cmap_sel_list=['viridis','rainbow_r','Greens', 'Blues', 'cwr_r', 'BrBG', 'coolwarm_r']
tooltips_r= {}
trimesh_dict={}
for vdim in vdims:
points = gv.Points(df_masked, crs=crs.epsg(25832), kdims=['X', 'Y'], vdims = vdim)
tooltips_r[vdim] = [(vdim, '@image')]
d = gv.Dataset(gv.operation.project_points(points))
trimesh_dict[vdim] = rasterize(hv.TriMesh((element, d)), aggregator=ds.mean(vdim), precompute=True, dynamic=True).opts(
cmap=cmap_sel)
class Overview_NR(param.Parameterized):
q_select_opts = ['GlQ', 'GlQ +5%', 'GlQ -10%', 'GlQ -20%', 'GlQ -30%']
cmap = param.ObjectSelector(default='Greens', objects=cmap_sel_list)
dchg = param.ObjectSelector(default='GlQ', objects=q_select_opts)
variable = param.ObjectSelector(default = 's_GlQ0_WD', objects=['s_GlQ0_WD', 's_GlQ0_SV', 's_GlQ0_BF'])
_variables = {'GlQ': ['s_GlQ0_WD', 's_GlQ0_SV', 's_GlQ0_BF'],
'GlQ +5%':['s_GlQp5_WD', 's_GlQp5_SV', 's_GlQp5_BF'],
'GlQ -10%':['s_GlQm10_WD', 's_GlQm10_SV', 's_GlQm10_BF'],
'GlQ -20%':['s_GlQm20_WD', 's_GlQm20_SV', 's_GlQm20_BF'],
'GlQ -30%':['s_GlQm30_WD', 's_GlQm30_SV', 's_GlQm30_BF']}
@param.depends('dchg', watch=True)
def _update_Variablen(self):
variables = self._variables[self.dchg]
self.param['variable'].objects = variables
self.variable = variables[0]
#the method inkluding param decorator shoud return the requested DynamincMap
@param.depends('variable', 'cmap', watch=True)
def view(self):
hover=HoverTool(tooltips=tooltips_r[self.variable])
return trimesh_dict[self.variable].opts(cmap=self.cmap, tools=[hover])
ov_nr = Overview_NR()
layout = pn.Row(ov_nr.view, ov_nr.param)
server = pn.serve(layout, start=False, show=True)