Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equality operations support (and copy?) #72

Open
pp-mo opened this issue May 13, 2024 · 0 comments
Open

Equality operations support (and copy?) #72

pp-mo opened this issue May 13, 2024 · 0 comments

Comments

@pp-mo
Copy link
Owner

pp-mo commented 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.

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).

@pp-mo pp-mo changed the title Equality operations support Equality operations support (and copy?) May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant