Ignore:
Timestamp:
Jun 4, 2018, 8:00:50 PM (6 years ago)
Author:
sommeria
Message:

bugs corrected in plot profiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r1045 r1048  
    539539end
    540540% default output
    541 errormsg='';%default
    542541Xline=[];
    543542flux=0;
     
    545544liny=ObjectData.Coord(:,2);
    546545NbPoints=size(ObjectData.Coord,1);
    547 testfalse=0;
    548 ListIndex={};
    549546
    550547%% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
     
    556553CellInfo=CellInfo(NbDim>=2); %keep only the 2D or 3D cells
    557554cell_select=true(size(CellInfo));
    558 
    559555for icell=1:length(CellInfo)
    560556    if isfield(CellInfo{icell},'ProjModeRequest')
    561 %         if ~strcmp(CellInfo{icell}.ProjModeRequest, ProjMode)
    562 %             cell_select(icell)=0;
    563 %         end
    564557        if strcmp(ProjMode,'interp_tps')&& ~strcmp(CellInfo{icell}.CoordType,'tps')
    565558            cell_select(icell)=0;
     
    567560    end
    568561end
    569 if isempty(find(cell_select))
     562if isempty(find(cell_select,1))
    570563    errormsg=[' invalid projection mode ''' ProjMode ''': use ''interp_tps'' to interpolate spatial derivatives'];
    571564    return
     
    598591end
    599592CheckClosedLine=~isempty(find(strcmp(ObjectData.Type,{'rectangle','ellipse','polygon'})));
    600 
    601 %     x = a \ \cosh \mu \ \cos \nu
    602 %
    603 %     y = a \ \sinh \mu \ \sin \nu
    604593
    605594%% angles of the polyline and boundaries of action for mode 'projection'
     
    694683        %case of unstructured coordinates
    695684        case 'scattered'
    696             %             XName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
    697             %             YName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
    698685            coord_x=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)});
    699686            coord_y=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
    700687           
    701             if isequal(ProjMode,'projection')
     688            if strcmp(ProjMode,'projection')
    702689                if width==0
    703690                    errormsg='range of the projection object is missing';
     
    707694                ProjData.VarDimName=[ProjData.VarDimName FieldData.ListVarName(CellInfo{icell}.CoordIndex(end))];
    708695                nbvar=numel(ProjData.ListVarName);
     696                ProjData.VarAttribute{nbvar}.Role='coord_x';
    709697                ProjData.VarAttribute{nbvar}.long_name='abscissa along line';
    710698                % select the (non false) input data located in the band of projection
     
    742730                    ProjData.VarDimName=[ProjData.VarDimName {XName}];
    743731                    nbvar=numel(ProjData.ListVarName);
     732                    ProjData.VarAttribute{nbvar}.Role='coord_x';
    744733                    ProjData.VarAttribute{nbvar}.long_name='abscissa along line';
    745734                    check_abscissa=1; % define abcissa only once
     
    769758                        end
    770759                    end
    771                     ProjData.VarAttribute{ivar+nbvar}.Role='continuous';% will promote plots of the profiles with continuous lines
     760                    ProjData.VarAttribute{ivar+nbvar}.Role='coord_y';% will promote plots of the profiles with continuous lines
    772761                    ProjData.(ListFieldProj{ivar})=ProjVar{ivar};
    773762                end
     
    778767                NbCentres=FieldData.(FieldData.ListVarName{CellInfo{icell}.NbCentres_tps});
    779768                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}));
    782771                end
    783772                [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord,NbCentres,SubRange,FieldVar,CellInfo{icell}.FieldName,cat(3,XI,YI));
     
    786775                ProjData.X=Xproj;
    787776                nbvar=numel(ProjData.ListVarName);
     777                ProjData.VarAttribute{nbvar}.Role='coord_x';
    788778                ProjData.VarAttribute{nbvar}.long_name='abscissa along line';
    789779                ProjVarName=(fieldnames(DataOut))';
     
    799789                        end
    800790                    end
    801                     ProjData.VarAttribute{ivar+nbvar}.Role='continuous';% will promote plots of the profiles with continuous lines
     791                    ProjData.VarAttribute{ivar+nbvar}.Role='coord_y';% will promote plots of the profiles with continuous lines
    802792                    ProjData.(ProjVarName{ivar})=DataOut.(ProjVarName{ivar});
    803793                end
     
    11071097%error=0;%default
    11081098%flux=0;
    1109 %testfalse=0;
    1110 %ListIndex={};
    11111099
    11121100%% group the variables (fields of 'FieldData') in cells of variables with the same dimensions
Note: See TracChangeset for help on using the changeset viewer.