-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fast 1D
interpolation
#4
Comments
cc: @Sbozzolo |
Could you write up the requirements, the proposed design to address them, and how the interface would look like? |
I verified that indeed we are not using any interpolation in time, so we don't need that. I rephrased what, in my view, the requirements are, from this google doc The instances where Interpolations.jl is currently used are:
In addition to this, Interpolations.jl comes with several dependencies and features we don't want, is not very well maintained, and doesn't have good documentation. [It is also possible that 2 could be accomplished in a different way (by completing overhauling the way we do initial condition in ClimaAtmos, which is already something we'd like to do).] From this, it comes that ClimaInterpolations.jl needs to implement:
Nice to have:
Nice to have, but hard:
[*] In CliMA/ClimaUtilities.jl#143, I implemented support to this feature in a hacky and inefficient way. |
Sounds good. However, we will soon need the interpolation to pressure coordinates and accumulation of averages on them on the fly, i.e., every output step of the model, so this needs to be fast in the end. Hopefully, ClimaInterpolate will enable this. |
What's the rough timeline for this work to be completed? |
The following features are currently added in PR #3
Combined together, this also provided 3D interpolation on extruded 3D grids. I am working on
These will be done within the next few days. I am currently working from the draft branch. |
Current interfaces:
|
|
If people are currently using different interfaces, we will need to add some wrappers for user convenience. I can also add additional optimizations for special cases, as needed. |
Hi @sriharshakandala, thank you for the information. @tapios, what's the rough due date for this work to be completed? |
My understanding for the feature that was driving the immediate need for a new package was the ability to immediately read files with 3D altitudes without having to pre-process them resampling to a common vertical z. (There are other capabilities we would like in the short term and that we don't have at all, like supporting a mask-aware interpolation to avoid mixing ocean and land values, requiring a new approach/package.) In other words, we wanted a simpler and more accurate way to interpolate from files to model grids, where files are often defined on a grid defined as follows: (lon, lat, k), with k level and have a 3D array z[lon, lat, k]. Since we already support reading files with (lon, lat, z), the current workflow is to read input data is to preprocess the file and interpolate the it onto a single grid (lat, lon, z), then do linear interpolation to interpolate on every single point of the model grid (using Interpolations.jl). Note that this pre-process step is very slow because Interpolations.jl is not parallel and files can be huge. However, preprocessing is only done once, because once the file is generated, it is reused for all the simulations. Moreover, this problem is embarassingly parallel, and I showed how this can this parallelized (CliMA/ClimaArtifacts@main...gb/dyamond processes the full dyamond inititial conditions in less than 2 hours on the node of the cluster). My understanding is that the desired workflow would be immediately read the file without the intermediate pre-processing step. This would be simpler and lead to more accurate vertical interpolation. We can do 1D, 2D (or nD) linear interpolations with Interpolations.jl, but the capability we don't have is to immediately read a file (lat, lon, k) with z[lat, lon, k] (3D altitudes) and use the full 3D altitudes without intermediate step (one step vs two steps). I don't think this problem cannot be trivially decomposed into 2D+1D because neighboring columns can have different z vectors (it can still be decomposed in 2D + 1D, but it requires more work and more care in correctly searching the neighboring points, as I show in CliMA/ClimaUtilities.jl#143). I showed how this can be done in CliMA/ClimaUtilities.jl#143. This PR shows a proof of concept of how to remove the need for the pre-processing step and do more accurate interpolation with 3D altitudes. This also solves the issue with pre-processing being slow (because pre-processing is not done). The interface in that PR looks like:
(this is more or less the interface we discussed in the meeting with Tapio and Zhaoyi in December). It doesn't look like #3 is addressing this capability and the functions it provides are functions we already have (yes, ours are not vectorized, but that's not as important for generating initial data). Note also that in addition to this capability, there's a big chunk of work related to supporting new interpolations schemes into our simulations that I don't think has been considered yet.
If we want to use On the topic of interfaces, |
|
Let's talk about this again if we need to. What I want to have right now is the simplest interpolation that allows us to quickly initialize the atmosphere model at arbitrary resolutions. We do not need mask-aware interpolations immediately; we can interpolate, e.g., atmosphere and land separately on their grids, and average where we need to after the fact, as for fluxes. |
Sure.
We can address interface preferences during the review process, get them to align with end user preferences. I might have misread users preferences a bit on interest for a functors-based interface for these functions. Newer users expressed some issues understanding code when working with functors inside ClimaAtmos.jl initialization code and expressed preference for a simpler alternative in their earlier days. However, we can switch to functors-based interface if this is indeed preferred by the users! |
The Climate Modeling Alliance
Software Design Issue 📜
Purpose
Fast
1D
interpolationCost/Benefits/Risks
Benefits
Provides fast 1D interpolation.
People and Personnel
Components
Inputs
Results and Deliverables
Fast
1D
interpolationScope of Work
Tasks
SDI Revision Log
CC
@tapios @sriharshakandala @charleskawczynski @cmbengue
The text was updated successfully, but these errors were encountered: