Open benbovy opened 1 month ago
I also assume that it will require numpy>=2?
It might certainly be nice to at some point use a custom user-defined numpy dtype, instead of the object dtype that can hold anything.
But the current setup works quite OK I think (and you get a nice error message if some value in the object array is not a Geography), so I would also say to first focus on getting a minimal viable package with the current approach, and we can always improve this later.
I also assume that it will require numpy>=2?
Not sure about that, the commit I linked above is from 6 years ago. I also don't really know whether there would be a more elegant, numpy 2 solution nowadays.
It might certainly be nice to at some point use a custom user-defined numpy dtype, instead of the object dtype that can hold anything. But the current setup works quite OK I think
Yes definitely! Just wanted to link this here as a useful reference in case we might eventually need it. The ufunc feature is also relevant (perhaps more than user dtypes) to work around the limitations of pybind11::vectorize
.
I also assume that it will require numpy>=2?
Not sure about that, the commit I linked above is from 6 years ago. I also don't really know whether there would be a more elegant, numpy 2 solution nowadays.
Ah, I hadn't checked the date of the commit ;) Yes, nowadays numpy exposes a newer API to properly create custom dtypes (and expose those to the user in Python), so I assume the linked code might need to be updated for that.
I am also not entirely sure if the custom dtype already supports object dtype (I know when we explored an initial version of it two years ago for shapely, that wasn't yet the case)
Not sure that we need this now, but here is an implementation of Numpy user dtypes and ufuncs with pybind11.