Changeset 654 for trunk/src/uvmat.m
- Timestamp:
- Jun 30, 2013, 11:16:45 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r651 r654 2418 2418 % abstime_1=[]; 2419 2419 % end 2420 set(handles.TimeValue,'String',num2str(abstime)) 2420 2421 abstime_1=[]; 2421 2422 TimeName_1=get(handles.TimeName_1,'String'); … … 2480 2481 2481 2482 %% analyse input field 2482 [CellInfo,NbDimArray,errormsg]=find_field_cells(UvData.Field);% analyse the input field structure 2483 if ~isempty(errormsg) 2484 errormsg=['uvmat /refresh_field / find_field_cells / ' errormsg];% display error 2485 return 2486 end 2487 2488 NbDim=max(NbDimArray);% spatial dimension of the input field 2489 imax=find(NbDimArray==NbDim);% indices of field cells to consider 2490 if isfield(UvData.Field,'NbDim') 2491 NbDim=double(UvData.Field.NbDim);% deal with plane fields containing z coordinates 2492 end 2493 2494 %% get bounds and mesh (needed to propose default options for projection objects) 2495 if NbDim>1 2496 CoordMax=zeros(numel(imax),NbDim); 2497 CoordMin=zeros(numel(imax),NbDim); 2498 Mesh=zeros(1,numel(imax)); 2499 for ind=1:numel(imax) 2500 if strcmp(CellInfo{imax(ind)}.CoordType,'tps') 2501 CoordName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex};% X,Y coordinates in a single variable 2502 CoordMax(ind,NbDim)=max(max(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3);% max of x component (2D case) 2503 CoordMax(ind,NbDim-1)=max(max(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% max of y component (2D case) 2504 CoordMin(ind,NbDim)=min(min(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3); 2505 CoordMin(ind,NbDim-1)=min(min(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% min of y component (2D case) 2506 else 2507 XName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)}; 2508 YName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)}; 2509 CoordMax(ind,NbDim)=max(max(UvData.Field.(XName))); 2510 CoordMin(ind,NbDim)=min(min(UvData.Field.(XName))); 2511 CoordMax(ind,NbDim-1)=max(max(UvData.Field.(YName))); 2512 CoordMin(ind,NbDim-1)=min(min(UvData.Field.(YName))); 2513 % test_x=1;%test for unstructured coordinates 2514 if NbDim==3 2515 ZName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)}; 2516 CoordMax(imax(ind),1)=max(max(UvData.Field.(ZName))); 2517 CoordMin(ind,1)=min(min(UvData.Field.(ZName))); 2518 end 2519 end 2520 switch CellInfo{imax(ind)}.CoordType 2521 2522 case {'scattered','tps'} %unstructured coordinates 2523 NbPoints=CellInfo{imax(ind)}.CoordSize;% total nbre of points 2524 Mesh(ind)=(prod(CoordMax(ind,:)-CoordMin(ind,:))/NbPoints)^(1/NbDim); %(volume or area per point)^(1/NbDim) 2525 case 'grid'%structured coordinate 2526 NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points in each direction 2527 Mesh(ind)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1)); 2528 end 2529 end 2530 UvData.Field.CoordMesh=min(Mesh); 2531 UvData.Field.XMax=max(CoordMax(:,end)); 2532 UvData.Field.XMin=min(CoordMin(:,end)); 2533 UvData.Field.YMax=max(CoordMax(:,end-1)); 2534 UvData.Field.YMin=min(CoordMin(:,end-1)); 2535 if NbDim==3 2536 UvData.Field.ZMax=max(CoordMax(ind,1)); 2537 UvData.Field.ZMin=max(CoordMin(ind,1)); 2538 end 2539 % adjust the mesh to a value 1, 2 , 5 *10^n 2540 ord=10^(floor(log10(UvData.Field.CoordMesh)));%order of magnitude 2541 if UvData.Field.CoordMesh/ord>=5 2542 UvData.Field.CoordMesh=5*ord; 2543 elseif UvData.Field.CoordMesh/ord>=2 2544 UvData.Field.CoordMesh=2*ord; 2545 else 2546 UvData.Field.CoordMesh=ord; 2547 end 2483 % [CellInfo,NbDimArray,errormsg]=find_field_cells(UvData.Field);% analyse the input field structure 2484 % if ~isempty(errormsg) 2485 % errormsg=['uvmat /refresh_field / find_field_cells / ' errormsg];% display error 2486 % return 2487 % end 2488 % 2489 % NbDim=max(NbDimArray);% spatial dimension of the input field 2490 % imax=find(NbDimArray==NbDim);% indices of field cells to consider 2491 % if isfield(UvData.Field,'NbDim') 2492 % NbDim=double(UvData.Field.NbDim);% deal with plane fields containing z coordinates 2493 % end 2494 % 2495 % %% get bounds and mesh (needed to propose default options for projection objects) 2496 % if NbDim>1 2497 % CoordMax=zeros(numel(imax),NbDim); 2498 % CoordMin=zeros(numel(imax),NbDim); 2499 % Mesh=zeros(1,numel(imax)); 2500 % for ind=1:numel(imax) 2501 % if strcmp(CellInfo{imax(ind)}.CoordType,'tps') 2502 % CoordName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex};% X,Y coordinates in a single variable 2503 % CoordMax(ind,NbDim)=max(max(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3);% max of x component (2D case) 2504 % CoordMax(ind,NbDim-1)=max(max(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% max of y component (2D case) 2505 % CoordMin(ind,NbDim)=min(min(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3); 2506 % CoordMin(ind,NbDim-1)=min(min(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% min of y component (2D case) 2507 % else 2508 % XName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)}; 2509 % YName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)}; 2510 % CoordMax(ind,NbDim)=max(max(UvData.Field.(XName))); 2511 % CoordMin(ind,NbDim)=min(min(UvData.Field.(XName))); 2512 % CoordMax(ind,NbDim-1)=max(max(UvData.Field.(YName))); 2513 % CoordMin(ind,NbDim-1)=min(min(UvData.Field.(YName))); 2514 % % test_x=1;%test for unstructured coordinates 2515 % if NbDim==3 2516 % ZName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)}; 2517 % CoordMax(imax(ind),1)=max(max(UvData.Field.(ZName))); 2518 % CoordMin(ind,1)=min(min(UvData.Field.(ZName))); 2519 % end 2520 % end 2521 % switch CellInfo{imax(ind)}.CoordType 2522 % 2523 % case {'scattered','tps'} %unstructured coordinates 2524 % NbPoints=CellInfo{imax(ind)}.CoordSize;% total nbre of points 2525 % Mesh(ind)=(prod(CoordMax(ind,:)-CoordMin(ind,:))/NbPoints)^(1/NbDim); %(volume or area per point)^(1/NbDim) 2526 % case 'grid'%structured coordinate 2527 % NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points in each direction 2528 % Mesh(ind)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1)); 2529 % end 2530 % end 2531 % UvData.Field.CoordMesh=min(Mesh); 2532 % UvData.Field.XMax=max(CoordMax(:,end)); 2533 % UvData.Field.XMin=min(CoordMin(:,end)); 2534 % UvData.Field.YMax=max(CoordMax(:,end-1)); 2535 % UvData.Field.YMin=min(CoordMin(:,end-1)); 2536 % if NbDim==3 2537 % UvData.Field.ZMax=max(CoordMax(ind,1)); 2538 % UvData.Field.ZMin=max(CoordMin(ind,1)); 2539 % end 2540 % % adjust the mesh to a value 1, 2 , 5 *10^n 2541 % ord=10^(floor(log10(UvData.Field.CoordMesh)));%order of magnitude 2542 % if UvData.Field.CoordMesh/ord>=5 2543 % UvData.Field.CoordMesh=5*ord; 2544 % elseif UvData.Field.CoordMesh/ord>=2 2545 % UvData.Field.CoordMesh=2*ord; 2546 % else 2547 % UvData.Field.CoordMesh=ord; 2548 % end 2549 if UvData.Field.NbDim>1 2550 UvData.Field=find_field_bounds(UvData.Field); 2548 2551 % default projection plane 2549 2552 if isempty(UvData.ProjObject{1}) … … 2555 2558 end 2556 2559 %% 3D case (menuvolume) 2557 if NbDim==3% && UvData.NewSeries2560 if UvData.Field.NbDim==3% && UvData.NewSeries 2558 2561 test_set_object=1; 2559 2562 hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI … … 2607 2610 2608 2611 %% usual 1D (x,y) plots 2609 if NbDim<=12612 if UvData.Field.NbDim<=1 2610 2613 set(handles.Objects,'Visible','off') 2611 2614 set(handles.ListObject_1_title,'Visible','off') … … 2727 2730 view_field(ObjectData) 2728 2731 else 2732 % ObjectData.VarAttribute{5}.Role='scalar';TODO CORRECT 2729 2733 [PlotType,PlotParamOut]=plot_field(ObjectData,haxes(imap),PlotParam{imap},PosColorbar{imap}); 2730 2734 if imap==1 … … 3155 3159 set(handles.FixVelType,'visible','off') 3156 3160 set(handles.VelType,'Visible','off') 3157 set(handles.VelType_1,'Visible','off')3161 %set(handles.VelType_1,'Visible','off') 3158 3162 3159 3163 %read selection from get_field … … 3163 3167 FieldList={}; 3164 3168 VecColorList={}; 3165 XName=GetFieldData.Coordinates.Coord_x;3166 3169 switch GetFieldData.FieldOption 3167 3170 case 'vectors' 3168 3171 UName=GetFieldData.PanelVectors.vector_x; 3169 3172 VName=GetFieldData.PanelVectors.vector_y; 3170 XName=GetFieldData.Coordinates.Coord_x;3171 3173 YName={GetFieldData.Coordinates.Coord_y}; 3172 3174 CName=GetFieldData.PanelVectors.vec_color; … … 3174 3176 case 'scalar' 3175 3177 AName=GetFieldData.PanelScalar.scalar; 3176 XName=GetFieldData.Coordinates.Coord_x;3177 3178 YName={GetFieldData.Coordinates.Coord_y}; 3178 3179 FieldList={AName}; 3179 3180 case '1D plot' 3180 3181 YName=GetFieldData.PanelOrdinate.ordinate; 3181 XName=GetFieldData.Coordinates.Coord_x; 3182 end 3182 case 'civdata...'%return to civdata from get_field 3183 % [FieldList,VecColorList]=set_field_list('U','V','C'); 3184 set(handles.FieldName,'Value',2) 3185 set(handles.FixVelType,'visible','on') 3186 set(handles.VelType,'Visible','on') 3187 end 3188 if ~strcmp(GetFieldData.FieldOption,'civdata...') 3189 XName=GetFieldData.Coordinates.Coord_x; 3183 3190 TimeNameStr=GetFieldData.Time.SwitchVarIndexTime; 3184 3191 if strcmp(TimeNameStr,'file index') … … 3203 3210 UvData.FileType{1}='netcdf'; 3204 3211 set(handles.uvmat,'UserData',UvData) 3212 end 3205 3213 run0_Callback(hObject, eventdata, handles) 3206 3214 … … 4076 4084 function num_MinVec_Callback(hObject, eventdata, handles) 4077 4085 %------------------------------------------------------------------------ 4078 max_vec_Callback(hObject, eventdata, handles)4086 num_MaxVec_Callback(hObject, eventdata, handles) 4079 4087 4080 4088 %------------------------------------------------------------------------ … … 5202 5210 function MenuPIV_Callback(hObject, eventdata, handles) 5203 5211 Param=read_param(handles); 5204 Param.ActionName='civ_series'; 5205 series(Param) 5212 % Param.ActionName='civ_series'; 5213 hseries=series(Param); 5214 hhseries=guidata(hseries); 5215 ActionMenu=get(hhseries.ActionName,'String'); 5216 index_action=find(strcmp('civ_series',ActionMenu)); 5217 set(hhseries.ActionName,'Value',index_action); 5218 series('ActionName_Callback',hObject,eventdata,hhseries); %file input with xml reading in uvmat, show the image in phys coordinates 5219 5206 5220 5207 5221 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.