Changeset 389
- Timestamp:
- Apr 8, 2012, 11:11:38 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r383 r389 65 65 units_cell={}; 66 66 67 %% interpolation with new civ data 68 %if isfield(DataIn,'X_SubRange') 67 %% interpolation with new civ data 69 68 if isfield(DataIn,'SubRange') &&(strcmp(VelType,'filter1')||strcmp(VelType,'filter2')) 70 XMax=max(max(DataIn.SubRange(1,:,:))); 69 XMax=max(max(DataIn.SubRange(1,:,:)));% extrema of the coordinates 71 70 YMax=max(max(DataIn.SubRange(2,:,:))); 72 71 XMin=min(min(DataIn.SubRange(1,:,:))); … … 76 75 xI=XMin:Mesh:XMax; 77 76 yI=YMin:Mesh:YMax; 78 [XI,YI]=meshgrid(xI,yI); 77 [XI,YI]=meshgrid(xI,yI);% interpolation grid 79 78 XI=reshape(XI,[],1); 80 79 YI=reshape(YI,[],1); … … 82 81 DataOut.ListGlobalAttribute=DataIn.ListGlobalAttribute; %reproduce global attribute 83 82 for ilist=1:numel(DataOut.ListGlobalAttribute) 84 eval(['DataOut.' DataOut.ListGlobalAttribute{ilist} '=DataIn.' DataIn.ListGlobalAttribute{ilist} ';'])83 DataOut.(DataOut.ListGlobalAttribute{ilist})=DataIn.(DataIn.ListGlobalAttribute{ilist}); 85 84 end 86 85 DataOut.ListVarName={'coord_y','coord_x','FF'}; … … 89 88 DataOut.coord_y=[yI(1) yI(end)]; 90 89 DataOut.coord_x=[xI(1) xI(end)]; 91 DataOut.U=zeros(size(XI)); 92 DataOut.V=zeros(size(XI)); 93 DataOut.vort=zeros(size(XI)); 94 DataOut.div=zeros(size(XI)); 90 switch FieldName{1} 91 case {'velocity','u','v'} 92 DataOut.U=zeros(size(XI)); 93 DataOut.V=zeros(size(XI)); 94 case 'vort' 95 DataOut.vort=zeros(size(XI)); 96 case 'div' 97 DataOut.div=zeros(size(XI)); 98 case 'strain' 99 DataOut.strain=zeros(size(XI)); 100 end 95 101 nbval=zeros(size(XI)); 96 102 NbSubDomain=size(DataIn.SubRange,3); 97 103 for isub=1:NbSubDomain 98 104 if isfield(DataIn,'NbSites') 99 nbvec_sub=DataIn.NbSites(isub); 105 nbvec_sub=DataIn.NbSites(isub); 100 106 else 101 nbvec_sub=numel(find(DataIn.Indices_tps(:,isub))); 107 nbvec_sub=numel(find(DataIn.Indices_tps(:,isub))); 102 108 end 103 ind_sel=find(XI>=DataIn.SubRange(1,1,isub) & XI<=DataIn.SubRange(1,2,isub) & YI>=DataIn.SubRange(2,1,isub) & YI<=DataIn.SubRange(2,2,isub)); 104 %rho smoothing parameter 105 epoints = [XI(ind_sel) YI(ind_sel)];% coordinates of interpolation sites 106 ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs 107 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 108 % PM = [ones(size(epoints,1),1) epoints]; 109 switch FieldName{1} 110 case {'velocity','u','v'} 111 % DM_eval = DistanceMatrix(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs 112 % EM = tps(1,DM_eval);%values of thin plate 113 EM = tps_eval(epoints,ctrs); 114 case{'vort','div'} 115 [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs 116 117 end 118 switch FieldName{1} 119 case 'velocity' 120 ListFields={'U', 'V'}; 121 VarAttributes{1}.Role='vector_x'; 122 VarAttributes{2}.Role='vector_y'; 123 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 124 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 125 case 'u' 126 ListFields={'U'}; 127 VarAttributes{1}.Role='scalar'; 128 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 129 case 'v' 130 ListFields={'V'}; 131 VarAttributes{1}.Role='scalar'; 132 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 133 case 'vort' 134 ListFields={'vort'}; 135 VarAttributes{1}.Role='scalar'; 136 DataOut.vort(ind_sel)=DataOut.vort(ind_sel)+EMDY *DataIn.U_tps(1:nbvec_sub+3,isub)-EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 137 case 'div' 138 ListFields={'div'}; 139 VarAttributes{1}.Role='scalar'; 140 DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDX*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDY *DataIn.V_tps(1:nbvec_sub+3,isub); 141 end 142 end 143 DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang 144 109 ind_sel=find(XI>=DataIn.SubRange(1,1,isub) & XI<=DataIn.SubRange(1,2,isub) & YI>=DataIn.SubRange(2,1,isub) & YI<=DataIn.SubRange(2,2,isub)); 110 %rho smoothing parameter 111 epoints = [XI(ind_sel) YI(ind_sel)];% coordinates of interpolation sites 112 ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs 113 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 114 switch FieldName{1} 115 case {'velocity','u','v'} 116 EM = tps_eval(epoints,ctrs);%kernels for calculating the velocity from tps 'sources' 117 case{'vort','div','strain'} 118 [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%kernels for calculating the spatial derivatives from tps 'sources' 119 end 120 switch FieldName{1} 121 case 'velocity' 122 ListFields={'U', 'V'}; 123 VarAttributes{1}.Role='vector_x'; 124 VarAttributes{2}.Role='vector_y'; 125 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 126 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 127 case 'u' 128 ListFields={'U'}; 129 VarAttributes{1}.Role='scalar'; 130 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 131 case 'v' 132 ListFields={'V'}; 133 VarAttributes{1}.Role='scalar'; 134 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 135 case 'vort' 136 ListFields={'vort'}; 137 VarAttributes{1}.Role='scalar'; 138 DataOut.vort(ind_sel)=DataOut.vort(ind_sel)+EMDY *DataIn.U_tps(1:nbvec_sub+3,isub)-EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 139 case 'div' 140 ListFields={'div'}; 141 VarAttributes{1}.Role='scalar'; 142 DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDX*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDY *DataIn.V_tps(1:nbvec_sub+3,isub); 143 case 'strain' 144 ListFields={'strain'}; 145 VarAttributes{1}.Role='scalar'; 146 DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+EMDY*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 147 end 148 end 149 DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang 145 150 DataOut.FF=reshape(DataOut.FF,numel(yI),numel(xI)); 146 151 nbval(nbval==0)=1; 147 DataOut.U=DataOut.U ./nbval; 148 DataOut.V=DataOut.V ./nbval; 149 DataOut.U=reshape(DataOut.U,numel(yI),numel(xI)); 150 DataOut.V=reshape(DataOut.V,numel(yI),numel(xI)); 152 switch FieldName{1} 153 case {'velocity','u','v'} 154 DataOut.U=reshape(DataOut.U./nbval,numel(yI),numel(xI)); 155 DataOut.V=reshape(DataOut.V./nbval,numel(yI),numel(xI)); 156 case 'vort' 151 157 DataOut.vort=reshape(DataOut.vort,numel(yI),numel(xI)); 158 case 'div' 152 159 DataOut.div=reshape(DataOut.div,numel(yI),numel(xI)); 160 case 'strain' 161 DataOut.strain=reshape(DataOut.strain,numel(yI),numel(xI)); 162 end 153 163 DataOut.ListVarName=[DataOut.ListVarName ListFields]; 154 164 for ilist=3:numel(DataOut.ListVarName) … … 157 167 DataOut.VarAttribute={[],[]}; 158 168 DataOut.VarAttribute{3}.Role='errorflag'; 159 DataOut.VarAttribute=[DataOut.VarAttribute VarAttributes]; 160 else 169 DataOut.VarAttribute=[DataOut.VarAttribute VarAttributes]; 170 else 161 171 162 %% civx data172 %% civx data 163 173 DataOut=DataIn; 164 174 for ilist=1:length(FieldName) -
trunk/src/civ.m
r388 r389 1169 1169 nbslice=numel(j1_civ1); 1170 1170 if ~strcmp(CivMode,'CivX') 1171 if Param.CheckCiv1 1171 1172 [Param.Civ1.FileTypeA,FileInfo,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1}); 1172 1173 [Param.Civ1.FileTypeB,FileInfo,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1}); 1174 end 1175 if Param.CheckCiv2 1176 [Param.Civ2.FileTypeA,FileInfo,Param.Civ2.ImageA]=get_file_type(filecell.ima1.civ2{1}); 1177 [Param.Civ2.FileTypeB,FileInfo,Param.Civ2.ImageB]=get_file_type(filecell.ima2.civ2{1}); 1178 end 1173 1179 end 1174 1180 … … 2941 2947 % determine the menu for checkciv1 pairs depending on existing netcdf file at the middle of 2942 2948 % the field series set by first_i, incr, last_i 2949 % index=1: look for pairs for civ1 2950 % index=2: look for pairs for civ2 2943 2951 function errormsg=find_netcpair_civ(handles,index) 2944 2952 %------------------------------------------------------------------------ … … 2947 2955 %% initialisation 2948 2956 errormsg=''; 2949 % filebase=get(handles.RootPath,'String');2950 % [filepath,Nme,ext_dir]=fileparts(filebase);2951 2957 browse=get(handles.RootPath,'UserData'); 2952 2958 compare_list=get(handles.ListCompareMode,'String'); … … 2966 2972 2967 2973 %% determine nom_type_nc, nomenclature type of the .nc files: 2968 % nom_type_nc='';%default 2969 % if isfield(browse,'nom_type_nc') 2970 % nom_type_nc=browse.nom_type_nc; 2971 % end 2972 % if isempty(nom_type_nc) 2973 [nom_type_nc]=nomtype2pair(nom_type_ima,mode); 2974 % end 2975 % browse.nom_type_nc=nom_type_nc; 2976 % set(handles.RootPath,'UserData',browse) 2974 [nom_type_nc]=nomtype2pair(nom_type_ima,mode); 2977 2975 2978 2976 %% reads .nc subdirectoy and image numbers from the interface … … 3004 3002 3005 3003 %% case with no Civ1 operation, netcdf files need to exist for reading 3006 % be performed, while the result is needed for next steps.3007 3004 displ_pair={''}; 3008 3005 select=ones(size(1:nbpair));%flag for displayed pairs =1 for display … … 3036 3033 errormsg=['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]; 3037 3034 else 3038 errormsg=['no civ1 file available for the selected reference ind ex i=' num2str(ref_i) ' and subdirectory ' subdir_civ1];3035 errormsg=['no civ1 file available for the selected reference indices (i,j)= ' num2str(ref_i) ', ' num2str(ref_j) ' and subdirectory ' subdir_civ1]; 3039 3036 end 3040 3037 set(handles.ListPairCiv1,'String',{''}); … … 3094 3091 if select(ipair) 3095 3092 displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))]; 3096 if ~checkframe && size(time,1)>=ref_i+1+displ_num(4,ipair) && size(time,2)>=ref_j+1+displ_num(2,ipair)&&displ_num(2,ipair)>=1 &&displ_num(1,ipair)>=1 3097 dt=time(ref_i+1+displ_num(4,ipair),ref_j+1+displ_num(2,ipair))-time(ref_i+1+displ_num(3,ipair),ref_j+1+displ_num(1,ipair));%time interval dt 3093 %if ~checkframe && size(time,1)>=ref_i+1+displ_num(4,ipair) && size(time,2)>=ref_j+1+displ_num(2,ipair)&&displ_num(2,ipair)>=1 &&displ_num(1,ipair)>=1 3094 % dt=time(ref_i+1+displ_num(4,ipair),ref_j+1+displ_num(2,ipair))-time(ref_i+1+displ_num(3,ipair),ref_j+1+displ_num(1,ipair));%time interval dt 3095 if ~checkframe && size(time,1)>=ref_i+1+ceil(ipair/2) && size(time,2)>=ref_j+1&& ref_i-floor(ipair/2)>=0 && ref_j>=0 3096 dt=time(ref_i+1+ceil(ipair/2),ref_j+1)-time(ref_i+1-floor(ipair/2),ref_j+1);%time interval dtref_j+1 3098 3097 else 3099 3098 dt=1; -
trunk/src/civ_matlab.m
r388 r389 172 172 return 173 173 end 174 check_patch1=1;174 175 175 Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch1_Rho','Patch1_Threshold','Patch1_SubDomain'}]; 176 176 Data.Patch1_Rho=Param.Patch1.SmoothingParam; 177 177 Data.Patch1_Threshold=Param.Patch1.MaxDiff; 178 178 Data.Patch1_SubDomain=Param.Patch1.SubdomainSize; 179 Data.ListVarName=[Data.ListVarName {'Civ1_U_ Diff','Civ1_V_Diff','Civ1_SubRange','Civ1_NbSites','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}];179 Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbSites','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}]; 180 180 Data.VarDimName=[Data.VarDimName {'NbVec1','NbVec1',{'NbCoord','Two','NbSubDomain1'},{'NbSubDomain1'},... 181 181 {'NbVec1Sub','NbCoord','NbSubDomain1'},{'Nbtps1','NbSubDomain1'},{'Nbtps1','NbSubDomain1'}}]; … … 183 183 Data.VarAttribute{nbvar-1}.Role='vector_x'; 184 184 Data.VarAttribute{nbvar}.Role='vector_y'; 185 Data.Civ1_U_ Diff=zeros(size(Data.Civ1_X));186 Data.Civ1_V_ Diff=zeros(size(Data.Civ1_X));185 Data.Civ1_U_smooth=zeros(size(Data.Civ1_X)); 186 Data.Civ1_V_smooth=zeros(size(Data.Civ1_X)); 187 187 if isfield(Data,'Civ1_FF') 188 188 ind_good=find(Data.Civ1_FF==0); … … 192 192 [Data.Civ1_SubRange,Data.Civ1_NbSites,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=... 193 193 filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomain,Data.Patch1_Rho,Data.Patch1_Threshold); 194 Data.Civ1_U_Diff(ind_good)=Data.Civ1_U(ind_good)-Ures; 195 Data.Civ1_V_Diff(ind_good)=Data.Civ1_V(ind_good)-Vres; 194 % Data.Civ1_U_Diff(ind_good)=Data.Civ1_U(ind_good)-Ures; 195 % Data.Civ1_V_Diff(ind_good)=Data.Civ1_V(ind_good)-Vres; 196 Data.Civ1_U_smooth(ind_good)=Ures; 197 Data.Civ1_V_smooth(ind_good)=Vres; 196 198 Data.Civ1_FF(ind_good)=FFres; 197 199 Data.CivStage=3; … … 213 215 ibx2=ceil(par_civ2.Bx/2); 214 216 iby2=ceil(par_civ2.By/2); 215 isx2=ibx2+ 5;% search ara +-5pixels around the guess216 isy2=iby2+ 5;217 isx2=ibx2+4;% search ara +-4 pixels around the guess 218 isy2=iby2+4; 217 219 % shift from par_civ2.filename_nc1 218 220 % shiftx=velocity interpolated at position -
trunk/src/filter_tps.m
r387 r389 28 28 W_smooth=[]; 29 29 NbCoord=size(Coord,2); 30 NbSubDomain= ceil(nbvec/SubDomain);30 NbSubDomain=nbvec/SubDomain; 31 31 MinCoord=min(Coord,[],1); 32 % MinY=min(Y,);33 32 MaxCoord=max(Coord,[],1); 34 % MaxY=max(Y);35 33 Range=MaxCoord-MinCoord; 36 % RangY=MaxY-MinY;37 34 AspectRatio=Range(2)/Range(1); 38 35 NbSubDomainX=max(floor(sqrt(NbSubDomain/AspectRatio)),1); … … 75 72 SubRange(:,1,isub)=SubRange(:,1,isub)-Siz'/4; 76 73 SubRange(:,2,isub)=SubRange(:,2,isub)+Siz'/4; 77 % SubRangy(isub,1)=SubRangy(isub,1)-Siz(2)/4; 78 % SubRangy(isub,2)=SubRangy(isub,2)+Siz(2)/4; 79 else 80 74 else 81 75 [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel,:),U(ind_sel),rho); 82 76 [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel,:),V(ind_sel),rho); … … 109 103 [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),V(ind_sel(ind_ind_sel)),rho); 110 104 U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+U_smooth_sub; 111 V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+V_smooth_sub; 105 V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+V_smooth_sub; 112 106 NbSites(isub)=numel(ind_ind_sel); 113 %Indices_tps(1:NbSites(isub),isub)=ind_sel(ind_ind_sel);114 107 Coord_tps(1:NbSites(isub),:,isub)=Coord(ind_sel(ind_ind_sel),:); 115 % Y_tps(1:NbSites(isub),:,isub)=Coord(ind_sel(ind_ind_sel),2);116 108 U_tps(1:NbSites(isub)+3,isub)=U_tps_sub; 117 109 V_tps(1:NbSites(isub)+3,isub)=V_tps_sub; … … 127 119 if ~isempty(ind_empty) 128 120 SubRange(:,:,ind_empty)=[]; 129 % SubRangy(ind_empty,:)=[];130 % Indices_tps(:,ind_empty)=[];131 121 Coord_tps(:,:,ind_empty)=[]; 132 % Y_tps(:,ind_empty)=[];133 122 U_tps(:,ind_empty)=[]; 134 123 V_tps(:,ind_empty)=[]; -
trunk/src/plot_field.m
r388 r389 156 156 set(htext,'String',{''}) 157 157 else 158 [errormsg]=plot_text(Data,CellVarIndex(index_0D), htext);158 [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext); 159 159 end 160 160 haxes=[]; … … 244 244 set(htext,'String',{''}) 245 245 else 246 [errormsg]=plot_text(Data,CellVarIndex(index_0D), htext);246 [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext); 247 247 end 248 248 end … … 276 276 277 277 %------------------------------------------------------------------- 278 function errormsg=plot_text(FieldData,CellVarIndex, htext)278 function errormsg=plot_text(FieldData,CellVarIndex,VarTypeCell,htext) 279 279 %------------------------------------------------------------------- 280 280 errormsg=[]; … … 283 283 VarIndex=CellVarIndex{icell};% indices of the selected variables in the list data.ListVarName 284 284 for ivar=1:length(VarIndex) 285 VarName=FieldData.ListVarName{VarIndex(ivar)}; 286 VarValue=FieldData.(VarName); 287 if size(VarValue,1)~=1 288 VarValue=VarValue'; 289 end 290 txt=[VarName '=' num2str(VarValue)]; 291 txt_cell=[txt_cell;{txt}]; 285 checkancillary=0; 286 if length(FieldData.VarAttribute)>=VarIndex(ivar) 287 VarAttribute=FieldData.VarAttribute{VarIndex(ivar)}; 288 if isfield(VarAttribute,'Role')&&strcmp(VarAttribute.Role,'ancillary') 289 checkancillary=1; 290 end 291 end 292 if ~checkancillary% does not display variables with attribute '.Role=ancillary' 293 VarName=FieldData.ListVarName{VarIndex(ivar)}; 294 VarValue=FieldData.(VarName); 295 if size(VarValue,1)~=1 296 VarValue=VarValue'; 297 end 298 txt=[VarName '=' num2str(VarValue)]; 299 txt_cell=[txt_cell;{txt}]; 300 end 292 301 end 293 302 end … … 1178 1187 siz2=1; 1179 1188 while siz2<2 1180 % values=[-9:div:9];1181 1189 values=-10:div:10; 1182 1190 ind=find((ord*values-MaxA)<0 & (ord*values-MinA)>0);%indices of 'values' such that MinA<ord*values<MaxA … … 1187 1195 end 1188 1196 siz2=size(ind,2); 1189 % siz2=siz(2)1190 1197 div=div/10; 1191 1198 end … … 1193 1200 end 1194 1201 1195 %'proj_grid': project fields with unstructured coordinantes on a regular grid1196 1202 % ------------------------------------------------------------------------- 1197 % function [A,rangx,rangy]=proj_grid(vec_X,vec_Y,vec_A,rgx_in,rgy_in,npxy_in) 1198 1199 1203 % --- 'proj_grid': project fields with unstructured coordinantes on a regular grid 1200 1204 function [A,rangx,rangy]=proj_grid(vec_X,vec_Y,vec_A,rgx_in,rgy_in,npxy_in) 1205 % ------------------------------------------------------------------------- 1201 1206 if length(vec_Y)<2 1202 1207 msgbox_uvmat('ERROR','less than 2 points in proj_grid.m'); … … 1212 1217 rangx=rgx_in; % first and last positions 1213 1218 rangy=rgy_in; 1214 % npxy=npxy_in;1215 1219 dxy(1)=1/(npxy_in(1)-1);%grid mesh in y 1216 1220 dxy(2)=1/(npxy_in(2)-1);%grid mesh in x … … 1227 1231 xi=[rangx(1):dxy(2):rangx(2)]; 1228 1232 yi=[rangy(1):dxy(1):rangy(2)]; 1229 [XI,YI]=meshgrid(xi,yi);% creates the matrix of regular coordinates1230 1233 A=griddata_uvmat(vec_X,vec_Y,vec_A,xi,yi'); 1231 1234 A=reshape(A,length(yi),length(xi)); … … 1235 1238 ymax=vec_Y(indexend+1);% y coordinate AFTER line change 1236 1239 ymin=vec_Y(index(1)); 1237 %y=[vec_Y(index) ymax]; % the set of y ordinates including the last one1238 1240 y=vec_Y(index); 1239 1241 y(length(y)+1)=ymax; … … 1252 1254 else 1253 1255 rangx=[vec_X(1) vec_X(nx)];% first and last position found for x 1254 % rangy=[ymin ymax];1255 1256 rangy=[max(ymax,ymin) min(ymax,ymin)]; 1256 1257 if max(nx,ny) <= 64 & isequal(npxy_in,'np>256') … … 1272 1273 else %no interpolation for a resolution higher than 256 1273 1274 A=B; 1274 XI=X; 1275 YI=Y; 1276 end 1277 end 1275 end 1276 end -
trunk/src/read_civdata.m
r382 r389 83 83 Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'Dt'}]; 84 84 var_ind=find(vardetect); 85 for ivar=1: min(numel(var_ind),numel(Field.VarAttribute))85 for ivar=1:numel(var_ind) 86 86 Field.VarAttribute{ivar}.Role=role{var_ind(ivar)}; 87 87 Field.VarAttribute{ivar}.Unit=units{var_ind(ivar)}; … … 95 95 Field.TimeUnit='s'; 96 96 Field.CoordUnit='pixel'; 97 98 99 97 100 98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 122 120 for ilist=1:length(FieldNames) 123 121 if ~isempty(FieldNames{ilist}) 124 switch FieldNames{ilist}125 case{'u','v'}126 testpatch=1;127 case {'vort','div','strain'}128 testder=1;129 122 switch FieldNames{ilist} 123 case{'u','v'} 124 testpatch=1; 125 case {'vort','div','strain'} 126 testder=1; 127 end 130 128 end 131 end 132 end 133 129 end 134 130 if isempty(vel_type) 135 131 switch CivStage … … 153 149 154 150 switch vel_type 155 case {'civ1','filter1'}156 var={'X','Y','Z','U','V','W','C','F','FF',' X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites','Indices_tps';...151 case 'civ1' 152 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 157 153 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 158 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites','Civ1_Indices_tps'}; 159 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','','','',''}; 160 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel','',''}; 161 case 'civ-filter1' 162 var={'X','Y','Z','U','V','W','FF';... 163 'Civ1_X','Civ1_Y','','Civ1_U_Diff','Civ1_V_Diff','','Civ1_FF'}; 164 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','errorflag'}; 165 units={'pixel','pixel','pixel','pixel','pixel','pixel',[]}; 166 % case 'filter1' 167 % var={'X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites','Indices_tps';... 168 % 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites','Civ1_Indices_tps'}; 169 % role={'','','','','','','','','',''}; 170 % units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel','',''}; 171 case {'civ2','filter2'} 172 var={'X','Y','Z','U','V','W','C','F','FF','X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites','Indices_tps';... 154 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbSites'}; 155 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','ancillary','ancillary',... 156 'ancillary','ancillary','ancillary','ancillary'}; 157 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 158 case 'filter1' 159 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 160 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U_smooth','Civ1_V_smooth','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 161 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbSites'}; 162 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','ancillary','ancillary',... 163 'ancillary','ancillary','ancillary','ancillary'}; 164 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 165 case 'civ2' 166 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 173 167 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 174 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites','Civ2_Indices_tps'}; 175 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','','','',''}; 176 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel','',''}; 177 % var={'X','Y','Z','U','V','W','C','F','FF';... 178 % 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF'}; 179 % role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 180 % units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]}; 181 case 'civ-filter2' 182 var={'X','Y','Z','U','V','W','FF';... 183 'Civ2_X','Civ2_Y','','Civ2_U_Diff','Civ2_V_Diff','','Civ2_FF'}; 184 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','errorflag'}; 185 units={'pixel','pixel','pixel','pixel','pixel','pixel',[]}; 186 % case 'filter2' 187 % var={'X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites','Indices_tps';... 188 % 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites','Civ2_Indices_tps'}; 189 % role={'','','','','','','','','',''}; 190 % units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel','',''}; 168 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbSites'}; 169 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','',''}; 170 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 171 case 'filter2' 172 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbSites';... 173 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U_smooth','Civ2_V_smooth','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 174 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbSites'}; 175 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','',''}; 176 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''}; 191 177 end 192 178 vel_type_out=vel_type; -
trunk/src/uvmat.m
r388 r389 42 42 % .NewSeries: =1 when the first view of a new field series is displayed, else 0 43 43 % .filename:(char string) 44 % .VelType:(char string) type of velocity field selected45 % .VelType_1:(char string) REMPLACER LE CELL ACTUEL46 44 % .FieldName: (char string) main field selected('image', 'velocity'...) 47 % .FieldName_1:(char string) second field selected('image', 'velocity'...)48 45 % .CName: (char string)name of the scalar used for vector colors 49 46 % .MovieObject{1}: movie object representing an input movie 50 47 % .MovieObject{2}: idem for a second input series (_1) 51 48 % .filename_1 : last second input file name (to deal with a constant second input without reading again the file) 52 % .VelType_1: last velocity type (VelType, civ2...) for the second input series53 % .FieldName_1: last field name(velocity, vorticity...) for the second input series54 49 % .ZMin, .ZMax: range of the z coordinate 55 50 %..... to complement … … 1892 1887 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 1893 1888 drawnow 1894 %filename=read_file_boxes(handles);1895 1889 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 1896 1890 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; … … 1899 1893 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); 1900 1894 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1]; 1901 % filename_1=read_file_boxes_1(handles);1902 1895 end 1903 1896 num_i1=stra2num(get(handles.i1,'String')); … … 1983 1976 FieldName= list_fields{index_fields}; % selected field 1984 1977 if ~strcmp(FieldName,'get_field...') 1985 TestVelType=get(handles.FixVelType,'Value'); 1986 if TestVelType 1987 VelType=setfield(handles);% read the velocity type. 1978 if get(handles.FixVelType,'Value') 1979 VelTypeList=get(handles.VelType,'String'); 1980 VelType=VelTypeList{get(handles.VelType,'Value')}; 1981 % VelType=setfield(handles);% read the velocity type. 1988 1982 end 1989 1983 end … … 2043 2037 case {'civx','civdata','netcdf'}; 2044 2038 list_fields=get(handles.Fields_1,'String');% list menu fields 2045 index_fields=get(handles.Fields_1,'Value');% selected string index 2046 FieldName_1= list_fields{index_fields}; % selected field 2039 FieldName_1= list_fields{get(handles.Fields_1,'Value')}; % selected field 2047 2040 if ~strcmp(FieldName,'get_field...') 2048 TestVelType=get(handles.FixVelType,'Value'); 2049 if TestVelType 2050 VelType_1=setfield(handles);% read the velocity type. 2041 if get(handles.FixVelType,'Value') 2042 VelTypeList=get(handles.VelType_1,'String'); 2043 VelType_1=VelTypeList{get(handles.VelType_1,'Value')};% read the velocity type. 2044 % VelType_1=setfield(handles);% read the velocity type. 2051 2045 end 2052 2046 end … … 2074 2068 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2075 2069 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2076 if isfield(UvData,'filename_1') && isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')2077 test_keepdata_1= strcmp(filename_1,UvData.filename_1) && strcmp(VelType_1,UvData.VelType_1)&& strcmp(FieldName_1,UvData.FieldName_1);2070 if isfield(UvData,'filename_1')%&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2071 test_keepdata_1= strcmp(filename_1,UvData.filename_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1); 2078 2072 end 2079 2073 end 2080 2074 if test_keepdata_1 2081 Field{2}=UvData.Field_1; 2075 Field{2}=UvData.Field_1;% keep the stored field 2082 2076 else 2083 2077 ParamIn.FieldName=FieldName_1; … … 2136 2130 set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu 2137 2131 else 2138 if ~isequal(FileType_1,'netcdf')|| isequal(FieldName_1,'get_field...')2132 if (~strcmp(FileType_1,'netcdf')&&~strcmp(FileType_1,'civdata')&&~strcmp(FileType_1,'civx'))|| isequal(FieldName_1,'get_field...') 2139 2133 set(handles.VelType_1,'Visible','off') 2140 2134 else … … 2162 2156 if UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W) && ~isequal(Field{1}.NbDim,3); 2163 2157 set(handles.SubField,'Value',1); 2164 %menu=update_menu(handles.Fields_1,'w');%update the menu for the background scalar nd set the choice to 'w'2165 2158 set(handles.RootPath_1,'String','"') 2166 2159 set(handles.RootFile_1,'String','"') 2167 2160 set(handles.SubDir_1,'String','"'); 2168 2161 indices=fullfile_uvmat('','','','',NomType,num_i1,num_i2,num_j1,num_j2); 2169 %[indices]=name_generator('',num_i1,num_j1,'',NomType,1,num_i2,num_j2,'');2170 2162 set(handles.FileIndex_1,'String',indices) 2171 2163 set(handles.FileExt_1,'String','"'); … … 2183 2175 %% store the current open names, fields and vel types in uvmat interface 2184 2176 UvData.filename_1=filename_1; 2185 UvData.VelType_1=[];%default2186 UvData.FieldName_1=[];2187 if isfield(ParamOut_1,VelType)2188 UvData.VelType_1=ParamOut_1.VelType;2189 end2190 if isfield(ParamOut_1,FieldName)2191 UvData.FieldName_1=ParamOut_1.FieldName;2192 end2193 2177 2194 2178 %% apply coordinate transform or other user fct … … 2209 2193 end 2210 2194 %px to phys or other transform on field 2211 if ~isempty(transform) 2195 if ~isempty(transform) 2212 2196 if length(Field)>=2 2213 2197 Field{2}.ZIndex=z_index; … … 2219 2203 Field{1}=transform(Field{1},XmlData); 2220 2204 end 2221 end 2222 2223 2224 %% update tps in phys coordinates if needed 2225 if (strcmp(VelType,'filter1')||strcmp(VelType,'filter2'))&& strcmp(FileType,'civdata')&&isfield(Field{1},'U')&& isfield(Field{1},'V') 2226 [Field{1}.SubRange,Field{1}.NbSites,Field{1}.Coord_tps,Field{1}.U_tps,Field{1}.V_tps]=filter_tps([Field{1}.X Field{1}.Y],Field{1}.U,Field{1}.V,[],1500,0); 2205 %% update tps in phys coordinates if needed 2206 if (strcmp(VelType,'filter1')||strcmp(VelType,'filter2'))&& strcmp(FileType,'civdata')&&isfield(Field{1},'U')&& isfield(Field{1},'V') 2207 Field{1}.X=Field{1}.X(Field{1}.FF==0); 2208 Field{1}.Y=Field{1}.Y(Field{1}.FF==0); 2209 Field{1}.U=Field{1}.U(Field{1}.FF==0); 2210 Field{1}.V=Field{1}.V(Field{1}.FF==0); 2211 [Field{1}.SubRange,Field{1}.NbSites,Field{1}.Coord_tps,Field{1}.U_tps,Field{1}.V_tps]=filter_tps([Field{1}.X Field{1}.Y],Field{1}.U,Field{1}.V,[],Field{1}.Patch1_SubDomain,0); 2212 end 2213 if numel(Field)==2 && ~test_keepdata_1 && isequal(FileType_1(1:3),'civ') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1) 2214 %update tps in phys coordinates if needed 2215 if (strcmp(VelType_1,'filter1')||strcmp(VelType_1,'filter2'))&& strcmp(FileType_1,'civdata')&&isfield(Field{2},'U')&& isfield(Field{2},'V') 2216 Field{2}.X=Field{2}.X(Field{2}.FF==0); 2217 Field{2}.Y=Field{1}.Y(Field{2}.FF==0); 2218 Field{2}.U=Field{1}.U(Field{2}.FF==0); 2219 Field{2}.V=Field{1}.V(Field{2}.FF==0); 2220 [Field{2}.SubRange,Field{2}.NbSites,Field{2}.Coord_tps,Field{2}.U_tps,Field{2}.V_tps]=filter_tps([Field{2}.X Field{2}.Y],Field{2}.U,Field{2}.V,[],1500,0); 2221 end 2222 end 2227 2223 end 2228 2224 2229 2225 %% calculate scalar 2230 if strcmp(FileType(1:3),'civ') && ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2231 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1},VelType); 2232 end 2233 if numel(Field)==2 && ~test_keepdata_1 && isequal(FileType_1(1:3),'civ') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1) 2234 %update tps in phys coordinates if needed 2235 if (strcmp(VelType_1,'filter1')||strcmp(VelType_1,'filter2'))&& strcmp(FileType_1,'civdata')&&isfield(Field{2},'U')&& isfield(Field{2},'V') 2236 [Field{2}.SubRange,Field{2}.NbSites,Field{2}.Coord_tps,Field{2}.U_tps,Field{2}.V_tps]=filter_tps([Field{2}.X Field{2}.Y],Field{2}.U,Field{2}.V,[],1500,0); 2237 end 2238 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2},VelType_1); 2226 if (strcmp(FileType,'civdata')||strcmp(FileType,'civx'))&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2227 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1},ParamOut.VelType); 2228 end 2229 if numel(Field)==2 && ~test_keepdata_1 && (strcmp(FileType,'civdata')||strcmp(FileType,'civx')) &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2230 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2},ParamOut_1.VelType); 2239 2231 end 2240 2232 … … 2387 2379 end 2388 2380 else 2389 % create a default projection2390 UvData.Object{1}.ProjMode='projection';%main plotting plane2391 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat2392 set(handles.ListObject,'Value',1);2393 list_object=get(handles.ListObject,'String');2394 if isempty(list_object)2395 list_object={''};2396 elseif ~isempty(list_object{1})2397 list_object=[{''};list_object];2398 end2399 set(handles.ListObject,'String',list_object);2400 % set(handles.list_object_2,'String',list_object);2381 % % create a default projection 2382 % UvData.Object{1}.ProjMode='projection';%main plotting plane 2383 % UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2384 % set(handles.ListObject,'Value',1); 2385 % list_object=get(handles.ListObject,'String'); 2386 % if isempty(list_object) 2387 % list_object={''}; 2388 % elseif ~isempty(list_object{1}) 2389 % list_object=[{''};list_object]; 2390 % end 2391 % set(handles.ListObject,'String',list_object); 2392 % % set(handles.list_object_2,'String',list_object); 2401 2393 end 2402 2394 testnewseries=UvData.NewSeries; … … 2783 2775 var_FixFlag(1:nb_vectors)=AxeData.FF;% 2784 2776 fin=close(nc); 2785 2786 %-------------------------------------------------------------------2787 %determines the fields to read from the interface2788 %------------------------------------------------------------------2789 function VelType=setfield(handles)2790 VelTypeList=get(handles.VelType,'String');2791 index=get(handles.VelType,'Value');2792 VelType=VelTypeList{index};2793 2794 %-------------------------------------------------------------------2795 %determines the veltype of the second field to read from the iinterface2796 %------------------------------------------------------------------2797 function VelType=setfield_1(handles)2798 VelTypeList=get(handles.VelType_1,'String');2799 index=get(handles.VelType_1,'Value');2800 VelType=VelTypeList{index};2801 2777 2802 2778 %--------------------------------------------------- … … 2966 2942 set(handles.num_Npy,'Visible','off') 2967 2943 end 2968 setfield(handles);% update the field structure ('civ1'....)2969 2944 if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 2970 2945 run0_Callback(hObject, eventdata, handles) … … 2980 2955 if check_new && isfield(UvData,'XmlData') 2981 2956 UvData.XmlData{2}=UvData.XmlData{1}; 2957 end 2958 if isfield(UvData,'Field_1') 2959 UvData=rmfield(UvData,'Field_1');% remove the stored second field (a new one needs to be read) 2982 2960 end 2983 2961 list_fields=get(handles.Fields,'String');% list menu fields … … 3062 3040 end 3063 3041 set(handles.uvmat,'UserData',UvData) 3064 setfield(handles);% update the field structure ('civ1'....)3042 % setfield(handles);% update the field structure ('civ1'....) 3065 3043 if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 3066 3044 run0_Callback(hObject, eventdata, handles) … … 3072 3050 function menu=set_veltype_display(Civ,FileType) 3073 3051 %------------------------------------------------------------------------ 3074 if isequal(Civ,0)3075 imax=0;3076 elseif isequal(Civ,1) || isequal(Civ,2)3077 imax=1;3078 elseif isequal(Civ,3)3079 imax=3;3080 elseif isequal(Civ,4) || isequal(Civ,5)3081 imax=4;3082 elseif isequal(Civ,6) %patch23083 imax=6;3084 end3085 3052 if ~exist('FileType','var') 3086 3053 FileType='civx'; … … 3088 3055 switch FileType 3089 3056 case 'civx' 3090 menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'}; 3057 menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'}; 3058 if isequal(Civ,0) 3059 imax=0; 3060 elseif isequal(Civ,1) || isequal(Civ,2) 3061 imax=1; 3062 elseif isequal(Civ,3) 3063 imax=3; 3064 elseif isequal(Civ,4) || isequal(Civ,5) 3065 imax=4; 3066 elseif isequal(Civ,6) %patch2 3067 imax=6; 3068 end 3091 3069 case 'civdata' 3092 menu={'civ1';'civ-filter1';'filter1';'civ2';'civ-filter2';'filter2'}; 3093 end 3070 menu={'civ1';'filter1';'civ2';'filter2'}; 3071 if isequal(Civ,0) 3072 imax=0; 3073 elseif isequal(Civ,1) || isequal(Civ,2) 3074 imax=1; 3075 elseif isequal(Civ,3) 3076 imax=2; 3077 elseif isequal(Civ,4) || isequal(Civ,5) 3078 imax=3; 3079 elseif isequal(Civ,6) %patch2 3080 imax=4; 3081 end 3082 end 3083 3084 3085 3094 3086 menu=menu(1:imax); 3095 3087 … … 3107 3099 3108 3100 set(handles.FixVelType,'Value',1)% the velocity type is now imposed by the GUI (not automatic) 3101 UvData=get(handles.uvmat,'UserData'); 3109 3102 %refresh field with a second filename=first fiel name 3110 3103 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow … … 3113 3106 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3114 3107 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3115 %filename=read_file_boxes(handles); 3116 3117 index=get(handles.VelType_1,'Value'); 3118 if index==1 3108 % VelTypeList=get(handles.VelType_1,'String'); 3109 % VelType_1=VelTypeList{get(handles.VelType_1,'Value')}; 3110 if isempty(InputFile.VelType_1) 3119 3111 filename_1='';% we plot the current field without the second field 3120 3112 set(handles.SubField,'Value',0) … … 3123 3115 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); 3124 3116 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1]; 3125 %filename_1=read_file_boxes_1(handles); %read the current second field 3117 % UvData.VelType{2}=InputFile.VelType_1; 3126 3118 else 3127 3119 filename_1=filename;% we compare two fields in the same file 3120 UvData.FileType{2}=UvData.FileType{1}; 3121 % UvData.VelType{2}=InputFile.VelType_1; 3128 3122 set(handles.SubField,'Value',1) 3129 3123 end 3130 3124 if isfield(UvData,'Field_1') 3125 UvData=rmfield(UvData,'Field_1');% removes the stored second field if it exists 3126 end 3127 set(handles.uvmat,'UserData',UvData) 3131 3128 num_i1=stra2num(get(handles.i1,'String')); 3132 3129 num_i2=stra2num(get(handles.i2,'String')); … … 4456 4453 4457 4454 %read the file 4458 % t=xmltree(fileinput);4459 % data=convert(t);4460 4455 data=xml2struct(fileinput); 4461 4456 data.enable_plot=1; 4462 [pp,data.Name]=fileparts(FileName); 4463 %PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 4457 [tild,data.Name]=fileparts(FileName); 4464 4458 hset_object=findobj(allchild(0),'tag','set_object'); 4465 4459 if ~isempty(hset_object) … … 4490 4484 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4491 4485 data.enable_plot=1; 4492 transform_list=get(handles.transform_fct,'String');4493 val=get(handles.transform_fct,'Value');4494 %data.CoordType=transform_list{val};4495 4486 data.Coord=[0 0]; %default 4496 4487 if isfield(UvData,'Field') 4497 4488 Field=UvData.Field; 4498 4489 if isfield(Field,'Mesh')&&~isempty(Field.Mesh) 4499 data.RangeX=Field.Mesh; 4500 data.RangeY=Field.Mesh; 4501 data.DX=Field.Mesh; 4502 data.DY=Field.Mesh; 4490 ord=10^(floor(log10(Field.Mesh)));%order of magnitude 4491 if Field.Mesh/ord>=5 4492 mesh=5*ord; 4493 elseif Field.Mesh/ord>=2 4494 mesh=2*ord; 4495 else 4496 mesh=ord; 4497 end 4498 data.RangeX=mesh; 4499 data.RangeY=mesh; 4500 data.DX=mesh; 4501 data.DY=mesh; 4503 4502 elseif isfield(Field,'AX')&& isfield(Field,'AY')&& isfield(Field,'A')%only image 4504 4503 np=size(Field.A); … … 4516 4515 end 4517 4516 end 4518 % if isfield(data,'Type') && isequal(data.Type,'line')4519 % if isfield(data,'DX')4520 % data.Coord=[[0 0 0];[data.DX 0 0]]; %default4521 % else4522 % data.Coord=[[0 0 0];[1 0 0]]; %default4523 % end4524 % end4525 4517 if ishandle(handles.UVMAT_title) 4526 4518 delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered 4527 4519 end 4528 %PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters4529 4520 set_object(data,handles);% call the set_object interface 4530 4521 set(handles.MenuObject,'checked','on') … … 4533 4524 CheckZoom_Callback(handles.uvmat, [], handles) 4534 4525 set(handles.delete_object,'Visible','on') 4535 % set(handles._title,'Visible','on')4536 % set(handles.view_field_title,'Visible','on')4537 4526 4538 4527 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.