- Timestamp:
- Jun 18, 2020, 11:16:14 AM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_field_cells.m
r1078 r1083 67 67 function [CellInfo,NbDim,errormsg]=find_field_cells(Data) 68 68 CellInfo={};%default output 69 NbDim=0; 69 %NbDim=0; 70 NbDim=[]; 70 71 errormsg=''; 71 72 if ~isfield(Data,'ListVarName'), errormsg='the list of variables .ListVarName is missing';return;end … … 147 148 148 149 149 %% initate cells around each scalar field 150 index_remove=[]; 151 cell_nbre=numel(ind_scalar)+numel(ind_vector_x); 152 flag_remove=false(1,cell_nbre); 153 NbDim=zeros(1,cell_nbre); 154 index_coord_x=zeros(size(ind_coord_x)); 155 for icell=1:numel(ind_scalar) 156 CellInfo{icell}.VarType='scalar'; 157 CellInfo{icell}.VarIndex_scalar=ind_scalar(icell); 158 CellInfo{icell}.VarIndex=ind_scalar(icell); 159 DimCell_var=Data.VarDimName{ind_scalar(icell)};% cell of dimension names for ivar_coord_x(icell) 160 %look for errorflag 161 for ivar=ind_errorflag 162 DimCell=Data.VarDimName{ivar}; 163 if isequal(DimCell,DimCell_var) 164 CellInfo{icell}.VarIndex(2)=ivar; 165 CellInfo{icell}.VarIndex_errorflag=ivar; 150 %% initate cells around each scalar field with different coordinates 151 % index_remove=[]; 152 % index_coord_x=zeros(size(ind_coord_x)); 153 cell_counter=0; 154 DimCell={}; 155 for iscalar=1:numel(ind_scalar) 156 icell=[]; 157 for iprev=1:numel(DimCell)-1 158 if isequal(DimCell{iprev},Data.VarDimName{ind_scalar(iscalar)}) 159 icell=iprev; 166 160 break 167 161 end 168 162 end 169 end 170 171 %% initate cells around each vector field 172 for icell=numel(ind_scalar)+1:cell_nbre 173 CellInfo{icell}.VarType='vector'; 174 CellInfo{icell}.VarIndex(1)=ind_vector_x(icell-numel(ind_scalar)); 175 CellInfo{icell}.VarIndex_vector_x=ind_vector_x(icell-numel(ind_scalar)); 176 DimCell_var=Data.VarDimName{ind_vector_x(icell-numel(ind_scalar))};% cell of dimension names for ivar_coord_x(icell) 177 % look for the associated y vector component 178 nbvar=1; 179 for ivar=ind_vector_y 180 DimCell=Data.VarDimName{ivar}; 181 if isequal(DimCell,DimCell_var) 182 CellInfo{icell}.VarIndex(2)=ivar; 183 nbvar=2; 184 CellInfo{icell}.VarIndex_vector_y=ivar; 163 if isempty(icell) 164 cell_counter=cell_counter+1; 165 icell=cell_counter; 166 CellInfo{icell}.VarType='scalar'; 167 DimCell{icell}=Data.VarDimName{ind_scalar(iscalar)}; 168 DimCell_var=Data.VarDimName{ind_scalar(iscalar)};% cell of dimension names for ivar_coord_x(icell) 169 CellInfo{icell}.VarIndex_scalar=ind_scalar(iscalar); 170 CellInfo{icell}.VarIndex=ind_scalar(iscalar); 171 else 172 CellInfo{iprev}.VarIndex_scalar=[CellInfo{iprev}.VarIndex_scalar ind_scalar(iscalar)]; 173 CellInfo{iprev}.VarIndex=[CellInfo{iprev}.VarIndex ind_scalar(iscalar)]; 174 end 175 end 176 177 %% initate or complement cells around each vector field with different coordinates 178 for index_list=1:numel(ind_vector_x) 179 icell=[]; 180 for iprev=1:numel(DimCell)% look for previous cells of vectors with the same dimensions 181 if isequal(DimCell{iprev},Data.VarDimName{ind_vector_x(index_list)})&& ~strcmp(CellInfo{iprev}.VarType, 'scalar') 182 icell=iprev; 185 183 break 186 184 end 187 185 end 188 if ~isfield(CellInfo{icell},'VarIndex_vector_y') 189 flag_remove(icell)=true;% no vector_y found , mark cell to remove 190 end 191 % look for the associated z vector component 192 for ivar=ind_vector_z 193 DimCell=Data.VarDimName{ivar}; 194 if isequal(DimCell,DimCell_var) 195 CellInfo{icell}.VarIndex(3)=ivar; 196 nbvar=3; 186 if isempty(icell)% new cell 187 cell_counter=cell_counter+1; 188 icell=cell_counter; 189 CellInfo{icell}.VarType='vector'; 190 DimCell{icell}=Data.VarDimName{ind_vector_x(index_list)}; 191 CellInfo{icell}.VarIndex=ind_vector_x(index_list); 192 CellInfo{icell}.VarIndex_vector_x=ind_vector_x(index_list); 193 else 194 CellInfo{icell}.VarIndex=[CellInfo{icell}.VarIndex ind_vector_x(index_list)]; 195 if isfield(CellInfo{icell},'VarIndex_vector_x') 196 CellInfo{icell}.VarIndex_vector_x=[CellInfo{icell}.VarIndex_vector_x ind_vector_x(index_list)]; 197 else 198 CellInfo{icell}.VarIndex_vector_x=ind_vector_x(index_list); 199 end 200 end 201 end 202 203 %% complement with vector_y 204 if ~isempty(ind_vector_x) 205 for index_list=1:numel(ind_vector_y) 206 for iprev=1:numel(DimCell) 207 if isequal(DimCell{iprev},Data.VarDimName{ind_vector_y(index_list)})&& ~strcmp(CellInfo{iprev}.VarType, 'scalar') 208 icell=iprev; 209 break 210 end 211 end 212 CellInfo{icell}.VarIndex=[CellInfo{icell}.VarIndex ind_vector_y(index_list)]; 213 if isfield(CellInfo{icell},'VarIndex_vector_y') 214 CellInfo{icell}.VarIndex_vector_y=[CellInfo{icell}.VarIndex_vector_y ind_vector_y(index_list)]; 215 else 216 CellInfo{icell}.VarIndex_vector_y=ind_vector_y(index_list); 217 end 218 end 219 220 %% look for the associated z vector component 221 for index_list=1:numel(ind_vector_z) 222 for iprev=1:numel(DimCell) 223 if isequal(DimCell{iprev},Data.VarDimName{ind_vector_z(index_list)})&& ~strcmp(CellInfo{iprev}.VarType, 'scalar') 224 icell=iprev; 225 break 226 end 227 end 228 CellInfo{icell}.VarIndex=[CellInfo{icell}.VarIndex ind_vector_z(index_list)]; 229 if isfield(CellInfo{icell},'VarIndex_vector_z') 230 CellInfo{icell}.VarIndex_vector_z=[CellInfo{icell}.VarIndex_vector_z ind_vector_z(index_list)]; 231 else 232 CellInfo{icell}.VarIndex_vector_z=ind_vector_z(index_list); 233 end 234 nbvar=3; 235 end 236 237 %% look for the associated vector color scalar (ancillary) 238 for index_list=1:numel(ind_ancillary) 239 for iprev=1:numel(DimCell) 240 if isequal(DimCell{iprev},Data.VarDimName{ind_ancillary(index_list)})&& ~strcmp(CellInfo{iprev}.VarType, 'scalar') 241 icell=iprev; 242 break 243 end 244 end 245 CellInfo{icell}.VarIndex=[CellInfo{icell}.VarIndex ind_ancillary(index_list)]; 246 if isfield(CellInfo{icell},'VarIndex_ancillary') 247 CellInfo{icell}.VarIndex_ancillary=[CellInfo{icell}.VarIndex_ancillary ind_ancillary(index_list)]; 248 else 249 CellInfo{icell}.VarIndex_ancillary=ind_ancillary(index_list); 250 end 251 end 252 253 %% look for the associated warnflag 254 for index_list=1:numel(ind_warnflag) 255 for iprev=1:numel(DimCell) 256 if isequal(DimCell{iprev},Data.VarDimName{ind_warnflag(index_list)}) 257 icell=iprev; 258 break 259 end 260 end 261 CellInfo{icell}.VarIndex=[CellInfo{icell}.VarIndex ind_warnflag(index_list)]; 262 if isfield(CellInfo{icell},'VarIndex_warnflag') 263 CellInfo{icell}.VarIndex_warnflag=[CellInfo{icell}.VarIndex_warnflag ind_ancillary(index_list)]; 264 else 265 CellInfo{icell}.VarIndex_warnflag=ind_warnflag(index_list); 266 end 267 end 268 end 269 270 %% look for the associated errorflag 271 for index_list=1:numel(ind_errorflag) 272 for iprev=1:numel(DimCell) 273 if isequal(DimCell{iprev},Data.VarDimName{ind_errorflag(index_list)}) 274 icell=iprev; 197 275 break 198 276 end 199 277 end 200 %look for the vector color scalar (ancillary) 201 for ivar=ind_ancillary 202 DimCell=Data.VarDimName{ivar}; 203 if isequal(DimCell,DimCell_var) 204 nbvar=nbvar+1; 205 CellInfo{icell}.VarIndex(nbvar)=ivar; 206 CellInfo{icell}.VarIndex_ancillary=ivar; 207 break 208 end 209 end 210 %look for warnflag 211 for ivar=ind_warnflag 212 DimCell=Data.VarDimName{ivar}; 213 if isequal(DimCell,DimCell_var) 214 nbvar=nbvar+1; 215 CellInfo{icell}.VarIndex(nbvar)=ivar; 216 CellInfo{icell}.VarIndex_warnflag=ivar; 217 break 218 end 219 end 220 %look for errorflag 221 for ivar=ind_errorflag 222 DimCell=Data.VarDimName{ivar}; 223 if isequal(DimCell,DimCell_var) 224 nbvar=nbvar+1; 225 CellInfo{icell}.VarIndex(nbvar)=ivar; 226 CellInfo{icell}.VarIndex_errorflag=ivar; 227 break 228 end 229 end 230 end 278 CellInfo{icell}.VarIndex=[CellInfo{icell}.VarIndex ind_errorflag(index_list)]; 279 if isfield(CellInfo{icell},'VarIndex_errorflag') 280 CellInfo{icell}.VarIndex_errorflag=[CellInfo{icell}.VarIndex_errorflag ind_errorflag(index_list)]; 281 else 282 CellInfo{icell}.VarIndex_errorflag=ind_errorflag(index_list); 283 end 284 end 285 231 286 232 287 %% find coordinates for each cell around field variables, scalars or vectors 233 for icell=1: cell_nbre288 for icell=1:numel(CellInfo) 234 289 CellInfo{icell}.CoordType=''; 235 290 ind_var=CellInfo{icell}.VarIndex(1); … … 320 375 check_coord=~isempty(DimRank); 321 376 end 322 % check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{1}))||...% coord varbable323 % (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{1})); % rasrewr coord defined by min and max324 377 if check_coord 325 378 CellInfo{icell}.CoordType='grid'; … … 341 394 check_coord=~isempty(DimRank); 342 395 end 343 % check_coord= (check_coord_names(ivar) && strcmp(Data.VarDimName{ivar},DimCell_var{NbDim(icell)-1}))||...% coord variable344 % (check_coord_raster(ivar) && strcmp(Data.ListVarName{ivar},DimCell_var{NbDim(icell)-1})); % rasrewr coord defined by min and max345 396 if check_coord 346 397 CellInfo{icell}.CoordType='grid'; … … 418 469 end 419 470 end 420 % 421 % %% loop on the tps coordinate sets 422 % 423 % for icell_tps=1:numel(ind_coord_tps) 424 % check_cell=zeros(1,nbvar);% =1 for the variables selected in the current cell 425 % check_cell(ivar_tps(icell_tps))=1;% mark the coordinate variable as selected 426 % DimCell=Data.VarDimName{ivar_tps(icell_tps)};% dimension names for the current tps coordinate variable 427 % icell=numel(CellInfo)+icell_tps; % new field cell index 428 % CellInfo{icell}.CoordIndex=ivar_tps(icell_tps);% index of the tps coordinate variable 429 % if numel(DimCell)==3 430 % VarDimName=Data.VarDimName(~check_select); 431 % for ivardim=1:numel(VarDimName) 432 % if strcmp(VarDimName{ivardim},DimCell{3}) 433 % CellInfo{icell}.NbCentres_tps= ivar_remain(ivardim);% nbre of sites for each tps subdomain 434 % check_cell(ivar_remain(ivardim))=1;% mark the variable as selected 435 % elseif strcmp(VarDimName{ivardim}{1},DimCell{2}) && numel(VarDimName{ivardim})>=3 && strcmp(VarDimName{ivardim}{3},DimCell{3}) 436 % CellInfo{icell}.SubRange_tps=ivar_remain(ivardim);% subrange definiton for tps 437 % check_cell(ivar_remain(ivardim))=1;% mark the variable as selected 438 % elseif strcmp(VarDimName{ivardim}{1},DimCell{1}) && strcmp(VarDimName{ivardim}{2},DimCell{3})% variable 439 % check_cell(ivar_remain(ivardim))=1;% mark the variable as selected 440 % end 441 % end 442 % end 443 % CellInfo{icell}.CoordType='tps'; 444 % CellInfo{icell}.VarIndex=find(check_cell); 445 % if check_var 446 % NbDim(icell)=size(Data.(Data.ListVarName{CellInfo{icell}.CoordIndex}),2); 447 % CellInfo{icell}.CoordSize=size(Data.(Data.ListVarName{CellInfo{icell}.CoordIndex}),1)*size(Data.(Data.ListVarName{CellInfo{icell}.CoordIndex}),3); 448 % else 449 % check_index_1= strcmp(DimCell{1},Data.ListDimName); 450 % check_index_2= strcmp(DimCell{2},Data.ListDimName); 451 % NbDim(icell)=Data.DimValue(check_index_2); 452 % if numel(DimCell)>=3 453 % check_index_3= strcmp(DimCell{3},Data.ListDimName); 454 % CellInfo{icell}.CoordSize=Data.DimValue(check_index_1)*Data.DimValue(check_index_3); 455 % end 456 % end 457 % check_select=check_select|check_cell; 458 % end 459 460 461 %% cell for ordinary plots 471 472 %% cell for ordinary plots: look for coord_x not included in scalar or vector cells 462 473 iremove=false(1,numel(ind_coord_y)); 463 for ilist=1:numel(ind_coord_y)% remove the y coordinates which have been used yetin scalar or vector fields474 for ilist=1:numel(ind_coord_y)% remove the y coordinates which have been used already in scalar or vector fields 464 475 for icell=1:numel(CellInfo) 465 476 if isfield(CellInfo{icell},'YIndex')&& isequal(CellInfo{icell}.YIndex,ind_coord_y(ilist)) … … 479 490 Cell1DPlot{icell}.YIndex_discrete=[]; 480 491 DimCell_x=Data.VarDimName{ind_coord_x(icell)}; 481 for ivar=[ind_coord_y ind_histo] 482 DimCell=Data.VarDimName{ivar}; 492 for ivar=[ind_coord_y ind_histo]% look for y coordinate corresponding to coord_x 493 DimCell=Data.VarDimName{ivar};%dimensions of coord_y 483 494 if numel(DimCell_x)==1 && strcmp(DimCell_x{1},DimCell{1}) 484 495 y_nbre(icell)=y_nbre(icell)+1; … … 530 541 end 531 542 end 532 % for icell=ind_coord_tps 533 % VarIndex=CellInfo{icell}.VarIndex; 534 % for ivar=VarIndex 535 % if isfield(CellInfo{icell},['VarIndex_' Role{ivar}]) 536 % CellInfo{icell}.(['VarIndex_' Role{ivar}])=[CellInfo{icell}.(['VarIndex_' Role{ivar}]) ivar]; 537 % else 538 % CellInfo{icell}.(['VarIndex_' Role{ivar}])= ivar; 539 % end 540 % if ~isempty(ProjModeRequest{ivar}) 541 % CellInfo{icell}.ProjModeRequest=ProjModeRequest{ivar}; 542 % end 543 % if ~isempty(FieldName{ivar}) 544 % CellInfo{icell}.FieldName=FieldName{ivar}; 545 % end 546 % if CheckSub(ivar)==1 547 % CellInfo{icell}.CheckSub=1; 548 % end 549 % end 550 % end 551 552 553 554 % 555 % %% analyse vector fields 556 % if ~isempty(ind_vector_x) && ~isempty(ind_vector_y) 557 % if numel(ind_vector_x)>1 558 % errormsg='multiply defined vector x component' 559 % return 560 % end 561 % DimCell_vec=Data.VarDimName{ind_vector_x};% cell of dimension names for ivar_coord_x(icell) 562 % if ischar(DimCell),DimCell={DimCell};end % transform char to cell for a single dimension 563 % DimCell_y=Data.VarDimName{ind_vector_y};% cell of dimension names for ivar_coord_x(icell) 564 % if ischar(DimCell_y),DimCell_y={DimCell_y};end % transform char to cell for a single dimension 565 % if ~isequal(DimCell,DimCell_y) 566 % errormsg='inconsistent x and y vector components'; 567 % return 568 % end 569 % %look for coordinates 570 % for ivar=ind_coord_y 571 % DimCell=Data.VarDimName{ivar}; 572 % if ischar(DimCell),DimCell={DimCell};end % transform char to cell for a single dimension 573 % if isequal(DimCell,DimCell_vec) 574 % CoordType='scattered'; 575 % coordy=ivar; 576 % else 577 % if isempty(ind_coord_z) && strcmp(DimCell{1},DimCell_vec{1}) 578 % CoordType='grid'; 579 % coordy=ivar; 580 % elseif ~isempty(ind_coord_z) && strcmp(DimCell{1},DimCell_vec{2}) 581 % CoordType='grid'; 582 % coordy=ivar; 583 % coordz=ind_coord_z; 584 % end 585 % end 586 % 587 % %% find scattered (unstructured) coordinates 588 % ivar_coord_x=find(strcmp('coord_x',Role));%find variables with Role='coord_x' 589 % check_select=false(1,nbvar); 590 % check_coord=false(1,nbvar); 591 % CellInfo=cell(1,numel(ivar_coord_x)); 592 % NbDim=zeros(1,numel(ivar_coord_x)); 593 % % loop on unstructured coordinate x -> different field cells 594 % for icell=1:numel(ivar_coord_x) 595 % DimCell=Data.VarDimName{ivar_coord_x(icell)};% cell of dimension names for ivar_coord_x(icell) 596 % if ischar(DimCell),DimCell={DimCell};end % transform char to cell for a single dimension 597 % % look for variables sharing dimension(s) with ivar_coord_x(icell) 598 % check_cell=zeros(numel(DimCell),nbvar); 599 % for idim=1:numel(DimCell);% for each variable with role coord_x, look at which other variables contain the same dimension 600 % for ivar=1:nbvar 601 % check_cell(idim,ivar)=max(strcmp(DimCell{idim},Data.VarDimName{ivar})); 602 % end 603 % end 604 % check_cell=sum(check_cell,1)==numel(DimCell);%logical array=1 for variables belonging to the current cell 605 % VarIndex=find(check_cell);% list of detected variable indices 606 % if ~(numel(VarIndex)==1 && numel(DimCell)==1)% exclude case of isolated coord_x variable (treated later) 607 % if ~(numel(VarIndex)==1 && numel(DimCell)>1)% a variable is associated to coordinate 608 % CellInfo{icell}.CoordIndex=ivar_coord_x(icell); 609 % % size of coordinate var 610 % if check_var 611 % CellInfo{icell}.CoordSize=numel(Data.(Data.ListVarName{ivar_coord_x(icell)})); 612 % else 613 % for idim=1:numel(DimCell) 614 % check_index= strcmp(DimCell{idim},Data.ListDimName); 615 % CellInfo{icell}.CoordSize(idim)=Data.DimValue(check_index); 616 % end 617 % CellInfo{icell}.CoordSize=prod(CellInfo{icell}.CoordSize); 618 % end 619 % % ind_scalar=find(strcmp('scalar',Role(VarIndex))); 620 % % ind_vector_x=find(strcmp('vector_x',Role(VarIndex))); 621 % % ind_vector_y=find(strcmp('vector_y',Role(VarIndex))); 622 % ind_y=find(strcmp('coord_y',Role(VarIndex))); 623 % if numel([ind_scalar ind_vector_x ind_vector_y])==0 624 % % if numel(VarIndex)==2||isempty(ind_y)% no variable, except possibly y 625 % NbDim(icell)=1; 626 % else 627 % CellInfo{icell}.CoordType='scattered'; 628 % ind_z=find(strcmp('coord_z',Role(VarIndex))); 629 % if numel(VarIndex)==3||isempty(ind_z)% no z variable, except possibly as a fct z(x,y) 630 % CellInfo{icell}.CoordIndex=[VarIndex(ind_y) CellInfo{icell}.CoordIndex]; 631 % NbDim(icell)=2; 632 % else 633 % CellInfo{icell}.CoordIndex=[VarIndex(ind_z) CellInfo{icell}.CoordIndex]; 634 % NbDim(icell)=3; 635 % end 636 % end 637 % end 638 % CellInfo{icell}.VarIndex=VarIndex; 639 % check_select=check_select|check_cell; 640 % end 641 % end 642 % 643 % %% look for tps coordinates 644 % ivar_remain=find(~check_select);% indices of remaining variables (not already selected) 645 % check_coord_tps= strcmp('coord_tps',Role(~check_select)); 646 % ivar_tps=ivar_remain(check_coord_tps);% variable indices corresponding to tps coordinates 647 % 648 % % loop on the tps coordinate sets 649 % for icell_tps=1:numel(ivar_tps) 650 % check_cell=zeros(1,nbvar);% =1 for the variables selected in the current cell 651 % check_cell(ivar_tps(icell_tps))=1;% mark the coordinate variable as selected 652 % DimCell=Data.VarDimName{ivar_tps(icell_tps)};% dimension names for the current tps coordinate variable 653 % icell=numel(CellInfo)+icell_tps; % new field cell index 654 % CellInfo{icell}.CoordIndex=ivar_tps(icell_tps);% index of the tps coordinate variable 655 % if numel(DimCell)==3 656 % VarDimName=Data.VarDimName(~check_select); 657 % for ivardim=1:numel(VarDimName) 658 % if strcmp(VarDimName{ivardim},DimCell{3}) 659 % CellInfo{icell}.NbCentres_tps= ivar_remain(ivardim);% nbre of sites for each tps subdomain 660 % check_cell(ivar_remain(ivardim))=1;% mark the variable as selected 661 % elseif strcmp(VarDimName{ivardim}{1},DimCell{2}) && numel(VarDimName{ivardim})>=3 && strcmp(VarDimName{ivardim}{3},DimCell{3}) 662 % CellInfo{icell}.SubRange_tps=ivar_remain(ivardim);% subrange definiton for tps 663 % check_cell(ivar_remain(ivardim))=1;% mark the variable as selected 664 % elseif strcmp(VarDimName{ivardim}{1},DimCell{1}) && strcmp(VarDimName{ivardim}{2},DimCell{3})% variable 665 % check_cell(ivar_remain(ivardim))=1;% mark the variable as selected 666 % end 667 % end 668 % end 669 % CellInfo{icell}.CoordType='tps'; 670 % CellInfo{icell}.VarIndex=find(check_cell); 671 % if check_var 672 % NbDim(icell)=size(Data.(Data.ListVarName{CellInfo{icell}.CoordIndex}),2); 673 % CellInfo{icell}.CoordSize=size(Data.(Data.ListVarName{CellInfo{icell}.CoordIndex}),1)*size(Data.(Data.ListVarName{CellInfo{icell}.CoordIndex}),3); 674 % else 675 % check_index_1= strcmp(DimCell{1},Data.ListDimName); 676 % check_index_2= strcmp(DimCell{2},Data.ListDimName); 677 % NbDim(icell)=Data.DimValue(check_index_2); 678 % if numel(DimCell)>=3 679 % check_index_3= strcmp(DimCell{3},Data.ListDimName); 680 % CellInfo{icell}.CoordSize=Data.DimValue(check_index_1)*Data.DimValue(check_index_3); 681 % end 682 % end 683 % check_select=check_select|check_cell; 684 % end 685 % 686 % 687 % 688 % % determine dimension sizes 689 % CoordSize=zeros(size(ListCoordIndex)); 690 % for ilist=1:numel(ListCoordIndex) 691 % if iscell(ListDimName{ilist}) 692 % ListDimName(ilist)=ListDimName{ilist};%transform cell to string 693 % end 694 % if check_var% if the list of dimensions has been directly defined, no variable data available 695 % CoordSize(ilist)=numel(Data.(ListCoordName{ilist}));% number of elements in the variable corresponding to the dimension #ilist 696 % else 697 % check_index= strcmp(ListDimName{ilist},Data.ListDimName);% find the index in the list of dimensions 698 % CoordSize(ilist)=Data.DimValue(check_index);% find the corresponding dimension value 699 % end 700 % if CoordSize(ilist)==2% case of uniform grid coordinate defined by lower and upper bounds only 701 % ListDimName{ilist}=ListCoordName{ilist};% replace the dimension name by the coordinate variable name 702 % end 703 % end 704 % end 705 % end 706 % 707 % 708 % 709 % %% suppress empty cells or cells with a single coordinate variable 710 % check_remove=false(size(CellInfo)); 711 % for icell=1:numel(check_remove) 712 % if isempty(CellInfo{icell})||(numel(CellInfo{icell}.VarIndex)==1 && numel(check_coord)>=icell && check_coord(icell)) 713 % check_remove(icell)=1; 714 % end 715 % end 716 % CellInfo(check_remove)=[]; 717 % NbDim(check_remove)=[]; 718 % 719 % 543 544 545 -
trunk/src/get_field.m
r1082 r1083 172 172 173 173 %% select the Time attribute from input 174 if Field.MaxDim > =2174 if Field.MaxDim >2 175 175 variable_index=find(strcmp('variable',ListSwitchVarIndexTime),1); 176 176 set(handles.SwitchVarIndexTime,'Value',variable_index); 177 177 else 178 if isfield(ParamIn,'TimeAttrName') 178 if isfield(ParamIn,'TimeAttrName')&& ~isempty(ParamIn.TimeAttrName) 179 179 time_index=find(strcmp(ParamIn.TimeAttrName,Field.Display.ListGlobalAttribute),1); 180 180 else 181 time_index=find( ~cellfun('isempty',regexp(Field.Display.ListGlobalAttribute,'Time')),1);% look for global attribute containing name 'Time'181 time_index=find(strcmp('Time',Field.Display.ListGlobalAttribute));% look for global attribute containing name 'Time' 182 182 end 183 183 if isempty(time_index) … … 796 796 set(handles.SwitchVarIndexTime,'Value',3)% the last dim must be considered as time 797 797 end 798 if numel(var_component)<2 798 if numel(var_component)<2 %unstructured coordinates excluded 799 799 if numel(find(test_coord))<2 800 800 ListCoord={''}; … … 828 828 end 829 829 if numel(find(coord_val))<2 830 %coord_val=[numel(var_component)+2 numel(var_component)+1];831 830 coord_val=[1 2 3]; 832 831 end 833 set(handles.Coord_x,'Value',coord_val( 1))834 set(handles.Coord_y,'Value',coord_val( 2))832 set(handles.Coord_x,'Value',coord_val(end)) 833 set(handles.Coord_y,'Value',coord_val(end-1)) 835 834 if numel(coord_val)>=3 836 set(handles.Coord_z,'Value',coord_val( 3))835 set(handles.Coord_z,'Value',coord_val(end-2)) 837 836 end 838 837 end -
trunk/src/uvmat.m
r1082 r1083 2186 2186 else 2187 2187 FileIndex_1=fullfile_uvmat('','','','',Input.NomType_1,i1,i2,j1,j2); 2188 msgbox_uvmat('WARNING','unable to synchronise the indices of the two series')2188 % msgbox_uvmat('WARNING','unable to synchronise the indices of the two series') 2189 2189 end 2190 2190 set(handles.FileIndex_1,'String',FileIndex_1)
Note: See TracChangeset
for help on using the changeset viewer.