NCO tools recently added depth interpolation. I asked teh author about it, and this was the response:
We may want to look at that code -- or at least compare some results:
Thanks for your interest in the NCO vertical interpolator.
It has come a long way since 2019 when I first wrote it
for atmospheric vertical coordinates. Now it works with
depth coordinates too.
Unfortunately it is fairly monolithic.
Given the author, that's probably no surprise :)
The core OpenMP loop that parallelizes the interpolation
over the variables in the input dataset might be segregable,
though even that takes like 30 variables as input, makes a
lot of netCDF API calls, and sits inside a time stepping
loop for time-varying vertical grids. It's for you to decide:
In any case, please feel free to borrow any ideas or code from it.
And it might be helpful to intercompare the results of Gridded
and ncremap to make sure neither one makes egregious mistakes.
NCO tools recently added depth interpolation. I asked teh author about it, and this was the response:
We may want to look at that code -- or at least compare some results:
Thanks for your interest in the NCO vertical interpolator. It has come a long way since 2019 when I first wrote it for atmospheric vertical coordinates. Now it works with depth coordinates too.
Unfortunately it is fairly monolithic. Given the author, that's probably no surprise :) The core OpenMP loop that parallelizes the interpolation over the variables in the input dataset might be segregable, though even that takes like 30 variables as input, makes a lot of netCDF API calls, and sits inside a time stepping loop for time-varying vertical grids. It's for you to decide:
https://github.com/nco/nco/blob/5.1.5/src/nco/nco_rgr.c#L3181
In any case, please feel free to borrow any ideas or code from it. And it might be helpful to intercompare the results of Gridded and ncremap to make sure neither one makes egregious mistakes.