I have (abridged):
PoyFluxFromEq = rank-2 dataset with units.
NetPoyFluxFromEq = fltarr(PoyFluxFromEq.length())
for I in range(PoyFluxFromEq.length()):
NetPoyFluxFromEq[I]= total(PoyFluxFromEq[I, some_rank-1_index])
or
NetPoyFluxFromEq[I]= reduceSum(PoyFluxFromEq[I, some_rank-1_index], 0)
The version using reduceSum() transfers the units of PoyFluxFromEq to NetPoyFluxFromEq. The version using total() does not.
My understanding was that total() and reduceSum() should behave identically now.
Small problem, it turns out, and that's that the total function returns a double, not a rank0 dataset with a unit. There's a "total" function which takes a second argument, the index to total over, which also handles the units and is probably the source of the confusion.
This script demos:
So we could make the total function return a rank 0 dataset instead of a double, but I'd want to do that over a major release (v2019b or v2020a)...
For v2019a_5, I should sweep through all the filters and see what still uses double. Once rank 0 datasets were introduced, this sort of code should have been removed, but I suspect it wasn't, and this is the last remaining one.