Operating on the two inner-most dimensions in an xarray as a matrix

I have a multi-dimensional DataArray in xarray where the two inner-most dimensions have equal length. I want to apply np.linalg.det() on the the square matrices formed by the two dimensions. How do I do that?

I have looked into the documentation and spent some time getting apply_ufunc() to work, but I don’t think thats the way to go.

Leave a Comment