-
Notifications
You must be signed in to change notification settings - Fork 415
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
Pint compatibility issues #38
Comments
I don't think this is good idea. Subclassing |
I thought that there were plenty of hooks too. Then I tried to use a pint Quantity with matplotlib's unit support--because matplotlib uses asarray() everywhere, the units get dropped quite readily. The balance of things might be in favor of non-subclass, but I really want to use matplotlib's unit support. Thoughts?
|
If matplotlib uses I know that matplotlib has a units API that in principle allows for custom formatting, but I haven't actually used it myself. |
Right--I'm aware of all these issues (I contributed patches to numpy to replace some It seems matplotlib's unit support works great with things that aren't arrays (or at least don't easily degrade to arrays), but broke with these things. Though, you're right, if Ryan
|
This seems like the more likely solution, unfortunately. |
Isn't the first time, won't be the last. Thanks for the useful discussion making clear that sub-classing doesn't solve the problem.
|
Just capturing here: |
Would cf_units instead of |
It existed but does not meet my requirements. I want array-like objects that I can do unit-correct math with. All I see with cf-units is the ability to take units and resolve them properly--meaning you still have to treat units out of band. What I want (and what pint, quantities, etc.) give is the ability to do just do math with arrays and have the units work themselves out automatically. |
@dopplershift I guess that is my fault for not addressing SciTools/cf-units#3. Here is a quick example on how to use http://nbviewer.ipython.org/gist/ocefpaf/b5dc173da0d445ee344e Note that all these libraries have their strengths and weakness. IMHO |
The lack of standalone is exactly why I'm not using |
Yeah. That is a bummer.
Some see that as an advantage. But your mileage may vary.
I did had issues with |
Object arrays are pretty much a deal breaker in terms of performance. This is why we need to be able to write a units dtype... |
I knew someone was going to bring the I fully agree! Until then... I am OK with object arrays and the performance hit. I rarely need to propagate units when computing things that need high performance. |
Yeah, |
Somehow we need to make the
pint.Quantity
instances be numpy subclasses. This would:In the best case, this gets contributed upstream to pint.
The text was updated successfully, but these errors were encountered: