 Timestamp:
 Jul 15, 2013, 2:50:47 PM (11 years ago)
 Location:
 trunk/src/series
 Files:

 6 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/series/aver_stat.m
r635 r668 251 251 end 252 252 DataOut=Field;%default 253 DataOut.Conventions='uvmat'; %suppress Conventions='uvmat/civdata' for civ input files 253 254 for ivar=1:length(Field.ListVarName) 254 255 VarName=Field.ListVarName{ivar}; … … 261 262 siz=size(Field.(VarName)); 262 263 if ~isequal(DataOut.(VarName),0)&& ~isequal(siz,sizmean) 263 disp l_uvmat('ERROR',['unequal size of input field ' VarName ', need to project on a grid'],checkrun)264 disp_uvmat('ERROR',['unequal size of input field ' VarName ', need to project on a grid'],checkrun) 264 265 return 265 266 else … … 317 318 %% open the result file with uvmat (in RUN mode) 318 319 if checkrun 319 % hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI320 % delete(hget_field)321 320 uvmat(OutputFile)% open the last result file with uvmat 322 321 end 
trunk/src/series/check_peaklock.m
r592 r668 110 110 for iview=1:nbview 111 111 if ~exist(filecell{iview,1}','file') 112 disp l_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun)112 disp_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun) 113 113 return 114 114 end … … 146 146 [DataOut,tild,errormsg] = read_field(filecell{1,1},FileType{1},InputFields{1},1); 147 147 if ~isempty(errormsg) 148 disp l_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg],checkrun)148 disp_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg],checkrun) 149 149 return 150 150 end … … 211 211 % stop program if the first field reading is in error 212 212 if ~isempty(errormsg) 213 disp l_uvmat('ERROR',['time_series / sub_field / ' errormsg],checkrun)213 disp_uvmat('ERROR',['time_series / sub_field / ' errormsg],checkrun) 214 214 return 215 215 end … … 218 218 nbvar=length(Field.ListVarName); 219 219 if nbvar==0 220 disp l_uvmat('ERROR','no input variable selected',checkrun)220 disp_uvmat('ERROR','no input variable selected',checkrun) 221 221 return 222 222 end … … 227 227 var_role=Field.VarAttribute{ivar}.Role;%'role' of the variable 228 228 if isequal(var_role,'errorflag') 229 disp l_uvmat('ERROR','do not handle error flags in time series',checkrun)229 disp_uvmat('ERROR','do not handle error flags in time series',checkrun) 230 230 return 231 231 end … … 265 265 if isequal(Param.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode 266 266 if isempty(VarVal) 267 disp l_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(index))],checkrun)267 disp_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(index))],checkrun) 268 268 return 269 269 end … … 278 278 VarInit=DataOut.(VarName); 279 279 if isempty(errormsg) && ~isequal(VarVal,VarInit) 280 disp l_uvmat('ERROR',['time series requires constant coordinates ' VarName],checkrun)280 disp_uvmat('ERROR',['time series requires constant coordinates ' VarName],checkrun) 281 281 return 282 282 end … … 331 331 % display nbmissing 332 332 if ~isequal(nbmissing,0) 333 disp l_uvmat('WARNING',[num2str(nbmissing) ' files skipped: missing files or bad input, see command window display'],checkrun)333 disp_uvmat('WARNING',[num2str(nbmissing) ' files skipped: missing files or bad input, see command window display'],checkrun) 334 334 end 335 335 … … 340 340 display([OutputFile ' written']) 341 341 else 342 disp l_uvmat('ERROR',['error in Series/struct2nc: ' errormsg],checkrun)342 disp_uvmat('ERROR',['error in Series/struct2nc: ' errormsg],checkrun) 343 343 end 344 344 
trunk/src/series/civ_input.m
r666 r668 155 155 set(handles.ListPairCiv2,'Value',1) 156 156 set(handles.ListPairCiv2,'String',{''}) 157 if isfield(Param,'ActionInput')158 fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param159 end160 157 161 158 %% prepare the GUI with input parameters … … 229 226 if isfield(SeriesData,'Time') && ~isempty(SeriesData.Time{1}) 230 227 time=SeriesData.Time{1}; 231 %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml232 % if isequal(MaxIndex_i,1) && ~isequal(MaxIndex_j,1)% .Time is a line vector233 % if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D','once'))234 % time=time';235 % MaxIndex_i=MaxIndex_j;236 % MaxIndex_j=1;237 % end238 % end239 228 end 240 229 if isfield(Param.IndexRange,'TimeUnit')&&~isempty(Param.IndexRange.TimeUnit) … … 287 276 ListPairMode_Callback([], [], handles) 288 277 ListPairCiv1_Callback(hObject, eventdata, handles) 289 % for movies don't modify except if the current ref is outside index bounds 290 %if strcmp(ExtInput,'.nc') ~(strcmp(FileType,'mmreader')strcmp(FileType,'VideoReader') && num_ref_i<=MaxIndex_i && num_ref_j<=MaxIndex_j) 291 % if ~isempty(i1)% if i1 has been selected by the input 292 % num_ref_i=i1;%default ref index 293 % if ~isempty(i2) 294 % num_ref_i=floor((num_ref_i+i2)/2); 295 % end 296 % if ~isempty(j1) 297 % num_ref_j=j1; 298 % if ~isempty(j2) 299 % num_ref_j=floor((num_ref_j+j2)/2); 300 % end 301 % end 302 % end 303 % if num_ref_i>MaxIndex_inum_ref_i<MinIndex_i 304 % num_ref_i=round((MinIndex_i+MaxIndex_i)/2); 305 % end 306 % if ~isempty(num_ref_j)&&~isempty(MaxIndex_j)&& ~isempty(MinIndex_j) 307 % if (num_ref_j>MaxIndex_jnum_ref_j<MinIndex_j) 308 % num_ref_j=round((MinIndex_j+MaxIndex_j)/2); 309 % end 310 % end 311 % if isempty(num_ref_j) 312 % num_ref_j=1; 313 % end 314 % 278 279 %% introduce the stored parameters if relevant 280 if isfield(Param,'ActionInput') 281 fill_GUI(Param.ActionInput,hObject);%fill the GUI with the parameters retrieved from the input Param 282 end 283 315 284 %% set the GUI to modal: wait for OK to close 316 285 set(handles.civ_input,'WindowStyle','modal')% Make the GUI modal … … 327 296 % 328 297 % Get default command line output from handles structure 329 varargout{1} = handles.output; 330 delete(handles.civ_input) 298 varargout{1}=[];% default output when civ_input is canceled (no 'OK') 299 if ~isempty(handles) 300 varargout{1} = handles.output; 301 delete(handles.civ_input) 302 end 331 303 332 304 %  Executes when user attempts to close get_field. … … 910 882 find_pair_indices(PairString); 911 883 hseries=findobj(allchild(0),'Tag','series'); 912 %SeriesData=get(hseries,'UserData');913 884 hhseries=guidata(hseries); 914 885 set(hhseries.num_first_j,'String',num2str(ind1)); 915 886 set(hhseries.num_last_j,'String',num2str(ind2)); 916 887 set(hhseries.num_incr_j,'String',num2str(ind2ind1)); 917 918 % displ_num=get(handles.ListPairCiv1,'UserData'); 919 % list_pair2=get(handles.ListPairCiv2,'String');%get the menu of image pairs 920 % if index_pair<=length(list_pair2) 921 % set(handles.ListPairCiv2,'Value',index_pair); 922 % end 923 924 925 %update MinIndex_i and last_i according to the chosen image pairs 926 % mode_list=get(handles.ListPairMode,'String'); 927 % mode_value=get(handles.ListPairMode,'Value'); 928 % mode=mode_list{mode_value}; 929 % if isequal(mode,'series(Di)') 930 % MinIndex_i=str2double(get(handles.MinIndex_i,'String')); 931 % last_i=str2double(get(handles.last_i,'String')); 932 % incr_i=str2double(get(handles.incr_i,'String')); 933 % num_i=MinIndex_i:incr_i:last_i; 934 % lastfield=str2double(get(handles.MaxIndex_i,'String')); 935 % if ~isnan(lastfield) 936 % test_find=(num_ifloor(index_pair/2)*ones(size(num_i))>0)& ... 937 % (num_i+ceil(index_pair/2)*ones(size(num_i))<=lastfield); 938 % num_i=num_i(test_find); 939 % end 940 % set(handles.MinIndex_i,'String',num2str(num_i(1))); 941 % set(handles.last_i,'String',num2str(num_i(end))); 942 % elseif isequal(mode,'series(Dj)') 943 % MinIndex_j=str2double(get(handles.MinIndex_j,'String')); 944 % last_j=str2double(get(handles.last_j,'String')); 945 % incr_j=str2double(get(handles.incr_j,'String')); 946 % num_j=MinIndex_j:incr_j:last_j; 947 % lastfield2=str2double(get(handles.MaxIndex_j,'String')); 948 % if ~isnan(lastfield2) 949 % test_find=(num_jfloor(index_pair/2)*ones(size(num_j))>0)& ... 950 % (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2); 951 % num_j=num_j(test_find); 952 % end 953 % set(handles.MinIndex_j,'String',num2str(num_j(1))); 954 % set(handles.last_j,'String',num2str(num_j(end))); 955 % end 888 set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))%civ2 selection the same as civ& by default 889 956 890 957 891 % 
trunk/src/series/civ_series.m
r661 r668 45 45 if isstruct(Param) && isequal(Param.Action.RUN,0) 46 46 Data=civ_input(Param);% introduce the civ parameters using the GUI civ_input 47 if isempty(Data) 48 Data=Param;% if civ_input has been cancelled, keep previous parameters 49 end 47 50 Data.Program=mfilename;%gives the name of the current function 48 51 Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) … … 74 77 checkrun=0; 75 78 end 79 if ~isfield(Param,'ActionInput') 80 disp_uvmat('ERROR','no parameter set for PIV',checkrun) 81 return 82 end 76 83 hseries=findobj(allchild(0),'Tag','series'); 77 84 RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series … … 90 97 [filecell,i_series,tild,j_series]=get_file_series(Param); 91 98 if ~exist(filecell{1,1},'file') 92 disp l_uvmat('ERROR',' the first input file does not exist')99 disp_uvmat('ERROR',' the first input file does not exist',checkrun) 93 100 return 94 101 else … … 180 187 [FileType_B,FileInfo,VideoObject_B]=get_file_type(filecell{2,1}); 181 188 if ~ismember(FileType_B,{'image','multimage','mmreader','video'}) 182 disp l_uvmat('ERROR',['the file line ' num2str(iview_B) ' must be an image'])189 disp_uvmat('ERROR',['the file line ' num2str(iview_B) ' must be an image'],checkrun) 183 190 end 184 191 i1_series_Civ1=i_series{1};i1_series_Civ2=i_series{1}; … … 453 460 par_civ2.ImageB=[]; 454 461 % if ~isfield(Param.Civ1,'ImageA') 455 ImageName_A_Civ2=fullfile_uvmat(RootPath ,SubDir,RootFile,FileExt,NomType,i1_series_Civ2(ifield),[],j1_series_Civ2(ifield));462 ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ2(ifield),[],j1_series_Civ2(ifield)); 456 463 457 464 if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield)) … … 460 467 [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ2(ifield)); 461 468 end 462 ImageName_B_Civ2=fullfile_uvmat(RootPath ,SubDir,RootFile,FileExt,NomType,i2_series_Civ2(ifield),[],j2_series_Civ2(ifield));469 ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ2(ifield),[],j2_series_Civ2(ifield)); 463 470 if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_Civ1(ifield),FrameIndex_B_Civ2) 464 471 par_civ2.ImageB=par_civ1.ImageB; … … 467 474 end 468 475 469 ncfile=fullfile_uvmat(RootPath ,OutputDir,RootFile,'.nc',NomTypeNc,i1_series_Civ2(ifield),i2_series_Civ2(ifield),...476 ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ2(ifield),i2_series_Civ2(ifield),... 470 477 j1_series_Civ2(ifield),j2_series_Civ2(ifield)); 471 478 par_civ2.ImageWidth=FileInfo_A.Width; … … 996 1003 j1_series=ones(size(i_series));% set of first image numbers 997 1004 j2_series=ones(size(i_series)); 998 check_bounds=false(size(i_series));999 1005 r=regexp(str_civ,'^\D(?<ind>[ij])=(  )(?<num1>\d+)\(?<num2>\d+)','names'); 1000 1006 if ~isempty(r) … … 1003 1009 ind2=str2num(r.num2); 1004 1010 else 1005 mode=' burst';1011 mode='j1j2'; 1006 1012 r=regexp(str_civ,'^j= (?<num1>[az])(?<num2>[az])','names'); 1007 1013 if ~isempty(r) … … 1042 1048 NomTypeNc='_1_12'; 1043 1049 else %bursts 1044 j1_series=ind1*ones(size(i_series)); 1045 j2_series=ind2*ones(size(i_series)); 1046 end 1047 1048 1049 1050 1050 i1_series=i_series(1,:);% do not sweep the j index 1051 i2_series=i_series(1,:); 1052 j1_series=ind1*ones(1,size(i_series,2));% j index is fixed by pair choice 1053 j2_series=ind2*ones(1,size(i_series,2)); 1054 check_bounds=zeros(size(i1_series));% no limitations due to minmax indices 1055 end 1056 1057 1058 1059 
trunk/src/series/merge_proj.m
r642 r668 111 111 for iview=1:NbView 112 112 if ~exist(filecell{iview,1}','file') 113 disp l_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun)113 disp_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun) 114 114 return 115 115 end … … 129 129 diff_time=max(max(diff(time))); 130 130 if diff_time>0 131 disp l_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun)131 disp_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun) 132 132 end 133 133 end … … 150 150 FileExtOut='.nc';% write result as .nc files for netcdf inputs 151 151 else 152 disp l_uvmat('ERROR',['invalid file type input ' FileType{1}],checkrun)152 disp_uvmat('ERROR',['invalid file type input ' FileType{1}],checkrun) 153 153 return 154 154 end 155 155 for iview=1:NbView 156 156 if ~isequal(CheckImage{iview},CheckImage{1})~isequal(CheckNc{iview},CheckNc{1}) 157 disp l_uvmat('ERROR','input set of input series: need either netcdf either image series',checkrun)157 disp_uvmat('ERROR','input set of input series: need either netcdf either image series',checkrun) 158 158 return 159 159 end … … 162 162 163 163 %% mask (TODO: case of multilevels) 164 MaskData=cell(NbView,1); 164 165 if Param.CheckMask 165 MaskData=cell(NbView,1); 166 MaskSubDir=regexprep(Param.InputTable{iview,2},'\..*','');%take the root part of SubDir, before the first dot '.' 167 MaskName=fullfile(Param.InputTable{iview,1},[MaskSubDir '.mask'],'mask_1.png'); 168 if exist(MaskName,'file') 169 [MaskData{iview},tild,errormsg] = read_field(MaskName,'image'); 166 for iview=1:numel(Param.MaskTable) 167 % MaskData=cell(NbView,1); 168 % MaskSubDir=regexprep(Param.InputTable{iview,2},'\..*','');%take the root part of SubDir, before the first dot '.' 169 % MaskName=fullfile(Param.InputTable{iview,1},[MaskSubDir '.mask'],'mask_1.png'); 170 % if exist(MaskName,'file') 171 [MaskData{iview},tild,errormsg] = read_field(Param.MaskTable{iview},'image'); 170 172 if ~isempty(transform_fct) && nargin(transform_fct)>=2 171 MaskData{iview}=transform_fct(MaskData ,XmlData{iview});173 MaskData{iview}=transform_fct(MaskData{iview},XmlData{iview}); 172 174 end 173 175 end … … 301 303 GeometryCal.Tx_Ty_Tz=[T_x T_y 1]; 302 304 ImaDoc.GeometryCalib=GeometryCal; 303 % t=struct2xml(ImaDoc);304 % t=set(t,1,'name','ImaDoc');305 % save(t,[filebase_merge '.xml'])306 % display([filebase_merge '.xml saved'])307 305 else 308 306 MergeData.ListGlobalAttribute={'Conventions','Project','InputFile_1','InputFile_end','nb_coord','nb_dim','dt','Time','civ'}; … … 351 349 352 350 %% group the variables (fields of 'Data') in cells of variables with the same dimensions 353 [Cell VarIndex,NbDim,VarTypeCell]=find_field_cells(Data{1});351 [CellInfo,NbDim,errormsg]=find_field_cells(Data{1}); 354 352 %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS 355 353 % CellVarIndex=cells of variable index arrays 356 for icell=1:length(Cell VarIndex)354 for icell=1:length(CellInfo) 357 355 if NbDim(icell)==1 358 continue 359 end 360 VarIndex=CellVarIndex{icell};% indices of the selected variables in the list FieldData.ListVarName 361 VarType=VarTypeCell{icell}; 362 ivar_X=VarType.coord_x; 363 ivar_Y=VarType.coord_y; 364 ivar_FF=VarType.errorflag; 356 continue% skip field cells which are of dim 1 357 end 358 VarIndex=CellInfo{icell}.VarIndex;% indices of the selected variables in the list FieldData.ListVarName 359 % VarType=VarTypeCell{icell}; 360 ivar_X=CellInfo{icell}.CoordIndex(1); 361 ivar_Y=CellInfo{icell}.CoordIndex(2); 362 % ivar_Y=VarType.coord_y; 363 ivar_FF=CellInfo{icell}.VarIndex_errorflag; 365 364 if isempty(ivar_X) 366 365 test_grid=1;%test for input data on regular grid (e.g. image)coordinates 367 366 else 368 367 if length(ivar_Y)~=1 369 disp l_uvmat('ERROR','y coordinate missing in proj_field.m',checkrun)368 disp_uvmat('ERROR','y coordinate missing in proj_field.m',checkrun) 370 369 return 371 370 end … … 373 372 end 374 373 %case of input fields with unstructured coordinates 375 if ~test_grid374 if isequal(CellInfo{icell}.CoordType,'scattered') 376 375 for ivar=VarIndex 377 376 VarName=MergeData.ListVarName{ivar}; 
trunk/src/series/time_series.m
r656 r668 104 104 for iview=1:nbview 105 105 if ~exist(filecell{iview,1}','file') 106 disp l_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun)106 disp_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun) 107 107 return 108 108 end … … 122 122 diff_time=max(max(diff(time))); 123 123 if diff_time>0 124 disp l_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun)124 disp_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun) 125 125 end 126 126 time=time(1,:);% choose the time data from the first sequence … … 140 140 %% check the validity of the input file types 141 141 if ~CheckImage{1}&&~CheckNc{1} 142 disp l_uvmat('ERROR',['invalid file type input ' FileType{1}],checkrun)142 disp_uvmat('ERROR',['invalid file type input ' FileType{1}],checkrun) 143 143 return 144 144 end 145 145 if nbview==2 && ~isequal(CheckImage{1},CheckImage{2}) 146 disp l_uvmat('ERROR','input must be two image series or two netcdf file series',checkrun)146 disp_uvmat('ERROR','input must be two image series or two netcdf file series',checkrun) 147 147 return 148 148 end … … 182 182 [DataOut,tild,errormsg] = read_field(filecell{1,1},FileType{1},InputFields{1},1); 183 183 if ~isempty(errormsg) 184 disp l_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg],checkrun)184 disp_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg],checkrun) 185 185 return 186 186 end … … 278 278 % stop program if the first field reading is in error 279 279 if ~isempty(errormsg) 280 disp l_uvmat('ERROR',['time_series / sub_field / ' errormsg],checkrun)280 disp_uvmat('ERROR',['time_series / sub_field / ' errormsg],checkrun) 281 281 return 282 282 end … … 285 285 nbvar=length(Field.ListVarName); 286 286 if nbvar==0 287 disp l_uvmat('ERROR','no input variable selected',checkrun)287 disp_uvmat('ERROR','no input variable selected',checkrun) 288 288 return 289 289 end … … 294 294 var_role=Field.VarAttribute{ivar}.Role;%'role' of the variable 295 295 if isequal(var_role,'errorflag') 296 disp l_uvmat('ERROR','do not handle error flags in time series',checkrun)296 disp_uvmat('ERROR','do not handle error flags in time series',checkrun) 297 297 return 298 298 end … … 332 332 if isequal(Param.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode 333 333 if isempty(VarVal) 334 disp l_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(index))],checkrun)334 disp_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(index))],checkrun) 335 335 return 336 336 end … … 345 345 VarInit=DataOut.(VarName); 346 346 if isempty(errormsg) && ~isequal(VarVal,VarInit) 347 disp l_uvmat('ERROR',['time series requires constant coordinates ' VarName ': use projection mode interp'],checkrun)347 disp_uvmat('ERROR',['time series requires constant coordinates ' VarName ': use projection mode interp'],checkrun) 348 348 return 349 349 end … … 414 414 % display nbmissing 415 415 if ~isequal(nbmissing,0) 416 disp l_uvmat('WARNING',[num2str(nbmissing) ' files skipped: missing files or bad input, see command window display'],checkrun)416 disp_uvmat('WARNING',[num2str(nbmissing) ' files skipped: missing files or bad input, see command window display'],checkrun) 417 417 end 418 418 … … 423 423 display([OutputFile ' written']) 424 424 else 425 disp l_uvmat('ERROR',['error in Series/struct2nc: ' errormsg],checkrun)425 disp_uvmat('ERROR',['error in Series/struct2nc: ' errormsg],checkrun) 426 426 end 427 427
Note: See TracChangeset
for help on using the changeset viewer.