Changeset 589 for trunk/src/proj_field.m


Ignore:
Timestamp:
Mar 16, 2013, 3:46:12 PM (11 years ago)
Author:
sommeria
Message:

various minor corrections made

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r586 r589  
    621621                flagsel=ones(size(coord_x));
    622622            end
    623             if isequal(ProjMode,'projection') || isequal(ProjMode,'interp_tps')
     623            if isequal(ProjMode,'projection') %|| isequal(ProjMode,'interp_tps')
    624624                flagsel=flagsel & ((coord_y -yinf(ip))*(xinf(ip+1)-xinf(ip))>(coord_x-xinf(ip))*(yinf(ip+1)-yinf(ip))) ...
    625625                & ((coord_y -ysup(ip))*(xsup(ip+1)-xsup(ip))<(coord_x-xsup(ip))*(ysup(ip+1)-ysup(ip))) ...
     
    633633            for iselect=1:numel(VarIndex)-2*testU
    634634                VarName=FieldData.ListVarName{VarIndex(iselect)};
    635                 eval(['ProjVar{iselect}=FieldData.' VarName '(indsel);']);%scalar value
     635                ProjVar{iselect}=FieldData.(VarName)(indsel);%scalar value
    636636            end   
    637637            if testU
     
    11851185                        FieldData=rmfield(FieldData,FieldData.ListVarName{CellInfo{icell}.VarIndex_warnflag});
    11861186                    end
     1187                    % interpolate and calculate field on the grid
    11871188                    [VarVal,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldData,CellInfo{icell}.FieldName,XI,YI);
     1189                   
    11881190                    if isfield(CellInfo{icell},'CheckSub') && CellInfo{icell}.CheckSub && ~isempty(vector_x_proj)
    11891191                        ProjData.(ProjData.ListVarName{vector_x_proj})=ProjData.(ProjData.ListVarName{vector_x_proj})-VarVal{1};
     
    18331835                        eval(['FieldData.' VarName '=FieldData.' VarName '(indsel);'])
    18341836                    end
    1835                     eval(['InterpFct=TriScatteredInterp(double(coord_X),double(coord_Y),double(coord_Z),double(FieldData.' VarName '))'])
    1836                     eval(['ProjData.' VarName '=InterpFct(X,Y,Z);'])
     1837                    % linear interpolation
     1838                    InterpFct=TriScatteredInterp(double(coord_X),double(coord_Y),double(coord_Z),double(FieldData.(VarName)));
     1839                    ProjData.(VarName)=InterpFct(X,Y,Z);
    18371840%                     eval(['varline=reshape(ProjData.' VarName ',1,length(coord_y_proj)*length(coord_x_proj));'])
    18381841%                     FFlag= isnan(varline); %detect undefined values NaN
Note: See TracChangeset for help on using the changeset viewer.