holoviz-topics / EarthSim

Tools for working with and visualizing environmental simulations.
https://earthsim.holoviz.org
BSD 3-Clause "New" or "Revised" License
65 stars 21 forks source link

PolyAndPointAnnotator error on path_type spec #192

Closed kcpevey closed 3 years ago

kcpevey commented 6 years ago

From the Annotator notebook, cell 11, I've just added path_type=gv.Path:

annot = PolyAndPointAnnotator(path_type=gv.Path,
    poly_columns =['Group'], polys=[sample_poly], vertex_columns=['Weight'], 
    point_columns=['Size'],  points=sample_points
)

This gives:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-6ece8e98bcda> in <module>()
      2 annot = PolyAndPointAnnotator(path_type=gv.Path,
      3     poly_columns =['Group'], polys=[sample_poly], vertex_columns=['Weight'],
----> 4     point_columns=['Size'],  points=sample_points
      5 )
      6 annot.pprint()

c:\projects\ers\github\earthsim\master\earthsim\earthsim\annotators.py in __init__(self, poly_data, **params)
    198             if col not in self.polys:
    199                 self.polys = self.polys.add_dimension(col, 0, '', True)
--> 200                 self.polys.vdims = [vd for vd in self.polys.vdims if vd != col]
    201         self.poly_stream.source = self.polys
    202         if len(self.polys):

C:\ProgramData\Anaconda3\envs\earthsimAUG\lib\site-packages\param\__init__.py in __set__(self, obj, val)
   1155         """Set to the given value, raising an exception if out of bounds."""
   1156         self._check_bounds(val)
-> 1157         super(List,self).__set__(obj,val)

C:\ProgramData\Anaconda3\envs\earthsimAUG\lib\site-packages\param\parameterized.py in __set__(self, obj, val)
    483                 obj.__dict__[self._internal_name] = val
    484             else:
--> 485                 raise TypeError("Constant parameter '%s' cannot be modified"%self._attrib_name)

TypeError: Constant parameter 'vdims' cannot be modified
kcpevey commented 6 years ago

I'm running gv and hv master

kcpevey commented 6 years ago

@jbednar @philippjfr This appears to break all usage of Path with drawing tools.

philippjfr commented 6 years ago

Strange, wonder why I didn't encounter this. I'll get a PR up to fix this asap.

kcpevey commented 6 years ago

wonder why I didn't encounter this

I dont think there is an example of using gv.Path with the annotators in the example docs. There probably should be though...

philippjfr commented 6 years ago

Ah, right, thanks! That's an inconsistency in holoviews then, really vdims should always be declared constant.

kcpevey commented 5 years ago

This is fixed on the earthsim side. @philippjfr we can close unless you wanted to leave it open for some hv work?

kcpevey commented 3 years ago

There are examples in holoviews for using these tools