Skip to content
New issue

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

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

Already on GitHub? # to your account

Test aggregated cellbox #70

Merged
merged 8 commits into from
Jun 3, 2024
Merged

Test aggregated cellbox #70

merged 8 commits into from
Jun 3, 2024

Conversation

hjabbot
Copy link
Collaborator

@hjabbot hjabbot commented May 23, 2024

MeshiPhi Pull Request Template

Date: 2024-05-23
Version Number: 2.1.7

Description of change

Added test suite for aggregated_cellbox.py.
The following bugs were found that should be addressed in future PR's once the complete test suite is done.

- aggregated_cellbox.py: load_from_json() includes 'id' as part of agg_data
- aggregated_cellbox.py: inconsistent naming between set_boundary and get_bounds methods
- aggregated_cellbox.py: contains_point() does not account for antimeridian
EDIT: Addressed these bugs in this PR

Fixes #48

Testing

To ensure that the functionality of the MeshiPhi codebase remains consistent throughout the development cycle a testing strategy has been developed, which can be viewed in the document test/testing_strategy.md.
This includes a collection of test files which should be run according to which part of the codebase has been altered in a pull request. Please consult the testing strategy to determine which tests need to be run.

  • My changes have not altered any of the files listed in the testing strategy

  • My changes result in all required regression tests passing without the need to update test files.
    passing_tests

  • My changes require one or more test files to be updated for all regression tests to pass.

Checklist

  • My code follows pep8 style guidelines.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation of the codebase where required.
  • My changes generate no new warnings.
  • My PR has been made to the 2.1.x branch (DO NOT SUBMIT A PR TO MAIN)

@hjabbot hjabbot requested a review from SamuelHall700 May 23, 2024 10:18
@hjabbot hjabbot self-assigned this May 23, 2024
self.assertTrue(self.arbitrary_agg_cb.contains_point(50, 50))
self.assertTrue(self.equatorial_agg_cb.contains_point(0, 50))
self.assertTrue(self.meridian_agg_cb.contains_point(50, 0))
# self.assertTrue(self.antimeridian_agg_cb.contains_point(50, 180))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason this ones commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's a bug in aggregated_cellbox.py, basically the contains_point() method doesn't account for the antimeridian. It seems wrong to fix that and also be writing the test suite in the same PR, so I commented that one out, so that when we fix the bug, we can just uncomment it to test it works.

Happy to fix the bug in this PR if you prefer though

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd say uncomment the test out in this PR. If it's failing on the dev branch, we should reflect that in our tests. That being said, I don't really have a problem with the fix going into the same PR if it's fairly simple to do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, just fixed this up and am running tests now. How about the other bugs noted in the PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unsure about the deallocate_cellbox one - Think it's best to ask @ayat-khairy to see if this is functioning as she expected.

I don't think the 'id' should be part of the agg_data. I'm a little cautious that removing this here might break something though - but I suppose we'll have the tests now (or soon) to catch it.

Happy to change some function names in aggregrated_cellbox.py if it would increase clarity

Last one's just been fixed :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The regression tests still pass after removing 'id' from the agg_data. I think it's not an issue because the way it currently works is to write out the agg_cellbox in json, and the 'id' key/val pair gets overwritten by the line cell_json['id'] = self.get_id(), which outputs the same key/val pair anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just renamed set_boundary to set_bounds to keep consistency within meshiphi. Luckily, it's not called anywhere in the code with the exception of the test suite that this PR addresses

@hjabbot hjabbot requested a review from SamuelHall700 May 23, 2024 12:37
Copy link
Collaborator

@SamuelHall700 SamuelHall700 left a comment

Choose a reason for hiding this comment

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

Looks good!

@hjabbot hjabbot merged commit b935dcb into 2.1.x Jun 3, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants