Open Xunius opened 5 years ago
Thanks @Xunius , just as an aside, in the future, do you mind filing cdms2 bug in the cdms repo? It makes it easier for us maintainer. Please use CDAT only if you do not know for sure which cdsat component the bug is relating to. Thanks. @dnadeau4 we should create a template issue that mentions this,
@doutriaux1 Sure, that makes good sense, sorry I didnt think of that.
Coming back to the old issue.
I noticed that this is also causing trouble when reading a point value from a matplotlib plot figure. When putting the cursor at a point in a 2D imshow plot, it is calling specs2slices()
to slice the data, and fails because numpy.int64
is not counted as an integer.
The following fix seems to work:
key = speclist[i]
if isinstance(key, int): # x[i]
change to:
key = speclist[i]
if isinstance(key, numbers.Integral): # x[i]
And we import numbers
at the top of avariable.py
.
matplotlib
version: 3.3.0
cdms2
version: 3.1.5
numpy
version: 1.19.1
Hi all,
I got this error when doing something like:
Error:
where
mydata
is a TransientVariable,y
andx
happen to benumpy.int64
. I guess that's why they fail the test incdms2/avariable
'sspecs2slices()
function:So maybe something like:
For py2 there is also a
long
type.Or we just force user to cast their indices to plain int?