-
Notifications
You must be signed in to change notification settings - Fork 283
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
BUG: Tolerant crs comparison #2062
Conversation
if True in [dict2[key] is None, value is None]: | ||
result = dict2[key] == value | ||
elif np.isreal(dict2[key]) and np.isreal(value): | ||
result = abs(dict2[key] - value) < 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an intentionally naive/very accepting here. Feel free to share ideas of what might make floating point comparison here more suitable (i.e. numbers over what ranges and scales are deemed significant as different etc.). I suggest that any solution must address both acceptance criteria.
I have intentionally not changed those existing tests which are effected by this change. It would be good to get agreement in principle that this change seems reasonable first. I think a tolerance comparison between most objects which contain floats makes better sense to me (especially in the case here where we have derived values). What may likely be more controversial is how to decide on a 'suitable' tolerance value(s). Cheers |
Is there no interest in this change? Having better equality between iris objects is a continuing problem for us as iris generally does not perform equality involving floating point numbers in a practical way (no tolerance). |
Closing as I don't see any interest on this. |
Is it clear why this isn't a good idea and so not worthy including in iris? I can't see any comments giving us any indication why is not been picked up. |
Hi @jkettleb Thanks for the prod, I should have provided some context: I began a wider discussion around float handling in iris some time ago: I should probably stress that I my view remains that iris float handling is a serious problem (if not the most problematic we face). After all, we and our users experience many issues as a result, some mild (failures), some serious (silent continuation with incorrect results). This PR was intended to provide a local short term fix for a small subset of the problem in order to allow us to remove a monkey-patch we have for iris in our package. I don't see how we can gain traction on this PR while we can't agree that there is a serious problem to fix... :( |
Provide tolerant coordinate system comparison in iris.
Currently, coordinate system comparison in iris has the following issues associated that this PR addresses:
Solution:
I make a 'tolerant' dict comparison between the coordinate systems (also I remove the requirement for both to be defined from the same class). Tolerance value derived by the unittests written (see lib/iris/tests/unit/coord_systems/test_GeogCS.py).
Context:
In our current project, we are monkey-patching the
iris.coord_system.Coor.__eq__
method in order that all coordinate systems can be handled effectively. This PR is about removing the need for our own project hack.Closes #716
DO NOT MERGE