Skip to content

Conversation

@davidhassell
Copy link
Collaborator

Fixes #452

@davidhassell davidhassell added this to the Next release milestone Jun 23, 2023
Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, in general. Implements the requested feature in an elegant way. The testing and documentation for the new functionality is really thorough which is great.

I've raised a selection of minor comments and a question or two as well. But once you've considered those, feel free to merge. As a few general points to add to the minor comments in-line, I've noticed in the CI jobs that:

  • some _isclose tests are failing on both Ubuntu jobs which finished here, which could imply that the logic isn't consistent across environments:
======================================================================
FAIL: test_Query_isclose (test_Query.QueryTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cf-python/cf-python/main/cf/test/test_Query.py", line 690, in test_Query_isclose
    self.assertNotEqual(9.000001, q)
AssertionError: 9.000001 == <CF Query: (isclose 9)>

======================================================================
FAIL: test_Data_isclose (test_Data.DataTest)
Test the `isclose` Data method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cf-python/cf-python/main/cf/test/test_Data.py", line 4096, in test_Data_isclose
    self.assertFalse(d.isclose(1.1))
AssertionError: <CF Data(): True> is not false

so is probably something that should be looked into. Locally those both always passed for me when I ran the corresponding modules, FYI.

  • the linting job is failing so some formatting fixes should ideally be made pre-merge.

davidhassell and others added 11 commits June 28, 2023 12:36
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
@davidhassell
Copy link
Collaborator Author

some _isclose tests are failing on both Ubuntu jobs which finished here, which could imply that the logic isn't consistent across environments AssertionError: 9.000001 == <CF Query: (isclose 9)>

I vaguely recall that something similar happened in some other tests, and was due to differently represented rounding errors. I suspect that if I change the test to have fewer significant decimal places all will be well.

@davidhassell
Copy link
Collaborator Author

I suspect that if I change the test to have fewer significant decimal places all will be well.

Oh, hang on, I see that the Data test is also failing, whilst seeing if 1 is close to 1.1, with the default (i.e. tiny) rtol and atol. That's too weird - is it OK not to worry about this ? :)

@sadielbartholomew
Copy link
Member

Oh, hang on, I see that the Data test is also failing, whilst seeing if 1 is close to 1.1, with the default (i.e. tiny) rtol and atol. That's too weird - is it OK not to worry about this ? :)

Probably not, haha 🤔 But since you are off on leave and it would be good to get this merged, perhaps we can put down investigating it as a separate, follow-on issue? Then I can look into it whilst you are away. How does that sound?

@davidhassell
Copy link
Collaborator Author

Then I can look into it whilst you are away. How does that sound?

Sounds great :)

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback all addressed well, thanks. I've done a final sanity check on the state of the branch now and all is good. There are a few 'optional' tags to remove in line with the new tweak made to __query_isclose__, as raised in-line, but other than that, we are good to merge.

davidhassell and others added 4 commits June 29, 2023 17:07
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
Co-authored-by: Sadie L. Bartholomew <sadie.bartholomew@ncas.ac.uk>
@davidhassell
Copy link
Collaborator Author

Thanks, for the review, Sadie - merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aggregation Rerlating to metadata-based field and domain aggregation enhancement New feature or request

Projects

None yet

2 participants