Changeset 42


Ignore:
Timestamp:
Mar 10, 2010, 7:43:51 PM (11 years ago)
Author:
sommeria
Message:

-proj_field, plot_field, civ_3D: bug repair for 3D3C velocity fields (not finished)
-check_function: introduce try/catch for function datenum (error with french systems)
-cleaning of warndlg_uvmat in different fcts (replaced by msgbox_uvmat)

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_functions.m

    r38 r42  
    106106       date_str=datfile.date;%string of the date of last modification
    107107       datnum(i)=0;%default
    108        char_code=double(date_str);% code of the date characters
    109        special_char=(char_code>127); %non standard Ascii character (e.g. date in french)
    110        if isempty(find(special_char))% standard Ascii character
    111           datnum(i)=datenum(date_str);
     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)
    112112       end
    113113   end
  • trunk/src/civ_3D.m

    r2 r42  
    158158end
    159159if exist(name_todo,'file')~=2
    160     hwarn=warndlg(['no batch distributed processing available, queue file ' name_todo ' absent']);
     160    msgbox_uvmat('ERROR',['no batch distributed processing available, queue file ' name_todo ' absent']);
    161161  %  test_batch=0;  % Problems to detect file on linux/nfs filesystems
    162162end
     
    571571        if isempty(nom_type_read)
    572572                nom_type_ima='_i_j';
    573                 warndlg_uvmat('no ImageName defined in ImaDoc/Heading, take _i_j indexing by default','WARNING')
     573                msgbox_uvmat('WARNING','no ImageName defined in ImaDoc/Heading, take _i_j indexing by default')
    574574        else
    575575                nom_type_ima=nom_type_read;
     
    603603                field_i=field_i+1;
    604604%                 imagename_last=imagename;
    605                 [imagename,idetect]=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
     605                imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
     606                idetect=exist(imagename,'file');
    606607                if isequal(nom_type_ima,'none')
    607608                   idetect=0; %stop if the same image is repeated (if nom_type='none')
     
    617618        while idetect==1
    618619                    field_i=field_i-1;
    619                     [imagename,idetect]=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
     620                    imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
     621                    idetect=exist(imagename,'file');
    620622                    if isequal(nom_type_ima,'none')
    621623                        idetect=0; %stop if the same image is repeted (if nom_type='none')
     
    974976    dirname=fullfile(filepath,subdir_civ1,ext_dir);
    975977    if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir')
    976          hwarn=warndlg_uvmat(['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist'],'ERROR');
     978         msgbox_uvmat('ERROR',['no civ1 file available: subdirectory ' subdir_civ1 ' does not exist']);
    977979         set(handles.list_pair_civ1,'String',{});
    978980         return
    979981    end
    980982    for ipair=1:nbpair   
    981         [filename,select(ipair)]=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,...
     983        filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,...
    982984        ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1);
     985        select(ipair)=exist(filename,'file');
    983986    end
    984987    if ~exist('select','var') | isequal(select,zeros(size(1:nbpair)))
     
    988991            num_j1=ref_j-floor(browse.incr_pair(2)/2);
    989992            num_j2=ref_j+ceil(browse.incr_pair(2)/2);
    990             [filename,select(1)]=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1);
     993            [filename]=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1);
     994            select(1)=exist(filename,'file');
    991995            testpair=1;
    992996        else
    993997            if  isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)')
    994                 hwarn=warndlg_uvmat(['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1],'ERROR');
    995                 set(hwarn,'WindowStyle','modal');
     998                msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ1]);
    996999            else
    997                 hwarn=warndlg_uvmat(['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1],'ERROR');
    998                 set(hwarn,'WindowStyle','modal');
     1000                msgbox_uvmat('ERROR',['no civ1 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ1]);
    9991001            end
    10001002             set(handles.list_pair_civ1,'String',{''});
     
    11591161    end
    11601162    for ipair=1:nbpair       
    1161         [filename,select(ipair)]=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,...
     1163        [filename]=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,...
    11621164        ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1);
     1165        select(ipair)=exist(filename,'file');
    11631166    end
    11641167    if  isequal(select,zeros(size(1:nbpair)))
     
    11681171            num_j1=ref_j-floor(browse.incr_pair(2)/2);
    11691172            num_j2=ref_j+floor((browse.incr_pair(2)+1)/2);
    1170             [filename,select(1)]=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2);
     1173            filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2);
     1174            select(1)=exist(filename,'file');
    11711175        else
    11721176            if  isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)')
    1173                 errordlg(['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2])
     1177                msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2])
    11741178            else
    1175                 errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2])
     1179                msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2])
    11761180            end
    11771181             set(handles.list_pair_civ2,'String',{});
     
    15401544        end
    15411545    else
    1542         warndlg_uvmat('batch system not available','ERROR')
     1546        msgbox_uvmat('ERROR','batch system not available')
    15431547        return
    15441548    end
     
    15701574        end
    15711575    else
    1572          warndlg_uvmat('for BATCH option, UBC file names, beginning by \\, are needed','ERROR');
     1576         msgbox_uvmat('ERROR','for BATCH option, UBC file names, beginning by \\, are needed');
    15731577         set(handles.BATCH, 'Enable','On')
    15741578         set(handles.BATCH,'BackgroundColor',[1 0 0])
     
    15991603[Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ_3D)
    16001604if ~exist(Path_ima,'dir')
    1601     warndlg_uvmat(['path to images ' Path_ima ' not found'],'ERROR')
     1605    msgbox_uvmat('ERROR',['path to images ' Path_ima ' not found'])
    16021606    return
    16031607end
     
    16301634      for ifile=1:nbfield
    16311635%           for j=1:nbslice
    1632               [filename,detect]=name_generator(filebase,num1_civ1(ifile),[],'.nc',...
     1636              filename=name_generator(filebase,num1_civ1(ifile),[],'.nc',...
    16331637                nom_type_nc,1,num2_civ1(ifile),[],subdir_civ1);%
    1634               if detect==1% if a netcdf file already exists
     1638            detect=exist(filename,'file')
     1639              if detect% if a netcdf file already exists
    16351640                 subdir_civ1=[subdir_civ1 '.0'];
    16361641                 subdir_civ2=subdir_civ1;
     
    16381643              end
    16391644              filecell_nc1(ifile)={filename};
    1640           if detect==1% if a netcdf file already exists
     1645          if detect% if a netcdf file already exists
    16411646              break
    16421647          end
     
    16521657%get image names
    16531658for ifile=1:nbfield
    1654     [filecell_ima1_civ1{ifile},idetect]=name_generator(filebase, num1_civ1(ifile),[],ext_ima,nom_type_ima);%first image
    1655     [filecell_ima2_civ1{ifile},idetect_1]=name_generator(filebase, num2_civ1(ifile),[],ext_ima,nom_type_ima); %second image
    1656      if idetect==0
    1657             warndlg_uvmat([filecell_ima1_civ1{ifile} ' not found'],'ERROR')
     1659    filecell_ima1_civ1{ifile}=name_generator(filebase, num1_civ1(ifile),[],ext_ima,nom_type_ima);%first image
     1660    filecell_ima2_civ1{ifile}=name_generator(filebase, num2_civ1(ifile),[],ext_ima,nom_type_ima); %second image
     1661     if ~exist(filecell_ima1_civ1{ifile},'file')
     1662            msgbox_uvmat('ERROR',[filecell_ima1_civ1{ifile} ' not found'])
    16581663            set(handles.BATCH, 'Enable','On')
    16591664            set(handles.BATCH,'BackgroundColor',[1 0 0])
    16601665            cd(currentdir)
    16611666            return
    1662      end
    1663      if idetect_1==0,
    1664             errordlg([filecell_ima2_civ1{ifile} ' not found'])
     1667     end     
     1668     if ~exist(filecell_ima2_civ1{ifile},'file')
     1669            msgbox_uvmat('ERROR',[filecell_ima2_civ1{ifile} ' not found'])
    16651670            set(handles.BATCH, 'Enable','On')
    16661671            set(handles.BATCH,'BackgroundColor',[1 0 0])
     
    16921697            waitbar(ifile/nbfield);
    16931698            Atot=[];
    1694             [filename_A,idetect_cur]=name_generator(filebase,num1_civ1(ifile),1,'.png','_i');%A VOIR
     1699            filename_A=name_generator(filebase,num1_civ1(ifile),1,'.png','_i');%A VOIR
     1700            idetect_cur=exist(filename_A,'file');
    16951701            for j=1:nbslice
    16961702                    if idetect_cur==0
     
    17031709                    %filecell_ima1_civ1(ifile,j)={filename};
    17041710            Atot=[];
    1705             [filename_B,idetect_cur]=name_generator(filebase, num2_civ1(ifile),1,'.png','_i');
     1711            filename_B=name_generator(filebase, num2_civ1(ifile),1,'.png','_i');
     1712            idetect_cur=exist(filename_B,'file');
    17061713            for j=1:nbslice
    17071714                    if idetect_cur==0
     
    17421749    end
    17431750end
    1744 
     1751'TESTciv3D'
     1752nbfield
    17451753for ifile=1:nbfield
    17461754    i_cmd=0;
     
    21762184    browse=get(handles.browse_root,'UserData');
    21772185     varargin{1}='';
    2178     [image_name,idetect]=name_generator(filebase,1,1,browse.ext_ima,browse.nom_type_ima);%name of an image
    2179     if idetect==1
     2186    image_name=name_generator(filebase,1,1,browse.ext_ima,browse.nom_type_ima);%name of an image
     2187    if exist(image_name,'file')
    21802188         varargin{1}=image_name;
    21812189    end
    2182     warndlg_uvmat('no mask available, use TOOL menu in the uvmat interface to create it','ERROR')
     2190    msgbox_uvmat('ERROR','no mask available, use TOOL menu in the uvmat interface to create it')
    21832191%     makemask(varargin); %open the makemask interface
    21842192else
  • trunk/src/dataview.m

    r17 r42  
    336336set(handles.ListXml,'Value',Value(1));
    337337if isequal(Value(1),1)
    338     warndlg_uvmat('an xml file needs to be selected','ERROR')
     338    msgbox_uvmat('ERROR','an xml file needs to be selected')
    339339   return
    340340else
  • trunk/src/editxml.m

    r2 r42  
    311311head_element=get(t,1);
    312312if ~isfield(head_element,'name') | ~isfield(head_element,'attributes')
    313     warndlg_uvmat('root element of the .xml file not in correct format','ERROR')
     313    msgbox_uvmat('ERROR','root element of the .xml file not in correct format')
    314314end
    315315head_name=head_element.name;
     
    356356        xs=xmltree(schemapath);
    357357    else
    358         warndlg_uvmat(['The xml schema for ' CurrentFile ' is unknown, check the schema path set in the xml file PARAM'],'ERROR')
     358        msgbox_uvmat('ERROR',['The xml schema for ' CurrentFile ' is unknown, check the schema path set in the xml file PARAM'])
    359359        [FileName, PathName]=uigetfile( ...
    360360       {'*.xsd', '(*.xsd)';
     
    10211021               [path,fil,ext]=fileparts(cur_file);
    10221022               if ~exist(cur_file,'file')
    1023                    warndlg_uvmat(['non-existent link file' cur_file],'ERROR') % A FAIRE: propose to updtate the .xml file
     1023                   msgbox_uvmat('ERROR',['non-existent link file' cur_file]) % A FAIRE: propose to updtate the .xml file
    10241024                   return
    10251025               elseif isequal(ext,'.xml')
     
    12301230Value=get(hhdataview.ListXml,'Value');
    12311231if isequal(Value,1)
    1232     warndlg_uvmat('you need to select the xml files to edit','ERROR')
     1232    msgbox_uvmat('ERROR','you need to select the xml files to edit')
    12331233    return
    12341234end
     
    12571257                                [success,message]=copyfile(xmlfullname,backupfile);%make backup
    12581258                                if ~isequal(success,1)
    1259                                     warndlg_uvmat(['Error in the backup of ' xmlfullname],'ERROR')
     1259                                    msgbox_uvmat('ERROR',['Error in the backup of ' xmlfullname])
    12601260                                    return
    12611261                                end
  • trunk/src/geometry_calib.m

    r36 r42  
    598598end
    599599if ~isfield(sparam,'GeometryCalib_exe')
    600     warndlg_uvmat(['calibration program <GeometryCalib_exe> undefined in parameter file ' xmlfile],'ERROR')
     600    msgbox_uvmat('ERROR',['calibration program <GeometryCalib_exe> undefined in parameter file ' xmlfile])
    601601    return
    602602end
    603603Tsai_exe=sparam.GeometryCalib_exe;
    604604if ~exist(Tsai_exe,'file')
    605     warndlg_uvmat(['calibration program ' Tsai_exe ' does not exist'],'ERROR')
     605    msgbox_uvmat('ERROR',['calibration program ' Tsai_exe ' does not exist'])
    606606    return
    607607end
     
    612612    eval(['!' Tsai_exe ' -f t.txt > tsaicalib.log']);
    613613if ~exist('calib.dat','file')
    614     warndlg_uvmat('no output from calibration program Tsai_exe: possibly too few points','ERROR')
     614    msgbox_uvmat('ERROR','no output from calibration program Tsai_exe: possibly too few points')
    615615end
    616616calibdat=dlmread('calib.dat');
     
    771771        YCoord=str2num(coord_str(k(4)+5:end));
    772772    else
    773         warndlg_uvmat('the choice in menu_coord of uvmat must be px or phys ','ERROR')
     773        msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ')
    774774    end
    775775    huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
     
    874874end
    875875if ~isfield(AxeData,'ZoomAxes')
    876     warndlg_uvmat('first draw a window around a grid marker','ERRROR')
     876    msgbox_uvmat('ERROR','first draw a window around a grid marker')
    877877    return
    878878end
  • trunk/src/plot_field.m

    r19 r42  
    10161016        test_lim=0;
    10171017        if test_vec
    1018             Xlim=[min(vec_X) max(vec_X)];
    1019             Ylim=[min(vec_Y) max(vec_Y)];
     1018            'TESTplot'
     1019            Xlim=[min(vec_X) max(vec_X)]
     1020            Ylim=[min(vec_Y) max(vec_Y)]
    10201021            test_lim=1;
    10211022            if test_ima%both background image and vectors coexist, take the wider bound
  • trunk/src/proj_field.m

    r38 r42  
    11241124        % different cases of projection
    11251125        if isequal(ObjectData.ProjMode,'projection')
    1126             ProjData.ListDimName=[ProjData.ListDimName FieldData.ListDimName(DimIndices(1))];%add the point index to the list of dimensions
     1126            %ProjData.ListDimName=[ProjData.ListDimName
     1127            %FieldData.ListDimName(DimIndices(1))];%add the point index to
     1128            %the list of dimension
     1129            ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
    11271130            ProjData.DimValue=[ProjData.DimValue length(coord_X)];
    11281131            nbvar=0;
     
    11381141                if isempty(ivar_Z) || ivar~=ivar_Z
    11391142                    ProjData.ListVarName=[ProjData.ListVarName VarName];
    1140                     ProjData.VarDimIndex=[ProjData.VarDimIndex DimIndices(1)];
     1143                    ProjData.VarDimName=[ProjData.VarDimName DimCell];
    11411144                    nbvar=nbvar+1;
    11421145                    if isfield(FieldData,'VarAttribute') & length(FieldData.VarAttribute) >=ivar
     
    12261229        VarName=FieldData.ListVarName{VarIndex(1)};
    12271230        eval(['DimValue=size(FieldData.' VarName ');'])
    1228         ListDimName=FieldData.ListDimName(DimIndices);
     1231       
     1232        %ListDimName=FieldData.ListDimName(DimIndices);
     1233        ListDimName=FieldData.VarDimName{VarIndex(1)};
    12291234        ProjData.ListVarName=[{AYName} {AXName} ProjData.ListVarName]; %TODO: check if it already exists in Projdata (several cells)
    12301235        ProjData.VarDimName=[{AYName} {AXName} ProjData.VarDimName];
  • trunk/src/struct2xml.m

    r19 r42  
    1515
    1616function t=struct2xml(Object,t,root_uid)
    17 get(t,root_uid)
     17
    1818if ~exist('t','var')
    1919    t=xmltree;
  • trunk/src/uvmat.m

    r41 r42  
    22342234    if NbDim==3%
    22352235        if ~isempty(CellVarIndex) & ~isempty(VarType{imax}.coord_z)%unstructured coordinate z
    2236             ZName=UvData.ListVarName{VarType{imax}.coord_z};
     2236            ZName=UvData.Field.ListVarName{VarType{imax}.coord_z};
    22372237            eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
    22382238            eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
Note: See TracChangeset for help on using the changeset viewer.