Is there a way to customize the style of the layers in a livemap? I try to render the data with predefined colormap.
How can I achieve this? I tried 'ct.livemap.plot( {'data': data, 'cmap': 'magma'}, title=title, click_kwargs={'data': data})'.
I always see the same blue iso-lines ...
The complete script is
import cdstoolbox as ct VARIABLES = ['ice_days', 'wet_days'] def _get_data_at(data, location): lat = location['lat'] lon = location['lon'] data_sel = ct.geo.extract_point(data, lon=lon, lat=lat) yearly_sum = ct.cube.groupby_reduce(data_sel, group='time.year', how='sum', dim='time', squeeze=False) return yearly_sum @ct.child(position='floating') @ct.output.livefigure() def _handle_map_clicked(**kwargs): location = kwargs.get('location') data = kwargs.get('data') data_at = _get_data_at(data, location) print('data_at: ', data_at) fig = ct.chart.bar(data_at, layout_kwargs={"height": 200}) #fig.update_layout(autosize=False, width=800, height=800) return fig @ct.application(title='Plot Map') @ct.input.dropdown('variable', label='Variable', values=VARIABLES) @ct.output.livemap(height=65, click_on_map=_handle_map_clicked) def plot_map(variable): data = ct.catalogue.retrieve( 'sis-agroclimatic-indicators', { 'origin': 'ipsl_cm5a_lr_model', 'variable': variable, 'experiment': 'historical', 'temporal_aggregation': '10_day', 'period': '198101_201012', } ) title = '{}'.format(' '.join([text.capitalize() for text in variable.split('_')])) print('data', data) fig = ct.livemap.plot( {'data': data, 'cmap': 'magma'}, title=title, click_kwargs={'data': data}) return fig |