Changeset 518


Ignore:
Timestamp:
Aug 17, 2012, 11:52:49 PM (9 years ago)
Author:
sommeria
Message:

corrections in phys to adapt to new conventions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/transform_field/phys.m

    r507 r518  
    1616% Data_1, CalibData_1: same as Data, CalibData for the second field.
    1717
    18 function [DataOut,DataOut_1]=phys(DataIn,XmlData,DataIn_1,XmlData_1)
     18function DataOut=phys(DataIn,XmlData,DataIn_1,XmlData_1)
    1919% A FAIRE: 1- verifier si DataIn est une 'field structure'(.ListVarName'):
    2020% chercher ListVarAttribute, for each field (cell of variables):
     
    144144end
    145145
     146% subtract fields
     147if ~isempty(DataOut_1)
     148DataOut=sub_field(DataOut,[],DataOut_1);
     149end
    146150%------------------------------------------------
    147151%--- transform a single field
     
    183187    end
    184188end
    185 DataOut.ListVarName(ind_remove)=[];
    186 DataOut.VarDimName(ind_remove)=[];
    187 DataOut.VarAttribute(ind_remove)=[];
     189if isfield(DataOut.VarAttribute{3},'VarIndex_tps')
     190    DataOut.VarAttribute{3}=rmfield(DataOut.VarAttribute{3},'VarIndex_tps');
     191end
     192
     193if ~isempty(ind_remove)
     194    DataOut.ListVarName(ind_remove)=[];
     195    DataOut.VarDimName(ind_remove)=[];
     196    DataOut.VarAttribute(ind_remove)=[];
     197end
    188198   
    189    
    190 
    191199%% transform of spatial derivatives: TODO check the case with plane angles
    192 if isfield(Data,'X') && ~isempty(Data.X) && isfield(Data,'DjUi') && ~isempty(Data.DjUi)...
    193       && isfield(Data,'dt')   
    194     if ~isempty(Data.dt)
    195         % estimate the Jacobian matrix DXpx/DXphys
    196         for ip=1:length(Data.X)
    197             [Xp1,Yp1]=phys_XYZ(Calib,Data.X(ip)+0.5,Data.Y(ip),ZIndex);
    198             [Xm1,Ym1]=phys_XYZ(Calib,Data.X(ip)-0.5,Data.Y(ip),ZIndex);
    199             [Xp2,Yp2]=phys_XYZ(Calib,Data.X(ip),Data.Y(ip)+0.5,ZIndex);
    200             [Xm2,Ym2]=phys_XYZ(Calib,Data.X(ip),Data.Y(ip)-0.5,ZIndex);
     200if isfield(Data,'X') && ~isempty(Data.X) && isfield(Data,'DjUi') && ~isempty(Data.DjUi)
     201    % estimate the Jacobian matrix DXpx/DXphys
     202    for ip=1:length(Data.X)
     203        [Xp1,Yp1]=phys_XYZ(Calib,Data.X(ip)+0.5,Data.Y(ip),ZIndex);
     204        [Xm1,Ym1]=phys_XYZ(Calib,Data.X(ip)-0.5,Data.Y(ip),ZIndex);
     205        [Xp2,Yp2]=phys_XYZ(Calib,Data.X(ip),Data.Y(ip)+0.5,ZIndex);
     206        [Xm2,Ym2]=phys_XYZ(Calib,Data.X(ip),Data.Y(ip)-0.5,ZIndex);
    201207        %Jacobian matrix DXpphys/DXpx
    202            DjXi(1,1)=(Xp1-Xm1);
    203            DjXi(2,1)=(Yp1-Ym1);
    204            DjXi(1,2)=(Xp2-Xm2);
    205            DjXi(2,2)=(Yp2-Ym2);
    206            DjUi(:,:)=Data.DjUi(ip,:,:);
    207            DjUi=(DjXi*DjUi')/DjXi;% =J-1*M*J , curvature effects (derivatives of J) neglected
    208            DataOut.DjUi(ip,:,:)=DjUi';
    209         end
    210         DataOut.DjUi =  DataOut.DjUi/Dt;   %     min(Data.DjUi(:,1,1))=DUDX                         
    211     end
     208        DjXi(1,1)=(Xp1-Xm1);
     209        DjXi(2,1)=(Yp1-Ym1);
     210        DjXi(1,2)=(Xp2-Xm2);
     211        DjXi(2,2)=(Yp2-Ym2);
     212        DjUi(:,:)=Data.DjUi(ip,:,:);
     213        DjUi=(DjXi*DjUi')/DjXi;% =J-1*M*J , curvature effects (derivatives of J) neglected
     214        DataOut.DjUi(ip,:,:)=DjUi';
     215    end
     216    DataOut.DjUi =  DataOut.DjUi/Dt;   %     min(Data.DjUi(:,1,1))=DUDX
    212217end
    213218
Note: See TracChangeset for help on using the changeset viewer.