Changeset 890 for trunk/src/find_field_cells.m
- Timestamp:
- Apr 18, 2015, 11:03:01 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_field_cells.m
r809 r890 210 210 % 2)the coordinate variable contains only two elements, representing the coordinate bounds for the dimension with the same name as the cordinate 211 211 ivar_remain=find(~check_select);% indices of remaining variables, not already taken into account 212 ListVarName=Data.ListVarName(~check_select);%list of remaining variables212 ListVarName=Data.ListVarName(~check_select);%list of names of remaining variables 213 213 VarDimName=Data.VarDimName(~check_select);%dimensions of remaining variables 214 214 check_coord_select= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension 215 215 check_coord_select=check_coord_select & ~strcmp('ancillary',Role(~check_select));% do not select ancillary variables as coordinates 216 %check_coord(~check_select)=check_coord_select;217 216 ListCoordIndex=ivar_remain(check_coord_select);% indices of remaining variables with a single dimension 218 217 ListCoordName=ListVarName(check_coord_select);% corresponding names of remaining variables with a single dimension … … 220 219 221 220 %remove redondant variables -> keep only one variable per dimension 222 check_keep= logical(ones(size(ListDimName)));221 check_keep=true(size(ListDimName)); 223 222 for idim=1:numel(ListDimName) 224 prev_ind= strcmp(ListDimName{idim},ListDimName(1:idim-1));% check whether the dimension is already taken into account225 if ~isempty(prev_ind) 223 prev_ind=find(strcmp(ListDimName{idim},ListDimName(1:idim-1)));% check whether the dimension is already taken into account 224 if ~isempty(prev_ind)% in case of multiple coord variable 226 225 if strcmp(ListCoordName{idim},ListDimName{idim}) %variable with the same name as the coordinate taken in priority 227 check_keep(prev_ind)=0; 226 check_keep(prev_ind)=0;% choose a variable with the same name as coordinate in priority 228 227 else 229 check_keep(idim)=0; 228 check_keep(idim)=0; %keep the first coordiante variable found 230 229 end 231 230 end … … 256 255 NewCellDimIndex={}; 257 256 NewNbDim=[]; 258 for ivardim=1:numel(VarDimName) % loop at the list of remaining variables257 for ivardim=1:numel(VarDimName) % loop at the list of dimensions for the remaining variables 259 258 DimCell=VarDimName{ivardim};% dimension names of the current variable 260 259 if ischar(DimCell), DimCell={DimCell}; end %transform char to cell if needed
Note: See TracChangeset
for help on using the changeset viewer.