Changeset 411
- Timestamp:
- May 7, 2012, 3:32:21 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r408 r411 168 168 case 'velocity' 169 169 ListFields={'U', 'V'}; 170 VarAttribute s{var_count+1}.Role='vector_x';171 VarAttribute s{var_count+2}.Role='vector_y';170 VarAttribute{var_count+1}.Role='vector_x'; 171 VarAttribute{var_count+2}.Role='vector_y'; 172 172 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 173 173 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 174 174 case 'u' 175 175 ListFields={'u'}; 176 VarAttribute s{var_count+1}.Role='scalar';176 VarAttribute{var_count+1}.Role='scalar'; 177 177 DataOut.u(ind_sel)=DataOut.u(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 178 178 case 'v' 179 179 ListFields={'v'}; 180 VarAttribute s{var_count+1}.Role='scalar';180 VarAttribute{var_count+1}.Role='scalar'; 181 181 DataOut.v(ind_sel)=DataOut.v(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 182 182 case 'norm_vel' 183 183 ListFields={'norm_vel'}; 184 VarAttribute s{var_count+1}.Role='scalar';185 V=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub);184 VarAttribute{var_count+1}.Role='scalar'; 185 U=DataOut.U(ind_sel)+EM *DataIn.U_tps(1:nbvec_sub+3,isub); 186 186 V=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 187 187 DataOut.norm_vel(ind_sel)=sqrt(U.*U+V.*V); 188 188 case 'vort' 189 189 ListFields={'vort'}; 190 VarAttribute s{var_count+1}.Role='scalar';191 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);190 VarAttribute{var_count+1}.Role='scalar'; 191 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); 192 192 case 'div' 193 193 ListFields={'div'}; 194 VarAttribute s{var_count+1}.Role='scalar';194 VarAttribute{var_count+1}.Role='scalar'; 195 195 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); 196 196 case 'strain' 197 197 ListFields={'strain'}; 198 VarAttribute s{var_count+1}.Role='scalar';198 VarAttribute{var_count+1}.Role='scalar'; 199 199 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); 200 200 end 201 DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang 202 nbval(nbval==0)=1; 203 DataOut.ListVarName=[DataOut.ListVarName ListFields {'FF'}]; 204 for ilist=1:numel(ListFields) 205 VarDimName{ilist}={'coord_y','coord_x'}; 206 DataOut.(ListFields{ilist})=reshape(DataOut.(ListFields{ilist}),npy,npx); 207 end 208 DataOut.FF=reshape(DataOut.FF,npy,npx); 209 DataOut.VarDimName=[DataOut.VarDimName VarDimName {{'coord_y','coord_x'}}] ; 210 VarAttributes{length(ListFields)+1}.Role='errorflag'; 211 DataOut.VarAttribute=[DataOut.VarAttribute VarAttributes]; 212 end 213 end 201 end 202 end 203 DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang 204 nbval(nbval==0)=1; 205 if isempty(find(strcmp('FF',DataOut.ListVarName),1))% if FF is not already listed 206 DataOut.ListVarName=[DataOut.ListVarName {'FF'}]; 207 DataOut.VarDimName=[DataOut.VarDimName {{'coord_y','coord_x'}}]; 208 DataOut.VarAttribute{length(DataOut.ListVarName)}.Role='errorflag'; 209 end 210 DataOut.ListVarName=[DataOut.ListVarName ListFields]; 211 for ifield=1:numel(ListFields) 212 VarDimName{ifield}={'coord_y','coord_x'}; 213 DataOut.(ListFields{ifield})=reshape(DataOut.(ListFields{ifield}),npy,npx); 214 end 215 DataOut.FF=reshape(DataOut.FF,npy,npx); 216 DataOut.VarDimName=[DataOut.VarDimName VarDimName]; 217 DataOut.VarAttribute=[DataOut.VarAttribute VarAttribute]; 214 218 else 215 219 -
trunk/src/civ_matlab.m
r410 r411 490 490 491 491 %% Apply mask 492 % Convention for mask 492 % Convention for mask IDEAS TO IMPLEMENT ? 493 493 % mask >200 : velocity calculated 494 494 % 200 >=mask>150;velocity not calculated, interpolation allowed (bad spots) 495 495 % 150>=mask >100: velocity not calculated, nor interpolated 496 % 100>=mask> 20: velocity not calculated, impermeable (no flux through mask boundaries) TO IMPLEMENT496 % 100>=mask> 20: velocity not calculated, impermeable (no flux through mask boundaries) 497 497 % 20>=mask: velocity=0 498 498 checkmask=0; … … 504 504 end 505 505 % check_noflux=(par_civ.Mask<100) ;%TODO: to implement 506 check_undefined=(par_civ.Mask<200 & par_civ.Mask>= 100 );506 check_undefined=(par_civ.Mask<200 & par_civ.Mask>=20 ); 507 507 par_civ.ImageA(check_undefined)=min(min(par_civ.ImageA));% put image A to zero (i.e. the min image value) in the undefined area 508 508 par_civ.ImageB(check_undefined)=min(min(par_civ.ImageB));% put image B to zero (i.e. the min image value) in the undefined area -
trunk/src/find_field_indices.m
r404 r411 52 52 function [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data) 53 53 CellVarIndex={}; 54 54 55 NbDim=[]; 55 56 VarType=[]; … … 105 106 'ancillary','image','color','discrete','scalar','coord_tps'}; 106 107 NbDim=zeros(size(CellVarIndex));%default 108 if isfield(Data,'VarAttribute'); 109 VarAttribute=Data.VarAttribute; 110 else 111 VarAttribute={}; 112 end 107 113 for icell=1:length(CellVarIndex) 108 114 for ilist=1:numel(ListRole) … … 111 117 VarIndex=CellVarIndex{icell};%set of variable indices with the same dim 112 118 DimCell=Data.VarDimName{VarIndex(1)};% list of dimensions for each variable in the cell #icell 113 if isfield(Data,'VarAttribute');114 VarAttribute=Data.VarAttribute;115 else116 VarAttribute={};117 end118 119 test_2D=0; 119 120 for ivar=VarIndex … … 181 182 VarType{icell}.coord=coord; 182 183 if NbDim(icell)==0 && test_2D %look at attributes Coord_1, coord_2 (obsolete convention) 183 NbDim(icell)=2; 184 NbDim(icell)=2; 184 185 end 185 186 %look for tps data -
trunk/src/plot_field.m
r405 r411 100 100 PlotType='text'; %default 101 101 PlotParamOut=PlotParam;%default 102 Coordinates=[]; 103 if isfield(PlotParam,'Coordinates') 104 Coordinates=PlotParam.Coordinates; 102 if ~isfield(PlotParam,'Coordinates') 103 PlotParam.Coordinates=[]; 105 104 end 106 105 … … 193 192 194 193 %% set axes properties 195 if isfield( Coordinates,'CheckFixLimits') && isequal(Coordinates.CheckFixLimits,1) %adjust the graph limits194 if isfield(PlotParam.Coordinates,'CheckFixLimits') && isequal(PlotParam.Coordinates.CheckFixLimits,1) %adjust the graph limits 196 195 set(haxes,'XLimMode', 'manual') 197 196 set(haxes,'YLimMode', 'manual') … … 200 199 set(haxes,'YLimMode', 'auto') 201 200 end 202 if ~isfield( Coordinates,'CheckFixEqual')&& isfield(Data,'CoordUnit')203 Coordinates.CheckFixEqual=1;204 end 205 if isfield( Coordinates,'CheckFixEqual') && isequal(Coordinates.CheckFixEqual,1)201 if ~isfield(PlotParam.Coordinates,'CheckFixEqual')&& isfield(Data,'CoordUnit') 202 PlotParam.Coordinates.CheckFixEqual=1;% if CoordUnit is defined, the two coordiantes should be plotted with equal scale by default 203 end 204 if isfield(PlotParam.Coordinates,'CheckFixEqual') && isequal(PlotParam.Coordinates.CheckFixEqual,1) 206 205 set(haxes,'DataAspectRatioMode','manual') 207 206 set(haxes,'DataAspectRatio',[1 1 1]) … … 228 227 end 229 228 else 230 Coordinates=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes, Coordinates);%229 Coordinates=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,PlotParam.Coordinates);% 231 230 if testzoomaxes 232 231 [zoomaxes,Coordinates]=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),zoomaxes,PlotParam.Coordinates); … … 499 498 function [haxes,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex,VarTypeCell,haxes,PlotParam,PosColorbar) 500 499 %------------------------------------------------------------------- 501 grid(haxes, 'off') 500 501 grid(haxes, 'off')% remove grid (possibly remaining from other graphs) 502 502 %default plotting parameters 503 503 PlotType='plane';%default … … 505 505 PlotParam=[]; 506 506 end 507 if ~isfield(PlotParam,'Coordinates') 508 PlotParam.Coordinates=[]; 509 end 507 510 508 if ~isfield(PlotParam,'Scalar') 511 509 PlotParam.Scalar=[]; … … 866 864 hima=imagesc(AX,AY,B,[MaxA-1 MaxA]); 867 865 end 868 set(hima,'Tag','ima','HitTest','off') 866 % the function imagesc reset the axes 'DataAspectRatioMode'='auto', change if .CheckFixEqual is 867 % requested: 868 if isfield(PlotParam.Coordinates,'CheckFixEqual') && isequal(PlotParam.Coordinates.CheckFixEqual,1) 869 set(haxes,'DataAspectRatioMode','manual') 870 set(haxes,'DataAspectRatio',[1 1 1]) 871 end 872 set(hima,'Tag','ima') 873 set(hima,'HitTest','off') 869 874 set(haxes,'Tag',tag);%preserve the axes tag (removed by image fct !!!) 870 875 uistack(hima, 'bottom') -
trunk/src/uvmat.m
r410 r411 2456 2456 %% Plot the projections on the selected projection objects 2457 2457 % main projection object (uvmat display) 2458 list_object=get(handles.ListObject ,'String');2458 list_object=get(handles.ListObject_1,'String'); 2459 2459 if isequal(list_object,{''})%refresh list of objects if the menu is empty 2460 2460 UvData.Object={[]}; 2461 set(handles.ListObject ,'Value',1)2462 end 2463 IndexObj =get(handles.ListObject,'Value');%selected projection object for main view2461 set(handles.ListObject_1,'Value',1) 2462 end 2463 IndexObj(1)=get(handles.ListObject_1,'Value');%selected projection object for main view 2464 2464 if IndexObj(1)> numel(UvData.Object) 2465 2465 IndexObj(1)=1;%select the first object if the selected one does not exist 2466 set(handles.ListObject,'Value',1) 2466 set(handles.ListObject_1,'Value',1) 2467 end 2468 IndexObj(2)=get(handles.ListObject,'Value');%selected projection object for main view 2469 if isequal(IndexObj(2),IndexObj(1)) 2470 IndexObj(2)=[]; 2467 2471 end 2468 2472 plot_handles{1}=handles; … … 2744 2748 % --- Executes on button press in CheckFixEqual. 2745 2749 function CheckFixEqual_Callback(hObject, eventdata, handles) 2746 test=get(handles.CheckFixEqual,'Value'); 2747 if test 2750 if get(handles.CheckFixEqual,'Value') 2748 2751 set(handles.CheckFixEqual,'BackgroundColor',[1 1 0]) 2749 cla(handles.axes3)2750 2752 update_plot(handles); 2751 2753 else 2752 2754 set(handles.CheckFixEqual,'BackgroundColor',[0.7 0.7 0.7]) 2753 2755 update_plot(handles); 2754 % axis(handles.axes3,'image')2755 2756 end 2756 2757 … … 3465 3466 3466 3467 %delete mask if it is displayed 3467 if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on3468 UvData=rmfield(UvData,'MaskName'); %will impose mask refresh3469 end3468 % if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on 3469 % UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 3470 % end 3470 3471 set(handles.uvmat,'UserData',UvData) 3471 3472 run0_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.