Ignore:
Timestamp:
Jan 9, 2011, 12:56:28 PM (13 years ago)
Author:
sommeria
Message:

various bug repairs, in particular for 3D fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/read_civxdata.m

    r159 r179  
    55%
    66% OUTPUT:
    7 % nb_coord,nb_dim,
    8 % Civ: =0 or 1, indicates whether the data is civ (A SUPPRIMER ?)
    9 % CivStage: =0, ??? A UTILISER POUR REMPLACER civ
    10 %           =1, civ1 has been performed only
    11 %           =2, fix1 has been performed
    12 %           =3, pacth1 has been performed
    13 %           =4, civ2 has been performed
    14 %           =5, fix2 has been performed
    15 %           =6, pacth2 has been performed
    16 % time: absolute time
    17 % Field
     7% Field: structure representing the selected field, containing
    188%            .Txt: (char string) error message if any
    19 %            .NbDim: number of dimensions (=0 by default)
    20 %            .NbCoord: number of vector components
    21 %            .CoordType: expresses the type of coordinate ('px' for image, 'sig' for instruments, or 'phys')
    22 %            .dt: time interval for the corresponding image pair
    23 %            .CivStage: =0,
    24 %                   =1, civ1 has been performed only
    25 %                   =2, fix1 has been performed
    26 %                   =3, pacth1 has been performed
    27 %                   =4, civ2 has been performed
    28 %                   =5, fix2 has been performed
    29 %                   =6, pacth2 has been performed
    30 %            .X, .Y, .Z: set of vector coordinates
    31 %            .U,.V,.W: corresponding set of vector components
    32 %            .F: warning flags
    33 %            .FF: error flag, =0 for good vectors
    34 %            .C: scalar associated with velocity (used for vector colors)
    35 %            .CoordType
    36 %            .DijU; matrix of spatial derivatives (DijU(1,1,:)=DUDX,
    37 %            DijU(1,2,:)=DUDY, Dij(2,1,:)=DVDX, DijU(2,2,:)=DVDY
    38 %            .A, .AX, .AY: additional scalar
    39 % dt:time interval of the image pair red from a single file, or vector with
    40 % pixcmx,pixcmy: scaling factors (from the first file)
    41 % vel_type_out: string representing the selected velocity type (civ1,civ2,filter1...)
     9%            .ListGlobalAttribute: list of global attributes containing:
     10%                    .NbCoord: number of vector components
     11%                    .NbDim: number of dimensions (=2 or 3)
     12%                    .dt: time interval for the corresponding image pair
     13%                    .Time: absolute time (average of the initial image pair)
     14%                    .CivStage: =0,
     15%                       =1, civ1 has been performed only
     16%                       =2, fix1 has been performed
     17%                       =3, pacth1 has been performed
     18%                       =4, civ2 has been performed
     19%                       =5, fix2 has been performed
     20%                       =6, pacth2 has been performed
     21%                     .CoordUnit: 'pixel'
     22%             .ListVarName: {'X'  'Y'  'U'  'V'  'F'  'FF'}
     23%                   .X, .Y, .Z: set of vector coordinates
     24%                    .U,.V,.W: corresponding set of vector components
     25%                    .F: warning flags
     26%                    .FF: error flag, =0 for good vectors
     27%                     .C: scalar associated with velocity (used for vector colors)
     28%                    .DijU; matrix of spatial derivatives (DijU(1,1,:)=DUDX,
     29%                        DijU(1,2,:)=DUDY, Dij(2,1,:)=DVDX, DijU(2,2,:)=DVDY
     30%
     31% VelTypeOut: velocity type corresponding to the selected field: ='civ1','interp1','interp2','civ2'....
    4232%
    4333% INPUT:
     
    9585    Field.VarAttribute(end-2:end)=[];
    9686end
     87
     88%renaiming for standard conventions
     89Field.NbCoord=Field.nb_coord;
     90Field.NbDim=Field.nb_dim;
    9791
    9892%determine the appropriate constant for time and dt for the PIV pair
     
    125119end
    126120
    127 %update list of global attributes
    128 List=Field.ListGlobalAttribute;
    129 ind_remove=[];
    130 for ilist=1:length(List)
    131     switch(List{ilist})
    132         case {'patch2','fix2','civ2','patch','fix','dt2','absolut_time_T0','absolut_time_T0_2'}
    133             ind_remove=[ind_remove ilist];
    134             Field=rmfield(Field,List{ilist});
    135     end
    136 end
    137 List(ind_remove)=[];
    138 Field.ListGlobalAttribute=[List {'Time','CivStage','CoordUnit'}];
    139 
    140 % rescale to pixel coordiantes
     121%% rescale fields to pixel coordinates
    141122if isfield(Field,'pixcmx')
    142123    Field.pixcmx=double(Field.pixcmx);
     
    157138    end
    158139end
    159 %Field.CoordType='px';% TODO: abandon, use COORdUnit instead ? (to adapt 'px' and 'phys')
     140
     141%% update list of global attributes
     142List=Field.ListGlobalAttribute;
     143ind_remove=[];
     144for ilist=1:length(List)
     145    switch(List{ilist})
     146        case {'patch2','fix2','civ2','patch','fix','dt2','absolut_time_T0','absolut_time_T0_2','nb_coord','nb_dim','pixcmx','pixcmy'}
     147            ind_remove=[ind_remove ilist];
     148            Field=rmfield(Field,List{ilist});
     149    end
     150end
     151List(ind_remove)=[];
     152Field.ListGlobalAttribute=[{'NbCoord'},{'NbDim'} List {'Time','CivStage','CoordUnit'}];
    160153Field.CoordUnit='pixel';
    161154
Note: See TracChangeset for help on using the changeset viewer.