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

Create to_quantity() method for numerical properties #362

Open
morales-gregorio opened this issue Mar 4, 2020 · 0 comments
Open

Create to_quantity() method for numerical properties #362

morales-gregorio opened this issue Mar 4, 2020 · 0 comments

Comments

@morales-gregorio
Copy link

Hi!

I have encountered myself doing the following many, many times:

import quantities as pq
myQuantity = pq.Quantity(myOdml.properties['myProp'].value,
                         myOdml.properties['myProp'].unit)

So I wondered this is probably something people would expect odml to do for them. My suggestion would be a method of the property class that apart from doing the above also checks some stuff like:

  • If quantities is installed
  • If units are specified
  • If the units are compatible with quantities units
  • If the value is actually numerical
  • ...

And returns appropriate warnings/errors when the requirements are not met.

Let me know your thoughts!
Aitor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant