Changeset 1048


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

bugs corrected in plot profiles

Location:
trunk/src
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_field_cells.m

    r1045 r1048  
    328328        end
    329329        for ivar=ind_coord_y
    330               if check_coord_names(ivar)
     330            if check_coord_names(ivar)
    331331                    DimRank=find(strcmp(Data.VarDimName{ivar},DimCell_var));
    332332                check_coord=~isempty(DimRank);
     
    396396                CellInfo{icell}.CoordSize=numel(Data.(CellInfo{icell}.XName));
    397397            case 'grid'
     398                VarName=Data.ListVarName{CellInfo{icell}.VarIndex(1)};
    398399                if NbDim(icell)==3
    399                     CellInfo{icell}.CoordSize=[numel(Data.(CellInfo{icell}.XName)) numel(Data.(CellInfo{icell}.YName)) numel(Data.(CellInfo{icell}.YName))];
     400                    CellInfo{icell}.CoordSize=[size(Data.(VarName),3) size(Data.(VarName),2) size(Data.(VarName),1)];
    400401                else
    401                     CellInfo{icell}.CoordSize=[numel(Data.(CellInfo{icell}.XName)) numel(Data.(CellInfo{icell}.YName))];
     402                    CellInfo{icell}.CoordSize=[size(Data.(VarName),2) size(Data.(VarName),1)];
    402403                end
    403404            case 'tps'
     
    469470        Cell1DPlot{icell}.XIndex=ind_coord_x(icell);
    470471        Cell1DPlot{icell}.XName=Data.ListVarName{ind_coord_x(icell)};
     472        Cell1DPlot{icell}.YIndex=[];
     473        Cell1DPlot{icell}.YIndex_discrete=[];
    471474        DimCell_x=Data.VarDimName{ind_coord_x(icell)};
    472         for ivar=[ind_coord_y ind_discrete]
     475        for ivar=ind_coord_y
    473476            DimCell=Data.VarDimName{ivar};
    474477            if  numel(DimCell)==1 && strcmp(DimCell_x{1},DimCell{1})
    475478                y_nbre(icell)=y_nbre(icell)+1;
    476479                Cell1DPlot{icell}.YIndex(y_nbre(icell))=ivar;
    477                 break
    478             end
    479         end
    480     end
    481     Cell1DPlot(find(y_nbre==0))=[];
     480            end
     481        end
     482        for ivar=ind_discrete
     483            DimCell=Data.VarDimName{ivar};
     484            if  numel(DimCell)==1 && strcmp(DimCell_x{1},DimCell{1})
     485                y_nbre(icell)=y_nbre(icell)+1;
     486                Cell1DPlot{icell}.YIndex_discrete(y_nbre(icell))=ivar;
     487            end
     488        end
     489    end
     490    Cell1DPlot(y_nbre==0)=[];
    482491    CellInfo=[CellInfo Cell1DPlot];
    483492    NbDim=[NbDim ones(1,numel(Cell1DPlot))];
  • trunk/src/plot_field.m

    r1045 r1048  
    410410%loop on input  fields
    411411for icell=1:numel(CellInfo)
    412     VarIndex=CellInfo{icell}.YIndex;%  indices of the selected variables in the list data.ListVarName
     412    VarIndex=[CellInfo{icell}.YIndex CellInfo{icell}.YIndex_discrete];%  indices of the selected variables in the list data.ListVarName
    413413    coord_x_index=CellInfo{icell}.XIndex;
    414414    coord_x_name{icell}=data.ListVarName{coord_x_index};
     
    442442            end
    443443        end
    444         if isfield(CellInfo{icell},'VarIndex_discrete')
     444        if isfield(CellInfo{icell},'YIndex_discrete')&& ~isempty(CellInfo{icell}.YIndex_discrete)
    445445            charplot_0='''+''';
    446446        else
  • 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
  • trunk/src/series/civ_input.m

    r1033 r1048  
    337337
    338338%% set default choice of pair mode
    339 PairIndex=[];
     339PairIndex=1;
    340340if isfield(Param,'ActionInput') && isfield(Param.ActionInput,'PairIndices')
    341341    PairIndex=find(strcmp(Param.ActionInput.PairIndices.ListPairMode,PairMenu));
  • trunk/src/uvmat.m

    r1046 r1048  
    41644164    test_v=0;
    41654165    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% A REMETTRE
    4166 %     if ~isempty(menu_histo)
    4167 %         set(handles.HistoMenu,'Value',1)
    4168 %         set(handles.HistoMenu,'String',menu_histo)
    4169 %         set(handles.Histogram,'Visible','on')
    4170 %         set(handles.HistoMenu,'Visible','on')
    4171 %         set(handles.HistoAxes,'Visible','on')
    4172 %         HistoMenu_Callback(handles.HistoMenu, [], handles)% plot first histogram
    4173 %     end
     4166    if ~isempty(menu_histo)
     4167        set(handles.HistoMenu,'Value',1)
     4168        set(handles.HistoMenu,'String',menu_histo)
     4169        set(handles.Histogram,'Visible','on')
     4170        set(handles.HistoMenu,'Visible','on')
     4171        set(handles.HistoAxes,'Visible','on')
     4172        HistoMenu_Callback(handles.HistoMenu, [], handles)% plot first histogram
     4173    end
    41744174end
    41754175% open the set_object for interactive plane projection in 3D case
     
    42624262            end
    42634263        end
     4264        Histo.VarAttribute{1}.Role='coord_x';
     4265        Histo.VarAttribute{2}.Role='coord_y';
    42644266        if ~isempty(units)
    42654267            Histo.VarAttribute{1}.units=units;
Note: See TracChangeset for help on using the changeset viewer.