{"action":"opened","issue":{"url":"https://api.github.com/repos/enthought/scimath/issues/49","repository_url":"https://api.github.com/repos/enthought/scimath","labels_url":"https://api.github.com/repos/enthought/scimath/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/enthought/scimath/issues/49/comments","events_url":"https://api.github.com/repos/enthought/scimath/issues/49/events","html_url":"https://github.com/enthought/scimath/issues/49","id":183761959,"number":49,"title":"Bug/feature request: convert/convert_unitted","user":{"login":"jonathanrocher","id":593945,"avatar_url":"https://avatars.githubusercontent.com/u/593945?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanrocher","html_url":"https://github.com/jonathanrocher","followers_url":"https://api.github.com/users/jonathanrocher/followers","following_url":"https://api.github.com/users/jonathanrocher/following{/other_user}","gists_url":"https://api.github.com/users/jonathanrocher/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanrocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanrocher/subscriptions","organizations_url":"https://api.github.com/users/jonathanrocher/orgs","repos_url":"https://api.github.com/users/jonathanrocher/repos","events_url":"https://api.github.com/users/jonathanrocher/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanrocher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-18T18:10:07Z","updated_at":"2016-10-18T18:10:07Z","closed_at":null,"body":"[I feel like I have had this conversation before, but can't find trace of it anymore. Hope it is not a duplicate]\r\n\r\nI keep forgetting that the `convert` function only works for float, not `UnitScalar`s. As a result, and because `UnitScalar` is a subclass of `np.ndarray`, the following happens:\r\n```\r\nIn [3]: from scimath.units.api import convert, UnitScalar\r\n\r\nIn [4]: x = UnitScalar(1., units=\"cm\")\r\n\r\nIn [5]: from scimath.units.length import meter\r\n\r\nIn [6]: convert(x, from_unit=x.units, to_unit=meter)\r\nOut[6]: UnitScalar(0.01, units='0.01*m')\r\n```\r\nwhich feels very buggy. I believe that we should:\r\n1. either raise an exception when a `UnitScalar` is passed, and create a new `convert_unitted` function that accepts `UnitScalar`s/`UnitArray`s\r\n2. or support the `UnitScalar`s correctly.\r\n\r\nI think I like option 2 better, but it makes things not backward compatible, so is probably a no go.\r\n\r\nOpinions? @timdiller @rkern ?"}}
{"actor":{"display_login":"jonathanrocher"}}