Changeset 867
- Timestamp:
- Feb 12, 2015, 9:31:47 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field_tps.m
r866 r867 105 105 VarAttribute=[VarAttribute VarAttributeNew]; 106 106 end 107 Attr_FF.Role='errorflag';108 VarAttribute=[VarAttribute {Attr_FF}];107 %Attr_FF.Role='errorflag'; 108 %VarAttribute=[VarAttribute {Attr_FF}]; 109 109 FieldName(check_remove)=[]; 110 110 … … 160 160 end 161 161 end 162 DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang163 nbval(nbval==0)= 1;% to avoid division by zero for averaging162 %DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang 163 nbval(nbval==0)=NaN;% to avoid division by zero for averaging 164 164 ListFieldOut=fieldnames(DataOut); 165 165 for ifield=1:numel(ListFieldOut) -
trunk/src/find_field_bounds.m
r809 r867 41 41 NbDim=max(NbDimArray);% spatial dimension of the input field 42 42 imax=find(NbDimArray==NbDim);% indices of field cells to consider 43 if isfield(Field,'NbDim')44 NbDim=double(Field.NbDim);% deal with plane fields containing z coordinates45 end43 % if isfield(Field,'NbDim') 44 % NbDim=double(Field.NbDim);% deal with plane fields containing z coordinates 45 % end 46 46 FieldOut.NbDim=NbDim; 47 47 if NbDim<=1; return; end% stop here for 1D fields -
trunk/src/find_file_series.m
r809 r867 68 68 i1_series=[];i2_series=[];j1_series=[];j2_series=[]; 69 69 i1_input=1;i2_input=[];j1_input=[];j2_input=[]; 70 if ~exist(fullfileinput,'file') 71 RootFile=''; 72 return 73 end 70 74 end 71 75 if ~exist(FilePath,'dir') … … 74 78 if checkfileindexing 75 79 NomTypePref=''; 76 if isempty(NomType) 80 if isempty(NomType)||strcmp(NomType,'*') 77 81 if exist(fullfileinput,'file') 78 82 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension -
trunk/src/proj_field.m
r866 r867 666 666 667 667 %% identify vector components 668 testU=isfield(CellInfo{icell},'VarIndex_vector_x') &&isfield(CellInfo{icell},'VarIndex_vector_y') ;% test for vectors668 %testU=isfield(CellInfo{icell},'VarIndex_vector_x') &&isfield(CellInfo{icell},'VarIndex_vector_y') ;% test for vectors 669 669 % if testU 670 670 % UName=FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x}; … … 700 700 return 701 701 end 702 ProjData.ListVarName=[ProjData.ListVarName {FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}}];703 ProjData.VarDimName=[ProjData.VarDimName {FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}}];702 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName(CellInfo{icell}.CoordIndex(end))]; 703 ProjData.VarDimName=[ProjData.VarDimName FieldData.ListVarName(CellInfo{icell}.CoordIndex(end))]; 704 704 nbvar=numel(ProjData.ListVarName); 705 705 ProjData.VarAttribute{nbvar}.long_name='abscissa along line'; … … 717 717 ProjData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)})=Xproj; 718 718 for ivar=1:numel(VarIndex) 719 ProjData.(VarName{ivar})=FieldData.(VarName{ivar})(flagsel);% restrict v rtibles to the projection band719 ProjData.(VarName{ivar})=FieldData.(VarName{ivar})(flagsel);% restrict variables to the projection band 720 720 ProjData.(VarName{ivar})=ProjData.(VarName{ivar})(indsort);% sort by absissa 721 721 ProjData.ListVarName=[ProjData.ListVarName VarName{ivar}]; 722 ProjData.VarDimName=[ProjData.VarDimName {FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}}];722 ProjData.VarDimName=[ProjData.VarDimName FieldData.ListVarName(CellInfo{icell}.CoordIndex(end))]; 723 723 ProjData.VarAttribute{nbvar+ivar}=FieldData.VarAttribute{VarIndex(ivar)};%reproduce var attribute 724 724 if isfield(ProjData.VarAttribute{nbvar+ivar},'Role') 725 725 if strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x'); 726 ivar_U= ivar;726 ivar_U=nbvar+ivar; 727 727 elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y'); 728 ivar_V= ivar;728 ivar_V=nbvar+ivar; 729 729 end 730 730 end … … 777 777 end 778 778 [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord,NbCentres,SubRange,FieldVar,CellInfo{icell}.FieldName,cat(3,XI,YI)); 779 ProjData.ListVarName=[ProjData.ListVarName {'X'}]; 780 ProjData.VarDimName=[ProjData.VarDimName {'X'}]; 779 781 ProjData.X=Xproj; 780 782 nbvar=numel(ProjData.ListVarName); … … 784 786 ProjData.VarAttribute=[ProjData.VarAttribute VarAttribute]; 785 787 for ivar=1:numel(VarAttribute) 786 ProjData.VarDimName=[ProjData.VarDimName { XName}];788 ProjData.VarDimName=[ProjData.VarDimName {'X'}]; 787 789 if isfield(VarAttribute{ivar},'Role') 788 790 if strcmp(VarAttribute{ivar}.Role,'vector_x'); -
trunk/src/read_field.m
r822 r867 136 136 Role=[Role {'vector_y'}]; 137 137 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 138 ListInputField=[ListInputField {''}];139 %List Operator=[ListOperator {[r.Operator '_V']}];138 ListInputField=[ListInputField InputField(ilist)]; 139 %ListInputField=[ListInputField {''}]; 140 140 else 141 141 checkV=1; -
trunk/src/series.m
r863 r867 135 135 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series 136 136 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series' 137 ActionExtList={'.m';'.sh' };% default choice of extensions (Matlab fct .m or compiled version .sh137 ActionExtList={'.m';'.sh';'.py (in dev.)'};% default choice of extensions (Matlab fct .m or compiled version .sh 138 138 ActionPathList=cell(NbBuiltinAction,1);%initiate the cell matrix of Action fct paths 139 139 ActionPathList(:)={path_series_fct}; %set the default path to series fcts to all list members … … 620 620 if ~exist(RootPath,'dir') 621 621 i1_series=[]; 622 RootPath=fileparts(RootPath); %will try the upper folder 622 %RootPath=fileparts(RootPath); %will try the upper folder 623 RootFile=''; 623 624 else %scan the input folder 624 625 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=... … … 626 627 end 627 628 % if no file is found, open a browser 628 if isempty( i1_series)629 if isempty(RootFile)&& isempty(i1_series) 629 630 fileinput=uigetfile_uvmat(['wrong input at line ' num2str(iview) ':pick a new input file'],RootPath); 630 631 if isempty(fileinput) … … 722 723 if strcmp(iview,'append') % display the input data as a new line in the table 723 724 iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line 724 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];725 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 725 726 elseif strcmp(iview,'one') % refresh the list of input file series 726 727 iview=1; %the first line in InputTable becomes the current line 727 728 InputTable={'','','','',''}; 728 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];729 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 729 730 set(handles.TimeTable,'Data',[{''},{[]},{[]},{[]},{[]}]) 730 731 set(handles.MinIndex_i,'Data',[]) … … 742 743 SeriesData.Time={}; 743 744 end 745 SeriesData.i1_series(iview+1:end)=[]; 746 SeriesData.i2_series(iview+1:end)=[]; 747 SeriesData.j1_series(iview+1:end)=[]; 748 SeriesData.j2_series(iview+1:end)=[]; 749 SeriesData.FileType(iview+1:end)=[]; 750 SeriesData.FileInfo(iview+1:end)=[]; 751 SeriesData.Time(iview+1:end)=[]; 752 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 744 753 if iview >1 745 754 set(handles.InputLine,'String',num2str(iview)) … … 1396 1405 ActionExt='.m';%default 1397 1406 if isfield(Param.Action,'ActionExt') 1398 ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)1407 ActionExt=Param.Action.ActionExt;% '.m', '.sh' (compiled) or '.py' (Python) 1399 1408 Param.Action=rmfield(Param.Action,'ActionExt');%remove from the recorded xml file to avoid interference during ImportConfig 1400 1409 end … … 1647 1656 set(handles.status,'UserData',StatusData) 1648 1657 1658 1659 if strcmp(ActionExt, '.py (in dev.)') 1660 fprintf([ 1661 '\n' ... 1662 '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n' ... 1663 'The option .py is used. It is still in development.\n' ... 1664 'Do not use it unless you really know what you do!\n' ... 1665 'To try it, first install Pyp and the most recent version of FluidDyn.\n' ... 1666 '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n']) 1667 RunMode = 'python'; 1668 t = struct2xml(Param); 1669 t = set(t, 1, 'name', 'Series'); 1670 filexml = fullfile_uvmat(DirXml, '', Param.InputTable{1,3}, '.xml', OutputNomType,... 1671 Param.IndexRange.first_i, Param.IndexRange.last_i, first_j, last_j); 1672 save(t, filexml); 1673 end 1674 1675 1649 1676 %% direct processing on the current Matlab session 1650 1677 if strcmp (RunMode,'local') … … 1682 1709 end 1683 1710 end 1684 else 1711 elseif ~strcmp(RunMode,'python') 1685 1712 %% processing on a different session of the same computer (background) or cluster, create executable files 1686 1713 batch_file_list=cell(NbProcess,1);% initiate the list of executable files … … 1837 1864 system(oar_command); 1838 1865 msgbox_uvmat('CONFIRMATION',[ActionName ' launched in cluster: press STATUS to see results']) 1866 case 'python' 1867 command = [ 1868 'LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "p.split('':'') | [s for s in p if ''matlab'' not in s] | '':''.join(p)") ' ... 1869 'python -m fluiddyn.postproc.uvmat ' filexml]; 1870 % fprintf(['command:\n' command '\n\n']) 1871 system(command, '-echo'); 1839 1872 end 1840 1873 … … 1859 1892 if isfield(Param,'Pairs') 1860 1893 Param=rmfield(Param,'Pairs'); %info Pairs not needed for output 1894 end 1895 if isfield(Param,'InputLine') 1896 Param=rmfield(Param,'InputLine'); 1897 end 1898 if isfield(Param,'EditObject') 1899 Param=rmfield(Param,'EditObject'); 1861 1900 end 1862 1901 Param.IndexRange.TimeSource=Param.IndexRange.TimeTable{end,1}; … … 2328 2367 SeriesData=get(handles.series,'UserData'); 2329 2368 % input line for which the field choice is relevant 2330 iview=find( strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));% all nc files, icluding civ2369 iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'}));% all nc files, icluding civ 2331 2370 hget_field=findobj(allchild(0),'name','get_field'); 2332 2371 if ~isempty(hget_field) … … 2337 2376 % check the existence of the first file in the series 2338 2377 first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1;%default setting for index j 2339 if isfield(Param.IndexRange,'first_j');% if index j is used 2378 if isfield(Param.IndexRange,'first_j');% if index j is used 2340 2379 first_j=Param.IndexRange.first_j; 2341 2380 last_j=Param.IndexRange.last_j; … … 2346 2385 if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString{iview}; end 2347 2386 [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString); 2348 FirstFileName=fullfile_uvmat(InputTable{1},InputTable{2},InputTable{3},... 2349 InputTable{5},InputTable{4},i1,i2,j1,j2); 2387 LineIndex=iview(1); 2388 if numel(iview)>1 2389 answer=msgbox_uvmat('INPUT_TXT',['select the line of the input table:' num2str(iview)] ,num2str(iview(1))); 2390 LineIndex=str2num(answer); 2391 % InputLine=str2num(get(handles.InputLine,'String')); 2392 % if ismember(InputLine,iview) 2393 % LineIndex=InputLine; 2394 % end 2395 end 2396 FirstFileName=fullfile_uvmat(InputTable{LineIndex,1},InputTable{LineIndex,2},InputTable{LineIndex,3},... 2397 InputTable{LineIndex,5},InputTable{LineIndex,4},i1,i2,j1,j2); 2350 2398 if exist(FirstFileName,'file') 2351 2399 ParamIn.Title='get_field: pick input variables and coordinates for series processing'; … … 2372 2420 XName='X'; 2373 2421 YName='y'; 2374 set(handles.VelType,'visible','on')2375 set(handles.VelType_title,'visible','on')2376 2422 end 2377 2423 set(handles.FieldName,'Value',1) 2378 2424 set(handles.FieldName,'String',[FieldList; {'get_field...'}]); 2379 2425 if ~strcmp(GetFieldData.FieldOption,'civdata...') 2380 set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default 2381 set(handles.VelType,'visible','off') 2382 set(handles.VelType_title,'visible','off') 2426 if ~isempty(regexp(FieldList{1},'^vec')) 2427 set(handles.FieldName,'Value',1) 2428 else 2429 set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default 2430 end 2383 2431 XName=GetFieldData.Coordinates.Coord_x; 2384 2432 YName=GetFieldData.Coordinates.Coord_y; … … 2392 2440 TimeName=['att:' GetFieldData.Time.TimeName]; 2393 2441 % update the time table 2394 TimeTable{ iview,2}=get_time(Param.IndexRange.MinIndex_i(iview),MinIndex_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % Min time2395 TimeTable{ iview,3}=get_time(Param.IndexRange.first_i,first_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % first time2396 TimeTable{ iview,4}=get_time(Param.IndexRange.last_i,last_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % last time2397 TimeTable{ iview,5}=get_time(Param.IndexRange.MaxIndex_i(iview),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % Max time2442 TimeTable{LineIndex,2}=get_time(Param.IndexRange.MinIndex_i(LineIndex),MinIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % Min time 2443 TimeTable{LineIndex,3}=get_time(Param.IndexRange.first_i,first_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % first time 2444 TimeTable{LineIndex,4}=get_time(Param.IndexRange.last_i,last_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % last time 2445 TimeTable{LineIndex,5}=get_time(Param.IndexRange.MaxIndex_i(LineIndex),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % Max time 2398 2446 case 'variable' 2399 2447 set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName]) … … 2409 2457 ParamIn.TimeDimName=GetFieldData.Time.TimeName; 2410 2458 end 2411 TimeTable{ iview,1}=TimeName;2459 TimeTable{LineIndex,1}=TimeName; 2412 2460 set(handles.TimeTable,'Data',TimeTable); 2413 2461 end 2414 2462 set(handles.Coord_x,'String',XName) 2415 2463 set(handles.Coord_y,'String',YName) 2464 set(handles.Coord_x,'Visible','on') 2465 set(handles.Coord_y,'Visible','on') 2416 2466 else 2417 2467 msgbox_uvmat('ERROR',[FirstFileName ' does not exist']) … … 3106 3156 ActionExtList=get(handles.ActionExt,'String'); 3107 3157 ActionExt=ActionExtList{get(handles.ActionExt,'Value')}; 3108 ActionList=get(handles.ActionName,'String'); 3109 ActionName=ActionList{get(handles.ActionName,'Value')}; 3158 if strcmp(ActionExt,'.py (in dev.)') 3159 set(handles.RunMode,'Value',2) 3160 end 3161 % ActionList=get(handles.ActionName,'String'); 3162 % ActionName=ActionList{get(handles.ActionName,'Value')}; 3110 3163 3111 3164 function num_NbProcess_Callback(hObject, eventdata, handles) -
trunk/src/series/aver_stat.m
r810 r867 136 136 for iview=1:NbView 137 137 if ~exist(filecell{iview,1}','file') 138 msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'])138 disp_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun) 139 139 return 140 140 end … … 155 155 diff_time=max(max(diff(time))); 156 156 if diff_time>0 157 msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])157 disp_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun) 158 158 end 159 159 end … … 176 176 FileExtOut='.nc';% write result as .nc files for netcdf inputs 177 177 else 178 msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])178 disp_uvmat('ERROR',['invalid file type input ' FileType{1}],checkrun) 179 179 return 180 180 end 181 181 if NbView==2 && ~isequal(CheckImage{1},CheckImage{2}) 182 msgbox_uvmat('ERROR','input must be two image series or two netcdf file series')182 disp_uvmat('ERROR','input must be two image series or two netcdf file series',checkrun) 183 183 return 184 184 end … … 216 216 % index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice 217 217 nbfiles=0; 218 nbmissing=0;218 % nbmissing=0; 219 219 220 220 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% … … 275 275 [Field,errormsg]=proj_field(Field,Param.ProjObject); 276 276 if ~isempty(errormsg) 277 msgbox_uvmat('ERROR',['error in aver_stat/proj_field:' errormsg])277 disp_uvmat('ERROR',['error in aver_stat/proj_field:' errormsg],checkrun) 278 278 return 279 279 end … … 289 289 DataOut=Field;%default 290 290 DataOut.Conventions='uvmat'; %suppress Conventions='uvmat/civdata' for civ input files 291 for ivar=1:length(Field.ListVarName) 291 errorvar=zeros(numel(Field.ListVarName));%index of errorflag associated to each variable 292 for ivar=1:numel(Field.ListVarName) 292 293 VarName=Field.ListVarName{ivar}; 293 DataOut.(VarName)=double(DataOut.(VarName)); 294 end 295 else %current field 296 for ivar=1:length(Field.ListVarName) 297 VarName=Field.ListVarName{ivar}; 298 sizmean=size(DataOut.(VarName)); 299 siz=size(Field.(VarName)); 300 if ~isequal(DataOut.(VarName),0)&& ~isequal(siz,sizmean) 301 disp_uvmat('ERROR',['unequal size of input field ' VarName ', need to project on a grid'],checkrun) 302 return 294 DataOut.(VarName)=zeros(size(DataOut.(VarName)));% initiate each field to zero 295 NbData.(VarName)=zeros(size(DataOut.(VarName)));% initiate the nbre of good data to zero 296 for iivar=1:length(Field.VarAttribute) 297 if isequal(Field.VarDimName{iivar},Field.VarDimName{ivar})&& isfield(Field.VarAttribute{iivar},'Role')... 298 && strcmp(Field.VarAttribute{iivar}.Role,'errorflag') 299 errorvar(ivar)=iivar; % index of the errorflag variable corresponding to ivar 300 end 301 end 302 end 303 DataOut.ListVarName(errorvar(errorvar~=0))=[]; %remove errorflag from result 304 DataOut.VarDimName(errorvar(errorvar~=0))=[]; %remove errorflag from result 305 DataOut.VarAttribute(errorvar(errorvar~=0))=[]; %remove errorflag from result 306 end %current field 307 for ivar=1:length(DataOut.ListVarName) 308 VarName=Field.ListVarName{ivar}; 309 sizmean=size(DataOut.(VarName)); 310 siz=size(Field.(VarName)); 311 if ~isequal(DataOut.(VarName),0)&& ~isequal(siz,sizmean) 312 disp_uvmat('ERROR',['unequal size of input field ' VarName ', need to project on a grid'],checkrun) 313 return 314 else 315 if errorvar(ivar)==0 316 check_bad=isnan(Field.(VarName));%=0 for NaN data values, 1 else 303 317 else 304 DataOut.(VarName)=DataOut.(VarName)+ double(Field.(VarName)); % update the sum318 check_bad=isnan(Field.(VarName)) | Field.(Field.ListVarName{errorvar(ivar)})~=0;%=0 for NaN or error flagged data values, 1 else 305 319 end 320 Field.(VarName)(check_bad)=0; %set to zero NaN or data marked by error flag 321 DataOut.(VarName)=DataOut.(VarName)+ double(Field.(VarName)); % update the sum 322 NbData.(VarName)=NbData.(VarName)+ ~check_bad;% records the number of data for each point 306 323 end 307 324 end … … 315 332 for ivar=1:length(Field.ListVarName) 316 333 VarName=Field.ListVarName{ivar}; 317 DataOut.(VarName)=DataOut.(VarName)/nbfiles; % normalize the mean 318 end 334 DataOut.(VarName)=DataOut.(VarName)./NbData.(VarName); % normalize the mean 335 end 336 nbmissing=NbField-nbfiles; 319 337 if nbmissing~=0 320 msgbox_uvmat('WARNING',[num2str(nbmissing) ' input files are missing or skipted'])338 disp_uvmat('WARNING',[num2str(nbmissing) ' input files are missing or skipted'],checkrun) 321 339 end 322 340 if isempty(time) % time is read from files -
trunk/src/series/merge_proj.m
r857 r867 196 196 FileExtOut='.nc'; %netcdf output 197 197 end 198 NomTypeOut=NomType;% output file index will indicate the first and last ref index in the series198 %NomTypeOut=NomType;% output file index will indicate the first and last ref index in the series 199 199 RootFileOut=RootFile{1}; 200 200 for iview=2:NbView … … 403 403 end 404 404 errormsg=''; 405 MergeData=Data{1};% merged field= first field by default, reproduces the gl abal attributes of the first field405 MergeData=Data{1};% merged field= first field by default, reproduces the global attributes of the first field 406 406 NbView=length(Data); 407 if NbView==1 408 return 407 if NbView==1% if there is only one field, just reproduce it in MergeData 408 return 409 409 end 410 410 … … 419 419 if NbDim(icell)~=1 % skip field cells which are of dim 1 420 420 switch CellInfo{icell}.CoordType 421 case 'scattered' %case of input fields with unstructured coordinates: just conca cene data421 case 'scattered' %case of input fields with unstructured coordinates: just concatene data 422 422 for ivar=CellInfo{icell}.VarIndex % indices of the selected variables in the list FieldData.ListVarName 423 423 VarName=Data{1}.ListVarName{ivar}; 424 %MergeData=Data{1};% merged field= first field by default, reproduces the glabal attributes of the first field425 424 for iview=2:NbView 426 425 MergeData.(VarName)=[MergeData.(VarName); Data{iview}.(VarName)]; … … 431 430 if isfield(CellInfo{icell},'VarIndex_errorflag') && ~isempty(CellInfo{icell}.VarIndex_errorflag) 432 431 FFName=Data{1}.ListVarName{CellInfo{icell}.VarIndex_errorflag};% name of errorflag variable 432 MergeData.ListVarName(CellInfo{icell}.VarIndex_errorflag)=[];%remove error flag variable in MergeData (will use NaN instead) 433 MergeData.VarDimName(CellInfo{icell}.VarIndex_errorflag)=[]; 434 MergeData.VarAttribute(CellInfo{icell}.VarIndex_errorflag)=[]; 433 435 end 434 436 % select good data on each view … … 441 443 check_bad=isnan(Data{iview}.(VarName)) | Data{iview}.(FFName)~=0;%=0 for NaN or error flagged data values, 1 else 442 444 end 443 Data{iview}.(VarName)(check_bad)=0; %set to zero NaN or masked data445 Data{iview}.(VarName)(check_bad)=0; %set to zero NaN or data marked by error flag 444 446 if iview==1 445 MergeData.(VarName)=Data{1}.(VarName);% correct the field of MergeData447 %MergeData.(VarName)=Data{1}.(VarName);% initiate MergeData with the first field 446 448 NbAver=~check_bad;% initiate NbAver: the nbre of good data for each point 447 449 elseif size(Data{iview}.(VarName))~=size(MergeData.(VarName)) 448 450 errormsg='sizes of the input matrices do not agree, need to interpolate on a common grid using a projection object'; 449 451 return 450 else 451 452 MergeData.(VarName)=MergeData.(VarName) + Data{iview}.(VarName);%add data 452 else 453 MergeData.(VarName)=MergeData.(VarName) +double(Data{iview}.(VarName));%add data 453 454 NbAver=NbAver + ~check_bad;% add 1 for good data, 0 else 454 455 end 455 456 end 456 457 MergeData.(VarName)(NbAver~=0)=MergeData.(VarName)(NbAver~=0)./NbAver(NbAver~=0);% take average of defined data at each point 458 MergeData.(VarName)(NbAver==0)=NaN;% set to NaN the points with no good data 457 459 end 458 460 end 459 if isempty(FFName)460 FFName='FF';461 end462 MergeData.(FFName)(NbAver~=0)=0;% flag to 1 undefined summed data463 MergeData.(FFName)(NbAver==0)=1;% flag to 1 undefined summed data461 % if isempty(FFName) 462 % FFName='FF'; 463 % end 464 % MergeData.(FFName)(NbAver~=0)=0;% flag to 1 undefined summed data 465 % MergeData.(FFName)(NbAver==0)=1;% flag to 1 undefined summed data 464 466 end 465 467 end -
trunk/src/series/time_series.m
r810 r867 207 207 %% Set field names and velocity types 208 208 InputFields{1}=[];%default (case of images) 209 if nbview==2 210 InputFields{2}=[];%default (case of images) 211 end 209 212 if isfield(Param,'InputFields') 210 213 InputFields{1}=Param.InputFields; 211 end 212 if nbview==2 213 InputFields{2}=[];%default (case of images) 214 if isfield(Param,'InputFields') 215 InputFields{2}=Param.InputFields{1};%default 214 if nbview==2 215 InputFields{2}=Param.InputFields;%default 216 216 if isfield(Param.InputFields,'FieldName_1') 217 217 InputFields{2}.FieldName=Param.InputFields.FieldName_1; -
trunk/src/uvmat.m
r866 r867 2818 2818 elseif ref_j_1<0 2819 2819 errormsg='minimum j index reached'; 2820 elseif ref_i_1+1>size(UvData.i1_series{2},3) 2820 elseif ref_i_1+1>size(UvData.i1_series{2},3)&&~isempty(InputFile.NomType_1) 2821 2821 errormsg='maximum i index reached for the second series (reload the input file to update the index bound)'; 2822 elseif ref_j_1+1>size(UvData.i1_series{2},2) 2822 elseif ref_j_1+1>size(UvData.i1_series{2},2)&&~isempty(InputFile.NomType_1) 2823 2823 errormsg='maximum j index reached for the second series(reload the input file to update the index bound)'; 2824 2824 end … … 2826 2826 siz=size(UvData.i1_series{2}); 2827 2827 ref_indices=ref_i_1*siz(1)*siz(2)+ref_j_1*siz(1)+1:ref_i_1*siz(1)*siz(2)+(ref_j_1+1)*siz(1); 2828 i1_subseries=UvData.i1_series{2}(ref_indices); 2829 ref_indices=ref_indices(i1_subseries>0); 2830 if isempty(ref_indices)% case of pairs (free index i) 2831 ref_indices=ref_i_1*siz(1)*siz(2)+1:(ref_i_1+1)*siz(1)*siz(2); 2828 if ~isempty(InputFile.NomType_1) 2832 2829 i1_subseries=UvData.i1_series{2}(ref_indices); 2833 2830 ref_indices=ref_indices(i1_subseries>0); 2834 end 2835 i1_1=UvData.i1_series{2}(ref_indices(end)); 2836 if ~isempty(UvData.i2_series{2}) 2837 i2_1=UvData.i2_series{2}(ref_indices(end)); 2838 end 2839 if ~isempty(UvData.j1_series{2}) 2840 j1_1=UvData.j1_series{2}(ref_indices(end)); 2841 end 2842 if ~isempty(UvData.j2_series{2}) 2843 j2_1=UvData.j2_series{1}(ref_indices(end)); 2831 if isempty(ref_indices)% case of pairs (free index i) 2832 ref_indices=ref_i_1*siz(1)*siz(2)+1:(ref_i_1+1)*siz(1)*siz(2); 2833 i1_subseries=UvData.i1_series{2}(ref_indices); 2834 ref_indices=ref_indices(i1_subseries>0); 2835 end 2836 i1_1=UvData.i1_series{2}(ref_indices(end)); 2837 if ~isempty(UvData.i2_series{2}) 2838 i2_1=UvData.i2_series{2}(ref_indices(end)); 2839 end 2840 if ~isempty(UvData.j1_series{2}) 2841 j1_1=UvData.j1_series{2}(ref_indices(end)); 2842 end 2843 if ~isempty(UvData.j2_series{2}) 2844 j2_1=UvData.j2_series{1}(ref_indices(end)); 2845 end 2844 2846 end 2845 2847 else% the second series (if needed) is the same file as the first … … 3600 3602 %% get bounds and dimensions of the input field 3601 3603 UvData.Field=find_field_bounds(UvData.Field); 3602 3603 3604 testnewseries=UvData.NewSeries; 3604 3605 UvData.NewSeries=0;% put to 0 the test for a new field series (set by RootPath_callback)
Note: See TracChangeset
for help on using the changeset viewer.