Giter VIP home page Giter VIP logo

Comments (6)

apatlpo avatar apatlpo commented on July 29, 2024

The code that performs the interpolation is fairly simple:

for (k=0;k<NZT;k++)
{
if (ztk[k] <= zsk[0]){
if (b_extrap == 1) vtk[k] = vsk[0];
else if (b_extrap == 2) vtk[k] = lin_int(zsk[0],vsk[0],zsk[1],vsk[1],ztk[k]);
else vtk[k] = NPY_NAN;
}
else if (ztk[k] >= zsk[NZ-1]){
if (t_extrap == 1) vtk[k] = vsk[NZ-1];
else if (t_extrap == 2) vtk[k] = lin_int(zsk[NZ-2],vsk[NZ-2],zsk[NZ-1],vsk[NZ-1],ztk[k]);
else vtk[k] = NPY_NAN;
}
else {
while (ztk[k] > zsk[k1]) k1++;
k0 = k1-1;
vtk[k] = lin_int(zsk[k0],vsk[k0],zsk[k1],vsk[k1],ztk[k]);
}
}

and consistent with the notebook.
The question that follows is then: what do we do about it?

Allowing for grids that are reversed is certainly feasible.
But do we want to also allow unsorted vertical grid points?

from croco.

apatlpo avatar apatlpo commented on July 29, 2024

My preference would be for the former.

from croco.

NoeLahaye avatar NoeLahaye commented on July 29, 2024

Ah OK! I could have read more carefully fast_insterp3D.c. Maybe the least we could do, if we don't want to modify the routine, is to add a mention in the docstrings or even add a test in interp2z?

from croco.

apatlpo avatar apatlpo commented on July 29, 2024

Agreed, could you please push a commit updating the doc?

Could you also modify the title of this issue with something like: "more general orders of input vertical grids for fast_interp3D " ?

We'll list this issue as a new feature request to remember a PR should be proposed at some point in order to allow interpolation with vertical grids with opposite orders.

from croco.

NoeLahaye avatar NoeLahaye commented on July 29, 2024

done

from croco.

slgentil avatar slgentil commented on July 29, 2024

There's a new method in xgcm to interpolate (see xgcm tutorial in crocosi : xgcmgrid.transform). The target coordinate must be monotonically increasing or decreasing. Performance seems quite good. May be it could help...
@NoeLahaye , @apatlpo

from croco.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.