jbusecke/xarrayutils

reversing the sign of vertical coordinate

miniufo opened this issue · 4 comments

Hi @jbusecke

I am trying your utils in vertical-coordinate transformation, from z-level to density levels. From your notebook, I found that one need to assume that the depth values are increasing with the depth dimension. I tried with MITgcm data which are defined on a decresing z-levels (e.g., -5, -15, ..., -5000) and get somewhat strange results. So I have to do the simplest fix is to flip the sign of all depth values.

This is somewhat annoying. Is this necessary for a monotonically decreasing coordinate and why is that?

There is a quick fix (which is not quite intuitive). Flip the bins you use! I think that should work.
There is some logic that deals with the 'boundary cells' that makes this a little clunky. I plan to have a higher level wrapper at some point, which would detect these, flip them, apply the remapping and flip them back. But for now youll have to do it manually.

Now, it is fine but I’m still looking forward to your wrapper.

Glad its working for you now. I ll definitely keep this in mind when I get the time to work on this.

Closing this, since I am planning to deprecate this functionality in xarrayutils (see #84).