psyplot / psy-maps

The psyplot plugin for visualizations on a map
https://psyplot.github.io/psy-maps
8 stars 5 forks source link

Setting a `matplotlib.colors` normalization as `bounds` causes error in `mapcombined` #47

Open guidocioni opened 11 months ago

guidocioni commented 11 months ago

Code Sample

import psyplot.project as psy
from matplotlib.colors import Normalize

combined = psy.plot.mapcombined(
    'les_toscana_test_icon_oper_DOM03_ML.nc',
    time=1,
    name=[['t_2m', ['u_10m', 'v_10m']]],
    bounds=Normalize(vmin=280, vmax=310),
    cmap='gist_ncar',
    vplot='stream',
    )

Problem description

When running the code I get the following error

Plotter.__init__(self, data, ax, auto_update, project, draw, make_plot, clear, enable_post, **kwargs)
   1258 for key, value in six.iteritems(kwargs):  # then the user values
   1259     self[key] = value
-> 1260 self.initialize_plot(data, ax=ax, draw=draw, clear=clear,
...
--> 469     data = data.to_series()
    470 mask = np.asarray(data.notnull())
    471 return data.values[mask]
AttributeError: 'InteractiveList' object has no attribute 'to_series'

The same code works when using mapplot without the vectors, so there must be some problems when passing the normalization istance of matplotlib in mapcombined.

Output of psyplot -aV

psy_maps.plugin: requirements: cartopy: 0.21.1 version: 1.4.2 psy_simple.plugin: version: 1.4.1 psyplot: requirements: matplotlib: 3.7.2 numpy: 1.25.1 pandas: 2.0.3 python: 3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 18:10:28) [Clang 15.0.7 ] xarray: 2023.6.0 version: 1.4.3 psyplot_gui: requirements: pyqt: 5.15.9 qt: 5.15.8 qtconsole: 5.4.4 version: 1.4.0