Changeset 1199 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 18, 2026, 12:44:56 PM (3 hours ago)
Author:
sommeria
Message:

bugs repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r1196 r1199  
    253253        for ilist=1:length(h.export_fct)
    254254            if exist(h.export_fct{ilist},'file')==2
    255                 [path,file]=fileparts(h.export_fct{ilist});
     255                [~,file]=fileparts(h.export_fct{ilist});
    256256                export_menu=[export_menu; {file}];
    257257            end
     
    265265set(handles.TransformPath,'UserData',[])
    266266export_menu=[export_menu;{'more...'}];%append the option more.. to the menu
    267 %set(handles.TransformName,'String',transform_menu)% display the menu of transform fcts
    268267
    269268%% case of an input argument for uvmat
    270 %testinputfield=0;
    271269inputfile=[];
    272 %Field=[];
    273270if exist('input','var')
    274271    if ishandle(handles.UVMAT_title)
     
    356353
    357354%------------------------------------------------------------------------
    358 %--- activated when resizing the GUI view_field
     355%--- activated when resizing the GUI uvmat
    359356 function ResizeFcn(gcbo,eventdata,handles)
    360357%------------------------------------------------------------------------
    361358set(handles.uvmat,'Units','pixels')
    362359size_fig=get(handles.uvmat,'Position');
    363 ColumnWidth=max(150,0.18*size_fig(3));
    364 ColumnWidth=min(ColumnWidth,250); % width of the right side display column, between 150 and 250, depending on the fig width
     360ColumnWidth=max(150,0.18*size_fig(3)); %width of the right side display column equal to 0.18 *uvmat_GUI, in the range between 150 px and 250 px
     361ColumnWidth=min(ColumnWidth,250);
    365362
    366363%% position of panel InputFile
    367364set(handles.InputFile,'Units','pixels')
    368 pos_InputFile=get(handles.InputFile,'Position');% [lower x lower y width height] for text_display
    369 pos_InputFile(1)=0;
    370 pos_InputFile(2)=size_fig(4)-pos_InputFile(4);             % set frame InputFile to the top of the fig
    371 pos_InputFile(3)=size_fig(3);
    372 set(handles.InputFile,'Position',pos_InputFile);% [lower x lower y width height] for text_display
     365%pos_InputFile=get(handles.InputFile,'Position')% [lower x lower y width height] for text_display
     366pos_InputFile(1)=0;            % set frame InputFile to the left of uvmat GUI
     367pos_InputFile(2)=size_fig(4)-60;             % set frame InputFile to the top of uvmat GUI
     368pos_InputFile(3)=size_fig(3);     %width of the GUI uvmat
     369pos_InputFile(4)=60; %set the height of the panel to 60 px
     370set(handles.InputFile,'Position',pos_InputFile);% [lower x lower y width height]
    373371
    374372%% reset position of text_display and TableDisplay
     
    376374set(handles.TableDisplay,'Units','pixels')
    377375pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
    378     pos_1(3)=1.2*ColumnWidth;
     376pos_1(3)=1.2*ColumnWidth;
    379377pos_1(1)=size_fig(3)-pos_1(3);             % set text display to the right of the fig
    380378pos_1(2)=size_fig(4)-pos_InputFile(4)-pos_1(4);             % set text display to the top of the fig
     
    396394%% reset position of Coordinates panel
    397395set(handles.Coordinates,'Units','pixels')
    398 pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
     396%pos_2=get(handles.Coordinates,'Position')% [lower x lower y width height] for frame 'Coordinates'
     397pos_2(1)=size_fig(3)-ColumnWidth;       % set 'Coordinates' to the right of the fig
     398pos_2(2)=pos_1(2)-80;          % set 'Coordinates' to the lower edge of text display
    399399pos_2(3)=ColumnWidth;
    400 pos_2(1)=size_fig(3)-pos_2(3);       % set 'Coordinates' to the right of the fig
    401 pos_2(2)=pos_1(2)-pos_2(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
     400pos_2(4)=80;%keep height to 80 px
    402401set(handles.Coordinates,'Position',pos_2)
    403402
    404403%% reset position of Axes panel
    405404set(handles.Axes,'Units','pixels')
    406 pos_3=get(handles.Axes,'Position');% [lower x lower y width height] for frame 'Coordinates'
     405%pos_3=get(handles.Axes,'Position')% [lower x lower y width height] for frame 'Coordinates'
     406pos_3(1)=size_fig(3)-ColumnWidth;       % set 'Coordinates' to the right of the fig
     407pos_3(2)=pos_2(2)-140;   
    407408pos_3(3)=ColumnWidth;
    408 pos_3(1)=size_fig(3)-pos_3(3);       % set 'Coordinates' to the right of the fig
    409 pos_3(2)=pos_2(2)-pos_3(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
     409pos_3(4)=140;%keep height to 140 px
    410410set(handles.Axes,'Position',pos_3)
    411411
    412412%% reset position of  Scalar
    413413set(handles.Scalar,'Units','pixels')
    414 pos_4=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
     414%pos_4=get(handles.Scalar,'Position') % [lower x lower y width height] for frame 'Scalar'
     415pos_4(1)=size_fig(3)-ColumnWidth;         % set 'Scalar' to the right of the fig
     416if strcmp(get(handles.Scalar,'Visible'),'on')
     417    pos_4(2)=pos_3(2)-140; % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
     418else
     419    pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
     420end
    415421pos_4(3)=ColumnWidth;
    416 pos_4(1)=size_fig(3)-pos_4(3);         % set 'Scalar' to the right of the fig
    417 if strcmp(get(handles.Scalar,'Visible'),'on')
    418     pos_4(2)=pos_3(2)-pos_4(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
    419 else
    420     pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
    421 end
     422pos_4(4)=140;
    422423set(handles.Scalar,'Position',pos_4)
    423424
    424425%% reset position of  Vectors
    425426set(handles.Vectors,'Units','pixels')
    426 pos_5=get(handles.Vectors,'Position');
     427%pos_5=get(handles.Vectors,'Position')
     428pos_5(1)=size_fig(3)-ColumnWidth;
     429if strcmp(get(handles.Vectors,'visible'),'on')
     430    pos_5(2)=pos_4(2)-240;
     431else
     432    pos_5(2)=pos_4(2);
     433end
    427434pos_5(3)=ColumnWidth;
    428 pos_5(1)=size_fig(3)-pos_5(3);
    429 if strcmp(get(handles.Vectors,'visible'),'on')
    430     pos_5(2)=pos_4(2)-pos_5(4);
    431 else
    432     pos_5(2)=pos_4(2);
    433 end
     435pos_5(4)=240;
    434436set(handles.Vectors,'Position',pos_5)
    435437
     
    459461% search the files, recognize their type according to their name and fill the rootfile input windows
    460462function MenuBrowse_Callback(hObject, eventdata, handles)
     463% --------------------------------------------------------------------
    461464[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    462465if isempty(regexp(RootPath,'^http://'))%usual files
     
    484487% --------------------------------------------------------------------
    485488function MenuBrowseOpendap_Callback(hObject, eventdata, handles)
     489% --------------------------------------------------------------------
    486490oldfile=get(hObject,'Label');
    487491fileinput=uigetfile_uvmat('pick an input file',oldfile);
     
    776780
    777781%% create movie
    778 % duration = 2*FrameNumber/60;
    779 % [~,name,~] = fileparts(MovieName);
    780 % ffmpegcmd = ['ffmpeg -i ' ' ' MovieName ' ' '-filter:v "setpts=(',...
    781 %      num2str(fps/duration),')*PTS"' ' ' strcat(MovieDir,...
    782 %      strcat('/',name,'.mkv'))];
    783 % [ffmpeg_err,~] = system(ffmpegcmd);
    784 % if ffmpeg_err
    785 %     disp_uvmat('ERROR',['ERROR: Errors in conversion to mkv, close MATLAB and run "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab" in terminal'],1 )
    786 %     return
    787 % end
    788 % msgbox_uvmat('CONFIRMATION',{['movie ' MovieName ' created '];['with ' num2str(FrameNumber) ' frames']})
    789 
    790 
    791 %
    792782aviobj = VideoWriter(MovieName,'Motion JPEG AVI');
    793783open(aviobj)
     
    826816% --------------------------------------------------------------------
    827817function MenuExportCustom_Callback(hObject, eventdata, handles)
    828 export_fct_name=get(handles.MenuExportCustom,'label');
    829 if strcmp(export_fct_name,'user export fct.')
     818%------------------------------------------------------------------------
     819if strcmp(get(handles.MenuExportCustom,'label'),'user export fct.')
    830820    MenuExportMore_Callback(hObject, eventdata, handles)
    831821else
    832822    current_dir=pwd;%current working dir
    833823    cd(fullfile(fileparts(which('uvmat')),'export_fct'))
    834     export_handle=str2func(export_fct_name);
    835     cd(current_dir)
     824    export_handle=str2func(export_fct_name);% pick the relevant export fct in the folder UVMAT/export_fct
     825    cd(current_dir) %come back to the current working dir
    836826    export_handle(handles)
    837827end
     
    839829% --------------------------------------------------------------------
    840830function MenuExportMore_Callback(hObject, eventdata, handles)
    841 
     831%------------------------------------------------------------------------
    842832prev_path=fullfile(fileparts(which('uvmat')),'export_fct');
    843833transform_fct_chosen=uigetfile_uvmat('Pick the export function',prev_path,'.m');
    844834if ~isempty(transform_fct_chosen)
    845     [PathName,transform_name]=fileparts(transform_fct_chosen);
     835    [~,transform_name]=fileparts(transform_fct_chosen);
    846836    set(handles.MenuExportCustom,'label',transform_name)
    847     set(handles.MenuExportCustom,'checked','on')
    848837    MenuExportCustom_Callback(hObject, eventdata, handles)
    849838end
     
    953942data.ProjMode='interp_lin';%default
    954943data.ProjModeMenu={};
    955 % set(handles.create,'Visible','on')
    956 % set(handles.create,'Value',1)
    957 % VOLUME_Callback(hObject,eventdata,handles)data.ProjModeMenu={};
    958944create_object(data,handles)
    959945
     
    21332119function MenuHelp_Callback(hObject, eventdata, handles)
    21342120% --------------------------------------------------------------------
    2135 web('http://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp')
     2121web('https://gricad-gitlab.univ-grenoble-alpes.fr/legi/soft/uvmat-doc/-/blob/master/help/README.md')
    21362122
    21372123
     
    29232909        set(handles.RootFile,'String',RootFile)
    29242910    else
    2925         [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(index_string);% the index_string for the second series taken from FileIndex
     2911        [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(index_string);% the index_string for the second series taken from FileIndex
    29262912        switch index_rank
    29272913            case 1
     
    40734059else
    40744060    if  isempty(TimeUnit)
    4075         set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  10^(-3)'] )
     4061        set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  ms'] )
    40764062    else
    40774063        set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  m' TimeUnit] )
     
    47094695%-----------------------------------------------------------------------
    47104696% --- desactivate display used for a second file series
     4697function desable_subfield(handles)
    47114698%-----------------------------------------------------------------------
    4712 function desable_subfield(handles)
    47134699
    47144700set(handles.RootPath_1,'String','')
     
    47904776    NomType_1=get(handles.NomType,'String');%read FileExt by default
    47914777end
     4778
    47924779%------------------------------------------------------------------------
    47934780% --- Executes on menu selection FieldName
    4794 
    4795     function FieldName_Callback(hObject, eventdata, handles)
    4796 %------------------------------------------------------------------------
    4797 
     4781function FieldName_Callback(hObject, eventdata, handles)
     4782%------------------------------------------------------------------------
    47984783%% read data from uvmat
    47994784UvData=get(handles.uvmat,'UserData');
     
    48024787field= list_fields{index_fields(1)}; % selected string
    48034788[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    4804 if isempty(regexp(RootPath,'^http://'))
     4789if isempty(regexp(RootPath,'^http://', 'once'))
    48054790    FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    48064791else
    48074792    FileName=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
    48084793end
    4809 [tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
     4794[~,~,~,i1,~,j1,~,~,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
    48104795
    48114796switch field
     
    48974882                set(handles.uvmat,'ToolBar','figure')
    48984883                set(handles.Coord_y,'Max',2)
    4899                 %set(huvmat,
    49004884            case 'civdata...'%reinitiate input, return to automatic civ data readingget_field
    49014885                UvData.FileInfo{1}.FieldType='netcdf';
     
    49244908                    set(handles.MaxIndex_i,'String',MaxIndex_i)%TODO: record time unit
    49254909                    UvData.TimeUnit=GetFieldData.Time.TimeUnit;
    4926 % %                     set(handles.uvmat,'UserData',UvData);
    49274910                    set(handles.FileIndex,'String','')
    49284911                    ParamIn.TimeVarName=GetFieldData.Time.TimeName;
     
    50054988[RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);
    50064989FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];
    5007 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));
     4990[~,~,~,i1,~,j1,~]=fileparts_uvmat(get(handles.FileIndex,'String'));
    50084991switch field_1
    50094992    case 'get_field...'
     
    51065089            end
    51075090            set(handles.Coord_x,'String',XName)
    5108 %             if ischar(YName)
    5109 %                 YName={YName};
    5110 %             end
    51115091            set(handles.Coord_y,'String',YName)
    51125092            set(handles.FieldName_1,'Value',1)
     
    53705350                end
    53715351            end
    5372             if isfield(ObjectData,'Coord')& isfield(ObjectData,'Style')
     5352            if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Style')
    53735353                if isequal(ObjectData.Type,'polygon')
    53745354                    X=ObjectData.Coord(:,1);
     
    54355415
    54365416%------------------------------------------------------------------------
     5417
    54375418%------------------------------------------------------------------------
    54385419% --- Executes on selection change in TransformName.
    5439 
    54405420function TransformName_Callback(hObject, eventdata, handles)
    54415421%------------------------------------------------------------------------
     
    55125492    set(handles.TransformName,'ToolTipString','transform_fct:choose a transform function')
    55135493else
    5514     try
    5515         [fid,errormsg] =fopen([fullfile(list_path{ichoice},transform_name) '.m']);
    5516         InputText=textscan(fid,'%s',1,'delimiter','\n');
    5517         fclose(fid);
    5518         set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help
    5519     end
     5494    [fid,errormsg] =fopen([fullfile(list_path{ichoice},transform_name) '.m']);
     5495    if ~isempty(errormsg)
     5496        msgbox_uvmat('ERROR',errormsg)
     5497        return
     5498    end
     5499    InputText=textscan(fid,'%s',1,'delimiter','\n');
     5500    fclose(fid);
     5501    set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help
    55205502end
    55215503
     
    56475629%------------------------------------------------------------------------
    56485630set(handles.CheckFixScalar,'Value',1) %suppress auto mode
    5649 % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
    56505631MinA=str2double(get(handles.num_MinA,'String'));
    56515632MaxA=str2double(get(handles.num_MaxA,'String'));
     
    56995680% Vector representation
    57005681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    5701 % % %-------------------------------------------------------------------
    5702 % % function CheckHideWarning_Callback(hObject, eventdata, handles)
    5703 % % %-------------------------------------------------------------------
    5704 % % update_plot(handles);
    57055682
    57065683%-------------------------------------------------------------------
     
    59465923end
    59475924PlotParam=read_GUI(handles.uvmat);
    5948 [tild,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam);
     5925[~,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam);
    59495926errormsg=fill_GUI(PlotParamOut,handles.uvmat);
    59505927if isempty(errormsg)
     
    60065983%  desactivate the edit object mode
    60075984set(handles.CheckEditObject,'Value',0)
    6008 % set(handles.CheckEditObject,'BackgroundColor',[0.7,0.7,0.7])
    60095985
    60105986%------------------------------------------------------------------------
     
    61446120end
    61456121
    6146 
    61476122%------------------------------------------------------------------------
    61486123% --- Executes on button press in CheckViewObject.
     
    61516126check_view=get(handles.CheckViewObject,'Value');
    61526127hset_object=findobj(allchild(0),'tag','set_object');
    6153 % if ~isempty(hset_object)
    6154 %     delete(hset_object)% delete existing version of set_object
    6155 % end
    61566128if check_view %activate set_object
    61576129    IndexObj=get(handles.ListObject,'Value');
     
    61946166end
    61956167
    6196 
    61976168%------------------------------------------------------------------------
    61986169% --- Executes on button press in CheckViewField.
     
    62316202    end
    62326203    hhview_field=guidata(hview_field);
    6233     [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the GUI view_field);
     6204    [~,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the GUI view_field);
    62346205    errormsg=fill_GUI(PlotParam,hview_field);
    62356206    for list={'Scalar','Vectors'}
     
    62546225end
    62556226
    6256 
    62576227%------------------------------------------------------------------------
    62586228% --- Executes on button press in DeleteObject.
    6259 %------------------------------------------------------------------------
    62606229function DeleteObject_Callback(hObject, eventdata, handles)
    6261 
     6230%------------------------------------------------------------------------
    62626231IndexObj=get(handles.ListObject,'Value');%projection object selected for view_field
    62636232IndexObj_1=get(handles.ListObject_1,'Value');%projection object selected for uvmat plot
     
    62666235end
    62676236
    6268 %'DeleteObject': delete a projection object, defined by its index in the Uvmat list or by its graphic handle
    6269 %------------------------------------------------------------------------
    6270 % function DeleteObject(hObject)
    6271 %
    6272 % INPUT:
    6273 % hObject: object index (if integer) or handle of the graphic object. If
    6274 %          hObject is a subobject, the parent object is detected and deleted.
    6275 
     6237% --------------------------------------------------------------------
     6238% --- Delete a projection object, defined by its index in the Uvmat list or by its graphic handle
    62766239function delete_object(IndexObj)
    6277 
     6240%------------------------------------------------------------------------
    62786241huvmat=findobj('tag','uvmat');%handles of the uvmat interface
    62796242UvData=get(huvmat,'UserData');
     
    63336296end
    63346297
    6335 
    6336 
    6337 
    6338 
     6298% --------------------------------------------------------------------
    63396299% --- Executes on selection change in LogLinHisto.
     6300% --------------------------------------------------------------------
    63406301function LogLinHisto_Callback(hObject, eventdata, handles)
    6341     HistoMenu_Callback(hObject, eventdata, handles)
    6342 % hObject    handle to LogLinHisto (see GCBO)
    6343 % eventdata  reserved - to be defined in a future version of MATLAB
    6344 % handles    structure with handles and user data (see GUIDATA)
    6345 
    6346 % Hints: contents = cellstr(get(hObject,'String')) returns LogLinHisto contents as cell array
    6347 %        contents{get(hObject,'Value')} returns selected item from LogLinHisto
     6302HistoMenu_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.