You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently making progress with fully-feature dataset comparison, which should complete soon #27 , #70
But it is natural in code to expect equality comparison of the core objects.
In course of proposing a dim-slicing, found I wanted comparison for testing it, and copying for the operation itself. See #70
We avoided doing this because an uncritical one-purpose equality may not be very useful -- at least, on dataset and variables .
At the same time, it's confusing + unexpected that even NcDimension and NcAttribute don't behave as expected with ==.
The NcDimension and NcAttribute comparison, at least, can be quite simple + what you would expect.
Maybe the NcData / NcVariable comparison can work via compare_datasets function (probably to be renamed "dataset-difference").
Scope of all the settings (data-compare, dims-order etc) could be provided via a context control, e.g.
with ncdata.COMPARE_CONTROL.context(check_dims_order=False, check_var_data=False):
result = var1 == var2
But obviously, this will take a bit of explaining, and might be better left as a difference function.
( Also, what should the defaults be, and do we allow direct one-time setting, e.g. COMPARE_CONTROL.check_dims_order = False
)
In any case, the best default behaviour for variable equality is not too clear. Hard to choose anything but "total equality", and user beware. But then we should also do a non-realising equality test (which we currently don't).
Also for this, we should expose variable-comparison as a separate function, which it currently is not (but again quite simple).
The text was updated successfully, but these errors were encountered:
pp-mo
changed the title
Equality operations support
Equality operations support (and copy?)
May 13, 2024
Currently making progress with fully-feature dataset comparison, which should complete soon #27 , #70
But it is natural in code to expect equality comparison of the core objects.
In course of proposing a dim-slicing, found I wanted comparison for testing it, and copying for the operation itself. See #70
We avoided doing this because an uncritical one-purpose equality may not be very useful -- at least, on dataset and variables .
At the same time, it's confusing + unexpected that even NcDimension and NcAttribute don't behave as expected with ==.
The NcDimension and NcAttribute comparison, at least, can be quite simple + what you would expect.
Maybe the NcData / NcVariable comparison can work via compare_datasets function (probably to be renamed "dataset-difference").
Scope of all the settings (data-compare, dims-order etc) could be provided via a context control, e.g.
But obviously, this will take a bit of explaining, and might be better left as a difference function.
( Also, what should the defaults be, and do we allow direct one-time setting, e.g.
COMPARE_CONTROL.check_dims_order = False
)
In any case, the best default behaviour for variable equality is not too clear. Hard to choose anything but "total equality", and user beware. But then we should also do a non-realising equality test (which we currently don't).
Also for this, we should expose variable-comparison as a separate function, which it currently is not (but again quite simple).
The text was updated successfully, but these errors were encountered: