Changeset 42 for trunk/src/civ_3D.m


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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.