pacificclimate / design-value-explorer

Web application for interactively visualizing and downloading design value fields and tables.
GNU General Public License v3.0
0 stars 0 forks source link

Backend error with color scale #238

Open jameshiebert opened 5 months ago

jameshiebert commented 5 months ago

Seen in the wild:

{"asctime": "2024-02-27 18:29:55", "msecs": 325.6237506866455, "levelname": "DEBUG", "name": "dve.callbacks.map_figure", "message": "zmax = 12540"}
Exception on /design-value-explorer/_dash-update-component [POST]
Traceback (most recent call last):
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/dash/dash.py", line 1336, in dispatch
    response.set_data(func(*args, outputs_list=outputs_list))
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/dash/_callback.py", line 151, in add_context
    output_value = func(*func_args, **func_kwargs)  # %% callback invoked %%
  File "/app/dve/callbacks/map_figure.py", line 233, in update_map
    colours = colorscale_colors(color_map_name, num_actual_colors)
  File "/app/dve/colorbar.py", line 152, in colorscale_colors
    cmap = matplotlib.cm.get_cmap(colour_map_name, num_colours)
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/matplotlib/cm.py", line 286, in get_cmap
    _api.check_in_list(sorted(_cmap_registry), name=name)
  File "/app/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.8/site-packages/matplotlib/_api/__init__.py", line 129, in check_in_list
    raise ValueError(msg)
ValueError: 'None' is not a valid value for name; supported values are 'Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'seismic', 'seismic_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'turbo', 'turbo_r', 'twilight', 'twilight_r', 'twilight_shifted', 'twilight_shifted_r', 'viridis', 'viridis_r', 'winter', 'winter_r'
jameshiebert commented 5 months ago

I suspect that this has something to do with the frontend submitting a map request before it has loaded the options for the color scale.