# Re: [ferret_users] z depth (in meter) to sigma layer

```Hi Dessy,

> As we know, the vertical layer of levitus_climatology data (world
> ocean data) are provided in meter depth.
> Since I am applying a simulation on the sigma coordinate, then I
> need levitus data in sigma layer for the input file of simulation.

I think your problem is here:

>>! 3. set variable depth on sigma --> rose to depth_on_sigma
>>let/title="layer in sigma" depth_on_sigma=(rose*z[gz=znew])/z[gz=temp]

1) rose < 0 for the ocean.
2) What you want is not this quantity but
a "sigma field" in the x-y-z coordinates.

That is

let depth_on_sigma = (-1)*z[gz=temp[d=1]] / rose[d=2]

(Note that the name of the variable is misleading.)
Since sigma = depth / (total depth), the above quantity
is a 3D sigma field defined on a temperature grid (x and y taken
from "rose" and z from "temp").  Once you have the sigma field
defined on the x-y-z grid, you can compute a temperature field
mapped onto the sigma coordinates as

zaxreplace(temp  in x-y-z coordinates,
sigma in x-y-z coordinates,
z[gz = sigma coordinate]        )

Notice that the structure of your problem is exactly the same
as when you map a temperature or salinity (or any scalar) field
onto density coordinates:

zaxreplace(temp    in x-y-z coordinates,
density in x-y-z coordinates,
z[gz = density coordinate]    ),

for which the Ferret documentation includes examples.

I'm attaching a complete example.

Regards,
Ryo
---------------------------------
yes? set data levitus_climatology
yes? set data etopo60
yes? define axis/z=0:1:0.05/units="sigma"/depth znew
*** NOTE: (fyi) units are not subject to auto-conversion: SIGMA
yes? let depth_on_sigma = (-1)*z[gz=temp[d=1]] / rose[d=2]
yes? let temp_dens=zaxreplace(temp[d=1],depth_on_sigma,z[gz=znew])
yes? fill/x=180 temp_dens
*** NOTE: Ambiguous coordinates on X axis: ZAXREPLACE(TEMP[D=1],DEPTH_ON_SIGMA,Z[GZ=ZNEW])
yes?

```