DimensionalData.jl
DimensionalData.jl copied to clipboard
implement `isequal` and clarify `==` for DimArrays with missing values
As of now:
using DimensionalData
da = DimArray([1, missing], X(1:2))
da2 = DimArray([1, missing], Y(1:2))
da == da2 # errors!
isequal(da, da2) # true
The error is because == is defined as parent(A1) == parent(A2) && dims(A1) == dims(A2) - if the first returns missing than this errors, so we should just swap the order here.
The point of isequal is that it handles missing values well - which is really neat because Rasters tend to have lots of missing values. Here it returns true because it uses the fallback definition and so never checks the dimensions.
If we implement these properly then probably we don't need additional definitions in e.g. Rasters.jl
Yeah, definately shouldn't error. But if base gives missing then we should return missing too. So check if == returns missing, if not do the dims comparison?
And yes we just forgot isequal
If we swap, we will return missing. This should also be faster for the same data and different dims case.