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

EAMXX: add a DataInterpolation class #6812

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

bartgol
Copy link
Contributor

@bartgol bartgol commented Dec 6, 2024

The class is in charge of reading in time-dependent datasets from input file(s), interpolate to current model time, and possibly do horizontal/vertical interpolation


The implementation is not yet complete, but some early thoughts on whether we're on the right track or not may help. Besides, getting some early testing on ghci machines can also help.

Things left to do:

  • testing for time-only interpolation for Linear timeline
  • add creation of vert/horiz remappers: this needs some extra input from parameter list (a map file, and for vert remap some choices for top/bot extrapolation)
  • testing for time+horiz, time+vert, and time+horiz+vert
  • add possibility of using an "IOP remapper" (a closest-column kind for horiz interpolation). This may allow the upcoming IOP forcing atm proc to use the DataIntepolation routine directly.
  • start using DataInterpolation in eamxx. E.g., use in SPA, and fix the alloc issue (see linked issue)

I am NOT implementing a data interpolation for variables without a time dependence. It simply reduces to constructing 2 remappers, and since non-time dep data is most likely load-able at init, there's no real need for a complex data structure. Time interpolation is the most tricky of the 3 anyways, due to the different needs (nudging uses Linear timeline, while SPA uses a YearlyPeriodic one)

For reviewers: i recommend reviewing one commit at a time. That would help isolate concepts, so you can hopefully better follow. The hardest thing to review is the data interpolation unit tests, since there is quite a bit of code needed to generate cases that we can manually check without redoing the same operation as the interpolation class (copy+paste of src code in tests folder doesn't help).

Fixes #6810
Fixes #6820

@bartgol bartgol self-assigned this Dec 6, 2024
@bartgol bartgol added EAMxx PRs focused on capabilities for EAMxx code usability code cleanup labels Dec 6, 2024
Copy link

github-actions bot commented Dec 6, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://E3SM-Project.github.io/E3SM/pr-preview/pr-6812/
on branch gh-pages at 2024-12-07 00:38 UTC

@bartgol bartgol force-pushed the bartgol/eamxx/data-interpolation branch 2 times, most recently from d6d24a8 to 261933d Compare December 6, 2024 19:35
Simplifies some operations that looked clunky on the client end
* The class handles time, horizontal, and vertical interpolation
* The vertical/horizontal are optional, but the time dimension is REQUIRED
@bartgol bartgol force-pushed the bartgol/eamxx/data-interpolation branch from 261933d to eb23fd7 Compare December 6, 2024 21:26
@bartgol bartgol force-pushed the bartgol/eamxx/data-interpolation branch from eb23fd7 to 6bfbb0f Compare December 6, 2024 21:52
@bartgol bartgol marked this pull request as draft December 7, 2024 00:33
We may not have any mid or any int field. No need to force us to
create a valid field just for passing checks.
Copy link
Contributor

@AaronDonahue AaronDonahue left a comment

Choose a reason for hiding this comment

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

Would it make sense to break this plan into three PRs. This one which introduces the DataInterpolation Class and applies it to time interpolation and then subsequent ones with horiz and vertical?

* and allows two things: compute the interval length (in days), and check if
* a timestamp lies within the interval.
*
* When te TimeLine arg to the ctor is YearlyPeriodic, the year part of beg/end
Copy link
Contributor

Choose a reason for hiding this comment

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

"te" should be "the"

@bartgol
Copy link
Contributor Author

bartgol commented Dec 9, 2024

Would it make sense to break this plan into three PRs. This one which introduces the DataInterpolation Class and applies it to time interpolation and then subsequent ones with horiz and vertical?

I don't think so. The three interpolations are tightly coupled via remappers. Sure, the remapper can be IdentityRemapper if no remap is requested, but the structure is there. I think it may be confusing to integrate a feature that seems to support something, but it doesn't.

For reviewers: I try to isolate concepts into their own commits. So one way to make reviews easier is to review one commit at a time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup code usability EAMxx PRs focused on capabilities for EAMxx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EAMxx: Kokkos View allocations in spa EAMXX: unify time interpolation implementations
2 participants