Ignore:
Timestamp:
Apr 27, 2012, 12:28:47 PM (12 years ago)
Author:
sommeria
Message:

implementation of thin plate interpolation (proj on planes with mode 'filter'), rationalisation of variable formats in civ_matlab

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_field_indices.m

    r397 r399  
    5858VarDimIndex=[];
    5959VarDimName={};
    60 
    6160if ~isfield(Data,'VarDimName')
    6261    errormsg='missing .VarDimName';
     
    6463end
    6564
    66 %loop on the list of variables
     65%% loop on the list of variables, group them by common dimensions
    6766for ivar=1:nbvar
    6867    DimCell=Data.VarDimName{ivar}; %dimensions associated with the variable #ivar
     
    8584        CellVarIndex{icell}=ivar;%put the current variabl index in the new cell
    8685    end
    87     
     86   
    8887    %look for dimension variables
    8988    if numel(DimCell)==1% if the variable has a single dimension
     
    10099end
    101100
    102 % find the spatial dimensions and vector components
     101%% find the spatial dimensions and vector components
    103102ListRole={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','warnflag','errorflag',...
    104103    'ancillary','image','color','discrete','scalar','coord_tps'};
     104NbDim=zeros(size(CellVarIndex));%default
    105105for icell=1:length(CellVarIndex)
    106106    for ilist=1:numel(ListRole)
     
    142142        return
    143143    end
    144 %     if ivar_vector_x>1
    145 %         ivar_vector_x=ivar_vector_x(1);
    146 %     end
    147 %     if ivar_vector_y>1
    148 %         ivar_vector_y=ivar_vector_y(1);
    149 %     end
    150 %     if ivar_vector_z>1
    151 %         ivar_vector_z=ivar_vector_z(1);
    152 %     end
    153144    if numel(ivar_errorflag)>1
    154145        errormsg='multiply defined error flag in the same cell';
     
    159150        return
    160151    end
    161     %NbDim(icell)=0;% nbre of space dimensions
    162 %     NbDim(icell)=numel(DimCell);
    163     NbDim(icell)=0;
    164152    test_coord=0;
    165153    if numel(VarIndex)>1     
     
    193181        NbDim(icell)=2;
    194182    end
     183    %look for tps data
     184    if ~isempty(VarType{icell}.coord_tps)
     185        VarType{icell}.var_tps=[];
     186        tps_dimnames=Data.VarDimName{VarType{icell}.coord_tps};
     187        if length(tps_dimnames)==3
     188            for ilist=1:length(Data.VarDimName)
     189                if strcmp(tps_dimnames{1},Data.VarDimName{ilist}{1}) && strcmp(tps_dimnames{3},Data.VarDimName{ilist}{2})% identify the variables corresponding to the tps site coordinates coord_tps
     190                    VarType{icell}.var_tps=[VarType{icell}.var_tps ilist];
     191                elseif length(Data.VarDimName{ilist})==1 && strcmp(tps_dimnames{3},Data.VarDimName{ilist}{1})% identify the variable corresponding to nbsites
     192                    VarType{icell}.nbsites_tps= ilist;
     193                elseif length(Data.VarDimName{ilist})==3 && strcmp(tps_dimnames{2},Data.VarDimName{ilist}{1})&& strcmp(tps_dimnames{3},Data.VarDimName{ilist}{3})% identify the variable subrange
     194                    VarType{icell}.subrange_tps= ilist;
     195                end
     196            end
     197        end
     198        NbDim(icell)=2;
     199    end 
    195200end
Note: See TracChangeset for help on using the changeset viewer.