Convert sigma coordinate to Z depth in ferret

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
sbs8612
Posts: 1
Joined: Mon Feb 21, 2011 9:43 pm
Location: KIOST

Convert sigma coordinate to Z depth in ferret

#1 Unread post by sbs8612 »

Hi all

I have a problem that is very easy to solve, but I don't know how...

I want to convert sigma coordinates to depth coordinates, in ferret(not in matlab).
In my ocean_his.nc,
when I did 'ncdump -h' ,
------------------------------------------------------------------------------------------
double s_rho(s_rho) ;
s_rho:long_name = "S-coordinate at RHO-points" ;
s_rho:valid_min = -1. ;
s_rho:valid_max = 0. ;
s_rho:positive = "up" ;
s_rho:standard_name = "ocean_s_coordinate_g1" ;
s_rho:formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc" ;
s_rho:field = "s_rho, scalar" ;
double s_w(s_w) ;
s_w:long_name = "S-coordinate at W-points" ;
s_w:valid_min = -1. ;
s_w:valid_max = 0. ;
s_w:positive = "up" ;
s_w:standard_name = "ocean_s_coordinate_g1" ;
s_w:formula_terms = "s: s_w C: Cs_w eta: zeta depth: h depth_c: hc" ;
s_w:field = "s_w, scalar" ;
double Cs_r(s_rho) ;
Cs_r:long_name = "S-coordinate stretching curves at RHO-points" ;
Cs_r:valid_min = -1. ;
Cs_r:valid_max = 0. ;
Cs_r:field = "Cs_r, scalar" ;
double Cs_w(s_w) ;
Cs_w:long_name = "S-coordinate stretching curves at W-points" ;
Cs_w:valid_min = -1. ;
Cs_w:valid_max = 0. ;
Cs_w:field = "Cs_w, scalar" ;
----------------------------------------------------------------------------------
it shows 's_rho' ,'s_w', 'Cs_r' and 'Cs_w'

but in ferret, when I did 'Show data',
it shows only 'Cs_r' & 'Cs_w'

Convert sigma coordinate to Z depth in ferret,
But, h(depth) is a 2D variable that does'nt have a Z dimension, So I need to create a new 3Dvariable,

(I think h(bathymetry at RHO-points) * s_rho(S-coordinate at RHO-points) = 3Dvarible , Is that right??)

I want to define 's_rho'&'s_w' in data,
Is is possible in ocean.in or cppdefs?
Thank you
Last edited by sbs8612 on Wed May 04, 2011 1:08 pm, edited 1 time in total.

rgoldman
Posts: 3
Joined: Tue Oct 12, 2010 12:33 am
Location: Israel Oceanographic & Limnological Research

Re: Convert sigma coordinate to Z depth in ferret

#2 Unread post by rgoldman »

the reason that you can't see s_rho is because it is interpreted as an axis. you can see it with
show axis/all
and access it using
z[gz=s_rho]
As for the dummy variable, I think it can be a time independent approximation if zeta is small compared to the characteristics of the profile (if zeta is a few centimeters and you have a mixed layer of several meters or something like that). Otherwise I rhink the formula should be z3d=zeta+z[gz=s_rho]*h

asujrpv

Re: Convert sigma coordinate to Z depth in ferret

#3 Unread post by asujrpv »

sbs8612 wrote:Hi all

I have a problem that is very easy to solve, but I don't know how...

I want to convert sigma coordinates to depth coordinates, in ferret(not in matlab).
In my ocean_his.nc,
when I did 'ncdump -h' ,
------------------------------------------------------------------------------------------
double s_rho(s_rho) ;
s_rho:long_name = "S-coordinate at RHO-points" ;
s_rho:valid_min = -1. ;
s_rho:valid_max = 0. ;
s_rho:positive = "up" ;
s_rho:standard_name = "ocean_s_coordinate_g1" ;
s_rho:formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc" ;
s_rho:field = "s_rho, scalar" ;
double s_w(s_w) ;
s_w:long_name = "S-coordinate at W-points" ;
s_w:valid_min = -1. ;
s_w:valid_max = 0. ;
s_w:positive = "up" ;
s_w:standard_name = "ocean_s_coordinate_g1" ;
s_w:formula_terms = "s: s_w C: Cs_w eta: zeta depth: h depth_c: hc" ;
s_w:field = "s_w, scalar" ;
double Cs_r(s_rho) ;
Cs_r:long_name = "S-coordinate stretching curves at RHO-points" ;
Cs_r:valid_min = -1. ;
Cs_r:valid_max = 0. ;
Cs_r:field = "Cs_r, scalar" ;
double Cs_w(s_w) ;
Cs_w:long_name = "S-coordinate stretching curves at W-points" ;
Cs_w:valid_min = -1. ;
Cs_w:valid_max = 0. ;
Cs_w:field = "Cs_w, scalar" ;
----------------------------------------------------------------------------------
it shows 's_rho' ,'s_w', 'Cs_r' and 'Cs_w'

but in ferret, when I did 'Show data',
it shows only 'Cs_r' & 'Cs_w'

Convert sigma coordinate to Z depth in ferret,
But, h(depth) is a 2D variable that does'nt have a Z dimension, So I need to create a new 3Dvariable,

(I think h(bathymetry at RHO-points) * s_tho(S-coordinate at RHO-points) = 3Dvarible , Is that right??)

I want to define 's_rho'&'s_w' in data,
Is is possible in ocean.in or cppdefs?
Thank you
I have a similar problem, although not sure it is easy for me. I have a vertical profile of T and salinity S as function of 'z' which I want to convert to S coordinates and use these as initial conditions for my simulation, is there an 'easy' way to do this? I have built my grid but still in the stage of creating the initial and boundary conditions. I would appreciate your feedback.

staalstrom
Posts: 31
Joined: Mon Feb 04, 2008 3:43 pm
Location: NIVA, OSLO, NORWAY

Re: Convert sigma coordinate to Z depth in ferret

#4 Unread post by staalstrom »

Hi

It is necessary to calculate z_r (3D) and z_w (also 3D) from the stretching function (C_s and C_w). C_s and C_w is calculated in Utility/set_scoord.F and is constant in the horizontal directions. 4 different versions are available now (after roms-3.4). But the stretching functions was already stored?

Then the depths are calculated in Nonlinear/set_depth.F. This is called "transforms" and here the variation with the horizontal directions are introduced. You must find out if Vtransform is set to 1 or 2 in your application. If Vtransform is missing from your history files it is probably set to Vtransform=1.
To read through set_depth.F is very informative.

Best regards
Andre Staalstrom (ans@niva.no)

crode1968
Posts: 13
Joined: Thu Oct 28, 2004 6:58 pm
Location: Danish Meteorological Institute

Re: Convert sigma coordinate to Z depth in ferret

#5 Unread post by crode1968 »

I faced the problems with ferret several times and have found a quite simple solution

Assuming that show data gives the following output

Code: Select all

     currently SET data sets:
    1> ./ocean_his_0001.nc  (default)
title                             I         J         K         L
NTIMES   number of long time-steps        ...       ...       ...       ...
NDTFAST  number of short time-steps       ...       ...       ...       ...
DT       size of long time-steps          ...       ...       ...       ...
  ... (shortened output) ...
CS_R     S-coordinate stretching curves   1:24      ...       ...       ...
CS_W     S-coordinate stretching curves   1:25      ...       ...       ...
  ... (cut the tailing information) ...
Define two new variables

let cs_rz=zsequence(cs_r)
let cs_wz=zsequence(cs_w)

and use the first one, for example, with the total depth h to compute the layer's depth at the box centers

let /title="Depth"/units="Meter" depth = abs(h * cs_rz) .

By including mask_rho you are even masking land points to beautify your plots

let /title="Depth"/units="Meter" depth = if mask_rho then abs(h * cs_rz) .

Post Reply