Changeset 193


Ignore:
Timestamp:
Feb 20, 2011, 10:42:19 AM (14 years ago)
Author:
sommeria
Message:

improves the use of get_field, no projection object by default in uvmat( allows usual 1D plots),

various bug repairs, elimination of get_plot_handles.m (not useful)

Location:
trunk/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_functions.m

    r89 r193  
    4747          'get_field';...% choose and plot a field from a Netcdf file
    4848          'get_field.fig';...%interface for get_field
    49           'get_plot_handles';... %provides handles of elements setting the plotting parameters in the uvmat interface
    5049          'griddata_uvmat';...%make 2D linear interpolation using griddata, with input appropriate for both Matlab 6.5 and 7
    5150          'hist_update';...%  update of a current global histogram by inclusion of a new field 
     
    9291icount=0;
    9392% loop on the list of functions in the uvmat package
     93datnum=zeros(1,length(list_fct));
    9494 for i=1:length(list_fct)
    9595    dir_fct=which(list_fct{i});% path to fct
     
    104104       end
    105105       datfile=dir(dir_fct);
    106        date_str=datfile.date;%string of the date of last modification
    107        datnum(i)=0;%default
    108        try
    109            datnum(i)=datenum(date_str);
    110        catch
    111            datnum(i)=0;%in case of error with datenum (e.g. date in french)
     106       if isfield(datfile,'datenum')
     107          datnum(i)= datfile.datenum;
    112108       end
     109%        date_str=datfile.date;%string of the date of last modification
     110%        datnum(i)=0;%default
     111%        try
     112%            datnum(i)=datenum(date_str);
     113%        catch
     114%            datnum(i)=0;%in case of error with datenum (e.g. date in french)
     115%        end
    113116   end
    114117end
  • trunk/src/get_field.m

    r188 r193  
    812812        uvmat(inputfile)
    813813    else
     814        set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases)
    814815        hhuvmat=guidata(huvmat);
    815816        uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat
     
    835836function plot_get_field(SubField,handles)
    836837%------------------------------------------------------------------------
    837 list_fig=get(handles.list_fig,'String');
     838list_fig=get(handles.list_fig,'String')
    838839val=get(handles.list_fig,'Value');
    839840if strcmp(list_fig{val},'uvmat')
  • trunk/src/mouse_up.m

    r192 r193  
    138138%                 testmask=get(hmask,'Value');
    139139%              end
    140 %              if testmask
    141 %                  PlotHandles=[];%do not project data on the object during mask creation
    142 %              else
    143            % PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
    144 %              end
    145140
    146141            %% update the object representation
     
    153148            UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);
    154149
    155             %% plot the field projected on the object and store it on the corresponding figure
     150            %% plot the field projected on the object
    156151            ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    157152            if ~isempty(ProjData)
    158153                if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen on view_field
    159                     %             if strcmp(projview,'view_field')
    160154                    hview_field=findobj(allchild(0),'tag','view_field');
    161155                    if isempty(hview_field)
     
    165159                    ViewFieldData.axes3=ProjData;
    166160                    set(hview_field,'UserData',ViewFieldData)
    167 %                     PlotHandles=guidata(hview_field);
     161                    hh_plotfield=guidata(hview_field);
    168162                else
    169163                    UvData.axes3=ProjData;
    170 %                     PlotHandles=hhuvmat;
     164                    hh_plotfield=hhuvmat;
    171165                end
    172                 [PlotType,PlotParam]=plot_field(ProjData,hhcurrentfig.axes3,hhcurrentfig);%update an existing field plot
    173                 write_plot_param(hhcurrentfig,PlotParam); %update the display of plotting parameters for the current object
    174             end
    175             %             if  isfield(UvData.Object{IndexObj},'PlotParam')
    176             %                 write_plot_param(PlotHandles,UvData.Object{IndexObj}.PlotParam); %update the display of plotting parameters for the current object
    177             %             end
     166                [PlotType,PlotParam]=plot_field(ProjData,hh_plotfield.axes3,read_plot_param(hh_plotfield));%update an existing field plot
     167                write_plot_param(hh_plotfield,PlotParam); %update the display of plotting parameters for the current object
     168            end
    178169            set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
    179170            set(hhuvmat.edit_object,'Value',1);%
     
    248239                ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
    249240                PosRect=CurrentOrigin;
    250                 xy=get(currentaxes,'CurrentPoint')%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     241                xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    251242                set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
    252243                set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
  • trunk/src/plot_field.m

    r192 r193  
    134134if testnewfig
    135135    hfig=figure;
    136 %     if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
    137 %         set(hfig,'UserData',PlotParam)
    138 %     end
    139136    set(hfig,'Units','normalized')
    140 %     set(hfig,'WindowButtonDownFcn','mouse_down')
    141 %     set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function
    142 %     set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function
    143137    haxes=axes;
    144138    set(haxes,'position',[0.13,0.2,0.775,0.73])
     
    161155    %% check the cells of fields :
    162156    [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data);
    163 
    164157    if ~isempty(errormsg)
    165158        msgbox_uvmat('ERROR',['input of plot_field/find_field_indices: ' errormsg]);
     
    202195errormsg=[];
    203196AxeData=get(haxes,'UserData');
     197if isempty(index_2D)
     198    plot_plane([],[],[],haxes);%removes images or vector plots if any
     199else
     200    [xx,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),haxes,PlotParam,PosColorbar);
     201    AxeData.NbDim=2;
     202    if testzoomaxes && isempty(errormsg)
     203        [zoomaxes,PlotParamOut,xx,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),zoomaxes,PlotParam,PosColorbar);
     204        AxeData.ZoomAxes=zoomaxes;
     205    end
     206    %remove coordinates variables from 1D plot
     207    for ivar=1:length(index_1D)
     208        if isequal(CellVarIndex{index_1D(ivar)},VarType{index_1D(ivar)}.coord)
     209            index_1D(ivar)=0;
     210        end
     211    end
     212    index_1D=find(index_1D);
     213end
     214
    204215if isempty(index_1D)
    205216     plot_profile([],[],[],haxes);%
     
    211222        end
    212223        PlotType='line';
    213 end
    214 
    215 if isempty(index_2D)
    216     plot_plane([],[],[],haxes);%removes images or vector plots if any
    217 else
    218          [xx,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),haxes,PlotParam,PosColorbar);
    219          AxeData.NbDim=2;
    220             if testzoomaxes && isempty(errormsg)
    221                 [zoomaxes,PlotParamOut,xx,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),zoomaxes,PlotParam,PosColorbar);
    222                 AxeData.ZoomAxes=zoomaxes;
    223             end
    224224end
    225225htext=findobj(hfig,'Tag','text_display');
     
    374374    else
    375375        coord_x_index_cell=VarType{icell}.coord(1);
    376          if isequal(coord_x_index_cell,0)
     376        if isequal(coord_x_index_cell,0)
    377377             continue  % the cell has no abscissa, skip it
    378          end
    379 %         if ~isempty(coord_x_index)&&~isequal(coord_x_index_cell,coord_x_index)
    380 %             %continue %all the selected variables must have the same first dimension
    381 %         else
    382 %             coord_x_index=coord_x_index_cell;
    383 %         end
    384           coord_x_index=coord_x_index_cell;
     378        end
     379        coord_x_index=coord_x_index_cell;
    385380    end
    386381    testplot=ones(size(data.ListVarName));%default test for plotted variables
     
    393388    end
    394389    eval(['coord_x{icell}=data.' data.ListVarName{coord_x_index} ';']);%coordinate variable set as coord_x
     390    XMin(icell)=min(coord_x{icell});
     391    XMax(icell)=max(coord_x{icell});
    395392    testplot(coord_x_index)=0;
    396393    if ~isempty(VarType{icell}.ancillary')
     
    425422            end
    426423            eval(['data.' VarName '=squeeze(data.' VarName ');'])
     424            eval(['YMin(ivar)=min(data.' VarName ');'])
     425            eval(['YMax(ivar)=max(data.' VarName ');'])
    427426            plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot_0 ','];
    428427            eval(['nbcomponent2=size(data.' VarName ',2);']);
     
    431430                coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1);
    432431            end
    433             %eval(['varmean=mean(double(data.' VarName '));']);%mean value
    434             %textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}];
    435432            if nbcomponent1==1|| nbcomponent2==1
    436433                legend_str=[legend_str {VarName}]; %variable with one component
     
    442439        end
    443440    end
     441    YMin_cell(icell)=min(YMin);
     442    YMax_cell(icell)=max(YMax);
    444443end
    445444
     
    447446if test_newplot && ~isequal(plotstr,'hhh=plot(') 
    448447    set(hfig,'CurrentAxes',haxes)
    449     tag=get(haxes,'tag');
    450    
     448    tag=get(haxes,'tag');   
    451449    %%%
    452450    plotstr=[plotstr '''tag'',''plot_line'');'];   
    453451    eval(plotstr)                  %execute plot (instruction  plotstr)
    454452    %%%
    455    
    456453    set(haxes,'tag',tag)
    457454    grid(haxes, 'on')
     
    499496end
    500497
     498%% determine axes bounds
     499 fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
     500if fix_lim
     501    if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY')
     502        fix_lim=0; %free limits if lits are not set,
     503    end  %else PlotParamOut.XMin =PlotParam.XMin...
     504end
     505if ~fix_lim
     506    PlotParamOut.MinX=min(XMin);
     507    PlotParamOut.MaxX=max(XMax);
     508    PlotParamOut.MinY=min(YMin_cell);
     509    PlotParamOut.MaxY=max(YMax_cell);
     510end
    501511
    502512%-------------------------------------------------------------------
     
    521531hcol=findobj(hfig,'Tag','Colorbar'); %look for colorbar axes
    522532hima=findobj(haxes,'Tag','ima');% search existing image in the current axes
    523 errormsg=[];%default
     533errormsg='';%default
    524534test_ima=0; %default: test for image or map plot
    525535test_vec=0; %default: test for vector plots
     
    661671            end
    662672            if test_interp_X 
    663                 npxy(1)=max([256 floor((AX(end)-AX(1))/DAX_min) floor((AX(end)-AX(1))/DAX_max)]);
     673                npxy(2)=max([256 floor((AX(end)-AX(1))/DAX_min) floor((AX(end)-AX(1))/DAX_max)]);
    664674                xI=linspace(AX(1),AX(end),npxy(2));   
    665675                if ~test_interp_Y
     
    10331043
    10341044%store the coordinate extrema occupied by the field
    1035 Data
    10361045if ~isempty(Data)
    10371046    fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
     
    10411050        end  %else PlotParamOut.XMin =PlotParam.XMin...
    10421051    end
    1043     'TESTfix'
    1044     fix_lim
    10451052    if ~fix_lim
    10461053        XMin=[];
     
    11101117rot=alpha*[cos(theta) -sin(theta); sin(theta) cos(theta)]';
    11111118%find the existing lines
    1112 %h=findobj(gca,'Type','Line');% search existing lines in the current axes
    11131119h=findobj(haxes,'Tag','vel');% search existing lines in the current axes
    11141120sizh=size(h);
    11151121set(h,'EraseMode','xor');
    11161122set(haxes,'NextPlot','replacechildren');
    1117      
     1123
    11181124%drawnow
    11191125%create lines (if no lines) or modify them
     
    11251131
    11261132for icolor=1:ncolor
    1127     %determine the line positions for each color icolor 
     1133    %determine the line positions for each color icolor
    11281134    ind=find(col_vec==icolor);
    11291135    xc=x(ind);
     
    11341140    xN=NaN*ones(size(xc));
    11351141    matx=[xc(:)-uc(:)/2 xc(:)+uc(:)/2 xN(:)]';
    1136 %     matx=[xc(:) xc(:)+uc(:) xN(:)]';
     1142    %     matx=[xc(:) xc(:)+uc(:) xN(:)]';
    11371143    matx=reshape(matx,1,3*n(2));
    11381144    maty=[yc(:)-vc(:)/2 yc(:)+vc(:)/2 xN(:)]';
    1139 %     maty=[yc(:) yc(:)+vc(:) xN(:)]';
     1145    %     maty=[yc(:) yc(:)+vc(:) xN(:)]';
    11401146    maty=reshape(maty,1,3*n(2));
    11411147   
     
    11491155    y2=yc+vc/2;
    11501156    y3=yc+vc/2-arrowmoins(2,:);
    1151 %     x1=xc+uc-arrowplus(1,:);
    1152 %     x2=xc+uc;
    1153 %     x3=xc+uc-arrowmoins(1,:);
    1154 %     y1=yc+vc-arrowplus(2,:);
    1155 %     y2=yc+vc;
    1156 %     y3=yc+vc-arrowmoins(2,:);
    11571157    matxar=[x1(:) x2(:) x3(:) xN(:)]';
    11581158    matxar=reshape(matxar,1,4*n(2));
     
    11601160    matyar=reshape(matyar,1,4*n(2));
    11611161    %draw the line or modify the existing ones
    1162   %    hx = [x1;x2;x3];
    1163   %    hy = [y1;y2;y3];
    1164     tri=reshape(1:3*length(uc),3,[])';
    1165     %d = tri(:,[1 2 3 1])';
    1166    
     1162    tri=reshape(1:3*length(uc),3,[])';   
    11671163    isn=isnan(colorlist(icolor,:));%test if color NaN
    11681164    if 2*icolor > sizh(1) %if icolor exceeds the number of existing ones
    1169         %axes(haxes)
    1170       %  hfig=get(haxes,'parent');
    1171 %         axes(haxes)
    1172       %  set(0,'CurrentFigure',hfig)
    1173        % set(hfig,'CurrentAxes',haxes)
    11741165        if ~isn(1) %if the vectors are visible color not nan
    11751166            if n(2)>0
     
    11771168                line(matx,maty,'Color',colorlist(icolor,:),'Tag','vel');% plot new lines
    11781169                line(matxar,matyar,'Color',colorlist(icolor,:),'Tag','vel');% plot arrows
    1179 %                 fill(hx(d),hy(d),colorlist(icolor,:),'EdgeColor','none','
    1180 %                 Tag','Vel');
    1181           end
     1170            end
    11821171        end
    11831172    else
    1184         if isn(1) 
     1173        if isn(1)
    11851174            delete(h(2*icolor-1))
    11861175            delete(h(2*icolor))
     
    11931182            set(h(2*icolor),'EraseMode','xor');
    11941183        end
    1195      end
     1184    end
    11961185end
    11971186if sizh(1) > 2*ncolor
  • trunk/src/proj_field.m

    r187 r193  
    20502050                    ICOMB=(XIMA-1)*DimValue(1)+YIMA;
    20512051                    ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
    2052                     vec_B(ind_in,[1:nbcolor])=vec_A(ICOMB,:);
     2052                    vec_B(ind_in,1:nbcolor)=vec_A(ICOMB,:);
    20532053                    for icolor=1:nbcolor
    20542054                        vec_B(ind_out,icolor)=zeros(size(ind_out));
  • trunk/src/set_object.m

    r187 r193  
    703703testnew=0;
    704704ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
    705 PlotHandles=get_plot_handles(hhuvmat);
    706 projview='view_field';%default
    707705if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame
    708706    IndexObj=IndexObj_1;
    709707    projview='uvmat';
    710      plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
    711708elseif ~isempty(IndexObj_2) && IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 
    712709    IndexObj=IndexObj_2;
     710    projview='view_field';
    713711else %new object
    714712    testnew=1;
    715713    IndexObj=numel(ListObject)+1;
    716     hview_field=findobj(allchild(0),'tag','view_field');
    717     if ~isempty(hview_field)
    718         PlotHandles=guidata(hview_field);
    719         plotaxes=PlotHandles.axes3;%handle of axes3 in view_field
    720     end
     714    projview='view_field';
    721715end
    722716if strcmp(projview,'view_field')
     
    728722    PlotHandles=guidata(hview_field);
    729723    plotaxes=PlotHandles.axes3;%handle of axes3 in view_field
     724else
     725    PlotHandles=hhuvmat;
     726    plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
    730727end   
    731 
    732728
    733729%% naming the object
     
    780776%% plot the field projected on the object and store in the corresponding figue
    781777ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    782 [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot
     778PlotParam=read_plot_param(PlotHandles);
     779[PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot
    783780
    784781%% update the GUI uvmat
  • trunk/src/uvmat.m

    r192 r193  
    201201function uvmat_OpeningFcn(hObject, eventdata, handles, input )
    202202%------------------------------------------------------------------------
    203 global nb_builtin
    204 
    205 % Choose default command menuline output for uvmat
     203
     204%% Choose default command menuline output for uvmat (standard GUI)
    206205handles.output = hObject;
    207206
    208 % Update handles structure
     207%% Update handles structure (standard GUI)
    209208guidata(hObject, handles);
    210209
    211 % set the position of colorbar and ancillary GUIs:
     210%% set the position of colorbar and ancillary GUIs:
    212211set(hObject,'Units','Normalized')
    213212movegui(hObject,'center')
     
    223222set(handles.axes3,'UserData',AxeData)
    224223
    225 %functions for the mouse and keyboard
     224%% set functions for the mouse and keyboard
    226225set(handles.histo_u,'NextPlot','replacechildren');
    227226set(handles.histo_v,'NextPlot','replacechildren');
     
    232231set(hObject,'DeleteFcn',{@closefcn})%
    233232
    234 %refresh projection plane
    235 UvData.Object{1}.Style='plane';%main plotting plane
     233%% refresh projection plane
     234%UvData.Object{1}.Style='plane';%main plotting plane
    236235UvData.Object{1}.ProjMode='projection';%main plotting plane
    237236if ~isfield(UvData.Object{1},'plotaxes')
    238237    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    239238    set(handles.list_object_1,'Value',1);
    240     set(handles.list_object_1,'String',{'1-PLANE'});
     239   % set(handles.list_object_1,'String',{'1-PLANE'});
     240   set(handles.list_object_1,'String',{''});
    241241end
    242242set(handles.Fields,'Value',1)
    243 set(handles.Fields,'string',{''})%TODO:  PUT IN THE GUI
    244 
    245 %TRANSFORM menu: builtin fcts
     243set(handles.Fields,'string',{''})
     244
     245%% TRANSFORM menu: builtin fcts
    246246menu_str={'';'phys';'px';'phys_polar'};
    247 nb_builtin=numel(menu_str); %number of functions
     247UvData.OpenParam.NbBuiltin=numel(menu_str); %number of functions
    248248path_uvmat=fileparts(which('uvmat'));
    249249addpath(fullfile(path_uvmat,'transform_field'))
     
    261261rmpath(fullfile(path_uvmat,'transform_field'))
    262262
    263 %load the list of previously browsed files in menus Open and Open_1
     263%% load the list of previously browsed files in menus Open and Open_1
    264264 dir_perso=prefdir; % path to the directory .matlab for personal data
    265265 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab
     
    291291                [path,file]=fileparts(h.transform_fct{ilist});
    292292                addpath(path)
    293 %              if exist(file,'file')
    294293                h_func=str2func(file);
    295294                rmpath(path)
     
    311310set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION
    312311set(handles.uvmat,'UserData',UvData)
    313 %set(handles.FixEqual,'Value',1)% by default: axes free to adapt in aspect ratio
    314 %set(handles.FixEqual,'BackgroundColor',[1 1 0])
    315 
    316 %check the path and date of modification of all functions in uvmat
     312
     313%% check the path and date of modification of all functions in uvmat
    317314path_to_uvmat=which ('uvmat');% check the path detected for source file uvmat
    318315[errormsg,date_str]=check_functions;%check the path of the functions called by uvmat.m
    319316date_str=['last modification: ' date_str];
    320 %case of an input argument for uvmat
     317
     318%% case of an input argument for uvmat
    321319testinputfield=0;
    322320inputfile=[];
     
    349347    end
    350348    if ~isempty(inputfile)
     349        %%%%% display the indput field %%%%%%%
    351350        display_file_name(hObject, eventdata, handles,inputfile)
     351        %%%%%%%
    352352        testinputfield=1;
    353353    end
     
    366366   end
    367367end
    368 % UvData.NewSeries=1;
    369 set(handles.uvmat,'UserData',UvData)
     368% set(handles.uvmat,'UserData',UvData)
     369
     370%% plot input field if exists
    370371if testinputfield
    371372    %delete drawn objects
     
    604605        set(handles.list_object_1,'Visible','on')
    605606        set(handles.frame_object,'Visible','on')
    606          % initiate input file:
     607         %%%%%% initiate input file:
    607608        update_rootinfo(hObject,eventdata,handles); 
    608609    otherwise
     
    743744        XmlData.GeometryCalib
    744745        if isfield(XmlData.GeometryCalib,'VolumeScan') && isequal(XmlData.GeometryCalib.VolumeScan,'y')
    745             'TESTvol'
    746746            set (handles.nb_slice,'String','volume')
    747747        end
     
    872872
    873873if testima
    874 %   set(handles.Fields,'Value',1) % set menu to 'image'
    875 %    set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})
    876874elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf')
    877875   Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ');
     
    901899end 
    902900
    903 % set index navigation options and refresh plots
     901%% set index navigation options and refresh plots
    904902set(handles.RootPath,'BackgroundColor',[1 1 1])
    905903drawnow
     
    923921NomTypeRaw=regexprep(NomType(2:end), '-', '');
    924922if numel(regexp(NomTypeRaw,'\D'))>=1
    925 %     case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab','#A','%01dA','%02dA','%03dA','%04dA'},% two navigation indices
    926923        state_j='on';
    927924        if isequal(nbfield,1)
     
    932929    NomTypeRaw=regexprep(NomType_1(2:end), '-', '');
    933930    if numel(regexp(NomTypeRaw,'\D'))>=1
    934 %     switch NomType_1
    935 %         case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices
    936931            state_j='on';
    937932            if isequal(nbfield,1)
     
    954949set(handles.j_text,'Visible',state_j);
    955950
    956 % view the field 
     951%% view the field 
    957952run0_Callback(hObject, eventdata, handles); %view field
    958953mask_test=get(handles.mask_test,'value');
     
    11691164set(handles.FileExt_1,'String',FileExt_1);
    11701165
    1171 % default choice of fields
    1172 if isequal(ext_test,'.image')
    1173 %    set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
    1174 %    set(handles.Fields_1,'Value',2) % set menu to 'image'
    1175 elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf')
    1176    Data=nc2struct(fileinput_1,[]);
    1177 %    if isfield(Data,'absolut_time_T0')
    1178 %        set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
    1179 %        set(handles.Fields_1,'Value',4) % set menu to 'velocity'
    1180 %    else   
    1181 %        set(handles.Fields_1,'Value',2) % set menu to 'get_field...'
    1182 %        set(handles.Fields_1,'String',{'';'get_field...'});
    1183 %    end
    1184 end 
     1166% % default choice of fields
     1167% if isequal(ext_test,'.image')
     1168% %    set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
     1169% %    set(handles.Fields_1,'Value',2) % set menu to 'image'
     1170% elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf')
     1171%    Data=nc2struct(fileinput_1,[]);
     1172% %    if isfield(Data,'absolut_time_T0')
     1173% %        set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})
     1174% %        set(handles.Fields_1,'Value',4) % set menu to 'velocity'
     1175% %    else   
     1176% %        set(handles.Fields_1,'Value',2) % set menu to 'get_field...'
     1177% %        set(handles.Fields_1,'String',{'';'get_field...'});
     1178% %    end
     1179% end 
    11851180set(handles.SubField,'Visible','on')
    11861181set(handles.SubField,'Value',1)
     
    24052400    eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors)
    24062401    test_x=1;%test for unstructured coordinates
    2407 else %structured coordinate
    2408     YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates
     2402elseif VarType{imax}.coord(NbDim)>0 %structured coordinate 
    24092403    XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)};
     2404    if NbDim>1
     2405        YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates
     2406    end
    24102407end
    24112408if NbDim==3
     
    24192416    end
    24202417end
     2418if exist('XName','var')
    24212419eval(['XMax=max(UvData.Field.' XName ');'])
    24222420eval(['XMin=min(UvData.Field.' XName ');'])
    2423 eval(['YMax=max(UvData.Field.' YName ');'])
    2424 eval(['YMin=min(UvData.Field.' YName ');'])
     2421UvData.Field.NbDim=NbDim;
     2422UvData.Field.XMax=XMax;
     2423UvData.Field.XMin=XMin;
     2424if NbDim >1
     2425    eval(['YMax=max(UvData.Field.' YName ');'])
     2426    eval(['YMin=min(UvData.Field.' YName ');'])
     2427    UvData.Field.YMax=YMax;
     2428    UvData.Field.YMin=YMin;
     2429end
    24252430eval(['nbvec=length(UvData.Field.' XName ');'])
    24262431if test_x %unstructured coordinates
     
    24342439    VarIndex=CellVarIndex{imax}; % list of variable indices
    24352440    DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
    2436     nbpoints_y=UvData.Field.DimValue(DimIndex(NbDim-1));
    24372441    nbpoints_x=UvData.Field.DimValue(DimIndex(NbDim));
    24382442    DX=(XMax-XMin)/(nbpoints_x-1);
    2439     DY=(YMax-YMin)/(nbpoints_y-1);
     2443    if NbDim >1
     2444        nbpoints_y=UvData.Field.DimValue(DimIndex(NbDim-1));
     2445        DY=(YMax-YMin)/(nbpoints_y-1);
     2446    end
    24402447    if NbDim==3
    24412448        nbpoints_z=UvData.Field.DimValue(DimIndex(1));
     
    24482455    end
    24492456end
    2450 UvData.Field.NbDim=NbDim;
    2451 UvData.Field.XMax=XMax;
    2452 UvData.Field.XMin=XMin;
    2453 UvData.Field.YMax=YMax;
    2454 UvData.Field.YMin=YMin;
    2455 
     2457end
    24562458
    24572459%% 3D case (menuvolume)
     
    25112513else
    25122514    % create a default projection menuplane
    2513     UvData.Object{1}.Style='plane';%main plotting plane
     2515    %UvData.Object{1}.Style='none';%main plotting plane
    25142516    UvData.Object{1}.ProjMode='projection';%main plotting plane
    25152517    UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
    25162518    set(handles.list_object_1,'Value',1);
    2517     set(handles.list_object_1,'String',{'1-PLANE'});
     2519    set(handles.list_object_1,'String',{''});
    25182520end
    25192521if ~isfield(UvData.Object{1},'plotaxes')
     
    25532555        haxes(2)=plot_handles{2}.axes3;
    25542556        PlotParam{2}=read_plot_param(plot_handles{2});%read plotting parameters on the uvmat interface
    2555         keeplim(2)=get(plot_handles{2}.FixedLimits,'Value');
     2557        keeplim(2)=get(plot_handles{2}.FixLimits,'Value');
    25562558        PosColorbar{2}='*'; %TODO: deal with colorbar position on view_field
    25572559    end
     
    28292831if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
    28302832    nc=netcdf.open(filename,'NC_WRITE');
    2831     netcdf.reDef(nc)
    2832     netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1)
     2833    netcdf.reDef(nc);
     2834    netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1);
    28332835    dimid = netcdf.inqDimID(nc,nbname);
    28342836    try
     
    28372839        varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist
    28382840    end
    2839     netcdf.endDef(nc)
     2841    netcdf.endDef(nc);
    28402842    netcdf.putVar(nc,varid,UvData.axes3.FF);
    2841     netcdf.close(nc) 
     2843    netcdf.close(nc); 
    28422844else %old netcdf library
    28432845    netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
     
    38193821function transform_fct_Callback(hObject, eventdata, handles)
    38203822%-------------------------------------------------------------
    3821 global nb_builtin
    3822 
    3823 huvmat=get(handles.transform_fct,'parent');
     3823
     3824UvData=get(handles.uvmat,'UserData');
    38243825menu=get(handles.transform_fct,'String');
    38253826ind_coord=get(handles.transform_fct,'Value');
     
    38593860   profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    38603861   if exist(profil_perso,'file')
     3862       nb_builtin=UvData.OpenParam.NbBuiltin;
    38613863       for ilist=nb_builtin+1:numel(list_transform)
    38623864           ff=functions(list_transform{ilist});
     
    38773879set(handles.FixLimits,'Value',0)
    38783880set(handles.FixLimits,'BackgroundColor',[0.7 0.7 0.7])
    3879 
    3880 UvData=get(huvmat,'UserData');
    38813881
    38823882%delete drawn objects
     
    39113911   UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 
    39123912end
    3913 set(huvmat,'UserData',UvData)
     3913set(handles.uvmat,'UserData',UvData)
    39143914run0_Callback(hObject, eventdata, handles)
    39153915
     
    41794179    colcode.colcode2=str2num(get(handles.colcode2,'String'));
    41804180end
    4181 % colcode.option=get(handles.vec_col_bar,'Value');
    41824181colcode.FixedCbounds=0;
    4183 % list_code=get(handles.col_vec,'String');% list menu fields
    4184 % index_code=get(handles.col_vec,'Value');% selected string index
    4185 % colcode.CName= list_code{index_code(1)}; % selected field used for vector color
    41864182colcode.FixedCbounds=1;
    41874183vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*(0.5:width-0.5)/width;%sample of vec_C values from min to max
     
    42034199UvData=get(handles.uvmat,'UserData');
    42044200AxeData=UvData.axes3;
    4205 'TESTupdateplot'
    4206 PlotParam=read_plot_param(handles)
    4207 PlotParam.Vectors
     4201PlotParam=read_plot_param(handles);
    42084202[PP,PlotParamOut]= plot_field(AxeData,haxes,PlotParam);
    4209 'TESTOUT'
    4210 PlotParamOut
    42114203write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    42124204
     
    42144206% --- Executes on button press in grid.
    42154207function grid_Callback(hObject, eventdata, handles)
    4216 
    42174208
    42184209
  • trunk/src/view_field.m

    r192 r193  
    266266
    267267%-------------------------------------------------------------------
    268 % --- Executes on button press in 'FixedLimits'.
    269 %-------------------------------------------------------------------
    270 function FixedLimits_Callback(hObject, eventdata, handles)
    271 test=get(handles.FixedLimits,'Value');
     268% --- Executes on button press in 'FixLimits'.
     269%-------------------------------------------------------------------
     270function FixLimits_Callback(hObject, eventdata, handles)
     271test=get(handles.FixLimits,'Value');
    272272if test
    273     set(handles.FixedLimits,'BackgroundColor',[1 1 0])
     273    set(handles.FixLimits,'BackgroundColor',[1 1 0])
    274274else
    275     set(handles.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
    276 end
    277 
    278 %-------------------------------------------------------------------
    279 % --- Executes on button press in auto_xy.
    280 function auto_xy_Callback(hObject, eventdata, handles)
    281 test=get(handles.auto_xy,'Value');
     275    set(handles.FixLimits,'BackgroundColor',[0.7 0.7 0.7])
     276end
     277
     278%-------------------------------------------------------------------
     279% --- Executes on button press in FixEqual.
     280function FixEqual_Callback(hObject, eventdata, handles)
     281test=get(handles.FixEqual,'Value');
    282282if test
    283     set(handles.auto_xy,'BackgroundColor',[1 1 0])
     283    set(handles.FixEqual,'BackgroundColor',[1 1 0])
    284284    cla(handles.axes3)
    285285    update_plot(handles)
    286286else
    287     set(handles.auto_xy,'BackgroundColor',[0.7 0.7 0.7])
     287    set(handles.FixEqual,'BackgroundColor',[0.7 0.7 0.7])
    288288    update_plot(handles)
    289289end
     
    298298if (get(handles.zoom,'Value') == 1);
    299299    set(handles.zoom,'BackgroundColor',[1 1 0])
    300     set(handles.FixedLimits,'Value',1)% propose by default fixed limits for the plotting axes
    301     set(handles.FixedLimits,'BackgroundColor',[1 1 0])
     300    set(handles.FixLimits,'Value',1)% propose by default fixed limits for the plotting axes
     301    set(handles.FixLimits,'BackgroundColor',[1 1 0])
    302302else
    303303    set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
     
    532532function MinA_Callback(hObject, eventdata, handles)
    533533%------------------------------------------
    534 set(handles.AutoScal,'Value',1) %suppress auto mode
    535 set(handles.AutoScal,'BackgroundColor',[1 1 0])
     534set(handles.FixScal,'Value',1) %suppress auto mode
     535set(handles.FixScal,'BackgroundColor',[1 1 0])
    536536update_plot(handles)
    537537
     
    539539function MaxA_Callback(hObject, eventdata, handles)
    540540%--------------------------------------------
    541 set(handles.AutoScal,'Value',1) %suppress auto mode
    542 set(handles.AutoScal,'BackgroundColor',[1 1 0])
     541set(handles.FixScal,'Value',1) %suppress auto mode
     542set(handles.FixScal,'BackgroundColor',[1 1 0])
    543543update_plot(handles)
    544544
    545545%-----------------------------------------------
    546 function AutoScal_Callback(hObject, eventdata, handles)
     546function FixScal_Callback(hObject, eventdata, handles)
    547547%--------------------------------------------
    548 test=get(handles.AutoScal,'Value');
     548test=get(handles.FixScal,'Value');
    549549if test
    550     set(handles.AutoScal,'BackgroundColor',[1 1 0])
     550    set(handles.FixScal,'BackgroundColor',[1 1 0])
    551551else
    552     set(handles.AutoScal,'BackgroundColor',[0.7 0.7 0.7])
     552    set(handles.FixScal,'BackgroundColor',[0.7 0.7 0.7])
    553553    update_plot(handles);
    554554%     set(handles.MinA,'String',num2str(ScalOut.MinA,3))
     
    592592function VecScale_Callback(hObject, eventdata, handles)
    593593%-------------------------------------------------------------------
    594 set(handles.AutoVec,'Value',1);
    595 set(handles.AutoVec,'BackgroundColor',[1 1 0])
    596 update_plot(handles)
    597 
    598 %-------------------------------------------------------------------
    599 function AutoVec_Callback(hObject, eventdata, handles)
    600 %-------------------------------------------------------------------
    601 test=get(handles.AutoVec,'Value');
     594set(handles.FixVec,'Value',1);
     595set(handles.FixVec,'BackgroundColor',[1 1 0])
     596update_plot(handles)
     597
     598%-------------------------------------------------------------------
     599function FixVec_Callback(hObject, eventdata, handles)
     600%-------------------------------------------------------------------
     601test=get(handles.FixVec,'Value');
    602602if test
    603     set(handles.AutoVec,'BackgroundColor',[1 1 0])
     603    set(handles.FixVec,'BackgroundColor',[1 1 0])
    604604else
    605605    update_plot(handles);
    606606    %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
    607     set(handles.AutoVec,'BackgroundColor',[0.7 0.7 0.7])
     607    set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])
    608608end
    609609
     
    819819
    820820
     821
     822
     823
     824function MinX_Callback(hObject, eventdata, handles)
     825% hObject    handle to MinX (see GCBO)
     826% eventdata  reserved - to be defined in a future version of MATLAB
     827% handles    structure with handles and user data (see GUIDATA)
     828
     829% Hints: get(hObject,'String') returns contents of MinX as text
     830%        str2double(get(hObject,'String')) returns contents of MinX as a double
     831
     832
     833% --- Executes during object creation, after setting all properties.
     834function MinX_CreateFcn(hObject, eventdata, handles)
     835% hObject    handle to MinX (see GCBO)
     836% eventdata  reserved - to be defined in a future version of MATLAB
     837% handles    empty - handles not created until after all CreateFcns called
     838
     839% Hint: edit controls usually have a white background on Windows.
     840%       See ISPC and COMPUTER.
     841if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     842    set(hObject,'BackgroundColor','white');
     843end
     844
     845
     846
     847function MaxX_Callback(hObject, eventdata, handles)
     848% hObject    handle to MaxX (see GCBO)
     849% eventdata  reserved - to be defined in a future version of MATLAB
     850% handles    structure with handles and user data (see GUIDATA)
     851
     852% Hints: get(hObject,'String') returns contents of MaxX as text
     853%        str2double(get(hObject,'String')) returns contents of MaxX as a double
     854
     855
     856% --- Executes during object creation, after setting all properties.
     857function MaxX_CreateFcn(hObject, eventdata, handles)
     858% hObject    handle to MaxX (see GCBO)
     859% eventdata  reserved - to be defined in a future version of MATLAB
     860% handles    empty - handles not created until after all CreateFcns called
     861
     862% Hint: edit controls usually have a white background on Windows.
     863%       See ISPC and COMPUTER.
     864if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     865    set(hObject,'BackgroundColor','white');
     866end
     867
     868
     869
     870function MinY_Callback(hObject, eventdata, handles)
     871% hObject    handle to MinY (see GCBO)
     872% eventdata  reserved - to be defined in a future version of MATLAB
     873% handles    structure with handles and user data (see GUIDATA)
     874
     875% Hints: get(hObject,'String') returns contents of MinY as text
     876%        str2double(get(hObject,'String')) returns contents of MinY as a double
     877
     878
     879% --- Executes during object creation, after setting all properties.
     880function MinY_CreateFcn(hObject, eventdata, handles)
     881% hObject    handle to MinY (see GCBO)
     882% eventdata  reserved - to be defined in a future version of MATLAB
     883% handles    empty - handles not created until after all CreateFcns called
     884
     885% Hint: edit controls usually have a white background on Windows.
     886%       See ISPC and COMPUTER.
     887if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     888    set(hObject,'BackgroundColor','white');
     889end
     890
     891
     892
     893function MaxY_Callback(hObject, eventdata, handles)
     894% hObject    handle to MaxY (see GCBO)
     895% eventdata  reserved - to be defined in a future version of MATLAB
     896% handles    structure with handles and user data (see GUIDATA)
     897
     898% Hints: get(hObject,'String') returns contents of MaxY as text
     899%        str2double(get(hObject,'String')) returns contents of MaxY as a double
     900
     901
     902% --- Executes during object creation, after setting all properties.
     903function MaxY_CreateFcn(hObject, eventdata, handles)
     904% hObject    handle to MaxY (see GCBO)
     905% eventdata  reserved - to be defined in a future version of MATLAB
     906% handles    empty - handles not created until after all CreateFcns called
     907
     908% Hint: edit controls usually have a white background on Windows.
     909%       See ISPC and COMPUTER.
     910if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     911    set(hObject,'BackgroundColor','white');
     912end
     913
     914
  • trunk/src/write_plot_param.m

    r192 r193  
    11%'write_plot_param': update the plotting parameters on the uvmat interface after a plotting operation
    22function write_plot_param(handles,PlotParam)
    3 'TESTwrite'
    4 PlotParam
    53%coordinates
    64if isfield(PlotParam,'FixEqual')
     
    1311    end
    1412end
     13if isfield(PlotParam,'MinX')
    1514set(handles.MinX,'String',num2str(PlotParam.MinX,4));
    1615set(handles.MaxX,'String',num2str(PlotParam.MaxX,4));
    1716set(handles.MinY,'String',num2str(PlotParam.MinY,4));
    1817set(handles.MaxY,'String',num2str(PlotParam.MaxY,4));
     18else
     19    set(handles.MinX,'String','');
     20set(handles.MaxX,'String','');
     21set(handles.MinY,'String','');
     22set(handles.MaxY,'String','');
     23end
    1924
    2025%scalar or image parameters
     
    9196set(handles.min_title,'Visible',state)
    9297set(handles.max_title,'Visible',state)
    93 set(handles.frame_scal,'Visible',state)
     98%set(handles.frame_scal,'Visible',state)
    9499set(handles.npx,'Visible',state)
    95100set(handles.npy,'Visible',state)
Note: See TracChangeset for help on using the changeset viewer.