<div dir="ltr"><div><div>Hi all,<br><br></div>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.<br>
<br>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?<br>
<br></div><div>As an example, would it be possible to supply month lengths?<br></div><div>>>> a = np.zeros(n, dtype='my_date[34,33,31,30,30,29,29,30,31,32,34,35]')<br></div><div><br></div><div>Or is the intended use of parametrisation more like:<br>
</div><div>>>> weird = my_stuff.make_dtype([34,33,31,30,30,29,29,30,31,32,34,35])<br></div><div>>>> a = np.zeros(n, dtype=weird)<br></div><div><br>[*] 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.<br>
<br></div><div>Richard<br></div></div>