Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: IndexVariable objects must be 1-dimensional #27

Open
guin0x opened this issue Jul 3, 2022 · 0 comments
Open

ValueError: IndexVariable objects must be 1-dimensional #27

guin0x opened this issue Jul 3, 2022 · 0 comments

Comments

@guin0x
Copy link

guin0x commented Jul 3, 2022

Hi, I'm trying to use this library to plot a 2d spectra of some buoy data.
Following this I face the following error on ow_spc.plot(col='location):

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/guin0x/Harmony_GITHUB/scripts/main_script_gui_with_buoypy.ipynb Cell 15' in <cell line: 6>()
      [3](vscode-notebook-cell:/home/guin0x/Harmony_GITHUB/scripts/main_script_gui_with_buoypy.ipynb#ch0000016?line=2) print('freqs = ',freqs)
      [4](vscode-notebook-cell:/home/guin0x/Harmony_GITHUB/scripts/main_script_gui_with_buoypy.ipynb#ch0000016?line=3) print(list(freqs))
----> [6](vscode-notebook-cell:/home/guin0x/Harmony_GITHUB/scripts/main_script_gui_with_buoypy.ipynb#ch0000016?line=5) ow_spc.plot(col='location')
      [8](vscode-notebook-cell:/home/guin0x/Harmony_GITHUB/scripts/main_script_gui_with_buoypy.ipynb#ch0000016?line=7) theta = np.arange(0., 360., 5.)
      [9](vscode-notebook-cell:/home/guin0x/Harmony_GITHUB/scripts/main_script_gui_with_buoypy.ipynb#ch0000016?line=8) ow_dir = ow_spc.as_directional(theta,s=5)

File ~/env/Harmony/lib/python3.10/site-packages/oceanwaves/plot.py:189, in OceanWavesPlotMethods.__call__(self, **kwargs)
    184         if not 'subplot_kws' in kwargs.keys():
    185             kwargs.update(dict(subplot_kws = dict(projection = 'polar'),
    186                                sharex = False,
    187                                sharey = False))
--> 189 r = super(OceanWavesPlotMethods, self).__call__(**kwargs)
    191 self.find_axes(r)
    192 self.rotate_axes()

File ~/env/Harmony/lib/python3.10/site-packages/xarray/plot/plot.py:866, in _PlotMethods.__call__(self, **kwargs)
    865 def __call__(self, **kwargs):
--> 866     return plot(self._da, **kwargs)

File ~/env/Harmony/lib/python3.10/site-packages/xarray/plot/plot.py:332, in plot(darray, row, col, col_wrap, ax, hue, rtol, subplot_kws, **kwargs)
    328     plotfunc = hist
    330 kwargs["ax"] = ax
...
-> 2668     raise ValueError(f"{type(self).__name__} objects must be 1-dimensional")
   2670 # Unlike in Variable, always eagerly load values into memory
   2671 if not isinstance(self._data, PandasIndexingAdapter):

ValueError: IndexVariable objects must be 1-dimensional

Any idea what I'm doing wronge? Should I post this somewhere else?
Thanks!

@guin0x guin0x changed the title AttributeError: module 'snappy' has no attribute 'compress' ValueError: IndexVariable objects must be 1-dimensional Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant