Add interpolation routine to make Var.resampled_as faster#183
Open
ph-kev wants to merge 2 commits into
Open
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #183 +/- ##
==========================================
+ Coverage 98.18% 98.29% +0.11%
==========================================
Files 12 13 +1
Lines 1209 1291 +82
==========================================
+ Hits 1187 1269 +82
Misses 22 22 ☔ View full report in Codecov by Sentry. |
5e3c3be to
d4e432a
Compare
Merged
4 tasks
Sbozzolo
reviewed
Dec 12, 2024
Sbozzolo
reviewed
Dec 12, 2024
Sbozzolo
reviewed
Dec 12, 2024
Member
Sbozzolo
left a comment
There was a problem hiding this comment.
Could you also move all the linear interpolation into its own module, so that it will be easier in the future to switch it to something else?
25c7808 to
bd1319b
Compare
This commit adds an interpolation routine for use in ClimaAnalysis, which seeks to replace Interpolations.jl in Var.jl. The interpolation routine supports N-dimensional linear interpolation on a grid with throw, flat, or periodic boundary conditions. Compared against Interpolations.jl, the interpolation routine does not make a struct and does not allocate anything on the heap when interpolating a point.
This commit removes Interpolations.jl from Var.jl. To do this, the function `_make_interpolant` was removed. Three new functions are added which are `_check_interpolant`, `interpolate_point`, and `interpolate_points`, where the latter two functions replace the functionality of `_make_interpolant`. Furthermore, the function `_find_extp_bound_cond` was refactored to `_find_extp_bound_conds` which find multiple extrapolation condtions using `_find_extp_bound_cond` which is refactored to find the extrapolation condition for a single point. All functions that use an interpolant are updated to use the new interpolation routine. The test for computing the bias in Atmos changes to check approximately close to 0.0, due to floating point errors. The tests that check for errors when interpolating out of bounds now check for ErrorException instead of BoundsError.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #182 - This commit adds an interpolation routine that makes
resampled_asand any other functions that use interpolations faster.Checklist
OutputVars (see issue on ClimaCoupler)Benchmarks from
@timeThe image below is from the current postprocessing pipeline using the latest commit on main.

The image below is from the current postprocessing pipeline using this PR.
