The _divide function in imap_processing/lo/l2/lo_l2.py is operating on numpy array, forcing the caller to switch to numpy and back to xarray. All this can likely just get done in xarray itself.
Note from Tim on this:
Just in general, as I got more experience with xarray, I found that doing the math directly in xarray objects ends up cleaner and avoids lots of code for extracting the numpy array and then putting that array into an xarray.DataArray. Not saying this needs to change, but it does look like xarray wraps the numpy.divide function: https://docs.xarray.dev/en/latest/generated/xarray.ufuncs.divide.html
The
_dividefunction inimap_processing/lo/l2/lo_l2.pyis operating on numpy array, forcing the caller to switch to numpy and back to xarray. All this can likely just get done in xarray itself.Note from Tim on this: