xESMF icon indicating copy to clipboard operation
xESMF copied to clipboard

vertical interpolation onto a tracer coordinate

Open miniufo opened this issue 4 years ago • 6 comments

I love the high-level API of this package and it's efficient. There are lots of geoscience applications that need vertical-coordinate transformation, like converting the pressure-level data to isentropic levels in atmospheric context and converting z-level data to denstiy levels in oceanic context.

Just wonder if I can do this using the current xESMF functionality, possibly keeping the conservative property. I've searched around for such a tool and hope this wonderful one could help me out so that I won't need many similar tools.

miniufo avatar Apr 04 '20 08:04 miniufo

@miniufo I met a similar problem with xarray. You can try xr.apply_ufunc(). But, that's not conservative. Maybe, @JiaweiZhuang has a better solution.

zxdawn avatar Apr 04 '20 13:04 zxdawn

Hi @zxdawn, thanks, I know there are many 1D interpolation methods, but I need one to do the conservative interpolation. I need to ensure that the total tracer amount should be exactly the same before and after the interp.

miniufo avatar Apr 05 '20 08:04 miniufo

@miniufo Got it! It's tricky to interpolate data to vertical levels conservatively, maybe we need some assumptions, such as the constant concentration between each level.

Em ... Have no idea how to code. Waiting for the answer from @JiaweiZhuang ;)

zxdawn avatar Apr 05 '20 08:04 zxdawn

As mentioned in https://github.com/JiaweiZhuang/xESMF/issues/24:

ESMPy does support 3D grid, but this is generally an overkill.

zxdawn avatar Apr 05 '20 09:04 zxdawn

ESMPy does support 3D grid, but this is generally an overkill.

Hi @zxdawn, for the case of z-to-z interpolation (different z-levels), I guess xESMF could handle well, even under the conservative constraint. As for the z-to-density case, not so sure. One may need to check the monotonicity of density and thus get a one-to-one relation z(rho) between z and density.

maybe we need some assumptions, such as the constant concentration between each level.

I think this is the very assumption of discretization, that variables are assumed to be constant within a single grid cell.

miniufo avatar Apr 05 '20 16:04 miniufo

I haven't tried it out, but I believe something like xlayers might help https://github.com/cspencerjones/xlayers.

bradyrx avatar Jul 28 '20 18:07 bradyrx