- Timestamp:
- Feb 23, 2026, 3:58:54 PM (8 days ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
-
fill_GUI.m (modified) (3 diffs)
-
find_file_series.m (modified) (5 diffs)
-
get_field.fig (modified) (previous)
-
get_field.m (modified) (10 diffs)
-
nc2struct.m (modified) (1 diff)
-
num2stra.m (modified) (2 diffs)
-
read_multimadoc.m (modified) (1 diff)
-
series.m (modified) (15 diffs)
-
series/filter_time_singlefile.m (modified) (5 diffs)
-
series/merge_proj.m (modified) (2 diffs)
-
struct2nc.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fill_GUI.m
r1127 r1194 33 33 errormsg=''; 34 34 if ~isstruct(Param) 35 errormsg='first input par maeter of fill_GUI must be a structure';35 errormsg='first input parameter of fill_GUI must be a structure'; 36 36 return 37 37 end … … 91 91 end 92 92 for ibox=1:numel(hh) 93 % finalise the update of GUI uicontrol filled by the input element93 % finalise the update of GUI uicontrol filled by the input element 94 94 if ~isempty(hh(ibox))&& ~check_done 95 95 set(hh(ibox),'Visible','on')% make the filled GUI element visible … … 104 104 if isnumeric(input_data) 105 105 if numel(input_data)>0 106 input_string=num2str(input_data(ibox),4); 106 if floor(input_data(ibox))==input_data(ibox) 107 input_string=num2str(input_data(ibox)); % case of integers, write in full 108 else 109 input_string=num2str(input_data(ibox),4);%case of floating point:nbre_digit=4; 110 end 107 111 end 108 112 elseif ischar(input_data) -
trunk/src/find_file_series.m
r1181 r1194 1 1 %'find_file_series': check the content of an input file and find the corresponding file series 2 2 %-------------------------------------------------------------------------- 3 % function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput ,checkxml)3 % function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput) 4 4 % 5 5 % OUTPUT: … … 7 7 % SubDir: data dir containing the input file series 8 8 % RootFile: root file detected in fileinput, possibly modified for movies (indexing is then done on image view, not file) 9 % i1_series(pair,ref_j+1, ref_i+1),i2_series,j1_series,j2_series: set of indices (i1,i2,j1,j2) sorted by ref index ref_i, ref_j, and pairindex in case of multiple pairs with the same ref 10 % (ref_i+1 is used to deal with the image index zero sometimes used) 9 % i1_series(pair,ref_j+1, ref_i+1): set of indices i1 sorted by ref index ref_i, ref_j, and pair index in case of multiple pairs with the same ref. 10 % (ref_i+1 is used to deal with the image index zero sometimes used) 11 % i2_series,j1_series,j2_series: same as i1_series but for the indices i2,j1,j2. 12 % 11 13 % NomType: nomenclature type corrected after checking the first file (problem of 0 before the number string) 12 14 % FileInfo: structure containing info on the input files (assumed identical on the whole series) … … 24 26 % FilePath: path to the directory to be scanned 25 27 % fileinput: name (without path) of the input file sample 26 % checkxml: =1(default) take into account xml file existence to possibly include indexes in RootFile27 % =0: do not take into account xml file existence28 28 29 29 %======================================================================= … … 45 45 %======================================================================= 46 46 47 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput ,checkxml)47 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput) 48 48 %------------------------------------------------------------------------ 49 49 … … 75 75 end 76 76 else 77 %% if checkxml=1, possibly include the first index in the root name, if there exists a corresponding xml file 78 if ~exist('checkxml','var')||checkxml 79 r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType 80 if ~isempty(r) %if NomType begins by a number or _1 81 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 82 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected 83 rr=regexp(fileinput_end,'^(?<i1>\d+)','names'); 84 else% if a separator '_' is detected 85 rr=regexp(fileinput_end,'^(?<i1>_\d+)','names'); 86 end 87 if ~isempty(rr) 88 RootFile_i=[RootFile rr.i1];% new root file 89 %look for an xml file correspoonding to the new root name 90 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 91 RootFile=RootFile_i; 92 NomTypePref=r.tiretnum; 93 NomType=regexprep(NomType,['^' NomTypePref],''); 94 i1_input=j1_input; 95 i2_input=j2_input; 96 j1_input=[]; 97 j2_input=[]; 98 end 99 end 100 end 101 end 77 102 78 103 79 %% analyse the list of existing files when relevant -
trunk/src/get_field.m
r1162 r1194 428 428 pos(2)=pos_coord(2)-pos(4)-2; 429 429 set(handles.PanelScalar,'Position',pos) 430 set(handles.Coord_x,'Visible','on') 430 431 set(handles.Coord_y,'Visible','on') 431 432 set(handles.Y_title,'Visible','on') … … 507 508 %------------------------------------------------------------------------ 508 509 Field=get(handles.get_field,'UserData'); 509 VarIndex=find(strcmp(VarName,Field.Display.ListVarName),1); 510 DimCell=Field.Display.VarDimName{VarIndex}; 510 VarIndex=find(strcmp(VarName,Field.Display.ListVarName),1);% find the index of the input coord variable 511 DimCell=Field.Display.VarDimName{VarIndex};% dimension(s) of the input coord variable 511 512 512 513 513 514 %% set list of possible coordinates 514 515 test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante 516 517 for ilist=1:numel(Field.Display.VarDimName) 518 %dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist 519 % if isequal(dimnames,DimCell)||isequal(dimnames(1:end-1),DimCell)||isequal(dimnames(2:end),DimCell) 520 % if numel(dimnames)==1 || 521 % test_coord(ilist)=1; 522 % end 523 end 524 ListCoord=Field.Display.ListVarName;%(find(test_coord)); 515 if isequal(get(handles.FieldOption,'Value'),1)% case of 1D plot 516 test_coord=false(size(Field.Display.VarDimName)); %=true when variable #ilist is eligible as ordinate 517 for ilist=1:numel(Field.Display.VarDimName) 518 dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist 519 if isequal(dimnames,DimCell)&& ~strcmp(Field.Display.ListVarName{ilist},VarName) %exclude the the same variable as coord_y 520 test_coord(ilist)=true; 521 elseif numel(dimnames)==2 && (isequal(dimnames(1),DimCell)||isequal(dimnames(2),DimCell)) 522 test_coord(ilist)=true; 523 end 524 end 525 ListCoord=Field.Display.ListVarName(test_coord); 526 else 527 ListCoord=Field.Display.ListVarName; 528 end 525 529 set(handles.Coord_y,'String',ListCoord) 526 530 val_y=1; … … 605 609 606 610 %% set list of possible coordinates 607 test_component= zeros(size(Field.Display.VarDimName));%=1 when variable #ilist is eligible as unstructured coordinate608 test_coord= zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante611 test_component=false(size(Field.Display.VarDimName));%=1 when variable #ilist is eligible as unstructured coordinate 612 test_coord=false(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante 609 613 dim_var=Field.Display.VarDimName{scalar_index};%list of dimensions of the selected variable 610 %if ~get(handles.CheckDimensionX,'Value') 614 611 615 %look for coordinate variables among the other variables 612 616 for ilist=1:numel(Field.Display.VarDimName) 613 617 dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist 614 618 if isequal(dimnames,dim_var) 615 test_component(ilist)= 1;% the listed variable has the same dimension as the selected scalar-> possibly chosen as unstructured coordinate619 test_component(ilist)=true;% the listed variable has the same dimension as the selected scalar-> possibly chosen as unstructured coordinate 616 620 elseif numel(dimnames)==1 && ~isempty(find(strcmp(dimnames{1},dim_var), 1))%variable ilist is a 1D array which can be coordinate variable 617 test_coord(ilist)=1; 618 end 619 end 620 %end 621 test_coord(ilist)=true; 622 % if strcmp(dimnames{1},Field.Display.ListVarName{ilist})% case of diemnsion with same name as the variable 623 % test_select(ilist)=true 624 end 625 end 626 621 627 var_component=find(test_component);% list of variable indices elligible as unstructured coordinates 622 628 var_coord=find(test_coord);% % list of variable indices elligible as gridded coordinates 623 index_coord=[];624 index_component=[];625 for iscalar=1:numel(scalar_index)626 index_component=[index_component find(var_component==scalar_index(iscalar),1)];627 index_coord=[index_coord find(var_coord==scalar_index(iscalar),1)];628 end629 var_component(index_component)=[];630 var_coord(index_coord)=[];629 % index_coord=[]; 630 % index_component=[]; 631 % for iscalar=1:numel(scalar_index) 632 % index_component=[index_component find(var_component==scalar_index(iscalar),1)]; 633 % index_coord=[index_coord find(var_coord==scalar_index(iscalar),1)]; 634 % end 635 % var_component(index_component)=[]; 636 % var_coord(index_coord)=[]; 631 637 ListCoord=Field.Display.ListVarName([var_coord var_component]); 632 coord_val=zeros(size(ListCoord));638 %coord_val=zeros(size(ListCoord)); 633 639 634 640 %% set default selection for grid coordinates 635 if numel(var_coord)>=2636 coord_val(1)=var_coord(end);637 coord_val(2)=var_coord(end-1);638 if numel(var_coord)>=3639 coord_val(3)=var_coord(end-2);640 end641 end641 % if numel(var_coord)>=2 642 % coord_val(1)=var_coord(end); 643 % coord_val(2)=var_coord(end-1); 644 % if numel(var_coord)>=3 645 % coord_val(3)=var_coord(end-2); 646 % end 647 % end 642 648 % if numel(find(test_coord))>3 643 649 % SwitchVarIndexTime=get(handles.SwitchVarIndexTime,'String'); … … 649 655 % SwitchVarIndexTime_Callback([], [], handles) 650 656 % end 657 coord_val=[]; 651 658 652 659 %% default selection for labelled unstructured coordinates … … 664 671 end 665 672 end 666 if numel(find(coord_val))<2 % no predefiend components 667 if numel(var_coord)>=3 668 coord_val(3)=3; 669 end 670 coord_val([1 2])=[1 2]; 673 % if numel(find(coord_val))<2 % no predefined components 674 % if numel(var_coord)>=3 675 % coord_val(3)=3; 676 % end 677 % coord_val([1 2])=[1 2]; 678 % end 679 %% structured coordinates 680 if isempty(coord_val)% structured coordinates 681 if numel(dim_var)>=3 682 ind_select3=find(strcmp(dim_var{3},ListCoord), 1); 683 if ~isempty(ind_select3) 684 coord_val(3)=ind_select3; 685 end 686 end 687 ind_select1=find(strcmp(dim_var{2},ListCoord)); 688 if ~isempty(ind_select1) 689 coord_val(1)=ind_select1; 690 end 691 ind_select2=find(strcmp(dim_var{1},ListCoord)); 692 if ~isempty(ind_select2) 693 coord_val(2)=ind_select2; 694 end 671 695 end 672 696 … … 676 700 set(handles.Coord_y,'Value',coord_val(2)) 677 701 set(handles.Coord_y,'String',ListCoord) 678 if numel( find(coord_val))>=3702 if numel(dim_var)>=3 679 703 set(handles.Coord_z,'Value',coord_val(3)) 680 704 set(handles.Coord_z,'String',ListCoord) … … 882 906 string=get(handles.Coord_x,'String'); 883 907 VarName=string{index}; 884 if ~ischar(DimCell) 885 update_field(handles,VarName) 908 if ~ischar(DimCell)% no dimension as input 909 update_field(handles,VarName)% update the display of the variable 'VarName' and its dimensions in the general list of variables 886 910 end 887 911 if isequal(get(handles.FieldOption,'Value'),1) 888 set_coord_y_options(handles,VarName)912 set_coord_y_options(handles,VarName) 889 913 end 890 914 … … 899 923 900 924 if ~ischar(DimCell) 901 update_field(handles,VarName)925 update_field(handles,VarName) 902 926 end 903 927 … … 911 935 VarName=string{index}; 912 936 if ~ischar(DimCell) 913 update_field(handles,VarName)937 update_field(handles,VarName) 914 938 end 915 939 … … 1003 1027 end 1004 1028 1005 1006 1007 % % --- Executes on button press in CheckDimensionY. 1008 % function CheckDimensionY_Callback(hObject, eventdata, handles) 1009 % FieldList=get(handles.FieldOption,'String'); 1010 % FieldOption=FieldList{get(handles.FieldOption,'Value')}; 1011 % switch FieldOption 1012 % case '1D plot' 1013 % 1014 % case {'scalar','pick variables'} 1015 % scalar_Callback(hObject, eventdata, handles) 1016 % case 'vectors' 1017 % end 1018 % 1019 % 1020 % % --- Executes on button press in CheckDimensionZ. 1021 % function CheckDimensionZ_Callback(hObject, eventdata, handles) 1022 % FieldList=get(handles.FieldOption,'String'); 1023 % FieldOption=FieldList{get(handles.FieldOption,'Value')}; 1024 % switch FieldOption 1025 % case '1D plot' 1026 % 1027 % case 'scalar' 1028 % scalar_Callback(hObject, eventdata, handles) 1029 % case 'vectors' 1030 % end 1031 1029 %------------------------------------------------------------------------ 1032 1030 % --- Executes on selection change in TimeName. 1031 %------------------------------------------------------------------------ 1033 1032 function TimeName_Callback(hObject, eventdata, handles) 1034 1033 -
trunk/src/nc2struct.m
r1181 r1194 284 284 return 285 285 end 286 ind_vec(index_time)=TimeIndex -1;% selected index(or indices) to read286 ind_vec(index_time)=TimeIndex(1)-1;% selected index(or indices) to read 287 287 ind_size(index_time)=numel(TimeIndex);%length of the selected set of time indices 288 288 if numel(TimeIndex)==1 && ~strcmp(VarName,TimeVarName) -
trunk/src/num2stra.m
r1127 r1194 8 8 % INPUT: 9 9 % num: input number (file index) 10 % nom_type: nomenc alture type (see fct name_generator)11 % index: 1 or 2 (first or seco dnindex in file naming)10 % nom_type: nomenclature type (see fct name_generator) 11 % index: 1 or 2 (first or second index in file naming) 12 12 % see also: stra2num, name_generator, name2display 13 13 … … 37 37 switch index 38 38 case 1 39 % if length(nom_type)>=4 && isequal(nom_type(1:2),'%0') && isequal(nom_type(4),'d')40 % str=num2str(num,nom_type(1:4));41 % else42 39 str=num2str(num); 43 % end44 40 case 2 45 41 if ~isempty(nom_type) && (isequal(nom_type(end),'a')||isequal(nom_type(end),'b')) -
trunk/src/read_multimadoc.m
r1184 r1194 79 79 function time=get_time(timeimadoc,i1_series,i2_series,j1_series,j2_series) 80 80 time=[]; 81 if ~ (isempty(i2_series)||size(timeimadoc,1) < i2_series(end) ||( ~isempty(j2_series) && size(timeimadoc,2) < j2_series(end)))% time array absent or too short in ImaDoc xml file'81 if ~ (isempty(i2_series)||size(timeimadoc,1) < i2_series(end)+1 ||( ~isempty(j2_series) && size(timeimadoc,2) < j2_series(end)+1))% time array absent or too short in ImaDoc xml file' 82 82 if isempty(j1_series) 83 83 j1_series=1; -
trunk/src/series.m
r1193 r1194 650 650 j1=str2double(get(handles.num_first_j,'String')); 651 651 j2=[];%default 652 PairString=get(handles.PairString,'Data'); 653 if numel(PairString)>=iview 654 r=regexp(PairString{iview},'(?<num1>\d+)-(?<num2>\d+)' ,'names'); 655 if ~isempty(r) 656 j1=str2double(r.num1); 657 j2=str2double(r.num2); 658 end 659 end 660 InputFile=fullfile_uvmat('','',InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,[],j1,j2); 652 % PairString=get(handles.PairString,'Data'); 653 % if numel(PairString)>=iview 654 % r=regexp(PairString{iview},'(?<num1>\d+)-(?<num2>\d+)' ,'names'); 655 % if ~isempty(r) 656 % j1=str2double(r.num1); 657 % j2=str2double(r.num2); 658 % end 659 % end 660 InputFile=[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]; 661 %InputFile=fullfile_uvmat('','',InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,[],j1,j2); 661 662 [RootPath,~,RootFile,Param.i1_series,Param.i2_series,Param.j1_series,Param.j2_series,~,Param.FileInfo,MovieObject]=... 662 663 find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),InputFile); … … 814 815 SeriesData.j1_series={}; 815 816 SeriesData.j2_series={}; 816 SeriesData.FileType={};817 % SeriesData.FileType={}; 817 818 SeriesData.FileInfo={}; 818 819 SeriesData.Time={}; … … 1067 1068 1068 1069 %% get index range in case of relabeling 1069 if ~isempty(Param.XmlData.Time)1070 if isfield(Param,'XmlData') && ~isempty(Param.XmlData.Time) 1070 1071 Time=Param.XmlData.Time; 1071 1072 MinIndex_i=1; … … 1075 1076 TimeName='xml'; 1076 1077 else 1077 [nbfield,nbfield_j]=size(XmlData.Time); 1078 InputTable=get(handles.InputTable,'Data'); 1079 [XmlFileName,Rank]=find_imadoc(InputTable{iview,1},InputTable{iview,2}); 1080 if isempty(XmlFileName) 1081 return 1082 else 1083 Param.XmlData=read_imadoc(XmlFileName); 1084 end 1085 [nbfield,nbfield_j]=size(Param.XmlData.Time); 1078 1086 nbfield=nbfield-1; %remove the possible index 0 1079 1087 nbfield_j=nbfield_j-1; %remove the possible index 0 … … 1089 1097 %i1=(first_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index 1090 1098 i1=1; 1091 if strcmp(SeriesData.TimeName,'xml')% indices i and j1099 if isfield(SeriesData,'TimeName') && strcmp(SeriesData.TimeName,'xml')% indices i and j 1092 1100 j1=mod(i1-1,nbfield_j)+first_j; 1093 1101 i1=floor((i1-1)/nbfield_j)+1; … … 1096 1104 end 1097 1105 end 1098 % set(handles.num_first_i,'String',num2str(i1))1099 % % last_i=str2double(get(handles.num_last_i,'String'));1100 % % last_j=str2double(get(handles.num_last_j,'String'));1101 % % i1=(last_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index1102 % % if strcmp(SeriesData.TimeName,'xml')% indices i and j1103 % % j1=mod(i1-1,nbfield_j)+1;1104 % % i1=floor((i1-1)/nbfield_j)+1;1105 % % end1106 % set(handles.num_last_i,'String',num2str(nbfield))1107 % set(handles.num_last_j,'String',num2str(nbfield_j))1108 % % else1109 1110 1111 1112 1113 % %% case of possible index relabeling from xml info1114 % if isfield(XmlData,'FileSeries')&& strcmp(FileInfo.FileType,'multimage')1115 % answer=msgbox_uvmat('INPUT_Y-N','relabel the frame indices according to the xml info?');1116 % if strcmp(answer,'Yes')1117 % set(handles.Relabel,'Visible','on')1118 % set(handles.Relabel,'Value',1)1119 % SeriesData.FileSeries{iview}=XmlData.FileSeries;1120 % TimeMin=Time(2,2);1121 % TimeMax=Time(end,end);1122 % TimeFirst=TimeMin;1123 % TimeLast=TimeMax;1124 % end1125 % elseif iview==11126 % set(handles.Relabel,'Visible','off')1127 % end1128 1106 1129 1107 if isfield(Param,'FileInfo') && ~isempty(Param.FileInfo) && strcmp(Param.FileInfo.FileType,'rdvision') … … 1137 1115 end 1138 1116 TimeMin=Time(MinIndex_i+1,MinIndex_j+1); 1139 % if size(Time)>=[first_i+1 first_j+1]1140 % TimeFirst=Time(first_i+1,first_j+1);1141 % end1142 % if size(Time)>=[last_i+1 last_j+1]1143 % TimeLast=Time(last_i+1,last_j+1);1144 % end1145 1117 if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1] 1146 1118 TimeMax=Time(MaxIndex_i+1,MaxIndex_j+1); … … 1261 1233 CheckPair= ~isempty(i2_series)||~isempty(j2_series); % check whether index pairs need to be defined 1262 1234 PairString=get(handles.PairString,'Data'); 1235 PairString{iview,1}=''; % no pair for #iview by default 1263 1236 if CheckPair% if pairs need to be display for line iview 1264 1237 [ModeMenu,ModeValue]=update_mode(i1_series,i2_series,j2_series); 1265 1238 Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,ModeMenu{ModeValue},Time,TimeUnit,ref_i,ref_j,TimeName,InputTable(iview,:),Param.FileInfo); 1266 PairString{iview,1}=Menu{1};1267 else 1268 PairString{iview,1}=''; % no pair for #iview1239 if numel(Menu)>=1 1240 PairString{iview,1}=Menu{1}; 1241 end 1269 1242 end 1270 1243 set(handles.PairString,'Data',PairString) … … 1282 1255 Position=get(handles.FileStatus,'Position'); 1283 1256 set(handles.FileStatus,'Units','normalized') 1284 %xI=0.5:Position(3)-0.5;1285 1257 nbview=numel(SeriesData.i1_series); 1286 j_max=cell(1,nbview);1258 i_max=cell(1,nbview); 1287 1259 MaxIndex_i=ones(1,nbview); % default 1288 1260 MinIndex_i=ones(1,nbview); % default 1261 missing_indices=cell(1,nbview); 1289 1262 for iline=1:nbview 1290 pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max on pair index 1291 j_max{iline}=max(pair_max,[],1); % max on j index 1292 if ~isempty(j_max{iline}) 1293 MaxIndex_i(iline)=find(j_max{iline}, 1, 'last' )-1; % max ref index i 1294 MinIndex_i(iline)=find(j_max{iline}, 1 )-1; % min ref index i 1263 pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max i1 indices from i1_series (as obtained by fct uvmat/find_file_series.m) 1264 % needed in the case of mutiple pairs for the same index ref_i) 1265 i_max{iline}=max(pair_max,[],1); % max on j index 1266 if ~isempty(i_max{iline})&& ~isequal(pair_max,0) 1267 MaxIndex_i(iline)=find(i_max{iline}, 1, 'last' )-1; % max ref index i 1268 MinIndex_i(iline)=find(i_max{iline}, 1 )-1; % min ref index i 1269 missing_indices{iline}= find(i_max{iline}(2:end)==0); 1295 1270 end 1296 1271 end … … 1299 1274 range_index=MaxIndex_i-MinIndex_i+1; 1300 1275 range_y=max(1,floor(Position(4)/nbview)); 1301 npx=floor(Position(3)); 1302 file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1; 1303 CData=zeros(nbview*range_y,npx); % initiate the image representing the existing files 1276 npx=floor(Position(3));%length of the bar image FileStatus in pixels 1277 1278 %file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1; 1279 CData=ones(nbview*range_y,npx); % initiate the image representing the existing files 1280 LineData=ones(1,npx); 1304 1281 for iline=1:nbview 1305 1282 ind_y=1+(iline-1)*range_y:iline*range_y; 1306 LineData=zeros(size(file_indices)); 1307 file_select=file_indices(file_indices<=numel(j_max{iline})); 1308 ind_select=file_indices<=numel(j_max{iline}); 1309 LineData(ind_select)=j_max{iline}(file_select)~=0; 1310 CData(ind_y,:)=ones(size(ind_y'))*LineData; 1283 missing_pixels=floor((missing_indices{iline}-MinIndex_i+1)*npx/range_index)+1; 1284 LineData(missing_pixels)=0; 1285 % LineData=zeros(size(file_indices)); 1286 % file_select=file_indices(file_indices<=numel(i_max{iline})); 1287 % ind_select=file_indices<=numel(i_max{iline}); 1288 % LineData(ind_select)=i_max{iline}(file_select)~=0; 1289 CData(ind_y,:)=ones(numel(ind_y),1)*LineData;%create an image band with width numel(ind_y) 1311 1290 end 1312 1291 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); % make color images r=0,g,b=0 … … 1520 1499 if isempty(pos_last), pos_last=1; end 1521 1500 Position=get(handles.Waitbar,'Position'); % position of the waitbar:= [ x,y, width, height] 1522 Position_status=get(handles.FileStatus,'Position'); 1501 Position_status=get(handles.FileStatus,'Position');% position of the FileStatus bar:= [ x,y, width, height] 1523 1502 Position(1)=Position_status(1)+Position_status(3)*pos_first; 1524 1503 Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001); % width must remain positive … … 2642 2621 end 2643 2622 if VelTypeRequest_1 && numel(iview_civ)>=2 2644 menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.File Type{iview_civ(2)});2623 menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileInfo{iview_civ(2)}.FileType); 2645 2624 set(handles.VelType_1,'Value',1)% set first choice by default 2646 2625 set(handles.VelType_1,'String',[{'*'};menu]) … … 2996 2975 FieldListInit(field_index(1))=[]; 2997 2976 SeriesData=get(handles.series,'UserData'); 2977 for iview=1:numel(SeriesData.FileInfo) 2978 FileType{iview}=SeriesData.FileInfo{iview}.FileType; 2979 end 2998 2980 % input line for which the field choice is relevant 2999 iview=find(ismember( SeriesData.FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ2981 iview=find(ismember(FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ 3000 2982 hget_field=findobj(allchild(0),'name','get_field'); 3001 2983 if ~isempty(hget_field) … … 3152 3134 end 3153 3135 Param=read_GUI(handles.series); 3154 InputTable=Param.InputTable(2,:);3136 %InputTable=Param.InputTable(2,:); 3155 3137 % check the existence of the first file in the series 3156 3138 first_j=[]; … … 4194 4176 check_input_file_series(handles,CheckRelabel) 4195 4177 ActionInput_Callback([],[], handles) 4196 % if get(handles.Relabel,'Value') 4197 % NomType='*'; 4198 % i1=1;i2=[];j1=1;j2=[]; 4199 % i1_series=1:size(XmlData.Time,1)-1; 4200 % i2_series=[]; 4201 % j1_series=1:size(XmlData.Time,2)-1; 4202 % j2_series=[]; 4203 % 4204 % 4205 % 4206 % SeriesData=get(handles.series,'UserData'); 4207 % if isfield(SeriesData,'FileSeries')&& ~isempty(SeriesData.FileSeries{1}) 4208 % [nbfield,nbfield_j]=size(SeriesData.Time{1}); 4209 % nbfield=nbfield-1; %remove the possible index 0 4210 % nbfield_j=nbfield_j-1; %remove the possible index 0 4211 % MaxIndex_i=get(handles.MaxIndex_i,'Data'); 4212 % MaxIndex_j=get(handles.MaxIndex_j,'Data'); 4213 % MaxIndex_i(1,:)=nbfield; 4214 % MaxIndex_j(1,:)=nbfield_j; 4215 % MinIndex_i(1,:)=1; 4216 % MinIndex_j(1,:)=1; 4217 % set(handles.MaxIndex_i,'Data',MaxIndex_i) 4218 % set(handles.MaxIndex_j,'Data',MaxIndex_j) 4219 % set(handles.MinIndex_i,'Data',MinIndex_i) 4220 % set(handles.MinIndex_j,'Data',MinIndex_j) 4221 % first_i=str2double(get(handles.num_first_i,'String')); 4222 % first_j=str2double(get(handles.num_first_j,'String')); 4223 % %i1=(first_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index 4224 % i1=1; 4225 % if strcmp(SeriesData.TimeName,'xml')% indices i and j 4226 % j1=mod(i1-1,nbfield_j)+first_j; 4227 % i1=floor((i1-1)/nbfield_j)+1; 4228 % set(handles.num_first_j,'String',num2str(j1)) 4229 % end 4230 % set(handles.num_first_i,'String',num2str(i1)) 4231 % % last_i=str2double(get(handles.num_last_i,'String')); 4232 % % last_j=str2double(get(handles.num_last_j,'String')); 4233 % % i1=(last_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index 4234 % % if strcmp(SeriesData.TimeName,'xml')% indices i and j 4235 % % j1=mod(i1-1,nbfield_j)+1; 4236 % % i1=floor((i1-1)/nbfield_j)+1; 4237 % % end 4238 % set(handles.num_last_i,'String',num2str(nbfield)) 4239 % set(handles.num_last_j,'String',num2str(nbfield_j)) 4240 % end 4241 % else 4242 % check_input_file_series(handles) 4243 % ActionInput_Callback([],[], handles) 4244 % end 4245 4178 4179 -
trunk/src/series/filter_time_singlefile.m
r1181 r1194 119 119 % filecell{iview,fileindex}: 120 120 % iview: line in the table corresponding to a given file series 121 % fileindex: file index within the file series, 122 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 121 % fileindex: file index within the file series, 122 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 123 123 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 124 124 %%%%%%%%%%%% NbView=1 : a single input series … … 141 141 [i1,~,j1,~] = get_file_index(Param.IndexRange.first_i,first_j,PairString); 142 142 [i2,~,j2,~] = get_file_index(Param.IndexRange.last_i,last_j,PairString); 143 ncfile_out=fullfile_uvmat(OutputPath,OutputDir,Param.InputTable{1,3},'.nc',NomTypeNc,i1,i2,j1,j2); 144 145 % OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device)); 146 % RootFileOut=RootFile{1}; 147 % NomTypeOut='_1'; 143 ncfile_out=fullfile_uvmat(OutputPath,OutputDir,Param.InputTable{1,3},'*.nc',NomTypeNc,i1,i2,j1,j2); 148 144 149 145 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 150 disp('loop for filtering started') 151 ncid=[];146 disp('loop for filtering started') 147 ncid=[]; 152 148 for index=1:NbField 153 149 index 154 155 150 [Field,~,errormsg]= read_field(filecell{1,index},'netcdf',Param.InputFields); 156 151 if ~isempty(errormsg) 157 152 disp(errormsg) 158 153 if ~isempty(ncid) 159 netcdf.close(ncid)154 netcdf.close(ncid) 160 155 end 161 156 return … … 179 174 VarDimIndex{ifield+3}=[2 3 1]; 180 175 end 181 182 % VarDimIndex={1,2,3,[1 2 3],[1 2 3]};183 184 176 DataOut.coord_x=Field.coord_x; 185 177 DataOut.coord_y=Field.coord_y; … … 192 184 netcdf.putVar(ncid,1,0,npy,Field.coord_y) 193 185 netcdf.putVar(ncid,2,0,npx,Field.coord_x) 194 % Uvarid=3;195 % Vvarid=4;196 186 TimeBlock=zeros(Param.ActionInput.WindowLength,1); 197 187 Fieldblock=zeros(numel(ListFields),Param.ActionInput.WindowLength,npy,npx); 198 %Vblock=zeros(Param.ActionInput.WindowLength,npy,npx); 199 end 200 188 end 189 201 190 TimeBlock=circshift(TimeBlock,[-1 0 ]); 202 191 TimeBlock(end)=Field.Time; … … 204 193 Timefilter=mean(TimeBlock(end-sumindex:end,:,:));%mid time 205 194 Fieldblock=circshift(Fieldblock,[0 -1 0 0]); %shift U by ishift along the first index 206 % Vblock=circshift(Vblock,[-1 0 0]); %shift U by ishift along the first index207 195 for ifield=1:numel(ListFields) 208 Fieldblock(ifield,end,:,:)=Field.(ListFields{ifield}); 209 end 210 %Vblock(end,:,:)=Field.V; 196 Fieldblock(ifield,end,:,:)=Field.(ListFields{ifield}); 197 end 211 198 Fieldfilter=squeeze(mean(Fieldblock(:,end-sumindex:end,:,:),2,'omitnan')); 212 % Ufilter=squeeze(mean(Ublock(end-sumindex:end,:,:),1,'omitnan')); 213 % Vfilter=squeeze(mean(Vblock(end-sumindex:end,:,:),1,'omitnan')); 214 % Uerror=Ufilter-Ublock(end-floor(sumindex/2),:,:); 215 % Verror=Ufilter-Vblock(end-floor(sumindex/2),:,:); 216 %updating output the netcdf file 217 tstart = tic; 218 netcdf.putVar(ncid,0,(index-1),Timefilter) 199 netcdf.putVar(ncid,0,(index-1),Timefilter) % update the field in the nc file 219 200 for ifield=1:numel(ListFields) 220 201 netcdf.putVar(ncid,Field_varid(ifield),[ 0 0 (index-1)],[npy npx 1],squeeze(Fieldfilter(ifield,:,:))) 221 202 end 222 % netcdf.putVar(ncid,Uvarid,[ 0 0 (index-1)],[npy npx 1],Ufilter) 223 % netcdf.putVar(ncid,Vvarid,[0 0 (index-1)],[npy npx 1],Vfilter) 224 225 telapsed = toc(tstart)% time for writting the field 226 % writing the result file as netcdf file 227 % i1=i1_series{1}(index)-ceil(NpTime/2); 228 % OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,'.nc',NomTypeOut,i1); 229 % errormsg=struct2nc(OutputFile, DataOut); 230 % if isempty(errormsg) 231 % disp([OutputFile ' written']) 232 % else 233 % disp(errormsg) 234 % end 235 end 236 netcdf.close(ncid) 237 figure 238 plot(telapsed) 239 ylabel('time lapsed computation') 203 end 204 240 205 'END' -
trunk/src/series/merge_proj.m
r1152 r1194 223 223 NomTypeOut='_1_1'; 224 224 end 225 %NomTypeOut=NomType;% output file index will indicate the first and last ref index in the series226 225 RootFileOut=RootFile{1}; 227 226 for iview=2:NbView … … 265 264 if ~isempty(j1_series{1}) 266 265 j1=j1_series{1}(index); 267 if ~isempty(j2_series{end}) 268 j2=j2_series{end}(index); 269 else 270 j2=j1; 271 end 272 end 273 OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,FileExtOut,NomTypeOut,i1,i2,j1,j2); 266 end 267 i_out=floor((i1+i2)/2); 268 OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,FileExtOut,NomTypeOut,i_out,[],j1); 274 269 if ~CheckOverwrite && exist(OutputFile,'file') 275 270 disp(['existing output file ' OutputFile ' already exists, skip to next field']) -
trunk/src/struct2nc.m
r1157 r1194 68 68 cmode = bitor(cmode, netcdf.getConstant('CLOBBER')); 69 69 nc = netcdf.create(flname, cmode); 70 netcdf.setFill(nc,'NOFILL') 70 71 71 72 %% write global constants
Note: See TracChangeset
for help on using the changeset viewer.
