[Numpy-discussion] Parameterised dtypes
andrew.collette at gmail.com
Tue May 28 14:47:15 EDT 2013
> I'm in the process of defining some new dtypes to handle non-physical
> calendars (such as the 360-day calendar used in the climate modelling
> world). This is all going fine[*] so far, but I'd like to know a little bit
> more about how much is ultimately possible.
> The PyArray_Descr members `metadata` and `c_metadata` allow run-time
> parametrisation, but is it possible to hook into the dtype('...') parsing
> mechanism to supply those parameters? Or is there some other dtype mechanism
> for supplying parameters?
I would also love to know the answer to this question. Right now h5py
is using field titles to hold metadata, because it's the most
straightforward way I could find (with my limited NumPy-internals
experience) to attach metadata that's preserved when dtypes are
passed around, copied, etc. It works but is awkward. If there's a
non-C way to deal with this that would be great.
> [*] The docs could do with updating, and the examples would benefit from
> standardising (or at least explaining the significance of the differences).
> I intend to post updates where possible.
Maybe a stupid question, but do you know a reference I could look at
for the metadata and c_metadata fields you described?
More information about the NumPy-Discussion