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

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

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

revision 1.8 by gforget, Fri Jan 29 15:23:31 2016 UTC revision 1.9 by gforget, Mon Feb 1 14:39:49 2016 UTC
# Line 47  if doOut; doOutInit=isempty(dir(filOut)) Line 47  if doOut; doOutInit=isempty(dir(filOut))
47  if isempty(who('method')); method='polygons'; end;  if isempty(who('method')); method='polygons'; end;
48    
49  %0) check for file types  %0) check for file types
50  test0=~isempty(dir(fldIn.fil));  test0=isfield(fldIn,'fil');
51  [PATH,NAME,EXT]=fileparts(fldIn.fil);  test1=0;
52  fil_nc=fullfile(PATH,NAME,[NAME '.0001.nc']);  if test0;
53  fil_nctiles=fullfile(PATH,NAME,NAME);    test0=~isempty(dir(fldIn.fil));
54  test1=~isempty(dir(fil_nc));    [PATH,NAME,EXT]=fileparts(fldIn.fil);
55      fil_nc=fullfile(PATH,NAME,[NAME '.0001.nc']);
56      fil_nctiles=fullfile(PATH,NAME,NAME);
57      test1=~isempty(dir(fil_nc));
58    end;
59  test2=~isempty(fldIn.fld);  test2=~isempty(fldIn.fld);
60    
61  %1) deal with time line  %1) deal with time line
# Line 62  if strcmp(fldIn.tim,'monclim'); Line 66  if strcmp(fldIn.tim,'monclim');
66      tim_prof=(profIn.prof_date-tmp2);      tim_prof=(profIn.prof_date-tmp2);
67      tim_prof(tim_prof>365)=365;      tim_prof(tim_prof>365)=365;
68      tim_prof=tim_prof/365*12;%neglecting differences in months length      tim_prof=tim_prof/365*12;%neglecting differences in months length
69        if test2; fldIs3d=(length(size(fldIn.fld{1}))==4); end;
70  elseif strcmp(fldIn.tim,'monloop')|strcmp(fldIn.tim,'monser');  elseif strcmp(fldIn.tim,'monloop')|strcmp(fldIn.tim,'monser');
71      if test1;      if test1;
72        eval(['ncload ' fil_nc ' tim']);        eval(['ncload ' fil_nc ' tim']);
# Line 71  elseif strcmp(fldIn.tim,'monloop')|strcm Line 76  elseif strcmp(fldIn.tim,'monloop')|strcm
76        tmp1=dir(fldIn.fil);        tmp1=dir(fldIn.fil);
77        nt=tmp1.bytes/prod(mygrid.ioSize)/length(mygrid.RC)/4;        nt=tmp1.bytes/prod(mygrid.ioSize)/length(mygrid.RC)/4;
78      else;      else;
79        error('gcmfaces input case is missing here');        ndim=length(size(fldIn.fld{1}));
80          fldIs3d=(ndim==4);
81          nt=size(fldIn.fld{1},ndim);
82      end;      end;
83      tmp1=[1:nt]'; tmp2=ones(nt,1)*[1992 1 15 0 0 0]; tmp2(:,2)=tmp1;      tmp1=[1:nt]'; tmp2=ones(nt,1)*[1992 1 15 0 0 0]; tmp2(:,2)=tmp1;
84      tim_fld=datenum(tmp2);      tim_fld=datenum(tmp2);
# Line 91  elseif strcmp(fldIn.tim,'monloop')|strcm Line 98  elseif strcmp(fldIn.tim,'monloop')|strcm
98  elseif strcmp(fldIn.tim,'const')|strcmp(fldIn.tim,'std');  elseif strcmp(fldIn.tim,'const')|strcmp(fldIn.tim,'std');
99      tim_fld=[1 2]; rec_fld=[1 1];      tim_fld=[1 2]; rec_fld=[1 1];
100      tim_prof=1.5*ones(profIn.np,1);      tim_prof=1.5*ones(profIn.np,1);
101        if test2; fldIs3d=(length(size(fldIn.fld{1}))==3); end;
102  else;  else;
103      error('this case remains to be implemented');      error('this case remains to be implemented');
104  end;  end;
# Line 106  for tt=1:length(rec_fld)-1; Line 114  for tt=1:length(rec_fld)-1;
114    if ~isempty(ii);    if ~isempty(ii);
115      %tt      %tt
116      %      %
117      if test2;      if test2&fldIs3d;
118        fld0=fldIn.fld(:,:,:,rec_fld(tt));        fld0=fldIn.fld(:,:,:,rec_fld(tt));
119        fld1=fldIn.fld(:,:,:,rec_fld(tt+1));        fld1=fldIn.fld(:,:,:,rec_fld(tt+1));
120        elseif test2&~fldIs3d;
121          fld0=fldIn.fld(:,:,rec_fld(tt));
122          fld1=fldIn.fld(:,:,rec_fld(tt+1));
123      elseif test1;      elseif test1;
124        fld0=read_nctiles(fil_nctiles,NAME,rec_fld(tt));        fld0=read_nctiles(fil_nctiles,NAME,rec_fld(tt));
125        fld1=read_nctiles(fil_nctiles,NAME,rec_fld(tt+1));        fld1=read_nctiles(fil_nctiles,NAME,rec_fld(tt+1));

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.22