/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/profiles_stats/MITprof_stats_load.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/profilesMatlabProcessing/profiles_stats/MITprof_stats_load.m

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


Revision 1.1 - (hide annotations) (download)
Thu Jan 6 23:16:55 2011 UTC (14 years, 6 months ago) by gforget
Branch: MAIN
- new directory dedicated to statistical analyses of MITprof files.

1 gforget 1.1 function [MITprof]=MITprof_stats_load(dirData,listData,varCur,varargin);
2     %[MITprof]=MITprof_stats_load(dirData,listData,varCur,varargin);
3     %object: loads a series of MITprof files, and computes
4     % normalized misfits for one variable
5     %input: dirData is the data directory name
6     % listData is the data file list (e.g. {'argo_in*'} or {'argo_in*','argo_at*'} )
7     % varCur is 'T' or 'S'
8     % normFactor (optional) is the normalization factor (1./prof_?weight by default)
9     %output: MITprof.prof is the normalized misfit
10     %note: by assumption, all of the files in listData must share the same vertical grid
11    
12     if nargin>3; normFactor=varargin{1}; else; normFactor=[]; end;
13    
14     for iFile=1:length(listData);
15     fileData=dir([dirData listData{iFile}]);
16     fileData=fileData.name;
17     MITprofCur=MITprof_load([dirData fileData]);
18    
19     % fixes:
20     if ~isfield(MITprofCur,'prof_S');
21     tmp1=NaN*MITprofCur.prof_T;
22     MITprofCur.prof_S=tmp1; MITprofCur.prof_Sestim=tmp1;
23     MITprofCur.prof_Sweight=tmp1; MITprofCur.prof_Sflag=[];
24     end;
25     % fixes
26    
27     if ~isempty(normFactor);%replace weights with normFactor
28     eval(['tmp1=MITprofCur.prof_' varCur 'weight;']);
29     tmp1(tmp1>0)=normFactor;
30     eval(['MITprofCur.prof_' varCur 'weight=tmp1;']);
31     end;
32    
33     if varCur=='T';
34     MITprofCur=rmfield(MITprofCur,{'prof_S','prof_Sestim','prof_Sflag','prof_Sweight'});
35     tmp1=(MITprofCur.prof_Testim-MITprofCur.prof_T).*sqrt(MITprofCur.prof_Tweight);
36     tmp1(tmp1==0)=NaN; MITprofCur.prof=tmp1;
37     MITprofCur=rmfield(MITprofCur,{'prof_T','prof_Testim','prof_Tflag','prof_Tweight'});
38     else;
39     MITprofCur=rmfield(MITprofCur,{'prof_T','prof_Testim','prof_Tflag','prof_Tweight'});
40     tmp1=(MITprofCur.prof_Sestim-MITprofCur.prof_S).*sqrt(MITprofCur.prof_Sweight);
41     tmp1(tmp1==0)=NaN; MITprofCur.prof=tmp1;
42     MITprofCur=rmfield(MITprofCur,{'prof_S','prof_Sestim','prof_Sflag','prof_Sweight'});
43     end;
44    
45     MITprofCur.prof_date=datenum(num2str(MITprofCur.prof_YYYYMMDD*1e6+MITprofCur.prof_HHMMSS),'yyyymmddHHMMSS');
46     %old: ii=find(MITprofCur.prof_date<datenum(1992,1,1)|MITprofCur.prof_date>datenum(2008,12,27)); MITprofCur.prof(ii,:)=NaN;
47    
48     % fixes
49     if MITprofCur.nr==45&length(listData)>1;
50     MITprofCur.nr=55;
51     MITprofCur.prof(:,46:55)=NaN*ones(MITprofCur.np,10);
52     MITprofCur.prof_depth=MITprof.prof_depth;
53     end;
54     % fixes
55    
56     if iFile==1;
57     MITprof=MITprofCur;
58     else;
59     MITprof=MITprof_concat(MITprof,MITprofCur);
60     end;
61     clear MITprofCur;
62     end;
63    
64    

  ViewVC Help
Powered by ViewVC 1.1.22