source: Roms_tools/Diagnostic_tools/get_3dvars.m @ 1

Last change on this file since 1 was 1, checked in by cholod, 13 years ago

import Roms_Agrif

File size: 1.7 KB
Line 
1function [n3dvars,varcell,L,M,N]=get_3dvars(nc)
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%
4%  get_3dvars: Get the all prognostic variable names (u,v,zeta,..)
5%  and sizes from a netcdf file
6%
7%
8%  Further Information: 
9%  http://www.brest.ird.fr/Roms_tools/
10
11%  This file is part of ROMSTOOLS
12%
13%  ROMSTOOLS is free software; you can redistribute it and/or modify
14%  it under the terms of the GNU General Public License as published
15%  by the Free Software Foundation; either version 2 of the License,
16%  or (at your option) any later version.
17%
18%  ROMSTOOLS is distributed in the hope that it will be useful, but
19%  WITHOUT ANY WARRANTY; without even the implied warranty of
20%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21%  GNU General Public License for more details.
22%
23%  You should have received a copy of the GNU General Public License
24%  along with this program; if not, write to the Free Software
25%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26%  MA  02111-1307  USA
27%
28%  Copyright (c) 2006 by Pierrick Penven
29%  e-mail:Pierrick.Penven@ird.fr 
30%
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32
33Vars = var(nc);
34Varnames = [ncnames(Vars)];
35nvar=length(Vars);
36ndims=0*(1:nvar);
37ligne='                    ';
38varstr=repmat(ligne,nvar,1);
39n3dvars=0;
40for i=1:nvar
41  vname=char(Varnames(i));
42  myvar=nc{vname};
43  ndims(i)=length(dim(myvar));
44  if ndims(i)>=3
45    n3dvars=n3dvars+1;
46    varstr(n3dvars,1:length(vname))=vname;
47    a=size(myvar);
48    if ndims(i)==4
49      L(n3dvars)=a(4);
50      M(n3dvars)=a(3);
51      N(n3dvars)=a(2);
52    else
53      L(n3dvars)=a(3);
54      M(n3dvars)=a(2);
55      N(n3dvars)=1;
56    end
57  end
58end
59varstr=varstr(1:n3dvars,:);
60varcell=cellstr(varstr);
Note: See TracBrowser for help on using the repository browser.