Changeset 522 for trunk/src


Ignore:
Timestamp:
Aug 18, 2012, 11:18:33 PM (12 years ago)
Author:
sommeria
Message:

merge_proj modified to fit with new conventions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/merge_proj.m

    r511 r522  
    193193        for iview=1:nbview
    194194            % reading input file(s)
    195             filecell{iview,index}
    196195            [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index));
    197196            if ~isempty(errormsg)
     
    225224                end
    226225            end
    227             if ~isempty(Param.ProjObject)&& strcmp(Param.ProjObject.ProjMode,'filter')&&~isfield(Data{iview},'Coord_tps')
    228                 Data{iview}=calc_tps(Data{iview});
    229             end
    230                  
    231             % field calculation (vort, div...)   
    232             if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
    233                 if isfield(Data{iview},'Coord_tps')
    234                     Data{iview}.FieldList=Param.InputFields.FieldName;
    235                 else
    236                     Data{iview}=calc_field(Param.InputFields.FieldName,Data{iview});%calculate field (vort..)
    237                 end
    238             end
     226               
     227            %% calculate tps coeff if needed
     228             check_proj_tps= ~isempty(Param.ProjObject)&& strcmp(Param.ProjObject.ProjMode,'filter')&&~isfield(Data{iview},'Coord_tps');
     229            Data{iview}=calc_tps(Data{iview},check_proj_tps);
     230             
     231%             % field calculation (vort, div...)   
     232%             if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
     233%                 if isfield(Data{iview},'Coord_tps')
     234%                     Data{iview}.FieldList=Param.InputFields.FieldName;
     235%                 else
     236%                     Data{iview}=calc_field(Param.InputFields.FieldName,Data{iview});%calculate field (vort..)
     237%                 end
     238%             end
    239239           
    240240            %projection on object (gridded plane)
     
    360360end
    361361
    362 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
    363 [CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1});
     362%% group the variables (fields of 'Data') in cells of variables with the same dimensions
     363[CellVarIndex,NbDim,VarTypeCell]=find_field_cells(Data{1});
    364364%LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
    365365% CellVarIndex=cells of variable index arrays
    366 ivar_new=0; % index of the current variable in the projected field
    367366for icell=1:length(CellVarIndex)
    368367    if NbDim(icell)==1
     
    388387            VarName=MergeData.ListVarName{ivar};
    389388            for iview=1:nbview
    390                 eval(['MergeData.' VarName '=[MergeData.' VarName '; Data{iview}.' VarName '];'])
     389                MergeData.(VarName)=[MergeData.(VarName); Data{iview}.(VarName)];
    391390            end
    392391        end
     
    402401                    end
    403402                end
    404                 eval(['MergeData.' VarName '=MergeData.' VarName '+ Data{iview}.' VarName ';'])
     403                MergeData.(VarName)=MergeData.(VarName) + Data{iview}.(VarName);
    405404            end
    406405        end
     
    410409            for ivar=VarIndex
    411410                VarName=MergeData.ListVarName{ivar};
    412                 eval(['MergeData.' VarName '(indgood)=double(MergeData.' VarName '(indgood))./nbaver(indgood);'])
     411                MergeData.(VarName)(indgood)=double(MergeData.(VarName)(indgood))./nbaver(indgood);
    413412            end
    414413        else
    415414            for ivar=VarIndex
    416415                VarName=MergeData.ListVarName{ivar};
    417                 eval(['MergeData.' VarName '=double(MergeData.' VarName ')./nbview;'])
     416                MergeData.(VarName)=double(MergeData.(VarName))./nbview;
    418417            end   
    419418        end
Note: See TracChangeset for help on using the changeset viewer.