G-Node / G-Node/python-odml

Create to_quantity() method for numerical properties

Open
#362 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
25
Forks
30
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.