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:
it requires that the destination coordinate have a different dimension and coordinate name (in conflict with CF conventions)
it does not handle variables with a Time dimension.
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:
Time
dimension.https://github.com/MPAS-Dev/MPAS-Analysis/blob/8f29c53d63317b4bce10917b02fb982f5fbaac3c/mpas_analysis/shared/interpolation/interp_1d.py