# Re: Sigma To z coordinate

Hi Masoud,
I would check that you have the definition of variable depth
correct. The demo file sigma_coordinate_demo.jnl is somewhat
complex because it is first creates a 4-dimensional field to use in
the regridding. All you need is the input Z layers, the bathymetry,
and the desired output depth axis.

Does your variable dep contain the depth of the sigma levels?
If so then you can use the function like this:

use test.cdf ! has s and dep on 5 levels define axis/z=0:100:5/unit=meters/depth zdepth
let salt=ZAXREPLACE(s,dep,z[gz=zdepth])

If dep is the thickenss of each layer, then you would need to do something
like this

let depths = LAYER_THICKNESS[k=@rsum]-layer_thickness/2
let salt=ZAXREPLACE(s,depths,z[gz=zdepth])

If dep is the bottom depth only, and you are creating
depths for each sigma level from it, then I am not sure what
you are doing with the command

let h0=dep[k=s]

You could set up a set of depths ranging down to the value
of variable dep with commands like this:

let nlev = `s, return=ksize`
let depths = dep * (k[gz=s] / ndep)

!! Try listing depths at a single value of X, Y, T
! list/x=0/y=180/L=1 depths let salt=ZAXREPLACE(s,depths,z[gz=zdepth])

I hope these ideas will get you started.

Ansley

Dear Ferreters,

I am trying to convert results from my model (sigma coord) to z coordinates.

When I tried use ZAXREPLACE, some problems occur. I followed the sigma_coordinate_demo.jnl as example. The following is my own journal:

use test.cdf !(5 sigma levels)
let flow=s ! flow takes place of salinity - s
let h0=dep[k=s] !dep -> my bathmetry
let h_nor=h0/h0[k=1:5@sum]
let h=h_nor*(-1*dep)
let depth=h[k=@sum]-h/2
define axis/z=0:100:5/unit=meters/depth zdepth
let salt=ZAXREPLACE(s,depth,z[gz=zdepth])

Any comment would be appreciated.

School of Earth Sciences
Faculty of Science and Engineering
Flinders University of South Australia
South Australia 5042
Phone: +61 8 82013055
Fax: +61 8 82012676
Mobile: +61 404 125 524
```