/[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.2 - (hide annotations) (download)
Fri Jul 1 18:01:54 2011 UTC (14 years ago) by gforget
Branch: MAIN
Changes since 1.1: +25 -11 lines
profiles_stats/MITprof_stats.m
	quick fix of delaunay call
profiles_stats/MITprof_stats_load.m
	better handling of rmfield
	and use extended standard depth vector
profiles_stats/MITprof_stats_cost.m is retired
        and replaced with ecco_v4/insitu_cost.m
profiles_stats/MITprof_stats_misfit.m is retired
	and replaced with ecco_v4/insitu_misfit.m

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 gforget 1.2 useExtendedProfDepth=1;
15    
16 gforget 1.1 for iFile=1:length(listData);
17     fileData=dir([dirData listData{iFile}]);
18 gforget 1.2 fileData=fileData.name
19 gforget 1.1 MITprofCur=MITprof_load([dirData fileData]);
20    
21     % fixes:
22     if ~isfield(MITprofCur,'prof_S');
23     tmp1=NaN*MITprofCur.prof_T;
24     MITprofCur.prof_S=tmp1; MITprofCur.prof_Sestim=tmp1;
25     MITprofCur.prof_Sweight=tmp1; MITprofCur.prof_Sflag=[];
26     end;
27     % fixes
28    
29     if ~isempty(normFactor);%replace weights with normFactor
30     eval(['tmp1=MITprofCur.prof_' varCur 'weight;']);
31     tmp1(tmp1>0)=normFactor;
32     eval(['MITprofCur.prof_' varCur 'weight=tmp1;']);
33     end;
34    
35     if varCur=='T';
36     tmp1=(MITprofCur.prof_Testim-MITprofCur.prof_T).*sqrt(MITprofCur.prof_Tweight);
37     tmp1(tmp1==0)=NaN; MITprofCur.prof=tmp1;
38     else;
39     tmp1=(MITprofCur.prof_Sestim-MITprofCur.prof_S).*sqrt(MITprofCur.prof_Sweight);
40     tmp1(tmp1==0)=NaN; MITprofCur.prof=tmp1;
41 gforget 1.2 end;
42    
43     listRm={ 'prof_T','prof_Testim','prof_Tweight','prof_Tflag','prof_Terr',...
44     'prof_S','prof_Sestim','prof_Sweight','prof_Sflag','prof_Serr'};
45     for iRm=1:length(listRm);
46     if isfield(MITprofCur,listRm{iRm}); MITprofCur=rmfield(MITprofCur,listRm{iRm}); end;
47 gforget 1.1 end;
48    
49     MITprofCur.prof_date=datenum(num2str(MITprofCur.prof_YYYYMMDD*1e6+MITprofCur.prof_HHMMSS),'yyyymmddHHMMSS');
50     %old: ii=find(MITprofCur.prof_date<datenum(1992,1,1)|MITprofCur.prof_date>datenum(2008,12,27)); MITprofCur.prof(ii,:)=NaN;
51    
52 gforget 1.2 if useExtendedProfDepth;
53     %use extended standard depth vector
54     all_depth=[ 0 5 10 15 20 25 30 35 45 50 55 65 75 85 95 100 ...
55     105 115 125 135 145 150 155 165 175 185 200 220 240 250 260 280 ...
56     300 320 340 360 380 400 420 440 460 480 500 550 600 650 700 750 ...
57     800 850 900 950 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 ...
58     2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 ...
59     3800 3900 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 ...
60     5400 5500 5600 5700 5800 5900 6000];
61     k_depth=NaN*zeros(1,MITprofCur.nr);
62     for kk=1:MITprofCur.nr; k_depth(kk)=find(MITprofCur.prof_depth(kk)==all_depth); end;
63     all_prof=NaN*ones(MITprofCur.np,length(all_depth));
64     all_prof(:,k_depth)=MITprofCur.prof;
65     MITprofCur.prof=all_prof;
66     MITprofCur.nr=length(all_depth);
67     MITprofCur.prof_depth=all_depth;
68 gforget 1.1 end;
69    
70     if iFile==1;
71     MITprof=MITprofCur;
72     else;
73     MITprof=MITprof_concat(MITprof,MITprofCur);
74     end;
75     clear MITprofCur;
76     end;
77    
78    

  ViewVC Help
Powered by ViewVC 1.1.22