Changeset 382
- Timestamp:
- Feb 6, 2012, 11:46:39 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r380 r382 23 23 % file, depending on the scalar 24 24 25 function [DataOut,errormsg]=calc_field(FieldName,DataIn )25 function [DataOut,errormsg]=calc_field(FieldName,DataIn,VelType,XI,YI) 26 26 27 27 %list of defined scalars to display in menus (in addition to 'ima_cor'). … … 66 66 67 67 %% interpolation with new civ data 68 if isfield(DataIn,'X_SubRange') 69 XMax=max(max(DataIn.X_SubRange)); 70 YMax=max(max(DataIn.Y_SubRange)); 71 XMin=min(min(DataIn.X_SubRange)); 72 YMin=min(min(DataIn.Y_SubRange)); 73 Mesh=sqrt((YMax-YMin)*(XMax-XMin)/numel(DataIn.X_tps));%2D 74 xI=XMin:Mesh:XMax; 75 yI=YMin:Mesh:YMax; 76 [XI,YI]=meshgrid(xI,yI); 77 XI=reshape(XI,[],1); 78 YI=reshape(YI,[],1); 68 %if isfield(DataIn,'X_SubRange') 69 if strcmp(VelType,'filter1')||strcmp(VelType,'filter2') 70 XMax=max(max(DataIn.SubRange(1,:,:))); 71 YMax=max(max(DataIn.SubRange(2,:,:))); 72 XMin=min(min(DataIn.SubRange(1,:,:))); 73 YMin=min(min(DataIn.SubRange(2,:,:))); 74 if ~(exist('XI','var')&&exist('YI','var')) 75 Mesh=sqrt((YMax-YMin)*(XMax-XMin)/numel(DataIn.Coord_tps(:,1,:)));%2D 76 xI=XMin:Mesh:XMax; 77 yI=YMin:Mesh:YMax; 78 [XI,YI]=meshgrid(xI,yI); 79 XI=reshape(XI,[],1); 80 YI=reshape(YI,[],1); 81 end 79 82 DataOut.ListGlobalAttribute=DataIn.ListGlobalAttribute; %reproduce global attribute 80 83 for ilist=1:numel(DataOut.ListGlobalAttribute) … … 88 91 DataOut.U=zeros(size(XI)); 89 92 DataOut.V=zeros(size(XI)); 90 DataOut.vort=zeros(size(XI)); 91 93 DataOut.vort=zeros(size(XI)); 92 94 DataOut.div=zeros(size(XI)); 93 95 nbval=zeros(size(XI)); 94 [NbSubDomain,xx]=size(DataIn.X_SubRange);96 NbSubDomain=size(DataIn.SubRange,3); 95 97 for isub=1:NbSubDomain 96 nbvec_sub=DataIn.NbSites(isub); 97 ind_sel=find(XI>=DataIn.X_SubRange(isub,1) & XI<=DataIn.X_SubRange(isub,2) & YI>=DataIn.Y_SubRange(isub,1) & YI<=DataIn.Y_SubRange(isub,2)); 98 if isfield(DataIn,'NbSites') 99 nbvec_sub=DataIn.NbSites(isub); 100 else 101 nbvec_sub=numel(find(DataIn.Indices_tps(:,isub))); 102 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)); 98 104 %rho smoothing parameter 99 105 epoints = [XI(ind_sel) YI(ind_sel)];% coordinates of interpolation sites 100 ctrs= [DataIn.X_tps(1:nbvec_sub,isub) DataIn.Y_tps(1:nbvec_sub,isub)];%(=initial points) ctrs106 ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs 101 107 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 102 108 % PM = [ones(size(epoints,1),1) epoints]; -
trunk/src/check_field_structure.m
r159 r382 58 58 return 59 59 end 60 eval(['sizvar=size(Data.' VarName ');'])% sizvar = dimension of variable60 sizvar=size(Data.(VarName));% sizvar = dimension of variable 61 61 DimCell=Data.VarDimName{ivar}; 62 62 if ischar(DimCell) … … 65 65 errormsg=['wrong format for .VarDimName{' num2str(ivar) ' (must be the cell of dimension names of the variable ' VarName]; 66 66 return 67 67 68 end 68 69 nbcoord=numel(sizvar);%nbre of coordinates for variable named VarName … … 91 92 else 92 93 if numel(DimCell)>nbcoord 93 DimCell=DimCell(end-nbcoord+1:end);%first singleton diemensions omitted, 94 sizvar(nbcoord+1:numel(DimCell))=1;% case of singleton dimensions (not seen by the function size) 95 % DimCell=DimCell(end-nbcoord+1:end)%first singleton diemensions omitted, 94 96 elseif nbcoord > numel(DimCell) 95 97 errormsg=['nbre of declared dimensions in .VarDimName{' num2str(ivar) '} smaller than the nbre of dimensions =' num2str(nbcoord) ' of the variable ' VarName]; … … 98 100 end 99 101 DimIndex=[]; 100 for idim=1:nbcoord %loop on the coordinates of variable #ivar 102 %for idim=1:nbcoord 103 for idim=1:numel(DimCell) %loop on the coordinates of variable #ivar 101 104 DimName=DimCell{idim}; 102 105 iprev=find(strcmp(DimName,Data.ListDimName),1);%look for dimension name DimName in the current list … … 112 115 else % DimName is detected in the current list of dimension names 113 116 if ~isequal(Data.DimValue(iprev),sizvar(idim)) 117 Data.DimValue(iprev) 118 sizvar(idim) 114 119 if isequal(Data.DimValue(iprev),2)&& RangeTest(iprev) % the dimension has been already detected as a range [min max] 115 120 Data.DimValue(iprev)=sizvar(idim); %update with actual value -
trunk/src/civ.m
r379 r382 32 32 'gui_LayoutFcn', [] , ... 33 33 'gui_Callback', []); 34 if nargin && ischar(varargin{1}) 34 if nargin && ischar(varargin{1}) && ~isempty(regexp(varargin{1},'_Callback$','once')) 35 35 gui_State.gui_Callback = str2func(varargin{1}); 36 36 end … … 1533 1533 batch_file_list{length(batch_file_list)+1}=filename_bat; 1534 1534 else 1535 [ Data,erromsg]=civ_matlab(Param,filecell.nc.civ1{ifile,j});1535 [tild,errormsg]=civ_matlab(Param,filecell.nc.civ1{ifile,j}); 1536 1536 if isempty(errormsg) 1537 1537 display([filecell.nc.civ1{ifile,j} ' written']) -
trunk/src/civ_matlab.m
r372 r382 3 3 % civ: PIV function itself 4 4 % fix: removes false vectors after detection by various criteria 5 % patch: make interpolation-smoothing5 % filter_tps: make interpolation-smoothing 6 6 %------------------------------------------------------------------------ 7 7 % function [Data,errormsg,result_conv]= civ_uvmat(Param,ncfile) … … 169 169 Data.Patch1_Threshold=Param.Patch1.MaxDiff; 170 170 Data.Patch1_SubDomain=Param.Patch1.SubdomainSize; 171 Data.ListVarName=[Data.ListVarName {'Civ1_U_Diff','Civ1_V_Diff','Civ1_ X_SubRange','Civ1_Y_SubRange','Civ1_NbSites','Civ1_X_tps','Civ1_Y_tps','Civ1_U_tps','Civ1_V_tps'}];172 Data.VarDimName=[Data.VarDimName {'NbVec1','NbVec1',{'Nb SubDomain1','Two'},{'NbSubDomain1','Two'},'NbSubDomain1',...173 {'NbVec1Sub','Nb SubDomain1'},{'NbVec1Sub','NbSubDomain1'},{'Nbtps1','NbSubDomain1'},{'Nbtps1','NbSubDomain1'}}];171 Data.ListVarName=[Data.ListVarName {'Civ1_U_Diff','Civ1_V_Diff','Civ1_SubRange','Civ1_NbSites','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}]; 172 Data.VarDimName=[Data.VarDimName {'NbVec1','NbVec1',{'NbCoord','Two','NbSubDomain1'},{'NbSubDomain1'},... 173 {'NbVec1Sub','NbCoord','NbSubDomain1'},{'Nbtps1','NbSubDomain1'},{'Nbtps1','NbSubDomain1'}}]; 174 174 nbvar=length(Data.ListVarName); 175 175 Data.VarAttribute{nbvar-1}.Role='vector_x'; … … 182 182 ind_good=1:numel(Data.Civ1_X); 183 183 end 184 [Data.Civ1_X_SubRange,Data.Civ1_Y_SubRange,Data.Civ1_NbSites,FFres,Ures, Vres,Data.Civ1_X_tps,Data.Civ1_Y_tps,Data.Civ1_U_tps,Data.Civ1_V_tps]=... 185 patch(Data.Civ1_X(ind_good)',Data.Civ1_Y(ind_good)',Data.Civ1_U(ind_good)',Data.Civ1_V(ind_good)',Data.Patch1_Rho,Data.Patch1_Threshold,Data.Patch1_SubDomain); 184 % [SubRange,NbPoints,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] 185 [Data.Civ1_SubRange,Data.Civ1_NbSites,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=... 186 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_Threshold,Data.Patch1_Rho); 186 187 Data.Civ1_U_Diff(ind_good)=Data.Civ1_U(ind_good)-Ures; 187 188 Data.Civ1_V_Diff(ind_good)=Data.Civ1_V(ind_good)-Vres; … … 335 336 Data.Patch2_Threshold=Param.Patch2.MaxDiff; 336 337 Data.Patch2_SubDomain=Param.Patch2.SubdomainSize; 337 Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_ NbSites','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps'}];338 Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'}, 'NbSubDomain2',...339 {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'} }];338 Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps','Civ2_Indices_tps'}]; 339 Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},... 340 {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'}}]; 340 341 nbvar=length(Data.ListVarName); 341 342 Data.VarAttribute{nbvar-1}.Role='vector_x'; … … 348 349 ind_good=1:numel(Data.Civ2_X); 349 350 end 350 [Data.Civ2_ X_SubRange,Data.Civ2_Y_SubRange,Data.Civ2_NbSites,FFres,Ures, Vres,Data.Civ2_X_tps,Data.Civ2_Y_tps,Data.Civ2_U_tps,Data.Civ2_V_tps]=...351 patch(Data.Civ2_X(ind_good)',Data.Civ2_Y(ind_good)',Data.Civ2_U(ind_good)',Data.Civ2_V(ind_good)',Data.Patch2_Rho,Data.Patch2_Threshold,Data.Patch2_SubDomain);351 [Data.Civ2_SubRange,Data.Civ2_NbSites,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=... 352 filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),Data.Patch2_SubDomain,Data.Patch2_Rho,Data.Patch2_Threshold); 352 353 Data.Civ2_U_Diff(ind_good)=Data.Civ2_U(ind_good)-Ures; 353 354 Data.Civ2_V_Diff(ind_good)=Data.Civ2_V(ind_good)-Vres; … … 697 698 698 699 699 %------------------------------------------------------------------------ 700 % patch function 701 % OUTPUT: 702 % SubRangx,SubRangy(NbSubdomain,2): range (min, max) of the coordiantes x and y respectively, for each subdomain 703 % nbpoints(NbSubdomain): number of source points for each subdomain 704 % FF: false flags 705 % U_smooth, V_smooth: filtered velocity components at the positions of the initial data 706 % X_tps,Y_tps,U_tps,V_tps: positions and weight of the tps for each subdomain 707 % 708 % INPUT: 709 % X, Y: set of coordinates of the initial data 710 % U,V: set of velocity components of the initial data 711 % Rho: smoothing parameter 712 % Threshold: max diff accepted between smoothed and initial data 713 % Subdomain: estimated number of data points in each subdomain 714 715 function [SubRangx,SubRangy,nbpoints,FF,U_smooth,V_smooth,X_tps,Y_tps,U_tps,V_tps] =patch(X,Y,U,V,Rho,Threshold,SubDomain) 716 %subdomain decomposition 717 warning off 718 U=reshape(U,[],1); 719 V=reshape(V,[],1); 720 X=reshape(X,[],1); 721 Y=reshape(Y,[],1); 722 nbvec=numel(X); 723 NbSubDomain=ceil(nbvec/SubDomain); 724 MinX=min(X); 725 MinY=min(Y); 726 MaxX=max(X); 727 MaxY=max(Y); 728 RangX=MaxX-MinX; 729 RangY=MaxY-MinY; 730 AspectRatio=RangY/RangX; 731 NbSubDomainX=max(floor(sqrt(NbSubDomain/AspectRatio)),1); 732 NbSubDomainY=max(floor(sqrt(NbSubDomain*AspectRatio)),1); 733 NbSubDomain=NbSubDomainX*NbSubDomainY; 734 SizX=RangX/NbSubDomainX;%width of subdomains 735 SizY=RangY/NbSubDomainY;%height of subdomains 736 CentreX=linspace(MinX+SizX/2,MaxX-SizX/2,NbSubDomainX); 737 CentreY=linspace(MinY+SizY/2,MaxY-SizY/2,NbSubDomainY); 738 [CentreX,CentreY]=meshgrid(CentreX,CentreY); 739 CentreY=reshape(CentreY,1,[]);% Y positions of subdomain centres 740 CentreX=reshape(CentreX,1,[]);% X positions of subdomain centres 741 rho=SizX*SizY*Rho/1000000;%optimum rho increase as the area of the subdomain (division by 10^6 to reach good values with the default GUI input) 742 U_tps_sub=zeros(length(X),NbSubDomain);%default spline 743 V_tps_sub=zeros(length(X),NbSubDomain);%default spline 744 U_smooth=zeros(length(X),1); 745 V_smooth=zeros(length(X),1); 746 747 nb_select=zeros(length(X),1); 748 FF=zeros(length(X),1); 749 check_empty=zeros(1,NbSubDomain); 750 SubRangx=zeros(NbSubDomain,2);%initialise the positions of subdomains 751 SubRangy=zeros(NbSubDomain,2); 752 for isub=1:NbSubDomain 753 SubRangx(isub,:)=[CentreX(isub)-0.55*SizX CentreX(isub)+0.55*SizX]; 754 SubRangy(isub,:)=[CentreY(isub)-0.55*SizY CentreY(isub)+0.55*SizY]; 755 ind_sel_previous=[]; 756 ind_sel=0; 757 while numel(ind_sel)>numel(ind_sel_previous) %increase the subdomain during four iterations at most 758 ind_sel_previous=ind_sel; 759 ind_sel=find(X>=SubRangx(isub,1) & X<=SubRangx(isub,2) & Y>=SubRangy(isub,1) & Y<=SubRangy(isub,2)); 760 % if no vector in the subdomain, skip the subdomain 761 if isempty(ind_sel) 762 check_empty(isub)=1; 763 U_tps(1,isub)=0;%define U_tps and V_tps by default 764 V_tps(1,isub)=0; 765 break 766 % if too few selected vectors, increase the subrange for next iteration 767 elseif numel(ind_sel)<SubDomain/4 && ~isequal( ind_sel,ind_sel_previous); 768 SubRangx(isub,1)=SubRangx(isub,1)-SizX/4; 769 SubRangx(isub,2)=SubRangx(isub,2)+SizX/4; 770 SubRangy(isub,1)=SubRangy(isub,1)-SizY/4; 771 SubRangy(isub,2)=SubRangy(isub,2)+SizY/4; 772 else 773 774 [U_smooth_sub,U_tps_sub]=tps_coeff([X(ind_sel) Y(ind_sel)],U(ind_sel),rho); 775 [V_smooth_sub,V_tps_sub]=tps_coeff([X(ind_sel) Y(ind_sel)],V(ind_sel),rho); 776 UDiff=U_smooth_sub-U(ind_sel); 777 VDiff=V_smooth_sub-V(ind_sel); 778 NormDiff=UDiff.*UDiff+VDiff.*VDiff; 779 FF(ind_sel)=20*(NormDiff>Threshold);%put FF value to 20 to identify the criterium of elimmination 780 ind_ind_sel=find(FF(ind_sel)==0); % select the indices of ind_sel corresponding to the remaining vectors 781 % no value exceeds threshold, the result is recorded 782 if isequal(numel(ind_ind_sel),numel(ind_sel)) 783 U_smooth(ind_sel)=U_smooth(ind_sel)+U_smooth_sub; 784 V_smooth(ind_sel)=V_smooth(ind_sel)+V_smooth_sub; 785 nbpoints(isub)=numel(ind_sel); 786 X_tps(1:nbpoints(isub),isub)=X(ind_sel); 787 Y_tps(1:nbpoints(isub),isub)=Y(ind_sel); 788 U_tps(1:nbpoints(isub)+3,isub)=U_tps_sub; 789 V_tps(1:nbpoints(isub)+3,isub)=V_tps_sub; 790 nb_select(ind_sel)=nb_select(ind_sel)+1; 791 display('good') 792 break 793 % too few selected vectors, increase the subrange for next iteration 794 elseif numel(ind_ind_sel)<SubDomain/4 && ~isequal( ind_sel,ind_sel_previous); 795 SubRangx(isub,1)=SubRangx(isub,1)-SizX/4; 796 SubRangx(isub,2)=SubRangx(isub,2)+SizX/4; 797 SubRangy(isub,1)=SubRangy(isub,1)-SizY/4; 798 SubRangy(isub,2)=SubRangy(isub,2)+SizY/4; 799 % display('fewsmooth') 800 % interpolation-smoothing is done again with the selected vectors 801 else 802 [U_smooth_sub,U_tps_sub]=tps_coeff([X(ind_sel(ind_ind_sel)) Y(ind_sel(ind_ind_sel))],U(ind_sel(ind_ind_sel)),rho); 803 [V_smooth_sub,V_tps_sub]=tps_coeff([X(ind_sel(ind_ind_sel)) Y(ind_sel(ind_ind_sel))],V(ind_sel(ind_ind_sel)),rho); 804 U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+U_smooth_sub; 805 V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+V_smooth_sub; 806 nbpoints(isub)=numel(ind_ind_sel); 807 X_tps(1:nbpoints(isub),isub)=X(ind_sel(ind_ind_sel)); 808 Y_tps(1:nbpoints(isub),isub)=Y(ind_sel(ind_ind_sel)); 809 U_tps(1:nbpoints(isub)+3,isub)=U_tps_sub; 810 V_tps(1:nbpoints(isub)+3,isub)=V_tps_sub; 811 nb_select(ind_sel(ind_ind_sel))=nb_select(ind_sel(ind_ind_sel))+1; 812 display('good2') 813 break 814 end 815 end 816 end 817 end 818 ind_empty=find(check_empty); 819 %remove empty subdomains 820 if ~isempty(ind_empty) 821 SubRangx(ind_empty,:)=[]; 822 SubRangy(ind_empty,:)=[]; 823 X_tps(:,ind_empty)=[]; 824 Y_tps(:,ind_empty)=[]; 825 U_tps(:,ind_empty)=[]; 826 V_tps(:,ind_empty)=[]; 827 end 828 nb_select(nb_select==0)=1;%ones(size(find(nb_select==0))); 829 U_smooth=U_smooth./nb_select; 830 V_smooth=V_smooth./nb_select; 831 832 833 834 835 700 701 702 703 -
trunk/src/proj_field.m
r379 r382 80 80 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 81 81 82 function [ProjData,errormsg]=proj_field(FieldData,ObjectData )82 function [ProjData,errormsg]=proj_field(FieldData,ObjectData,FieldName) 83 83 errormsg='';%default 84 84 %% case of no projection (object is used only as graph display) … … 913 913 %project on a plane 914 914 % AJOUTER flux,circul,error 915 function [ProjData,errormsg] = proj_plane(FieldData, ObjectData )915 function [ProjData,errormsg] = proj_plane(FieldData, ObjectData,FieldName) 916 916 %----------------------------------------------------------------- 917 917 … … 1164 1164 coord_x_proj=XMin:DX:XMax; 1165 1165 coord_y_proj=YMin:DY:YMax; 1166 if isfield(FieldData,[VarName '_tps']) 1167 [XI,YI]=meshgrid(coord_x_proj,coord_y_proj'); 1168 XI=reshape(XI,[],1); 1169 YI=reshape(YI,[],1); 1170 end 1166 1171 DimCell={'coord_y','coord_x'}; 1167 1172 ProjData.ListVarName={'coord_y','coord_x'}; … … 1186 1191 FF=zeros(1,length(coord_y_proj)*length(coord_x_proj)); 1187 1192 testFF=0; 1193 if ~isempty(FieldName) 1194 FieldData=calc_field(FieldName,FieldData,XI,YI); 1195 end 1188 1196 for ivar=VarIndex 1189 1197 VarName=FieldData.ListVarName{ivar}; … … 1196 1204 end 1197 1205 if ~isequal(ivar_FF,0) 1198 eval(['FieldData.' VarName '=FieldData.' VarName '(indsel);']) 1199 end 1200 eval(['ProjData.' VarName '=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.' VarName '),coord_x_proj,coord_y_proj'',rho);']) 1201 eval(['varline=reshape(ProjData.' VarName ',1,length(coord_y_proj)*length(coord_x_proj));']) 1206 FieldData.(VarName)=FieldData.(VarName)(indsel); 1207 end 1208 % if isfield(FieldData,[VarName '_tps']) 1209 % [XI,YI]=meshgrid(coord_x_proj,coord_y_proj'); 1210 % XI=reshape(XI,[],1); 1211 % YI=reshape(YI,[],1); 1212 % 1213 if ~isempty(FieldName) 1214 ProjData.(VarName)=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.(VarName)),coord_x_proj,coord_y_proj',rho); 1215 end 1216 varline=reshape(ProjData.(VarName),1,length(coord_y_proj)*length(coord_x_proj)); 1202 1217 FFlag= isnan(varline); %detect undefined values NaN 1203 1218 indnan=find(FFlag); 1204 1219 if~isempty(indnan) 1205 1220 varline(indnan)=zeros(size(indnan)); 1206 eval(['ProjData.' VarName '=reshape(varline,length(coord_y_proj),length(coord_x_proj));'])1221 ProjData.(VarName)=reshape(varline,length(coord_y_proj),length(coord_x_proj)); 1207 1222 FF(indnan)=ones(size(indnan)); 1208 1223 testFF=1; -
trunk/src/read_civdata.m
r380 r382 148 148 if strcmp(vel_type,'civ2') && testder 149 149 vel_type='filter2'; 150 elseif st cmp(vel_type,'civ1') && testder150 elseif strcmp(vel_type,'civ1') && testder 151 151 vel_type='filter1'; 152 152 end 153 153 154 154 switch vel_type 155 case {'civ1' }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' ;...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';... 157 157 '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' };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','' };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 161 case 'civ-filter1' 162 162 var={'X','Y','Z','U','V','W','FF';... … … 164 164 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','errorflag'}; 165 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';...168 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites'};169 role={'','','','','','','','',''};170 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''};171 case 'civ2'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' ;...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';... 173 173 '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' };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','' };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 177 % var={'X','Y','Z','U','V','W','C','F','FF';... 178 178 % 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF'}; … … 184 184 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','errorflag'}; 185 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';...188 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites'};189 role={'','','','','','','','',''};190 units={'pixel','pixel','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','',''}; 191 191 end 192 192 vel_type_out=vel_type; -
trunk/src/struct2nc.m
r246 r382 53 53 [Data,errormsg]=check_field_structure(Data);%check the validity of the input field structure 54 54 if ~isempty(errormsg) 55 errormsg=[' invalid input structure:' errormsg];55 errormsg=['error in struct2nc:invalid input structure_' errormsg]; 56 56 return 57 57 end … … 112 112 for ivar=1:length(ListVarName) 113 113 if isfield(Data,ListVarName{ivar}) 114 eval(['VarVal=Data.' ListVarName{ivar} ';'])%varval=values of the current variable 114 VarVal=Data.(ListVarName{ivar}); 115 %varval=values of the current variable 115 116 VarDimIndex=Data.VarDimIndex{ivar}; %indices of the variable dimensions in the list of dimensions 116 117 VarDimName=Data.VarDimName{ivar}; … … 122 123 testline=isequal(length(siz),2) && isequal(siz(1),1)&& isequal(siz(2), Data.DimValue(VarDimIndex));%matlab vector 123 124 testcolumn=isequal(length(siz),2) && isequal(siz(1), Data.DimValue(VarDimIndex))&& isequal(siz(2),1);%matlab column vector 124 if ~testrange && ~testline && ~testcolumn && ~isequal(siz,Data.DimValue(VarDimIndex))125 errormsg=['wrong dimensions declared for ' ListVarName{ivar} ' in struct2nc.m'];126 break127 end125 % if ~testrange && ~testline && ~testcolumn && ~isequal(siz,Data.DimValue(VarDimIndex)) 126 % errormsg=['wrong dimensions declared for ' ListVarName{ivar} ' in struct2nc.m']; 127 % break 128 % end 128 129 if testline || testrange 129 130 if testrange -
trunk/src/uvmat.m
r380 r382 1675 1675 if ~isempty(UvData.j1_series{1}) 1676 1676 if get(handles.scan_i,'Value')==1% case of scanning along index i 1677 j1_subseries=UvData.j1_series{1}(ref_i+1,:,:) 1677 j1_subseries=UvData.j1_series{1}(ref_i+1,:,:); 1678 1678 else 1679 j1_subseries=UvData.j1_series{1}(:,ref_j+1,:) 1679 j1_subseries=UvData.j1_series{1}(:,ref_j+1,:); 1680 1680 end 1681 1681 j1_subseries=j1_subseries(j1_subseries>0); … … 1684 1684 if ~isempty(UvData.j2_series{1}) 1685 1685 if get(handles.scan_i,'Value')==1% case of scanning along index i 1686 j2_subseries=UvData.j2_series{1}(ref_i+1,:,:) 1686 j2_subseries=UvData.j2_series{1}(ref_i+1,:,:); 1687 1687 else 1688 j2_subseries=UvData.j2_series{1}(:,ref_j+1,:) 1688 j2_subseries=UvData.j2_series{1}(:,ref_j+1,:); 1689 1689 end 1690 1690 j2_subseries=j2_subseries(j2_subseries>0); … … 1996 1996 ParamIn.Npx=UvData.XmlData.Npx; 1997 1997 else 1998 1998 1999 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 1999 2000 return … … 2007 2008 errormsg=['error in reading ' filename ': ' errormsg]; 2008 2009 return 2009 end 2010 end 2010 2011 if isfield(ParamOut,'Npx')&& isfield(ParamOut,'Npy') 2011 2012 set(handles.num_Npx,'String',num2str(ParamOut.Npx));% display image size on the interface … … 2213 2214 end 2214 2215 2216 2217 %% update tps in phys coordinates if needed 2218 if (strcmp(VelType,'filter1')||strcmp(VelType,'filter2'))&& isfield(Field{1},'U')&& isfield(Field{1},'V') 2219 [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); 2220 end 2221 2215 2222 %% calculate scalar 2216 2223 if strcmp(FileType(1:3),'civ') && ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2217 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1} );2224 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1},VelType); 2218 2225 end 2219 2226 if numel(Field)==2 && ~test_keepdata_1 && isequal(FileType_1(1:3),'civ') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1) 2220 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2} );2227 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2},VelType_1); 2221 2228 end 2222 2229
Note: See TracChangeset
for help on using the changeset viewer.