Changeset 1048 for trunk/src/proj_field.m
- Timestamp:
- Jun 4, 2018, 8:00:50 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r1045 r1048 539 539 end 540 540 % default output 541 errormsg='';%default542 541 Xline=[]; 543 542 flux=0; … … 545 544 liny=ObjectData.Coord(:,2); 546 545 NbPoints=size(ObjectData.Coord,1); 547 testfalse=0;548 ListIndex={};549 546 550 547 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions … … 556 553 CellInfo=CellInfo(NbDim>=2); %keep only the 2D or 3D cells 557 554 cell_select=true(size(CellInfo)); 558 559 555 for icell=1:length(CellInfo) 560 556 if isfield(CellInfo{icell},'ProjModeRequest') 561 % if ~strcmp(CellInfo{icell}.ProjModeRequest, ProjMode)562 % cell_select(icell)=0;563 % end564 557 if strcmp(ProjMode,'interp_tps')&& ~strcmp(CellInfo{icell}.CoordType,'tps') 565 558 cell_select(icell)=0; … … 567 560 end 568 561 end 569 if isempty(find(cell_select ))562 if isempty(find(cell_select,1)) 570 563 errormsg=[' invalid projection mode ''' ProjMode ''': use ''interp_tps'' to interpolate spatial derivatives']; 571 564 return … … 598 591 end 599 592 CheckClosedLine=~isempty(find(strcmp(ObjectData.Type,{'rectangle','ellipse','polygon'}))); 600 601 % x = a \ \cosh \mu \ \cos \nu602 %603 % y = a \ \sinh \mu \ \sin \nu604 593 605 594 %% angles of the polyline and boundaries of action for mode 'projection' … … 694 683 %case of unstructured coordinates 695 684 case 'scattered' 696 % XName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};697 % YName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};698 685 coord_x=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}); 699 686 coord_y=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}); 700 687 701 if isequal(ProjMode,'projection')688 if strcmp(ProjMode,'projection') 702 689 if width==0 703 690 errormsg='range of the projection object is missing'; … … 707 694 ProjData.VarDimName=[ProjData.VarDimName FieldData.ListVarName(CellInfo{icell}.CoordIndex(end))]; 708 695 nbvar=numel(ProjData.ListVarName); 696 ProjData.VarAttribute{nbvar}.Role='coord_x'; 709 697 ProjData.VarAttribute{nbvar}.long_name='abscissa along line'; 710 698 % select the (non false) input data located in the band of projection … … 742 730 ProjData.VarDimName=[ProjData.VarDimName {XName}]; 743 731 nbvar=numel(ProjData.ListVarName); 732 ProjData.VarAttribute{nbvar}.Role='coord_x'; 744 733 ProjData.VarAttribute{nbvar}.long_name='abscissa along line'; 745 734 check_abscissa=1; % define abcissa only once … … 769 758 end 770 759 end 771 ProjData.VarAttribute{ivar+nbvar}.Role='co ntinuous';% will promote plots of the profiles with continuous lines760 ProjData.VarAttribute{ivar+nbvar}.Role='coord_y';% will promote plots of the profiles with continuous lines 772 761 ProjData.(ListFieldProj{ivar})=ProjVar{ivar}; 773 762 end … … 778 767 NbCentres=FieldData.(FieldData.ListVarName{CellInfo{icell}.NbCentres_tps}); 779 768 SubRange=FieldData.(FieldData.ListVarName{CellInfo{icell}.SubRange_tps}); 780 if isfield(CellInfo{icell},'VarIndex_vector_x _tps')&&isfield(CellInfo{icell},'VarIndex_vector_y_tps')781 FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x _tps}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y_tps}));769 if isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y') 770 FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y})); 782 771 end 783 772 [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord,NbCentres,SubRange,FieldVar,CellInfo{icell}.FieldName,cat(3,XI,YI)); … … 786 775 ProjData.X=Xproj; 787 776 nbvar=numel(ProjData.ListVarName); 777 ProjData.VarAttribute{nbvar}.Role='coord_x'; 788 778 ProjData.VarAttribute{nbvar}.long_name='abscissa along line'; 789 779 ProjVarName=(fieldnames(DataOut))'; … … 799 789 end 800 790 end 801 ProjData.VarAttribute{ivar+nbvar}.Role='co ntinuous';% will promote plots of the profiles with continuous lines791 ProjData.VarAttribute{ivar+nbvar}.Role='coord_y';% will promote plots of the profiles with continuous lines 802 792 ProjData.(ProjVarName{ivar})=DataOut.(ProjVarName{ivar}); 803 793 end … … 1107 1097 %error=0;%default 1108 1098 %flux=0; 1109 %testfalse=0;1110 %ListIndex={};1111 1099 1112 1100 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
Note: See TracChangeset
for help on using the changeset viewer.