My understanding of this is that the dtype will only hold the unit metadata. So that means units would propogate through calculations automatically, but the dtype wouldn't be able to manipulate the array data (in an in-place unit conversion for example).
In this world, astropy quantities and yt's YTArray would become containers around an ndarray that would make use of the dtype metadata but also implement all of the unit semantics that they already implement. Since they would become container classes and would no longer be ndarray subclasses, that avoids most of the pitfalls one encounters these days. Please correct me if I'm wrong, Nathaniel. -Nathan On Thu, Oct 26, 2017 at 5:14 PM, Marten van Kerkwijk < m.h.vankerkw...@gmail.com> wrote: > Hi Nathaniel, > > Thanks for the link. The plans sounds great! You'll not be surprised > to hear I'm particularly interested in the units aspect (and, no, I > don't mind at all if we can stop subclassing ndarray...). Is the idea > that there will be a general way for allow a dtype to define how to > convert an array to one with another dtype? (Just as one now > implicitly is able to convert between, say, int and float.) And, if > so, is the idea that one of those conversion possibilities might > involve checking units? Or were you thinking of implementing units > more directly? The former would seem most sensible, if only so you can > initially focus on other things than deciding how to support, say, esu > vs emu units, or whether or not to treat radians as equal to > dimensionless (which they formally are, but it is not always handy to > do so). > > Anyway, do keep us posted! All the best, > > Marten > > On Thu, Oct 26, 2017 at 3:40 PM, Nathaniel Smith <n...@pobox.com> wrote: > > On Wed, Oct 18, 2017 at 10:24 PM, Nathaniel Smith <n...@pobox.com> wrote: > >> I'll also be giving a lunch talk at BIDS tomorrow to let folks locally > >> know about what's going on, which I think will be recorded – I'll send > >> around a link after in case others are interested. > > > > Here's that link: https://www.youtube.com/watch?v=fowHwlpGb34 > > > > -n > > > > -- > > Nathaniel J. Smith -- https://vorpus.org > > _______________________________________________ > > NumPy-Discussion mailing list > > NumPy-Discussion@python.org > > https://mail.python.org/mailman/listinfo/numpy-discussion > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion