# Re: [ferret_users] converting depth cordinated into density (sigma) cordinate

```Hi Binny, Ansley, and ferret users,

On Wed, Jan 18, 2017 at 5:32 AM, Ansley C. Manke
<ansley.b.manke@xxxxxxxx> wrote:

> The method would be the same. You need an expression that relates the units
> of Z axis to the other; it doesn't matter what is being converted to what.

I agree, but one issue that may not be obvious when you want to
convert to the z axis, is how to find the "z field".  In the
z-to-sigma (z-to-density) conversion of the 3D variable salt

ZAXREPLACE( salt, sigma, z[gz=axden]) ,

you need the 3D variable sigma(x,y,z).  To convert a 3D variable
salt(x,y,p) to the z axis, one needs the 3D "z field" z3d(x,y,p),
which is the depth of the isobaric surface p at (x,y). If you have
such a variable, then the conversion would be

ZAXREPLACE(salt, z3d, z[gz=z_axis]) .

You can compute z3d using the hydrostatic relation dp/dz = - rho z if
you know density.

HAVING SAID THAT, is this really what you are after, Binny?

Normally, pressure-to-z conversion is just to "re-interpret" the
vertical axis: You equate 10 dbar to 10 meters, for example. If this
re-interpretation is fine, all you need is

define axis/z= . . . ./units=meters  z_axis
let salt_in_z = salt_in_p[gz=z_axis@ASN]

See http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/Grids-Regions/GRIDS#_VPINDEXENTRY_663
for the @ASN transformation.  There is an example down the webpage.

Regards,

Ryo

```

• Follow-Ups:
• References: