Changeset 163


Ignore:
Timestamp:
Jan 3, 2011, 8:06:01 PM (13 years ago)
Author:
sommeria
Message:

civ and uvmat modified to deal with file names containing blanks (for Windows system)

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r159 r163  
    18611861            cmd=[cmd '#$ -cwd \n'];
    18621862            cmd=[cmd 'hostname && date \n'];
    1863             cmd=[cmd 'umask 002 \n'];
     1863            cmd=[cmd 'umask 002 \n'];%allow writting access for user group for created files
    18641864        end
    18651865        if civAll
     
    19641964            end
    19651965            if isequal(civAll,0)
     1966                if isunix %unix system
    19661967                cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ...
    19671968                    ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ...
    19681969                    ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname];
    1969                 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
     1970                else %windows system
     1971                    cmd_FIX=['"' sparam.FixBin '" -f "' filecell.nc.civ1{ifile,j} '" -fi1 ' num2str(flagindex1(1)) ...
     1972                    ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ...
     1973                    ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName "' maskname '"'];
     1974                    cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
     1975                end
    19701976                cmd=[cmd cmd_FIX '\n'];
    19711977            else
     
    19931999            if isequal(civAll,0)
    19942000                cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin);
    1995                 cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\');
    19962001                cmd=[cmd cmd_PATCH '\n'];
    19972002            else
     
    21092114                else
    21102115                    filename_cmx=regexprep(filename_cmx,'\\','\\\\');
    2111                     cmd=[cmd 'copy /Y ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n'];
     2116                    cmd=[cmd 'copy /Y "' filename_cmx '2" "' filename_cmx '"\n' cmd_CIV2 '\n'];
    21122117                end
    21132118            else
     
    21392144            end
    21402145            if isequal(civAll,0)
     2146                if isunix
    21412147                cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ...
    21422148                    ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
    21432149                    ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname];
    2144                 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
     2150                else
     2151                    cmd_FIX=['"' sparam.FixBin '" -f "' filecell.nc.civ2{ifile,j} '" -fi1 ' num2str(flagindex2(1)) ...
     2152                    ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
     2153                    ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName "' maskname '"'];
     2154                    cmd_FIX=regexprep(cmd_FIX,'\\','\\\\');
     2155                end
    21452156                cmd=[cmd cmd_FIX '\n'];
    21462157            else
     
    21682179            if isequal(civAll,0)
    21692180                cmd_PATCH=PATCH_CMD(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,sparam.PatchBin);
    2170                 cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\');
    21712181                cmd=[cmd cmd_PATCH '\n'];
    21722182            else
     
    22402250                % cmd_str=['!at -qb now -f ' filename_bat ' &']; %ou at -qb now -f bad idea...
    22412251            else %case of Windows
    2242                 cmd_str=['@call ' regexprep(filename_bat,'\\','\\\\')];
     2252                cmd_str=['@call "' regexprep(filename_bat,'\\','\\\\') '"'];
    22432253            end
    22442254            super_cmd=[super_cmd cmd_str '\n'];         
     
    25242534                filecell={};
    25252535                return
    2526             else         
     2536            elseif isunix         
    25272537                [xx,msg2] = fileattrib(subdir_civ1_new,'+w','g'); %yield writing access (+w) to user group (g)
    25282538                if ~strcmp(msg2,'')
     
    30113021namelog=[filename_nc([1:end-3]) '_patch.log'];
    30123022if test_interp==0
     3023    if isunix
    30133024    cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ...
    30143025        '  > ' namelog ' 2>&1']; % redirect standard output to the log file
     3026    else
     3027      cmd_PATCH=['"' PatchBin '" -f "' filename_nc '" -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ...
     3028        '  > "' namelog '" 2>&1']; % redirect standard output to the log file
     3029    end
    30153030else %nouveau programme patch
    30163031    cmd_PATCH=[PatchBin ' -f ' filename_nc ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ...
    30173032        ' -max ' thresh_value ' -nopt ' subdomain_patch  '  > ' namelog ' 2>&1']; % redirect standard output to the log file
    30183033end
    3019 
     3034cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\');
    30203035%------------------------------------------------------------------------
    30213036% --- STEREO Interp
     
    40324047    par.Dt='1' ;%case of 'displacement' mode
    40334048end
    4034 %
    4035 %     textcmx={'##############   CMX file';...
    4036 %     ['FirstImage ' par.filename_ima_a];...
    4037 %     ['LastImage  ' par.filename_ima_b];...
    4038 %     'XX' ;...
    4039 %     ['Mask ' par.maskflag] ;...
    4040 %     ['MaskName ' par.maskname];...
    4041 %     ['ImageSize ' par.npx ' ' par.npy];...   %VERIFIER CAS GENERAL ?
    4042 %     ['CorrelationBoxesSize ' par.ibx ' ' par.iby];...
    4043 %     ['SearchBoxeSize ' par.isx ' ' par.isy];...
    4044 %     ['RO ' par.rho];...
    4045 %     ['GridSpacing ' par.dx ' ' par.dy];...
    4046 %     'XX 1.0';...
    4047 %     ['Dt_TO ' par.Dt ' ' par.T0];...
    4048 %     ['PixCmXY ' par.pxcmx ' ' par.pxcmy];...
    4049 %     'XX 1';...
    4050 %     ['ShiftXY ' par.shiftx ' '  par.shifty];...
    4051 %     ['Grid ' par.gridflag];...
    4052 %     ['GridName ' par.gridname] ;...
    4053 %     'XX 85';...
    4054 %     'XX 1.0';...
    4055 %     'XX 1.0';...
    4056 %     'Hart 1';...
    4057 %     'DecimalShift 0';...
    4058 %     'Deformation 0';...
    4059 %     'CorrelationMin 0';...
    4060 %     'IntensityMin 0';...
    4061 %     'SeuilImage n';...
    4062 %     'SeuilImageValues 0 4096';...
    4063 %     ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ?
    4064 %     'ImageUsedBefore null null'};
    4065 %
    4066 %             textout=char(textcmx);
    40674049par.filename_ima_a=regexprep(par.filename_ima_a,'.png','');
    40684050par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');
     
    41004082fclose(fid);
    41014083
    4102 cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
    4103 cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
    4104 namelog=regexprep(namelog,'\\','\\\\');
    4105 
     4084% cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
     4085% cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
     4086% namelog=regexprep(namelog,'\\','\\\\');
    41064087if(isunix)
    41074088    [Rootbat,Filebat,extbat]=fileparts(namelog);
    41084089    ncName=fullfile(Rootbat,[ Filebat '.nc']);
     4090    cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file
    41094091    cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ1.log' '\n' 'chmod g+w ' ncName];
    4110 else
    4111     cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log'];
     4092else %Windows system
     4093    cmd_CIV1=['"' sparam.Civ1Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
     4094    cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\');
     4095    namelog=regexprep(namelog,'\\','\\\\');
     4096    cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ1.log"'];
    41124097end
    41134098
     
    42124197    par.Dt='1' ;%case of 'displacement' mode
    42134198end
    4214 % textcmx=['##############   CMX file'  '\n'...
    4215 % ['FirstImage ' par.filename_ima_a]  '\n'...
    4216 % ['LastImage  ' par.filename_ima_b]  '\n'...
    4217 % 'XX'   '\n'...
    4218 % ['Mask ' par.maskflag]  '\n'...
    4219 % ['MaskName ' par.maskname]  '\n'...
    4220 % ['ImageSize ' par.npx ' ' par.npy]  '\n'...
    4221 % ['CorrelationBoxesSize ' par.ibx ' ' par.iby]  '\n'...
    4222 % ['SearchBoxeSize ' par.ibx ' ' par.iby]  '\n'...
    4223 % ['RO ' par.rho]  '\n'...
    4224 % ['GridSpacing ' par.dx ' ' par.dy]  '\n'...
    4225 % 'XX 1.0'  '\n'...
    4226 % ['Dt_TO ' par.Dt ' ' par.T0]  '\n'...
    4227 % ['PixCmXY ' par.pxcmx ' ' par.pxcmy]  '\n'...
    4228 % 'XX 1'  '\n'...
    4229 % ['ShiftXY 0 0']  '\n'...
    4230 % ['Grid ' par.gridflag]  '\n'...
    4231 % ['GridName ' par.gridname]  '\n'...
    4232 % 'XX 85'  '\n'...
    4233 % 'XX 1.0'  '\n'...
    4234 % 'XX 1.0'  '\n'...
    4235 % 'Hart 1'  '\n'...
    4236 % ['DecimalShift ' par.decimal]  '\n'...
    4237 % ['Deformation ' par.deformation]  '\n'...
    4238 % 'CorrelationMin 0'  '\n'...
    4239 % 'IntensityMin 0'  '\n'...
    4240 % 'SeuilImage n'  '\n'...
    4241 % 'SeuilImageValues 0 4096'  '\n'...
    4242 % ['ImageToUse ' par.term_a ' ' par.term_b]  '\n'... % VERIFIER ?
    4243 % ['ImageUsedBefore ' par.filename_nc1]];
    4244 % textout=char(textcmx);
    4245 % fid=fopen([filename_cmx '2'],'w');
    4246 % fprintf(fid,textout);
    4247 % fclose(fid)
    42484199
    42494200par.filename_ima_a=regexprep(par.filename_ima_a,'.png','');
     
    42824233fclose(fid);
    42834234
    4284 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file
    4285 cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\');
    4286 namelog=regexprep(namelog,'\\','\\\\');
    4287 
    42884235if(isunix)
     4236    cmd_CIV2=[sparam.Civ2Bin ' -f ' filename  '.cmx >' filename '.log' ]; % redirect standard output to the log file
    42894237    [Rootbat,Filebat,extbat]=fileparts(namelog);
    42904238    ncName=fullfile(Rootbat,[ Filebat '.nc']);
    42914239    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog  ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName];
    4292 else
    4293     cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y ' namelog ' ' regexprep(namelog,'\.log','') '.civ2.log'];
     4240else
     4241    cmd_CIV2=['"' sparam.Civ2Bin '" -f "' filename  '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
     4242    cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\');
     4243    namelog=regexprep(namelog,'\\','\\\\');
     4244    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ2.log"'];
    42944245end
    42954246
  • trunk/src/uvmat.m

    r159 r163  
    447447%global filebase
    448448fileinput=[PathName FileName];%complete file name
    449 testblank=findstr(fileinput,' ');%look for blanks
    450 if ~isempty(testblank)
    451     msgbox_uvmat('ERROR',['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'])
    452     return
    453 end
     449% testblank=findstr(fileinput,' ');%look for blanks
     450% if ~isempty(testblank)
     451%     msgbox_uvmat('ERROR',['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'])
     452%     return
     453% end
    454454sizf=size(fileinput);
    455455if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
     
    986986        'Pick a file',RootPath);
    987987fileinput_1=[PathName FileName];%complete file name
    988 testblank=findstr(fileinput_1,' ');%look for blanks
    989 if ~isempty(testblank)
    990     msgbox_uvmat('ERROR',['The input file name ' fileinput_1 ' contains blank character : This is not allowed. Please change name'])
    991     return
    992 end
     988% testblank=findstr(fileinput_1,' ');%look for blanks
     989% if ~isempty(testblank)
     990%     msgbox_uvmat('ERROR',['The input file name ' fileinput_1 ' contains blank character : This is not allowed. Please change name'])
     991%     return
     992% end
    993993sizf=size(fileinput_1);
    994994if (~ischar(fileinput_1)||~isequal(sizf(1),1)),return;end
     
    50175017        'Pick an xml Object file',get(handles.RootPath,'String'));
    50185018fileinput=[PathName FileName];%complete file name
    5019 testblank=findstr(fileinput,' ');%look for blanks
    5020 if ~isempty(testblank)
    5021     msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
    5022     return
    5023 end
     5019% testblank=findstr(fileinput,' ');%look for blanks
     5020% if ~isempty(testblank)
     5021%     msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
     5022%     return
     5023% end
    50245024sizf=size(fileinput);
    50255025if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
Note: See TracChangeset for help on using the changeset viewer.