Skip to content

plot_as_array() glitch #237

@Didou09

Description

@Didou09
In [22]: dax = coll.plot_as_array('cprof_1djtot')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[22], line 1
----> 1 dax = coll.plot_as_array('cprof_1djtot')

File ~/projects/datastock/datastock/_class3.py:59, in DataStock3.plot_as_array(self, key, keyX, keyY, keyZ, keyU, ind, dvminmax, dscale, cmap, aspect, nmax, uniform, color_dict, dinc, lkeys, bstr_dict, rotation, inverty, bck, interp, show_commands, dax, dmargin, fs, wintit, tit, dcolorbar, dleg, label, connect, inplace)
     18 def plot_as_array(
     19     self,
     20     # parameters
   (...)     52     inplace=None,
     53 ):
     54     """ Plot the desired 1d, 2, 3, or 4d data array as a matrix
     55 
     56     other axes can be plotted using monotonous (optionally uniform) arrays
     57 
     58     """
---> 59     return _plot_as_array.plot_as_array(
     60         # parameters
     61         coll=self,
     62         key=key,
     63         keyX=keyX,
     64         keyY=keyY,
     65         keyZ=keyZ,
     66         keyU=keyU,
     67         ind=ind,
     68         dvminmax=dvminmax,
     69         dscale=dscale,
     70         cmap=cmap,
     71         aspect=aspect,
     72         nmax=nmax,
     73         uniform=uniform,
     74         color_dict=color_dict,
     75         dinc=dinc,
     76         lkeys=lkeys,
     77         bstr_dict=bstr_dict,
     78         rotation=rotation,
     79         inverty=inverty,
     80         bck=bck,
     81         interp=interp,
     82         show_commands=show_commands,
     83         # figure-specific
     84         dax=dax,
     85         dmargin=dmargin,
     86         fs=fs,
     87         wintit=wintit,
     88         tit=tit,
     89         dcolorbar=dcolorbar,
     90         dleg=dleg,
     91         label=label,
     92         connect=connect,
     93         inplace=inplace,
     94     )

File ~/projects/datastock/datastock/_plot_as_array.py:103, in plot_as_array(coll, key, keyX, keyY, keyZ, keyU, ind, dvminmax, dscale, cmap, aspect, nmax, uniform, color_dict, dinc, lkeys, bstr_dict, rotation, inverty, bck, interp, show_commands, dax, dmargin, fs, wintit, tit, dcolorbar, dleg, label, connect, inplace, **kwdargs)
     94 coll2, key = coll.extract(
     95     [key] + lk,
     96     inc_monot=False,
   (...)    100     inplace=inplace,
    101 )
    102 key = [kk for kk in key if kk not in lk][0]
--> 103 ndim = coll2.ddata[key]['data'].ndim
    105 # --------------
    106 # check input
    107 # --------------
    109 (
    110     key, lab,
    111     dkeys,
   (...)    121     dcolorbar, dleg, label, connect,
    122 ) = _check(**locals())

KeyError: 'cprof_m1d_bs1_nbs'

In [23]: dax = coll.plot_as_array('cprof_1dvdvt')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[23], line 1
----> 1 dax = coll.plot_as_array('cprof_1dvdvt')

File ~/projects/datastock/datastock/_class3.py:59, in DataStock3.plot_as_array(self, key, keyX, keyY, keyZ, keyU, ind, dvminmax, dscale, cmap, aspect, nmax, uniform, color_dict, dinc, lkeys, bstr_dict, rotation, inverty, bck, interp, show_commands, dax, dmargin, fs, wintit, tit, dcolorbar, dleg, label, connect, inplace)
     18 def plot_as_array(
     19     self,
     20     # parameters
   (...)     52     inplace=None,
     53 ):
     54     """ Plot the desired 1d, 2, 3, or 4d data array as a matrix
     55 
     56     other axes can be plotted using monotonous (optionally uniform) arrays
     57 
     58     """
---> 59     return _plot_as_array.plot_as_array(
     60         # parameters
     61         coll=self,
     62         key=key,
     63         keyX=keyX,
     64         keyY=keyY,
     65         keyZ=keyZ,
     66         keyU=keyU,
     67         ind=ind,
     68         dvminmax=dvminmax,
     69         dscale=dscale,
     70         cmap=cmap,
     71         aspect=aspect,
     72         nmax=nmax,
     73         uniform=uniform,
     74         color_dict=color_dict,
     75         dinc=dinc,
     76         lkeys=lkeys,
     77         bstr_dict=bstr_dict,
     78         rotation=rotation,
     79         inverty=inverty,
     80         bck=bck,
     81         interp=interp,
     82         show_commands=show_commands,
     83         # figure-specific
     84         dax=dax,
     85         dmargin=dmargin,
     86         fs=fs,
     87         wintit=wintit,
     88         tit=tit,
     89         dcolorbar=dcolorbar,
     90         dleg=dleg,
     91         label=label,
     92         connect=connect,
     93         inplace=inplace,
     94     )

File ~/projects/datastock/datastock/_plot_as_array.py:103, in plot_as_array(coll, key, keyX, keyY, keyZ, keyU, ind, dvminmax, dscale, cmap, aspect, nmax, uniform, color_dict, dinc, lkeys, bstr_dict, rotation, inverty, bck, interp, show_commands, dax, dmargin, fs, wintit, tit, dcolorbar, dleg, label, connect, inplace, **kwdargs)
     94 coll2, key = coll.extract(
     95     [key] + lk,
     96     inc_monot=False,
   (...)    100     inplace=inplace,
    101 )
    102 key = [kk for kk in key if kk not in lk][0]
--> 103 ndim = coll2.ddata[key]['data'].ndim
    105 # --------------
    106 # check input
    107 # --------------
    109 (
    110     key, lab,
    111     dkeys,
   (...)    121     dcolorbar, dleg, label, connect,
    122 ) = _check(**locals())

KeyError: 'cprof_m1d_bs1_nbs'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions