MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
37 stars 63 forks source link

Add a function for vertical interpolation of MPAS-Ocean datasets #479

Open xylar opened 1 year ago

xylar commented 1 year ago

It would be good to have one or more functions for performing interpolation from the MPAS vertical coordinate to a z-level coordinate. see https://github.com/E3SM-Project/E3SM/discussions/5335 for some discussion.

The function should be capable of extrapolating to the top of the top layer and the bottom of the bottom layer. Likely, linear interpolation would be sufficient to begin with, but conservative interpolation would be an added bonus. The function should use zMid, not the 1D reference coordinate so that is properly handles meshes with ice-shelf cavities and other non-z-level coordinates, and so that it accounts for variation of the z-star coordinate in time.

The following function in MPAS-Analysis is a starting point but it doesn't extrapolate beyond the middle of the top and bottom layers, which is a problem. It also has several other undesirable quirks:

https://github.com/MPAS-Dev/MPAS-Analysis/blob/8f29c53d63317b4bce10917b02fb982f5fbaac3c/mpas_analysis/shared/interpolation/interp_1d.py