Changeset 635 for trunk/src/get_file_series.m
 Timestamp:
 May 19, 2013, 11:37:49 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/get_file_series.m
r599 r635 20 20 incr_i=Param.IndexRange.incr_i; 21 21 last_i=Param.IndexRange.last_i; 22 ref_i=first_i:incr_i:last_i; 23 ref_j=[]; 22 % ref_i=first_i:incr_i:last_i; 23 %ref_j=[]; 24 first_j=[];last_j=[];incr_j=1;%default 24 25 if isfield(Param.IndexRange,'first_j') 25 26 first_j=Param.IndexRange.first_j; 26 27 incr_j=Param.IndexRange.incr_j; 27 28 last_j=Param.IndexRange.last_j; 28 ref_j=first_j:incr_j:last_j;29 29 end 30 30 31 31 %% determine the list of input file names 32 32 nbmissing=0; 33 34 for iview=1:size(InputTable,1) 33 NbView=size(InputTable,1); 34 i1_series=cell(NbView,1);% initiate index series with empty cells 35 i2_series=cell(NbView,1); 36 j1_series=cell(NbView,1); 37 j2_series=cell(NbView,1); 38 for iview=1:NbView 35 39 r.mode=''; 36 40 if isfield (Param.IndexRange,'PairString') … … 38 42 Param.IndexRange.PairString={Param.IndexRange.PairString}; 39 43 end 40 r=regexp(Param.IndexRange.PairString{iview,1},'(?<mode>(Di=)(Dj=)) *(?<num1>\d+)\(?<num2>\d+)','names'); 44 r=regexp(Param.IndexRange.PairString{iview,1},'(?<mode>(Di=)(Dj=)) *(?<num1>\d+)\(?<num2>\d+)','names');%look for mode=Dj or Di 41 45 if isempty(r) 42 r=regexp(Param.IndexRange.PairString{iview,1},'(?<num1>\d+)(?<mode>)(?<num2>\d+)','names'); 46 r=regexp(Param.IndexRange.PairString{iview,1},'(?<num1>\d+)(?<mode>)(?<num2>\d+)','names');%look for burst pairs 43 47 end 44 48 % TODO case of free pairs: … … 51 55 r(1).mode='**'; 52 56 else 53 r(1).mode='';57 r(1).mode=''; 54 58 end 55 59 end 56 if isequal(r(1).mode,'**')% free pairs 60 61 if isempty(incr_i)  isempty(incr_j)  isequal(r(1).mode,'**')% free pairs 57 62 FilePath=fullfile(InputTable{iview,1},InputTable{iview,2}); 58 63 fileinput=[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]; 59 [tild,tild,tild,i1_series{iview},i2_series{iview},j1_series{iview},j2_series{iview},NomType,FileType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput); 60 i1_series{iview}=squeeze(i1_series{iview}(1,:,:)); %first pair index 61 check_select=i1_series{iview}>=first_i & i1_series{iview}<=last_i; 62 i1_series{iview}=i1_series{iview}(check_select); 63 i2_series{iview}=[]; %first pair index 64 [tild,tild,tild,i1_series{iview},i2_series{iview},j1_series{iview},j2_series{iview},NomType,FileType,FileInfo,MovieObject,... 65 i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput); 66 i1_series{iview}=squeeze(i1_series{iview}(1,:,:)); %select first pair index as ordered by find_file_series 64 67 j1_series{iview}=squeeze(j1_series{iview}(1,:,:)); %first pair index 65 j2_series{iview}=squeeze(j2_series{iview}(1,:,:)); %first pair index 66 j1_series{iview}=j1_series{iview}(check_select); 67 j2_series{iview}=j2_series{iview}(check_select); 68 j2_series{iview}=squeeze(j2_series{iview}(1,:,:)); %second pair index 69 %check_select=i1_series{iview}>=first_i & i1_series{iview}<=last_i; 70 if isempty(incr_i) 71 if isempty(incr_j) 72 [ref_j,ref_i]=find(i1_series{iview}); 73 ref_i=ref_i1; 74 ref_j=ref_j1; 75 ref_i=ref_i(ref_i>=first_i & ref_i<=last_i); 76 ref_j=ref_j(ref_j>=first_j & ref_j<=last_j); 77 else 78 ref_j=first_j:incr_j:last_j; 79 [tild,ref_i]=find(i1_series{iview}(:,ref_j)); 80 ref_i=ref_i1; 81 ref_i=ref_i(ref_i>=first_i & ref_i<=last_i); 82 end 83 else 84 ref_i=first_i:incr_i:last_i;%default 85 if isempty(incr_j) 86 [ref_j,tild]=find(i1_series{iview}); 87 ref_j=ref_j1; 88 ref_j=ref_j(ref_j>=first_j & ref_j<=last_j); 89 else 90 ref_j=first_j:incr_j:last_j; 91 end 92 end 93 i1_series{iview}=i1_series{iview}(ref_j,ref_i); 94 j1_series{iview}=j1_series{iview}(ref_j,ref_i); 95 if ~isempty(j2_series{iview}) 96 j2_series{iview}=j2_series{iview}(ref_j,ref_i); 97 end 68 98 else 99 ref_i=first_i:incr_i:last_i;%default 100 ref_j=first_j:incr_j:last_j;%default 101 end 102 if ~isequal(r(1).mode,'**')% imposed pairs or single i and/or j index 69 103 [i1_series{iview},i2_series{iview},j1_series{iview},j2_series{iview}]=find_file_indices(ref_i,ref_j,str2num(r.num1),str2num(r.num2),r.mode); 70 104 end 71 105 72 106 %case of pairs (.nc files) 73 107 i2=[];j1=[];j2=[]; … … 83 117 j2=j2_series{iview}(ifile); 84 118 end 85 119 filecell{iview,ifile}=fullfile_uvmat(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,i2,j1,j2); 86 120 end 87 121 end
Note: See TracChangeset
for help on using the changeset viewer.