Changeset 1122 for trunk/src/tps_coeff_field.m
- Timestamp:
- Apr 21, 2023, 11:01:06 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tps_coeff_field.m
r1107 r1122 1 1 %'tps_coeff_field': calculate the thin plate spline (tps) coefficients within subdomains for a field structure 2 2 %--------------------------------------------------------------------- 3 % DataOut=tps_coeff_field(DataIn,checkall )3 % DataOut=tps_coeff_field(DataIn,checkall,Smoothing) 4 4 % 5 5 % OUTPUT: … … 13 13 % checkall:=1 if tps is needed for all fields (a projection mode interp_tps has been chosen), 14 14 % =0 otherwise (tps only needed to get spatial derivatives of scattered data) 15 % 15 % Smoothing parameter: =0 (no smoothing) by default 16 16 17 % called functions: 17 18 % 'find_field_cells': analyse the input field structure, grouping the variables into 'fields' with common coordinates … … 37 38 %======================================================================= 38 39 39 function [DataOut,errormsg]=tps_coeff_field(DataIn,checkall )40 function [DataOut,errormsg]=tps_coeff_field(DataIn,checkall,Smoothing) 40 41 DataOut=DataIn;%default 42 if ~exist('Smoothing','var') 43 Smoothing=0; 44 end 41 45 SubDomainNbPoint=1000; %default, estimated nbre of data source points in a subdomain used for tps 42 46 if isfield(DataIn,'SubDomain') … … 53 57 nbtps=0;% indicate the number of tps coordinate sets in the field structure (in general =1) 54 58 55 for icell=1:numel(CellInfo) ;59 for icell=1:numel(CellInfo) 56 60 if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered') %if the coordinates are scattered 57 61 NbCoord=NbDimArray(icell);% dimension of space … … 129 133 for isub=1:size(SubRange,3) 130 134 ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain 131 [tild,Var_tps(1:NbCentre(isub)+NbCoord+1,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist})(ind_sel), 0);%calculate the tps coeff in the subdomain135 [tild,Var_tps(1:NbCentre(isub)+NbCoord+1,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist})(ind_sel),Smoothing);%calculate the tps coeff in the subdomain 132 136 end 133 137 DataOut.(ListNewVar{ilist+3})=Var_tps;
Note: See TracChangeset
for help on using the changeset viewer.