Changeset 888 for trunk/src


Ignore:
Timestamp:
Apr 6, 2015, 7:58:22 PM (9 years ago)
Author:
sommeria
Message:

'proj_field

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r880 r888  
    13031303                    end
    13041304                    % interpolate and calculate field on the grid
     1305                   
    13051306                    [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldData,CellInfo{icell}.FieldName,XI,YI);
     1307                   
     1308                    % set to NaN interpolation points which are too far from any initial data (more than 2 CoordMaesh)
     1309                    F=scatteredInterpolant(coord_X, coord_Y,coord_X,'nearest');
     1310                    G=scatteredInterpolant(coord_X, coord_Y,coord_Y,'nearest');
     1311                    Distx=F(XI,YI)-XI;% diff of x coordinates with the nearest measurement point
     1312                    Disty=G(XI,YI)-YI;% diff of y coordinates with the nearest measurement point
     1313                    Dist=Distx.*Distx+Disty.*Disty;
     1314                    for ivar=1:numel(VarVal)
     1315                        VarVal{ivar}(Dist>2*ProjData.CoordMesh)=NaN;% put to NaN interpolated positions too far from initial data
     1316                    end 
    13061317                   
    13071318                    if isfield(CellInfo{icell},'CheckSub') && CellInfo{icell}.CheckSub && ~isempty(vector_x_proj)
     
    13361347                    FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x_tps}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y_tps}));
    13371348                end
     1349                % interpolate data using thin plate spline
    13381350                [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord,NbCentres,SubRange,FieldVar,CellInfo{icell}.FieldName,cat(3,XI,YI));
     1351               
     1352                % set to NaN interpolation points which are too far from any initial data (more than 2 CoordMaesh)
     1353                F=scatteredInterpolant(coord_X, coord_Y,coord_X,'nearest');
     1354                G=scatteredInterpolant(coord_X, coord_Y,coord_Y,'nearest');
     1355                Distx=F(XI,YI)-XI;% diff of x coordinates with the nearest measurement point
     1356                Disty=G(XI,YI)-YI;% diff of y coordinates with the nearest measurement point
     1357                Dist=Distx.*Distx+Disty.*Disty;
     1358                for ivar=1:numel(VarVal)
     1359                    VarVal{ivar}(Dist>2*ProjData.CoordMesh)=NaN;% put to NaN interpolated positions too far from initial data
     1360                end
     1361               
    13391362                ListVarName=(fieldnames(DataOut))';
    13401363                VarDimName=cell(size(ListVarName));
Note: See TracChangeset for help on using the changeset viewer.