Ignore:
Timestamp:
Jun 25, 2013, 12:48:10 AM (11 years ago)
Author:
sommeria
Message:

various bugs corrected. Introduction of campaign lists in Open menu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tps_coeff_field.m

    r586 r651  
    1 %'tps_coeff_field': calculate the thin plate spline (tps) coefficients with subdomains for a field structure
     1%'tps_coeff_field': calculate the thin plate spline (tps) coefficients within subdomains for a field structure
    22%---------------------------------------------------------------------
    33% DataOut=tps_coeff_field(DataIn,checkall)
    44%
    55% OUTPUT:
    6 % DataOut: output field structure
     6% DataOut: output field structure, reproducing the input field structure DataIn and adding the fields:
     7%         .Coord_tps
     8%         .[VarName '_tps'] for each eligible input variable VarName (scalar ofr vector components)
     9% errormsg: error message, = '' by default
    710%
    811% INPUT:
     
    7275            end
    7376            ListNewVar=cell(1,numel(VarIndexInterp)+3);
    74             ListNewVar(1:3)={['SubRange' term],['NbCentres' term],['Coord_tps' term]};
     77            ListNewVar(1:3)={['SubRange' term],['NbCentre' term],['Coord_tps' term]};
    7578            for ilist=1:numel(VarIndexInterp)
    7679                ListNewVar{ilist+3}=[ListVarInterp{ilist} '_tps' term];
     
    8285                {{['nb_tps' term],'nb_coord',['nb_subdomain' term]}}];
    8386            DataOut.VarAttribute{nbvar+3}.Role='coord_tps';
    84             [SubRange,NbCentres,IndSelSubDomain] =set_subdomains([X Y],SubDomainNbPoint);% create subdomains for tps
     87            [SubRange,NbCentre,IndSelSubDomain] =set_subdomains([X Y],SubDomainNbPoint);% create subdomains for tps
    8588            for isub=1:size(SubRange,3)
    86                 ind_sel=IndSelSubDomain(1:NbCentres(isub),isub);% array indices selected for the subdomain
    87                 Coord_tps=[X(ind_sel) Y(ind_sel)];
    88                 fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    89                 Coord_tps=cat(1,Coord_tps,fill);
     89                ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain
     90                DataOut.(['Coord_tps' term])(1:NbCentre(isub),1:2,isub)=[X(ind_sel) Y(ind_sel)];
     91                DataOut.(['Coord_tps' term])(NbCentre(isub)+1:NbCentre(isub)+3,1:2,isub)=0;%matrix of zeros to complement the matrix Coord_tps (conveninent for file storage)
     92                %fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
     93%                 fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
     94%                 Coord_tps=cat(1,Coord_tps,fill);
    9095            end         
    9196            for ivar=1:numel(VarIndexInterp)
     
    106111            end
    107112            DataOut.(['SubRange' term])=SubRange;
    108             DataOut.(['NbCentres' term])=NbCentres;
    109             DataOut.(['Coord_tps' term])=Coord_tps;
     113            DataOut.(['NbCentre' term])=NbCentre;
     114%             DataOut.(['Coord_tps' term])=Coord_tps;
    110115            for ilist=1:numel(VarIndexInterp)
     116%                 Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline
    111117                for isub=1:size(SubRange,3)
    112                     Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline
    113                     [tild,Var_tps(:,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist}),0);%calculate the tps coeff in the subdomain
     118                    ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain
     119                    [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 subdomain
    114120                end
    115121                DataOut.(ListNewVar{ilist+3})=Var_tps;
Note: See TracChangeset for help on using the changeset viewer.