35 |
tim_prof=(profIn.prof_date-tmp2); |
tim_prof=(profIn.prof_date-tmp2); |
36 |
tim_prof(tim_prof>365)=365; |
tim_prof(tim_prof>365)=365; |
37 |
tim_prof=tim_prof/365*12;%neglecting differences in months length |
tim_prof=tim_prof/365*12;%neglecting differences in months length |
38 |
elseif strcmp(fldIn.tim,'const'); |
elseif strcmp(fldIn.tim,'const')|strcmp(fldIn.tim,'std'); |
39 |
tim_fld=[1 2]; rec_fld=[1 2]; |
tim_fld=[1 2]; rec_fld=[1 1]; |
40 |
tim_prof=1.5*ones(profIn.np,1); |
tim_prof=1.5*ones(profIn.np,1); |
41 |
else; |
else; |
42 |
error('this case remains to be implemented'); |
error('this case remains to be implemented'); |
48 |
|
|
49 |
%2) loop over record pairs |
%2) loop over record pairs |
50 |
for tt=1:length(rec_fld)-1; |
for tt=1:length(rec_fld)-1; |
51 |
fld0=read_bin(fldIn.fil,rec_fld(tt)); |
fld0=mygrid.mskC.*read_bin(fldIn.fil,rec_fld(tt)); |
52 |
fld1=read_bin(fldIn.fil,rec_fld(tt+1)); |
fld1=mygrid.mskC.*read_bin(fldIn.fil,rec_fld(tt+1)); |
53 |
ndim=length(size(fld0{1})); |
ndim=length(size(fld0{1})); |
54 |
fld=cat(ndim+1,fld0,fld1); |
fld=cat(ndim+1,fld0,fld1); |
55 |
% |
% |
56 |
ii=find(tim_prof>=tim_fld(tt)&tim_prof<tim_fld(tt+1)); |
ii=find(tim_prof>=tim_fld(tt)&tim_prof<tim_fld(tt+1)); |
57 |
if ~isempty(ii); |
if ~isempty(ii); |
58 |
arr=gcmfaces_interp(fld,lon(ii),lat(ii),'polygons'); |
arr=gcmfaces_interp(fld,lon(ii),lat(ii),method); |
59 |
arr2=gcmfaces_interp_1d(2,depIn,arr,depOut); |
arr2=gcmfaces_interp_1d(2,depIn,arr,depOut); |
60 |
end; |
end; |
61 |
% |
% |
62 |
k0=floor(tim_prof(ii)); k1=k0+1; |
k0=floor(tim_prof(ii)); k1=k0+1; |
63 |
a0=tim_prof(ii)-k0; a0=a0*ones(1,profIn.nr); |
a0=tim_prof(ii)-k0; a0=a0*ones(1,profIn.nr); |
64 |
profOut(ii,:)=(1-a0).*arr2(:,:,1)+a0.*arr2(:,:,2); |
profOut(ii,:)=(1-a0).*arr2(:,:,1)+a0.*arr2(:,:,2); |
65 |
|
if strcmp(fldIn.tim,'std'); |
66 |
|
profOut(ii,:)=profOut(ii,:).*randn(size(profOut(ii,:))); |
67 |
|
end; |
68 |
end; |
end; |
69 |
|
|
70 |
%3) deal with file output |
%3) deal with file output |