Hey All,
Somewhere along the (recent?) updates to plot.py the point label
functionality has been broken, so that it doesn't display.
I'm just about to have a look into it and fix it, but don't want to
waste the effort if someone has already done it?
Regards
Darryl
From Robin's note, it looks like this may be fixed, but just in case:
Darryl Ross wrote:
RuntimeError: An array doesn't make sense as a truth value. Use any(a) or all(a).
Doing a dump of the values:
Last: {'pIndex': 0, 'curveNum': 0, 'pointXY': array([ 0., 0.]), 'legend': 'Cross Hatch Square', 'scaledXY': array([ 30.88, 169. ])}
New: {'pIndex': 16, 'curveNum': 2, 'pointXY': array([ 2.0106193 , -0.42577929]), 'legend': 'Red Line', 'scaledXY': array([ 187.49000946, 225.69464157])}
Casting both values in the test to a tuple solves the (immediate) problem:
if tuple(mDataDict["pointXY"]) != tuple(self.last_PointLabel["pointXY"]):
As long as you are using a numpy array, the idiomatic way to write this is:
if any(mDataDict["pointXY"] != self.last_PointLabel["pointXY"]):
any() is in the numpy namespace, so you may need numpy.any(), depending on how numpy was imported.
Another option is:
(mDataDict["pointXY"] != self.last_PointLabel["pointXY"]).any()
If you need to support the older versions (Numeric and/or numarray), you may need:
if sometrue( mDataDict["pointXY"] != self.last_PointLabel["pointXY"]):
which will work for tuples as well.
-Chris
ยทยทยท
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov