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

Unit.convert vs np.int32 #470

Closed
bblay opened this issue Apr 23, 2013 · 1 comment · Fixed by #472
Closed

Unit.convert vs np.int32 #470

bblay opened this issue Apr 23, 2013 · 1 comment · Fixed by #472

Comments

@bblay
Copy link
Contributor

bblay commented Apr 23, 2013

iris.unit.Unit.convert breaks with scalar np.int32.

>>> import iris.unit 
>>> u = iris.unit.Unit("hPa")
>>> u.convert(200, "Pa")
20000.0
>>> u.convert(np.float(200), "Pa")
20000.0
>>> u.convert(np.int64(200), "Pa")
20000.0
>>> u.convert(np.array([200,200], dtype=np.int32), "Pa")
array([ 20000.,  20000.])
>>> u.convert(np.int32(200), "Pa")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/h05/itbb/.local/lib/python2.7/site-packages/iris/unit.py", line 1779, in convert
    pointer = value_copy.ctypes.data_as(
AttributeError: 'numpy.float64' object has no attribute 'ctypes'
@esc24
Copy link
Member

esc24 commented Apr 25, 2013

Fixed by #472.

@esc24 esc24 closed this as completed Apr 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants