DataArray apply and Numpy array container
New method apply similar to methods in pandas and xarray for applying a mathematical function to all values in DataArray.
>>> da.apply(np.sin)
>>> da.apply(np.clip, 0.0, 1.0)
>>> da.apply(lambda x: x**2 if x > 0 else 0)
Would be even nicer if we could support this syntax;
da2 = np.sqrt(da)
I can't really figure out how this works, but somehow it calls the __array_ufunc__ function.
https://github.com/pydata/xarray/blob/3d3b236df3f8f5982760e68e064eb0db2aacc4a2/xarray/core/arithmetic.py#L43
Would be even nicer if we could support this syntax;
da2 = np.sqrt(da)I can't really figure out how this works, but somehow it calls the
__array_ufunc__function. https://github.com/pydata/xarray/blob/3d3b236df3f8f5982760e68e064eb0db2aacc4a2/xarray/core/arithmetic.py#L43
Great idea! A hacky first attempt is now checked in.
Note also this medium write up about someone attempting something similar: https://towardsdatascience.com/wrapping-numpys-arrays-971e015e14bb

This seem like the proper reference https://numpy.org/devdocs/user/basics.dispatch.html#writing-custom-array-containers
This PR will have to wait some weeks until we have time to do a proper implementation of Numpy array container such that a mikeio.DataArray can be considered truly array-like