- Timestamp:
- May 14, 2012, 7:03:14 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r419 r421 922 922 if isempty(hfig) 923 923 hfig=figure('DeleteFcn',@stop_status); 924 set(hfig,'MenuBar','none')% suppress the menu bar 925 set(hfig,'NumberTitle','off')%suppress the fig number in the title 924 926 set(hfig,'name','civ_status') 925 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list'); 927 set(hfig,'tag','civ_status') 928 set(hfig,'UserData',civ_files) 929 hlist= uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list'); 926 930 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...'); 927 931 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 928 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','OK','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 932 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 933 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@refresh_GUI); 929 934 BarPosition=[0.05 0.81 0.01 0.05]; 930 hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 931 drawnow 932 end 935 uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 936 drawnow 937 end 938 set(hrefresh,'UserData',option_civ) 939 filepath=fileparts(civ_files{1}); 940 set(hlist,'UserData',fileparts(filepath)) 941 refresh_GUI(hrefresh,[]) 942 943 %------------------------------------------------------------------------ 944 % launched by refreshing the status figure 945 function refresh_GUI(hObject, eventdata) 946 %------------------------------------------------------------------------ 933 947 Tabchar={}; 948 BarPosition=[0.05 0.81 0.01 0.05]; 949 hfig=get(hObject,'parent'); 950 civ_files=get(hfig,'UserData'); 951 [filepath,filename,ext]=fileparts(civ_files{1}); 952 [tild,SubDir,extdir]=fileparts(filepath); 953 SubDir=[SubDir extdir]; 954 option_civ=get(hObject,'UserData'); 934 955 nbfiles=numel(civ_files); 935 956 count=0; 936 957 testrecent=0; 937 while count<nbfiles958 % while count<nbfiles 938 959 count=0; 939 960 datnum=zeros(1,nbfiles); … … 976 997 count=count+1; 977 998 end 978 [ rr,filename,ext]=fileparts(civ_files{ifile});979 Tabchar{ifile,1}=[fullfile( [SubDir extdir],filename) ext '...' option_str];999 [filepath,filename,ext]=fileparts(civ_files{ifile}); 1000 Tabchar{ifile,1}=[fullfile(SubDir,filename) ext '...' option_str]; 980 1001 end 981 1002 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files … … 990 1011 [first,ind]=min(datnum); 991 1012 [last,indlast]=max(datnum); 992 if test_new993 message='existing file status, no processing launched yet';994 else1013 % if test_new 1014 % message='existing file status, no processing launched yet'; 1015 % else 995 1016 message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... 996 1017 ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; 997 end998 end 999 hfig=findobj(allchild(0),'name','civ_status');1000 if isempty(hfig)% the status list has been deleted1001 return1002 else1018 % end 1019 end 1020 %hfig=findobj(allchild(0),'name','civ_status'); 1021 % if isempty(hfig)% the status list has been deleted 1022 % return 1023 % else 1003 1024 hlist=findobj(hfig,'tag','list'); 1004 1025 hmsgbox=findobj(hfig,'tag','msgbox'); … … 1006 1027 set(hlist,'String',Tabchar) 1007 1028 set(hmsgbox,'String', message) 1008 if count>0 && ~test_new1029 if count>0 %&& ~test_new 1009 1030 BarPosition(3)=0.9*count/nbfiles; 1010 1031 set(hwaitbar,'Position',BarPosition) 1011 1032 end 1012 end 1013 set(hlist,'UserData',rootroot) 1014 if count<10||(nbfiles-count)<10 1015 pause(.5)% wait 0.5 seconds for next check 1016 else 1017 pause(10)% wait 10 seconds for next check 1018 end 1019 end 1033 % end 1034 % [root,filename,ext]=fileparts(civ_files{1}); 1035 % [rootroot,SubDir,extdir]=fileparts(root); 1036 % 1037 % set(hlist,'UserData',rootroot) 1038 % if count<10||(nbfiles-count)<10 1039 % pause(.5)% wait 0.5 seconds for next check 1040 % else 1041 % pause(10)% wait 10 seconds for next check 1042 % end 1043 % end 1044 1045 %------------------------------------------------------------------------ 1046 % launched by deleting the status figure 1047 function stop_status(hObject, eventdata) 1048 %------------------------------------------------------------------------ 1049 hciv=findobj(allchild(0),'tag','civ'); 1050 hhciv=guidata(hciv); 1051 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 1052 set(hhciv.status,'BackgroundColor',[0 1 0]) 1053 1054 %------------------------------------------------------------------------ 1055 % launched by pressing OK on the status figure 1056 function close_GUI(hObject, eventdata) 1057 %------------------------------------------------------------------------ 1058 delete(gcbf) 1059 1020 1060 1021 1061 %------------------------------------------------------------------------ … … 1143 1183 for bin_name=binary_list %loop on the list of binaries 1144 1184 if isfield(Param.xml,bin_name{1})% bin_name{1} =current name in the list 1145 if ~exist(Param.xml.(bin_name{1}),'file')%look for the full path if the file name has been defined with a relative path in PARAM.xml 1185 if exist(Param.xml.(bin_name{1}),'file') 1186 [path,name,ext]=fileparts(Param.xml.(bin_name{1})); 1187 currentdir=pwd; 1188 if exist(path,'dir') 1189 cd(path); 1190 binpath=pwd;%path of the binary 1191 Param.xml.(bin_name{1})=fullfile(binpath,[name ext]); 1192 cd(currentdir) 1193 else 1194 errormsg=['path ' path ' for binaries defined in PARAM.xml does not exist']; 1195 return 1196 end 1197 else %look for the full path if the file name has been defined with a relative path in PARAM.xm 1146 1198 fullname=fullfile(path_civ,Param.xml.(bin_name{1})); 1147 1199 if exist(fullname,'file') … … 1151 1203 return 1152 1204 end 1153 else 1154 [path,name,ext]=fileparts(Param.xml.(bin_name{1})); 1155 currentdir=pwd; 1156 cd(path); 1157 binpath=pwd;%path of the binary 1158 Param.xml.(bin_name{1})=fullfile(binpath,[name ext]); 1159 cd(currentdir); 1160 end 1161 1205 end 1162 1206 end 1163 1207 end … … 3215 3259 % end 3216 3260 3217 %------------------------------------------------------------------------3218 % launched by pressing OK on the status figure3219 function close_GUI(hObject, eventdata)3220 %------------------------------------------------------------------------3221 delete(gcbf)3222 3223 %------------------------------------------------------------------------3224 % launched by deleting the status figure3225 function stop_status(hObject, eventdata)3226 %------------------------------------------------------------------------3227 hciv=findobj(allchild(0),'tag','civ');3228 hhciv=guidata(hciv);3229 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ3230 set(hhciv.status,'BackgroundColor',[0 1 0])3231 3232 3261 3233 3262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -
trunk/src/find_file_series.m
r399 r421 222 222 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i. 223 223 end 224 [tild,ifile_min]=min(ref_ij(ref_ij>0)); 224 %[tild,ifile_min]=min(ref_ij(ref_ij>0)); 225 ifile_min=find(ref_ij>0 , 1); 225 226 if isempty(ifile_min) 226 227 % RootPath=''; -
trunk/src/msgbox_uvmat.m
r296 r421 38 38 39 39 % --- Executes just before msgbox_uvmat is made visible. 40 function msgbox_uvmat_OpeningFcn(hObject, eventdata, handles,title,display ,default_answer,Position)40 function msgbox_uvmat_OpeningFcn(hObject, eventdata, handles,title,display_str,default_answer,Position) 41 41 % This function has no output args, see OutputFcn. 42 42 … … 74 74 case 'ERROR' 75 75 icontype='error'; 76 if exist('display_str','var') 77 disp(display_str); %display the error message in the Matlab command window 78 end 76 79 case 'WARNING' 77 80 icontype='warn'; … … 92 95 end 93 96 end 94 if exist('display ','var')95 set(handles.text1, 'String', display );97 if exist('display_str','var') 98 set(handles.text1, 'String', display_str); 96 99 end 97 100 % if testinputstring -
trunk/src/nc2struct.m
r404 r421 204 204 if ~isempty(var_index) 205 205 dim_index=find(flag_used);%list of netcdf dimensions indices corresponding to used dimensions 206 ListDimName=ListDimNameNetcdf(dim_index);207 D imValue=dim_value(dim_index);206 Data.ListDimName=ListDimNameNetcdf(dim_index); 207 Data.DimValue=dim_value(dim_index); 208 208 end 209 209 -
trunk/src/plot_field.m
r415 r421 53 53 % .Scalar.CheckFixScal: =0 (default) lower and upper bounds of the scalar representation set to the min and max of the field 54 54 % =1 lower and upper bound imposed by .AMax and .MinA 55 % .Scalar.CheckBW= 1 black and white representation imposed, =0 by default. 55 % .Scalar.CheckBW= 1: black and white representation imposed, =0 color imposed (color scale or rgb), 56 % =[]: automatic (B/W for integer positive scalars, color else) 56 57 % .Scalar.CheckContours= 1: represent scalars by contour plots (Matlab function 'contour'); =0 by default 57 58 % .IncrA : contour interval … … 214 215 if isempty(index_2D) 215 216 plot_plane([],[],[],haxes);%removes images or vector plots if any 216 else 217 else %plot 2D field 217 218 [tild,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),haxes,PlotParam,PosColorbar); 218 219 AxeData.NbDim=2; … … 226 227 plot_profile([],[],[],haxes);% 227 228 end 228 else 229 else %plot 1D field (usual graph y vs x) 229 230 Coordinates=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,PlotParam.Coordinates);% 230 231 if testzoomaxes … … 717 718 718 719 %set the color map 719 if isfield(PlotParam.Scalar,'CheckBW') 720 BW=PlotParam.Scalar.CheckBW; % test for BW gray scale images721 else 720 if isfield(PlotParam.Scalar,'CheckBW') && ~isempty(PlotParam.Scalar.CheckBW) 721 BW=PlotParam.Scalar.CheckBW; %BW=0 color imposed, else gray scale imposed. 722 else % BW imposed automatically chosen 722 723 BW=(siz==2) && (isa(A,'uint8')|| isa(A,'uint16'));% non color images represented in gray scale by default 723 end724 724 PlotParamOut.Scalar.CheckBW=BW; 725 end 725 726 %case of grey level images or contour plot 726 727 if siz==2 … … 1145 1146 xN=NaN*ones(size(xc)); 1146 1147 matx=[xc(:)-uc(:)/2 xc(:)+uc(:)/2 xN(:)]'; 1147 % matx=[xc(:) xc(:)+uc(:) xN(:)]';1148 1148 matx=reshape(matx,1,3*n(2)); 1149 1149 maty=[yc(:)-vc(:)/2 yc(:)+vc(:)/2 xN(:)]'; 1150 % maty=[yc(:) yc(:)+vc(:) xN(:)]';1151 1150 maty=reshape(maty,1,3*n(2)); 1152 1151 … … 1165 1164 matyar=reshape(matyar,1,4*n(2)); 1166 1165 %draw the line or modify the existing ones 1167 tri=reshape(1:3*length(uc),3,[])';1166 % tri=reshape(1:3*length(uc),3,[])'; 1168 1167 isn=isnan(colorlist(icolor,:));%test if color NaN 1169 1168 if 2*icolor > sizh(1) %if icolor exceeds the number of existing ones -
trunk/src/proj_field.m
r408 r421 839 839 ProjData.VarDimName=[ProjData.VarDimName {AXName}]; 840 840 for ivar=VarIndex 841 VarName{ivar}=FieldData.ListVarName{ivar};841 %VarName{ivar}=FieldData.ListVarName{ivar}; 842 842 if test_interp2% interpolate on new grid 843 eval(['FieldData.' VarName{ivar} '=interp2(FieldData.' AXName ',FieldData.' AYName ',FieldData.' VarName{ivar} ',AXI,AYI'');'])%TO TEST844 end 845 eval(['vec_A=reshape(squeeze(FieldData.' VarName{ivar} '),npx*npy,nbcolor);'])%put the original image in colum843 FieldData.(FieldData.ListVarName{ivar})=interp2(FieldData.(AXName),FieldData.(AYName),FieldData.(FieldData.ListVarName{ivar}),AXI,AYI);%TO TEST 844 end 845 vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum 846 846 if nbcolor==1 847 847 vec_B(ind_in)=vec_A(ICOMB); 848 848 vec_B(ind_out)=zeros(size(ind_out)); 849 849 A_out=reshape(vec_B,npY,npX); 850 eval(['ProjData.' VarName{ivar} '=((sum(A_out,1)/npY))'';']);850 ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY; 851 851 elseif nbcolor==3 852 852 vec_B(ind_in,1:3)=vec_A(ICOMB,:); … … 855 855 vec_B(ind_out,3)=zeros(size(ind_out)); 856 856 A_out=reshape(vec_B,npY,npX,nbcolor); 857 eval(['ProjData.' VarName{ivar} '=squeeze(sum(A_out,1)/npY);']);857 ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY); 858 858 end 859 ProjData.ListVarName=[ProjData.ListVarName VarName{ivar}];859 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}]; 860 860 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate 861 861 ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line 862 862 end 863 863 if testU 864 eval(['vector_x =ProjData.' VarName{VarType.vector_x} ';'])865 eval(['vector_y =ProjData.' VarName{VarType.vector_y} ';'])866 eval(['ProjData.' VarName{VarType.vector_x} '=cos(theta)*vector_x+sin(theta)*vector_y;'])867 eval(['ProjData.' VarName{VarType.vector_y} '=-sin(theta)*vector_x+cos(theta)*vector_y;'])864 vector_x =ProjData.(FieldData.ListVarName{VarType.vector_x}); 865 vector_y =ProjData.(FieldData.ListVarName{VarType.vector_y}); 866 ProjData.(FieldData.ListVarName{VarType.vector_x}) =cos(theta)*vector_x+sin(theta)*vector_y; 867 ProjData.(FieldData.ListVarName{VarType.vector_y}) =-sin(theta)*vector_x+cos(theta)*vector_y; 868 868 end 869 869 ProjData.VarAttribute{nbvar+1}.long_name='abscissa along line'; -
trunk/src/series.m
r419 r421 1571 1571 % last_j=str2num(get(handles.num_last_j,'String')); 1572 1572 TimeTable=get(handles.TimeTable,'Data'); 1573 1573 Pairs=get(handles.PairString,'Data'); 1574 1574 for iview=1:size(TimeTable,1) 1575 Pairs=get(handles.PairString,'Data'); 1575 if size(SeriesData.Time,1)<iview 1576 break 1577 end 1576 1578 i1=ref_i; 1577 1579 j1=ref_j; 1578 1580 i2=ref_i; 1579 1581 j2=ref_j; 1582 % case of pairs 1580 1583 if ~isempty(Pairs{iview,1}) 1581 r=regexp(Pa ram.Pairs.list_pair_civ,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');1584 r=regexp(Pairs{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names'); 1582 1585 if isempty(r) 1583 r=regexp(Pa ram.Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');1586 r=regexp(Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); 1584 1587 end 1585 1588 switch r.mode … … 1595 1598 end 1596 1599 end 1597 if isempty(ref_j) 1598 time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2; 1599 time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2; 1600 else 1601 time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2; 1602 time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2; 1603 end 1604 TimeTable{iview,2}=time_first; %TODO: take into account pairs 1605 TimeTable{iview,3}=time_last; %TODO: take into account pairs 1600 TimeTable{iview,2}=[]; 1601 TimeTable{iview,3}=[]; 1602 if size(SeriesData.Time{iview},1)>=i2(2)&&size(SeriesData.Time{iview},1)>=j2(2) 1603 if isempty(ref_j) 1604 time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2; 1605 time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2; 1606 else 1607 time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2; 1608 time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2; 1609 end 1610 TimeTable{iview,2}=time_first; %TODO: take into account pairs 1611 TimeTable{iview,3}=time_last; %TODO: take into account pairs 1612 end 1606 1613 end 1607 1614 set(handles.TimeTable,'Data',TimeTable) 1608 return 1609 1610 1611 NomType=InputTable(:,4);1612 mode_list=get(handles.mode,'String');1613 index_mode=get(handles.mode,'Value');1614 1615 mode=mode_list{index_mode};1616 1617 time_first=[];1618 time_last=[];1619 if ~isfield(SeriesData,'Time')1620 SeriesData.Time{1}=[];1621 end1622 TimeTable=get(handles.TimeTable,'Data');1623 for iview=1:size(TimeTable,1)1624 time_first_cell{iview}='?';1625 time_last_cell{iview}='?';%default1626 time=SeriesData.Time{iview};1627 if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2')1628 if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num)1629 ind_shift=SeriesData.displ_num(iview,:);1630 if isequal(mode,'bursts')1631 first_j=0;1632 last_j=0;1633 end1634 first_i1=first_i +ind_shift(3);1635 first_i2 =first_i +ind_shift(4);1636 first_j1 =first_j +ind_shift(1);1637 first_j2 =first_j +ind_shift(2);1638 last_i1=last_i +ind_shift(3);1639 last_i2 =last_i +ind_shift(4);1640 last_j1 =last_j +ind_shift(1);1641 last_j2 =last_j +ind_shift(2);1642 siz=size(SeriesData.Time{1});1643 if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j21644 time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2;1645 time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2;1646 else%read the time in the nc files1647 RootPath=get(handles.RootPath,'String');1648 RootFile=get(handles.RootFile,'String');1649 SubDir=get(handles.SubDir,'String');1650 %VelType=get(handles.VelType,'String');1651 VelType_str=get(handles.VelTypeMenu,'String');1652 VelType_val=get(handles.VelTypeMenu,'Value');1653 VelType=VelType_str{VelType_val};1654 filebase=fullfile(RootPath{1},RootFile{1});1655 [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview});1656 if exist(filefirst,'file')1657 Attrib=nc2struct(filefirst,[]);1658 if isfield(Attrib,'Time')1659 time_first=Attrib.Time;1660 else1661 if isfield(Attrib,'absolut_time_T0')1662 time_first=Attrib.absolut_time_T0;1663 end1664 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))1665 time_first=Attrib.absolut_time_T0_2;1666 end1667 end1668 end1669 [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview});1670 if exist(filelast,'file')1671 Attrib=nc2struct(filelast,[]);1672 if isfield(Attrib,'Time')1673 time_last=Attrib.Time;1674 else1675 if isfield(Attrib,'absolut_time_T0')1676 time_last=Attrib.absolut_time_T0;1677 end1678 if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))1679 time_last=Attrib.absolut_time_T0_2;1680 end1681 end1682 end1683 end1684 end1685 else1686 siz=size(time);1687 if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=11688 time_first=times(first_i,first_j);1689 time_last=times(last_i,last_j);1690 end1691 end1692 time_first_cell{iview}=num2str(time_first,4);1693 time_last_cell{iview}=num2str(time_last,4);1694 end1695 1615 1616 1617 % 1618 % NomType=InputTable(:,4); 1619 % mode_list=get(handles.mode,'String'); 1620 % index_mode=get(handles.mode,'Value'); 1621 % 1622 % mode=mode_list{index_mode}; 1623 % 1624 % time_first=[]; 1625 % time_last=[]; 1626 % if ~isfield(SeriesData,'Time') 1627 % SeriesData.Time{1}=[]; 1628 % end 1629 % TimeTable=get(handles.TimeTable,'Data'); 1630 % for iview=1:size(TimeTable,1) 1631 % time_first_cell{iview}='?'; 1632 % time_last_cell{iview}='?';%default 1633 % time=SeriesData.Time{iview}; 1634 % if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2') 1635 % if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) 1636 % ind_shift=SeriesData.displ_num(iview,:); 1637 % if isequal(mode,'bursts') 1638 % first_j=0; 1639 % last_j=0; 1640 % end 1641 % first_i1=first_i +ind_shift(3); 1642 % first_i2 =first_i +ind_shift(4); 1643 % first_j1 =first_j +ind_shift(1); 1644 % first_j2 =first_j +ind_shift(2); 1645 % last_i1=last_i +ind_shift(3); 1646 % last_i2 =last_i +ind_shift(4); 1647 % last_j1 =last_j +ind_shift(1); 1648 % last_j2 =last_j +ind_shift(2); 1649 % siz=size(SeriesData.Time{1}); 1650 % if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2 1651 % time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2; 1652 % time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2; 1653 % else%read the time in the nc files 1654 % RootPath=get(handles.RootPath,'String'); 1655 % RootFile=get(handles.RootFile,'String'); 1656 % SubDir=get(handles.SubDir,'String'); 1657 % %VelType=get(handles.VelType,'String'); 1658 % VelType_str=get(handles.VelTypeMenu,'String'); 1659 % VelType_val=get(handles.VelTypeMenu,'Value'); 1660 % VelType=VelType_str{VelType_val}; 1661 % filebase=fullfile(RootPath{1},RootFile{1}); 1662 % [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview}); 1663 % if exist(filefirst,'file') 1664 % Attrib=nc2struct(filefirst,[]); 1665 % if isfield(Attrib,'Time') 1666 % time_first=Attrib.Time; 1667 % else 1668 % if isfield(Attrib,'absolut_time_T0') 1669 % time_first=Attrib.absolut_time_T0; 1670 % end 1671 % if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1672 % time_first=Attrib.absolut_time_T0_2; 1673 % end 1674 % end 1675 % end 1676 % [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview}); 1677 % if exist(filelast,'file') 1678 % Attrib=nc2struct(filelast,[]); 1679 % if isfield(Attrib,'Time') 1680 % time_last=Attrib.Time; 1681 % else 1682 % if isfield(Attrib,'absolut_time_T0') 1683 % time_last=Attrib.absolut_time_T0; 1684 % end 1685 % if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) 1686 % time_last=Attrib.absolut_time_T0_2; 1687 % end 1688 % end 1689 % end 1690 % end 1691 % end 1692 % else 1693 % siz=size(time); 1694 % if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 1695 % time_first=times(first_i,first_j); 1696 % time_last=times(last_i,last_j); 1697 % end 1698 % end 1699 % time_first_cell{iview}=num2str(time_first,4); 1700 % time_last_cell{iview}=num2str(time_last,4); 1701 % end 1702 % 1696 1703 1697 1704 %------------------------------------------------------------------------ … … 2069 2076 if value 2070 2077 set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow 2071 % DataInit.ParentButton=handles.GetObject;2072 2078 hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle 2073 2079 if ishandle(hset_object) 2074 uistack(hset_object,'top') 2075 %[SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface 2080 uistack(hset_object,'top')% show the GUI set_object if opened 2076 2081 else 2077 2082 %get the object file 2078 2083 InputTable=get(handles.InputTable,'Data'); 2079 2084 defaultname=InputTable{1,1}; 2080 % defaultname=get(handles.RootPath,'String');2081 2085 if isempty(defaultname) 2082 2086 defaultname={''}; … … 2088 2092 'Pick an xml object file (or use uvmat to create it)',defaultname{1}); 2089 2093 fileinput=[PathName FileName];%complete file name 2090 testblank=findstr(fileinput,' ');%look for blanks2091 if ~isempty(testblank)2092 msgbox_uvmat('ERROR','forbidden input file name: contain blanks')2093 return2094 end2095 2094 sizf=size(fileinput); 2096 2095 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end … … 2104 2103 data.ProjMode='projection'; 2105 2104 end 2106 transform_menu=get(handles.transform_fct,'String'); 2107 ichoice=get(handles.transform_fct,'Value'); 2108 % if isequal(transform_menu{ichoice},'px'); 2109 % data.CoordType='px'; 2110 % else 2111 % data.CoordType='phys'; 2112 % end 2113 data.desable_plot=1; 2105 % data.desable_plot=1; 2114 2106 [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface 2115 2107 end 2116 2108 else 2117 2109 set(handles.GetObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 2118 % if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object)2119 % close(SeriesData.hset_object)2120 % end2121 2110 end 2122 2111 set(handles.series,'UserData',SeriesData) -
trunk/src/uvmat.m
r415 r421 411 411 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 412 412 oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 413 % oldfile=read_file_box,es(handles);414 413 if isempty(oldfile)||isequal(oldfile,'') %loads the previously stored file name and set it as default in the file_input box 415 414 dir_perso=prefdir; … … 422 421 end 423 422 end 424 [FileName, PathName] = uigetfile( ... 425 {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx,*.fig,*.log,*.dat,*.bat)'; 426 '*.xml', '.xml files '; ... 427 '*.xls', '.xls files '; ... 428 '*.civ', '.civ files '; ... 429 '*.jpg',' jpeg image files'; ... 430 '*.png','.png image files'; ... 431 '*.tif','.tif image files'; ... 432 '*.avi;*.AVI','.avi movie files'; ... 433 '*.vol','.volume images (png)'; ... 434 '*.nc','.netcdf files'; ... 435 '*.cdf','.netcdf files'; ... 436 '*.cmx','.cmx text files ';... 437 '*.fig','.fig files (matlab fig)';... 438 '*.log','.log text files ';... 439 '*.dat','.dat text files ';... 440 '*.bat','.bat system command text files';... 441 '*.*', 'All Files (*.*)'}, ... 442 'Pick a file',oldfile); 423 % [FileName, PathName] = uigetfile( ... 424 % {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx,*.fig,*.log,*.dat,*.bat)'; 425 % '*.xml', '.xml files '; ... 426 % '*.xls', '.xls files '; ... 427 % '*.civ', '.civ files '; ... 428 % '*.jpg',' jpeg image files'; ... 429 % '*.png','.png image files'; ... 430 % '*.tif','.tif image files'; ... 431 % '*.avi;*.AVI','.avi movie files'; ... 432 % '*.vol','.volume images (png)'; ... 433 % '*.nc','.netcdf files'; ... 434 % '*.cdf','.netcdf files'; ... 435 % '*.cmx','.cmx text files ';... 436 % '*.fig','.fig files (matlab fig)';... 437 % '*.log','.log text files ';... 438 % '*.dat','.dat text files ';... 439 % '*.bat','.bat system command text files';... 440 % '*.*', 'All Files (*.*)'}, ... 441 % 'Pick a file',oldfile); 442 443 [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',oldfile); 443 444 fileinput=[PathName FileName];%complete file name 444 445 sizf=size(fileinput); … … 488 489 function MenuBrowse_1_Callback(hObject, eventdata, handles) 489 490 %------------------------------------------------------------------------ 490 % huvmat=get(handles.run0,'parent');491 UvData=get(handles.uvmat,'UserData');492 493 491 RootPath=get(handles.RootPath,'String'); 494 [FileName, PathName, filterindex] = uigetfile( ... 495 {'*.xml;*.xls;*.civ;*.jpg;*.png;*.avi;*.AVI;*.nc;*.cmx;*.fig;*.log;*.dat', ' (*.xml,*.xls,*.civ, *.jpg,*.png, *.avi,*.nc,*.cmx ,*.fig,*.log,*.dat)'; 496 '*.xml', '.xml files '; ... 497 '*.xls', '.xls files '; ... 498 '*.civ', '.civ files '; ... 499 '*.jpg','.jpg image files'; ... 500 '*.png','.png image files'; ... 501 '*.avi;*.AVI','.avi movie files'; ... 502 '*.nc','.netcdf files'; ... 503 '*.cdf','.netcdf files'; ... 504 '*.cmx','.cmx text files';... 505 '*.cmx2','.cmx2 text files';... 506 '*.fig','.fig files (matlab fig)';... 507 '*.log','.log text files ';... 508 '*.dat','.dat text files ';... 509 '*.*', 'All Files (*.*)'}, ... 510 'Pick a second file for comparison',RootPath); 492 % [FileName, PathName, filterindex] = uigetfile( ... 493 % {'*.xml;*.xls;*.civ;*.jpg;*.png;*.avi;*.AVI;*.nc;*.cmx;*.fig;*.log;*.dat', ' (*.xml,*.xls,*.civ, *.jpg,*.png, *.avi,*.nc,*.cmx ,*.fig,*.log,*.dat)'; 494 % '*.xml', '.xml files '; ... 495 % '*.xls', '.xls files '; ... 496 % '*.civ', '.civ files '; ... 497 % '*.jpg','.jpg image files'; ... 498 % '*.png','.png image files'; ... 499 % '*.avi;*.AVI','.avi movie files'; ... 500 % '*.nc','.netcdf files'; ... 501 % '*.cdf','.netcdf files'; ... 502 % '*.cmx','.cmx text files';... 503 % '*.cmx2','.cmx2 text files';... 504 % '*.fig','.fig files (matlab fig)';... 505 % '*.log','.log text files ';... 506 % '*.dat','.dat text files ';... 507 % '*.*', 'All Files (*.*)'}, ... 508 % 'Pick a second file for comparison',RootPath); 509 [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',RootPath); 511 510 fileinput_1=[PathName FileName];%complete file name 512 511 sizf=size(fileinput_1); … … 1997 1996 1998 1997 %% read the first input field if a filename has been introduced 1998 ParamIn.ColorVar='';%default variable name for vector color 1999 1999 if ~isempty(filename) 2000 2000 ObjectName=filename; … … 2350 2350 2351 2351 %% calculate scalar 2352 if (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%2352 if ~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2353 2353 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2354 2354 end 2355 if numel(Field)==2 && ~ test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx')) &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')2355 if numel(Field)==2 && ~strcmp(ParamOut_1.FieldName,'get_field...')&& ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx')) &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2356 2356 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2357 2357 end … … 2386 2386 return 2387 2387 end 2388 [NbDim,imax]=max(NbDim); 2388 [NbDim,imax]=max(NbDim);% spatial dimension of the input field 2389 2389 if isfield(UvData.Field,'NbDim') 2390 2390 NbDim=UvData.Field.NbDim;% deal with plane fields containing z coordinates 2391 2391 end 2392 XName=''; %default 2393 YName=''; 2392 2394 if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinates 2393 2395 XName=UvData.Field.ListVarName{VarType{imax}.coord_x}; 2394 2396 YName=UvData.Field.ListVarName{VarType{imax}.coord_y}; 2395 eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors)2397 nbvec=length(UvData.Field.(XName));%nbre of measurement points (e.g. vectors) 2396 2398 test_x=1;%test for unstructured coordinates 2397 2399 if ~isempty(VarType{imax}.coord_z) … … 2402 2404 elseif numel(VarType)>=imax && numel(VarType{imax}.coord)>=NbDim && VarType{imax}.coord(NbDim)>0 %structured coordinate 2403 2405 XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)}; 2404 if NbDim> 12406 if NbDim> 1 && VarType{imax}.coord(NbDim-1)>0 2405 2407 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates 2406 2408 end 2409 VarIndex=CellVarIndex{imax}; % list of variable indices 2410 DimIndex=VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2411 nbpoints_x=DimValue(DimIndex(NbDim)); 2412 XMax=nbpoints_x;%default 2413 XMin=1;%default 2407 2414 end 2408 2415 if NbDim==3 … … 2420 2427 end 2421 2428 end 2422 if exist('XName','var') 2423 eval(['XMax=max(max(UvData.Field.' XName '));']) 2424 eval(['XMin=min(min(UvData.Field.' XName '));']) 2429 2430 if ~isempty (XName) 2431 XMax=max(max(UvData.Field.(XName))); 2432 XMin=min(min(UvData.Field.(XName))); 2425 2433 UvData.Field.NbDim=NbDim; 2426 2434 UvData.Field.XMax=XMax; 2427 2435 UvData.Field.XMin=XMin; 2428 if NbDim >1 2429 eval(['YMax=max(max(UvData.Field.' YName '));'])2430 eval(['YMin=min(min(UvData.Field.' YName '));'])2436 if NbDim >1&& ~isempty(YName) 2437 YMax=max(max(UvData.Field.(YName))); 2438 YMin=min(min(UvData.Field.(YName))); 2431 2439 UvData.Field.YMax=YMax; 2432 UvData.Field.YMin=YMin; 2433 end 2434 eval(['nbvec=length(UvData.Field.' XName ');'])2440 UvData.Field.YMin=YMin; 2441 end 2442 nbvec=length(UvData.Field.(XName)); 2435 2443 if test_x %unstructured coordinates 2436 2444 if test_z … … 2440 2448 UvData.Field.Mesh=sqrt((XMax-XMin)*(YMax-YMin)/nbvec);%2D 2441 2449 end 2450 end 2451 end 2452 if ~test_x 2453 % VarIndex=CellVarIndex{imax}; % list of variable indices 2454 % DimIndex=VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2455 % nbpoints_x=DimValue(DimIndex(NbDim)); 2456 DX=(XMax-XMin)/(nbpoints_x-1); 2457 if NbDim >1 2458 nbpoints_y=DimValue(DimIndex(NbDim-1)); 2459 if isempty(YName)% if the y coordinate is not expressed, it is taken as the matrix index 2460 DY=1; 2461 UvData.Field.YMax=nbpoints_y; 2462 UvData.Field.YMin=1; 2463 else 2464 DY=(YMax-YMin)/(nbpoints_y-1); 2465 end 2466 end 2467 if NbDim==3 2468 nbpoints_z=DimValue(DimIndex(1)); 2469 DZ=(ZMax-ZMin)/(nbpoints_z-1); 2470 UvData.Field.Mesh=(DX*DY*DZ)^(1/3); 2471 UvData.Field.ZMax=ZMax; 2472 UvData.Field.ZMin=ZMin; 2442 2473 else 2443 VarIndex=CellVarIndex{imax}; % list of variable indices 2444 DimIndex=VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2445 nbpoints_x=DimValue(DimIndex(NbDim)); 2446 DX=(XMax-XMin)/(nbpoints_x-1); 2447 if NbDim >1 2448 nbpoints_y=DimValue(DimIndex(NbDim-1)); 2449 DY=(YMax-YMin)/(nbpoints_y-1); 2450 end 2451 if NbDim==3 2452 nbpoints_z=DimValue(DimIndex(1)); 2453 DZ=(ZMax-ZMin)/(nbpoints_z-1); 2454 UvData.Field.Mesh=(DX*DY*DZ)^(1/3); 2455 UvData.Field.ZMax=ZMax; 2456 UvData.Field.ZMin=ZMin; 2457 else 2458 UvData.Field.Mesh=DX;%sqrt(DX*DY); 2459 end 2460 end 2461 % adjust the mesh to a value 1, 2 , 5 *10^n 2462 ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude 2463 if UvData.Field.Mesh/ord>=5 2464 UvData.Field.Mesh=5*ord; 2465 elseif UvData.Field.Mesh/ord>=2 2466 UvData.Field.Mesh=2*ord; 2467 else 2468 UvData.Field.Mesh=ord; 2469 end 2470 end 2474 UvData.Field.Mesh=DX;%sqrt(DX*DY); 2475 end 2476 end 2477 % adjust the mesh to a value 1, 2 , 5 *10^n 2478 ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude 2479 if UvData.Field.Mesh/ord>=5 2480 UvData.Field.Mesh=5*ord; 2481 elseif UvData.Field.Mesh/ord>=2 2482 UvData.Field.Mesh=2*ord; 2483 else 2484 UvData.Field.Mesh=ord; 2485 end 2486 2471 2487 2472 2488 %% 3D case (menuvolume) … … 2560 2576 %PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2561 2577 PlotParam{1}=read_GUI(handles.uvmat); 2562 %default settings if vectors not visible (should not be needed)2578 %default settings if vectors not visible 2563 2579 if ~isfield(PlotParam{1},'Vectors') 2564 2580 PlotParam{1}.Vectors.MaxVec=1; … … 2595 2611 return 2596 2612 end 2597 if testnewseries && isfield(ObjectData,'CoordUnit') 2613 if testnewseries 2614 PlotParam{imap}.Scalar.CheckBW=[]; %B/W option depends on the input field (image or scalar) 2615 if isfield(ObjectData,'CoordUnit') 2598 2616 PlotParam{imap}.Coordinates.CheckFixEqual=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y) 2617 end 2599 2618 end 2600 2619 %use of mask (TODO: check) … … 4425 4444 hset_object=set_object(data,handles);% call the set_object interface 4426 4445 hhset_object=guidata(hset_object); 4427 set(hhset_object.PLOT,'enable','on')% activate the refresh button 4446 hchild=get(hset_object,'children'); 4447 set(hchild,'enable','on') 4448 %set(hhset_object.PLOT,'enable','on')% activate the refresh button 4428 4449 %set(handles.MenuObject,'checked','on') 4429 4450 set(handles.uvmat,'UserData',UvData) -
trunk/src/write_plot_param.m
r405 r421 39 39 set(handles.num_IncrA,'String',num2str(PlotParam.Scalar.IncrA,3)) 40 40 end 41 set(handles.CheckBW,'Value',PlotParam.Scalar.CheckBW) 41 42 else 42 43 set(handles.Scalar,'Visible','off')
Note: See TracChangeset
for help on using the changeset viewer.