finding depths of the layers

Facts, news, and guidance about ROMS software

Moderators: arango, robertson

Post Reply
Message
Author
nageswararao

finding depths of the layers

#1 Unread post by nageswararao »

Hi all,
I want to convert sigma coordinates to depth coordinates. I had used depths.m in Preprocessing_tools to get the depths but I am getting the following error.

??? Error using ==> nc_vinfo
NC_VINFO: ncvarid - cannot find variable: sc_r

Error in ==> nc_read at 64
[vdnames,vdsizes,igrid]=nc_vinfo(fname,vname);

Error in ==> depths at 60
sc_r=nc_read(fname,'sc_r');

What we have to give for tindex? Where I get information aboput sc_r, sc_w values? How can I fix this problem? or anyother method is there to convert layers to depth values. Please help me if anyone knows.

Thanks is in advance.

With regards,
G.NageswaraRao.

jacopo
Posts: 81
Joined: Fri Nov 21, 2003 9:30 pm
Location: CNR-ISMAR

#2 Unread post by jacopo »

the version of depths.m you are using is old, and consistent with ROMS-2.1.
While using ROMS 2.2, for NETCDF compliancy, s-coordinate parameters have been renamed.

replace the the following in depths.m

Code: Select all

%----------------------------------------------------------------------------
% Read in S-coordinate parameters.
%----------------------------------------------------------------------------

sc_r=nc_read(fname,'sc_r');
Cs_r=nc_read(fname,'Cs_r');

sc_w=nc_read(fname,'sc_w');
Cs_w=nc_read(fname,'Cs_w');
with the new one

Code: Select all

%----------------------------------------------------------------------------
% Read in S-coordinate parameters.
%----------------------------------------------------------------------------

sc_r=nc_read(fname,'s_rho');
Cs_r=nc_read(fname,'Cs_r');

sc_w=nc_read(fname,'s_w');
Cs_w=nc_read(fname,'Cs_w');

and it should work.

Tindex is used if you want to consider zeta evolving with time (then tindex is the i-th field in your history file). otherwise,

Code: Select all

% If the time record is not provided, it assumes zero free-surface and      %
% the grid is not evolving in time. 
Jacopo

nageswararao

Thank u

#3 Unread post by nageswararao »

Hi Jacopo,
Thank u for ur reply. I am getting the output but how to convert it into netcdf file? I had used mat2nc.m but it is writing the output in wrong format that it is writing i values in the place of k and k values in the place of i . How can I get the correct netcdf file? Please do reply.
Thanks in advance.

jacopo
Posts: 81
Joined: Fri Nov 21, 2003 9:30 pm
Location: CNR-ISMAR

#4 Unread post by jacopo »

I'm not sure to see your point, meanwhile keep in mind that it is a standard when writing NetCDF that the dimensions are somewhat 'reversed': if you have a matrix(i,j,k,time), in NetCDF it is supposed to be written as matrix(time,k,j,i). So, what you are having doesn't sound incorrect to me.

If this is really your point, have a look at

http://www.cgd.ucar.edu/cms/eaton/cf-me ... F-1.0.html

where BTW, it is in fact recommended

Code: Select all

If any or all of the dimensions of a variable have the interpretations of ``date or time'' (T), ``height or depth'' (Z), ``latitude'' (Y), or ``longitude'' (X) then we recommend, but do not require (see section 1.4), those dimensions to appear in the relative order T, then Z, then Y, then X in the CDL definition corresponding to the file. All other dimensions should, whenever possible, be placed to the left of the spatiotemporal dimensions.

Post Reply