Changeset 1077 for trunk/src/proj_field.m
- Timestamp:
- Mar 20, 2020, 11:29:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r1072 r1077 719 719 ProjData.VarAttribute{nbvar+ivar}=FieldData.VarAttribute{VarIndex(ivar)};%reproduce var attribute 720 720 if isfield(ProjData.VarAttribute{nbvar+ivar},'Role') 721 if strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x') ;721 if strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x') 722 722 ivar_U=nbvar+ivar; 723 elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y') ;723 elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y') 724 724 ivar_V=nbvar+ivar; 725 725 end 726 726 end 727 ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuoval(['us lines727 ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles as a set of individual dots 728 728 end 729 729 elseif isequal(ProjMode,'interp_lin') %filtering %linear interpolation: … … 756 756 ProjData.VarDimName=[ProjData.VarDimName {XName}]; 757 757 if isfield(VarAttribute{ivar},'Role') 758 if strcmp(VarAttribute{ivar}.Role,'vector_x') ;758 if strcmp(VarAttribute{ivar}.Role,'vector_x') 759 759 ivar_U=ivar+nbvar; 760 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') ;760 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') 761 761 ivar_V=ivar+nbvar; 762 762 end … … 787 787 ProjData.VarDimName=[ProjData.VarDimName {'X'}]; 788 788 if isfield(VarAttribute{ivar},'Role') 789 if strcmp(VarAttribute{ivar}.Role,'vector_x') ;789 if strcmp(VarAttribute{ivar}.Role,'vector_x') 790 790 ivar_U=ivar+nbvar; 791 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') ;791 elseif strcmp(VarAttribute{ivar}.Role,'vector_y') 792 792 ivar_V=ivar+nbvar; 793 793 end … … 813 813 AY=FieldData.(AYName);% set of y positions 814 814 AZ=FieldData.(AZName);% set of z positions 815 815 AName=FieldData.ListVarName{VarIndex(1)}; 816 816 npxy=size(FieldData.(AName)); 817 817 npz=npxy(1); … … 820 820 AXI=linspace(AX(1),AX(end), npx);%set of x positions for the interpolated input data 821 821 AYI=linspace(AY(1),AY(end), npy);%set of x positions for the interpolated input data 822 822 AZI=linspace(AZ(1),AZ(end), npy);%set of x positions for the interpolated input data 823 823 for ivar=VarIndex 824 824 VarName=FieldData.ListVarName{ivar}; 825 825 FieldData.(VarName)=interp3(FieldData.(AXName),FieldData.(AYName),FieldData.(AZName),FieldData.(VarName),AXI,AYI,AZI); 826 827 % vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum828 % if nbcolor==1829 % vec_B(ind_in)=vec_A(ICOMB);830 % vec_B(ind_out)=zeros(size(ind_out));831 % A_out=reshape(vec_B,npY,npX);832 % ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY;833 % elseif nbcolor==3834 % vec_B(ind_in,1:3)=vec_A(ICOMB,:);835 % vec_B(ind_out,1)=zeros(size(ind_out));836 % vec_B(ind_out,2)=zeros(size(ind_out));837 % vec_B(ind_out,3)=zeros(size(ind_out));838 % A_out=reshape(vec_B,npY,npX,nbcolor);839 % ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY);840 % end826 827 % vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum 828 % if nbcolor==1 829 % vec_B(ind_in)=vec_A(ICOMB); 830 % vec_B(ind_out)=zeros(size(ind_out)); 831 % A_out=reshape(vec_B,npY,npX); 832 % ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY; 833 % elseif nbcolor==3 834 % vec_B(ind_in,1:3)=vec_A(ICOMB,:); 835 % vec_B(ind_out,1)=zeros(size(ind_out)); 836 % vec_B(ind_out,2)=zeros(size(ind_out)); 837 % vec_B(ind_out,3)=zeros(size(ind_out)); 838 % A_out=reshape(vec_B,npY,npX,nbcolor); 839 % ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY); 840 % end 841 841 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}]; 842 842 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate … … 941 941 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}]; 942 942 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate 943 nbvar=nbvar+1; 944 ProjData.VarAttribute{nbvar}.Role='coord_y';% for plot with continuous line 945 end 943 nbvar_proj=numel(ProjData.ListVarName); 944 if isfield(FieldData.VarAttribute{ivar},'Role') 945 if strcmp(FieldData.VarAttribute{ivar}.Role,'vector_x') 946 ivar_U=nbvar_proj; 947 elseif strcmp(FieldData.VarAttribute{ivar}.Role,'vector_y') 948 ivar_V=nbvar_proj; 949 end 950 end 951 if isequal(ProjMode,'projection') 952 ProjData.VarAttribute{nbvar_proj}.Role='discrete'; 953 else 954 ProjData.VarAttribute{nbvar_proj}.Role='coord_y'; 955 end 956 end 957 946 958 if nbcolor==3 947 959 ProjData.VarDimName{end}={AXName,'rgb'}; … … 950 962 951 963 end 952 if ~isempty(ivar_U) && ~isempty(ivar_V) 953 vector_x =ProjData.(ProjData.ListVarName{ivar_U}); 954 ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 955 ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 956 end 964 % for vector fields, take the components longitudinal and tranverse to the projection line 965 if ~isempty(ivar_U) && ~isempty(ivar_V) 966 vector_x =ProjData.(ProjData.ListVarName{ivar_U}); 967 ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 968 ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 969 end 957 970 end 958 971 … … 1175 1188 AYName='coord_y'; 1176 1189 AXName='coord_x'; 1177 if strcmp(ObjectData.ProjMode,'projection') ||strcmp(ObjectData.Type,'plane')1190 if strcmp(ObjectData.ProjMode,'projection')%||strcmp(ObjectData.Type,'plane') 1178 1191 ProjData.coord_y=[FieldData.YMin FieldData.YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined 1179 1192 ProjData.coord_x=[FieldData.XMin FieldData.XMax];
Note: See TracChangeset
for help on using the changeset viewer.