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

Nearest neighbor interpolator #168

Merged
merged 3 commits into from
Jun 14, 2024
Merged

Nearest neighbor interpolator #168

merged 3 commits into from
Jun 14, 2024

Conversation

zihaoxu98
Copy link
Collaborator

This PR adds nearest neighbor interpolator, in case where the inverse distance weighting (IDW) does not make sense any more.

To use it, add method="NN" in the Map. For example,

apt.config.Map(
    name='test_map',
    default='map_file.json',
    method='NN',
)

@zihaoxu98 zihaoxu98 requested a review from dachengx June 12, 2024 13:11
@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9483108512

Details

  • 19 of 45 (42.22%) changed or added relevant lines in 2 files are covered.
  • 23 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.7%) to 85.04%

Changes Missing Coverage Covered Lines Changed/Added Lines %
appletree/config.py 11 17 64.71%
appletree/interpolation.py 8 28 28.57%
Files with Coverage Reduction New Missed Lines %
appletree/config.py 23 83.4%
Totals Coverage Status
Change from base Build 9481588762: -0.7%
Covered Lines: 2359
Relevant Lines: 2774

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9483112472

Details

  • 20 of 44 (45.45%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 85.04%

Changes Missing Coverage Covered Lines Changed/Added Lines %
appletree/config.py 12 16 75.0%
appletree/interpolation.py 8 28 28.57%
Totals Coverage Status
Change from base Build 9481588762: -0.7%
Covered Lines: 2359
Relevant Lines: 2774

💛 - Coveralls

@zihaoxu98 zihaoxu98 merged commit 7b3bc2f into master Jun 14, 2024
7 checks passed
@zihaoxu98 zihaoxu98 deleted the interp branch June 14, 2024 12:51
)
else:
raise ValueError(f"Unknown method {self.method} for 2D regular binning.")
elif len(self.coordinate_lowers) == 3 and self.method == "IDW":
Copy link
Collaborator

Choose a reason for hiding this comment

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

elif len(self.coordinate_lowers) == 3 and self.method == "IDW":

to

elif len(self.coordinate_lowers) == 3:

Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

3 participants