/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/MITprof_struct.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/profilesMatlabProcessing/profiles_misc/MITprof_struct.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by roquet, Wed Apr 13 20:54:19 2011 UTC revision 1.6 by gforget, Mon Mar 30 15:30:54 2015 UTC
# Line 1  Line 1 
1  function [MITprof]=MITprof_struct(nProf,depth);  function [MITprof]=MITprof_struct(nProf,dataset,varargin);
2  %   [MITprof]=MITprof_struct;  %   [MITprof]=MITprof_struct;
3  %   create an empty struct variable using the format MITprof  %   create an empty struct variable using the format MITprof
4  %       nProf: number of profiles  %       nProf: number of profiles
5  %       depth: list of depth levels  %       prof_depth: list of depth levels
6    %       list_var: specify name of created fields
7    %
8    %   list of fields always created:
9    %       prof_depth      [nDepth x 1]
10    %       prof_descr      {nProf x 1}
11    %       prof_date       [nProf x 1]
12    %       prof_YYYYMMDD   [nProf x 1]
13    %       prof_HHMMSS     [nProf x 1]
14    %       prof_lon        [nProf x 1]
15    %       prof_lat        [nProf x 1]
16    %       prof_basin      [nProf x 1]
17    %       prof_point      [nProf x 1]
18    %       np, nr, list_descr, nd
19    %
20    %   list of fields created by default, if list_var not specified
21    %       prof_T, prof_Tflag, prof_Terr, prof_Tweight, prof_Testim
22    %       prof_S, prof_Sflag, prof_Serr, prof_Sweight, prof_Sestim
23    %           array size: [nProf x nLev]
24    
25    prof_depth=dataset.z_std;
26    
27    list_vars={};
28    for ii=2:length(dataset.var_out);
29        list_vars={list_vars{:},['prof_' dataset.var_out{ii} ]};
30        list_vars={list_vars{:},['prof_' dataset.var_out{ii} 'weight']};
31        list_vars={list_vars{:},['prof_' dataset.var_out{ii} 'estim']};
32        %if dataset.outputMore;
33        list_vars={list_vars{:},['prof_' dataset.var_out{ii} 'err']};
34        list_vars={list_vars{:},['prof_' dataset.var_out{ii} 'flag']};
35        %end;
36    end;
37    % list_vars={'prof_T','prof_Tweight','prof_Testim','prof_Terr','prof_Tflag',...
38    %     'prof_S','prof_Sweight','prof_Sestim','prof_Serr','prof_Sflag'};
39    % if ~strcmp(dataset.coord,'depth'); list_vars={list_vars{:},'prof_D','prof_Destim'}; end;
40    if nargin>2,
41        list_vars=varargin{1};
42    end
43    
 nLev=length(depth);  
44    
45  MITprof=[];  MITprof=[];
46  MITprof.prof_depth=depth;  
47    nLev=length(prof_depth);
48    prof_depth=reshape(prof_depth,length(prof_depth),1);
49    MITprof.prof_depth=prof_depth;
50    
51  MITprof.prof_date=zeros(nProf,1);  MITprof.prof_date=zeros(nProf,1);
52  MITprof.prof_YYYYMMDD=zeros(nProf,1);  MITprof.prof_YYYYMMDD=zeros(nProf,1);
53  MITprof.prof_HHMMSS=zeros(nProf,1);  MITprof.prof_HHMMSS=zeros(nProf,1);
# Line 15  MITprof.prof_lon=zeros(nProf,1); Line 55  MITprof.prof_lon=zeros(nProf,1);
55  MITprof.prof_lat=zeros(nProf,1);  MITprof.prof_lat=zeros(nProf,1);
56  MITprof.prof_basin=zeros(nProf,1);  MITprof.prof_basin=zeros(nProf,1);
57  MITprof.prof_point=zeros(nProf,1);  MITprof.prof_point=zeros(nProf,1);
58    
59  MITprof.prof_descr=cell(nProf,1);  MITprof.prof_descr=cell(nProf,1);
60  MITprof.prof_T=zeros(nProf,nLev);  
61  MITprof.prof_Tweight=zeros(nProf,nLev);  for ii=1:length(list_vars),
62  MITprof.prof_Testim=zeros(nProf,nLev);      MITprof=setfield(MITprof,list_vars{ii},zeros(nProf,nLev));
63  MITprof.prof_Tflag=zeros(nProf,nLev);  end
64  MITprof.prof_Terr=zeros(nProf,nLev);  
 MITprof.prof_S=zeros(nProf,nLev);  
 MITprof.prof_Sweight=zeros(nProf,nLev);  
 MITprof.prof_Sestim=zeros(nProf,nLev);  
 MITprof.prof_Sflag=zeros(nProf,nLev);  
 MITprof.prof_Serr=zeros(nProf,nLev);  
65  MITprof.np=nProf;  MITprof.np=nProf;
66  MITprof.nr=nLev;  MITprof.nr=nLev;
67  MITprof.nd=0;  MITprof.nd=0;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.22