Changeset 888
 Timestamp:
 Apr 6, 2015, 7:58:22 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/proj_field.m
r880 r888 1303 1303 end 1304 1304 % interpolate and calculate field on the grid 1305 1305 1306 [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 1306 1317 1307 1318 if isfield(CellInfo{icell},'CheckSub') && CellInfo{icell}.CheckSub && ~isempty(vector_x_proj) … … 1336 1347 FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x_tps}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y_tps})); 1337 1348 end 1349 % interpolate data using thin plate spline 1338 1350 [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 1339 1362 ListVarName=(fieldnames(DataOut))'; 1340 1363 VarDimName=cell(size(ListVarName));
Note: See TracChangeset
for help on using the changeset viewer.