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

`missing` color does not support all of the new color syntaxes. #1825

Closed
chaosphere2112 opened this Issue Feb 12, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@chaosphere2112
Contributor

chaosphere2112 commented Feb 12, 2016

import vcs, cdms2
x = vcs.init()
box = x.createboxfill()
box.missing = "white"
f = cdms2.open(vcs.sample_data + "/clt.nc")
s = f('clt')
x.plot(s, box)

Leads to a traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/fries2/bin/uvcdat/cdatgui/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/Canvas.py", line 2424, in plot
    a = self.__plot(arglist, keyargs)
  File "/Users/fries2/bin/uvcdat/cdatgui/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/Canvas.py", line 3757, in __plot
    returned_kargs = self.backend.plot(*arglist, **keyargs)
  File "/Users/fries2/bin/uvcdat/cdatgui/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/VTKPlots.py", line 534, in plot
    vtk_backend_grid, vtk_backend_geo))
  File "/Users/fries2/bin/uvcdat/cdatgui/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/vcsvtk/pipeline2d.py", line 290, in plot
    self._createMaskedDataMapper()
  File "/Users/fries2/bin/uvcdat/cdatgui/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/vcsvtk/pipeline2d.py", line 332, in _createMaskedDataMapper
    color = _colorMap.index[color]
  File "/Users/fries2/bin/uvcdat/cdatgui/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/colormap.py", line 175, in __getitem__
    raise ValueError('Cell index must be in the range 0 to 255.')
ValueError: Cell index must be in the range 0 to 255.

This is because the code for retrieving the missing color does not properly account for all of our new methods for specifying colors.

I'm going to do a quick fix for this one, because I need some better logic for handling colors in the new GUI as well. I'll write up a quick function in vcs.utils that will take a color value and a colormap and spit back out the RGB values.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Feb 16, 2016

@chaosphere2112 while you are at it, could you please add the transparent color. I think it would be a useful one to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment