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

BUG: Iris AreaWeighted regrid float tolerance bug #2201

Closed
wants to merge 3 commits into from

Conversation

cpelley
Copy link

@cpelley cpelley commented Oct 19, 2016

Floating point equality without tolerance within iris.experimental.regrid._within_bounds produces masked results under circumstances where different longitude ranges are wrapped by wrap_lons here when we expect them to be equal (i.e. there is a loss of precision).

Here is a break point at within_bounds for the case where the source longitude extent is [-91, 0] and the target longitude extent is [270, 360]:

(Pdb) src_bounds
array([[-1.58824962,  0.        ]])
(Pdb) tgt_bounds
array([[ -1.57079633e+00,   6.66133815e-16]]

You will note the 6.66133815e-16 value which makes the equality checks fail, since 0 != 6.66133815e-16.

See the added unittest for the full working example.

@cpelley cpelley changed the title BUG: Iris AreaWeighted regrid bug BUG: Iris AreaWeighted regrid float tolerance bug Oct 19, 2016
@cpelley
Copy link
Author

cpelley commented Oct 19, 2016

I have started an iris dev discussion on the wider issue of dealing with floats in iris here.

@cpelley
Copy link
Author

cpelley commented Oct 19, 2016

Two exceptions raised.

One under python3.4 test target: default:

======================================================================
ERROR: test_simple (iris.tests.test_mapping.TestUnmappable)
----------------------------------------------------------------------
Traceback (most recent call last):
...
ValueError: Image comparison failed. Message: Actual SHA1 020e0ca45a9fbd5caef915e59c02276725919889 not in expected ['6c139dab88d9e5884d313f1a607de5e9c4fe5a93', 'a14231d0f6fe19de89dfd200d25f1d7dbc31b2ff'] for test iris.tests.test_mapping.TestUnmappable.test_simple.0.

The second under python3.4 test target: example:

======================================================================
ERROR: test_atlantic_profiles (example_tests.test_atlantic_profiles.TestAtlanticProfiles)
----------------------------------------------------------------------
Traceback (most recent call last):
...
ValueError: Image comparison failed. Message: Actual SHA1 f25dc9acc16a887eb224b4970d3042f5bcfd9743 not in expected ['0bde47fbbc4a15498c0ecb8bd3eb5e63339e5121', 'b8365851d0b4b5589289026eda692c643499c7f3', 'c3a2ccc6873ddee7ea0dafd25498b743ffece4fa', '4cbda27eb65fc360d08dde0ccf40b951fdfe4453', '3a2f43bc6b1bd4397a8eb6877a128ab7a4f051ff', 'da5cd8269bcc96533c8c2f4a788e2c980381dfef'] for test example_tests.test_atlantic_profiles.TestAtlanticProfiles.test_atlantic_profiles.0.

Anyone might know what this might specifically effect only python3.4?
Cheers

@marqh
Copy link
Member

marqh commented Nov 2, 2016

Anyone might know what this might specifically effect only python3.4?

@cpelley unfortunately, lots of things

we have moved swiftly onto perceptual hashing, to let us handle issues such as this

please rebase and see how this affects your change, it should help with image comparison issues

@cpelley cpelley changed the base branch from master to v1.11.x November 7, 2016 14:25
@cpelley cpelley changed the base branch from v1.11.x to master November 7, 2016 14:25
@cpelley
Copy link
Author

cpelley commented Nov 7, 2016

Thanks @marqh. All tests pass. I have made an alternate PR (#2237) which points to the new v1.11.x branch now that it exists.
We would have a preference to this making it to v1.11.x so that we don't have to make our users dependent on iris master.

Cheers

@cpelley
Copy link
Author

cpelley commented Nov 10, 2016

Closing this as it is replaced by #2237 which points to v1.11.x

@cpelley cpelley closed this Nov 10, 2016
@cpelley cpelley deleted the IRIS_REGRID_BUG branch November 11, 2016 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants