Changeset 174 for trunk/src/civ.m
- Timestamp:
- Jan 5, 2011, 9:43:28 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r173 r174 267 267 oldfile=filebase; 268 268 end 269 testall=get(handles.ImaDoc,'UserData');269 % testall=get(handles.ImaDoc,'UserData'); 270 270 ind_opening=1;%default 271 271 browse.incr_pair=[0 0]; %default 272 if testall 273 menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 274 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'}; 275 else % menu selecting only .civ or .avi files 276 menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 277 '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... 278 '*.*', 'All Files (*.*)'}; 279 end 272 % if testall 273 % menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 274 % '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'}; 275 % else % menu selecting only .civ or .avi files 276 menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)'; 277 '*.xml', '.xml files '; ... 278 '*.civ', '.civ files '; ... 279 '*.png','.png image files'; ... 280 '*.jpg',' jpeg image files'; ... 281 '*.tif','.tif image files'; ... 282 '*.avi;*.AVI','.avi movie files'; ... 283 '*.nc','.netcdf files'; ... 284 '*.*', 'All Files (*.*)'}; 285 % menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ... 286 % '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';... 287 % '*.*', 'All Files (*.*)'}; 288 % end 280 289 [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile); 281 290 fileinput=[PathName FileName];%complete file name … … 431 440 end 432 441 set(handles.browse_root,'UserData',browse);% store information from browser 433 testall=isequal(menu(filtindex,1),{'*.*'});434 set(handles.ImaDoc,'UserData',testall);442 % testall=isequal(menu(filtindex,1),{'*.*'}); 443 % set(handles.ImaDoc,'UserData',testall); 435 444 436 445 RootName_Callback(hObject, eventdata, handles); … … 1868 1877 civAllxml=set(civAllxml,1,'name','CivDoc'); 1869 1878 end 1870 filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file 1871 filename_cmx(end-1:end+1)='cmx';%name of cmx file 1879 %filename_cur=filecell.nc.civ1{ifile,j};%output netcdf file 1880 [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention) 1881 %filename_cmx(end-1:end+6)='civ1.cmx';%name of cmx file 1872 1882 if batch 1873 [Rootbat,Filebat,extbat]=fileparts(filename_cmx);1874 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);1883 % [Rootbat,Filebat,extbat]=fileparts(filename_cmx); 1884 filename_bat=fullfile(Rootbat,['job_' Filebat]); 1875 1885 else 1876 filename_bat=f ilename_cmx;1877 end 1878 filename_bat (end-2:end)='bat';1886 filename_bat=fullfile(Rootbat,Filebat); 1887 end 1888 filename_bat=[filename_bat '.bat']; 1879 1889 1880 1890 %CIV1 … … 1882 1892 par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; 1883 1893 par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; 1884 namelog=[f ilename_cmx([1:end-3]) 'log'];1894 namelog=[fullfile(Rootbat,Filebat) '.civ1.log']; 1885 1895 par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); 1886 1896 par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); … … 1935 1945 i_cmd=i_cmd+1; 1936 1946 if isequal(civAll,0) 1937 cmd=[cmd CIV1_CMD(f ilename_cmx(1:end-4),namelog,par_civ1,handles,sparam) '\n'];1947 cmd=[cmd CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam) '\n']; 1938 1948 else 1939 1949 civAllCmd=[civAllCmd ' civ1 ']; 1940 str=CIV1_CMD_Unified(f ilename_cmx([1:end-4]),namelog,par_civ1);1950 str=CIV1_CMD_Unified(fullfile(Rootbat,Filebat),'',par_civ1); 1941 1951 fieldnames=fields(str); 1942 1952 [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1'); … … 2054 2064 par_civ2.filename_ima_b=filecell.ima2.civ2{ifile,j}; 2055 2065 %par_civ2.filename_ima_b([end-3:end])=[];%remove .png extension 2056 namelog=[filename_cmx([1:end-3]) 'log']; 2066 [Rootbat,Filebat]=fileparts(filecell.nc.civ2{ifile,j});%output netcdf file (without extention) 2067 namelog=[fullfile(Rootbat,Filebat) '.civ2.log']; 2057 2068 par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j))); 2058 2069 par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2); … … 2108 2119 %endTESTgrid 2109 2120 i_cmd=i_cmd+1; 2110 cmd_CIV2=CIV2_CMD(f ilename_cmx(1:end-4),namelog,par_civ2,sparam);2121 cmd_CIV2=CIV2_CMD(fullfile(Rootbat,Filebat),[],par_civ2,sparam);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx] 2111 2122 if isequal(civAll,0) 2123 flname=fullfile(Rootbat,Filebat); 2112 2124 if(isunix) 2113 cmd=[cmd 'cp -f ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n'];2125 cmd=[cmd 'cp -f ' flname '.civ2.cmx ' flname '.cmx\n' cmd_CIV2 '\n']; 2114 2126 else 2115 f ilename_cmx=regexprep(filename_cmx,'\\','\\\\');2116 cmd=[cmd 'copy /Y "' f ilename_cmx '2" "' filename_cmx '"\n' cmd_CIV2 '\n'];2127 flname=regexprep(flname,'\\','\\\\'); 2128 cmd=[cmd 'copy /Y "' flname '.civ2.cmx" "' flname '.cmx"\n' cmd_CIV2 '\n']; 2117 2129 end 2118 2130 else … … 2253 2265 end 2254 2266 super_cmd=[super_cmd cmd_str '\n']; 2255 % eval(cmd_str);2256 2267 disp(cmd_str); 2257 2268 end … … 2478 2489 subdir_civ1=get(handles.subdir_civ1,'String');%subdirectory subdir_civ1 for the netcdf output data 2479 2490 subdir_civ2=get(handles.subdir_civ2,'String'); 2480 if isequal(subdir_civ1,''),subdir_civ1=' A'; end% put default subdir2491 if isequal(subdir_civ1,''),subdir_civ1='CIV'; end% put default subdir 2481 2492 if isequal(subdir_civ2,''),subdir_civ2=subdir_civ1; end% put default subdir 2482 2493 currentdir=pwd;%store the current working directory … … 2708 2719 %create the new subdir_civ2_new 2709 2720 if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir') 2710 [xx,m2]=mkdir( subdir_civ2_new);2721 [xx,m2]=mkdir(fullfile(Path_ima,subdir_civ2_new)); 2711 2722 [xx,msg2] = fileattrib(subdir_civ2_new,'+w','g'); %yield writing access (+w) to user group (g) 2712 2723 if ~isequal(m2,'') … … 4043 4054 4044 4055 %changes : filename_cmx -> filename ( no extension ) 4045 4056 % input namelog not used 4046 4057 if isequal(par.Dt,'0') 4047 4058 par.Dt='1' ;%case of 'displacement' mode … … 4086 4097 % namelog=regexprep(namelog,'\\','\\\\'); 4087 4098 if(isunix) 4088 [Rootbat,Filebat,extbat]=fileparts(namelog); 4089 ncName=fullfile(Rootbat,[ Filebat '.nc']); 4090 cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file 4091 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ1.log' '\n' 'chmod g+w ' ncName]; 4099 % filename 4100 % namelog 4101 % 4102 % [Rootbat,Filebat,extbat]=fileparts(namelog); 4103 % ncName=fullfile(Rootbat,[ Filebat '.nc']); 4104 cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4105 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting 4106 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx 4092 4107 else %Windows system 4108 filename=regexprep(filename,'\\','\\\\'); 4093 4109 cmd_CIV1=['"' sparam.Civ1Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file 4094 4110 cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); 4095 4111 namelog=regexprep(namelog,'\\','\\\\'); 4096 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ1.log"']; 4112 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; 4113 cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ1.cmx"']; 4097 4114 end 4098 4115 … … 4197 4214 par.Dt='1' ;%case of 'displacement' mode 4198 4215 end 4199 4200 4216 par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); 4201 4217 par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ? 4202 fid=fopen([filename '.cmx2'],'w'); 4218 [fid,errormsg]=fopen([filename '.civ2.cmx'],'w'); 4219 if isequal(fid,-1) 4220 msgbox_uvmat('ERROR',errormsg) 4221 cmd_CIV2=''; 4222 return 4223 end 4203 4224 fprintf(fid,['############## CMX file' '\n' ]); 4204 4225 fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility … … 4234 4255 4235 4256 if(isunix) 4236 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file 4237 [Rootbat,Filebat,extbat]=fileparts(namelog); 4238 ncName=fullfile(Rootbat,[ Filebat '.nc']); 4239 cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName]; 4257 % cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4258 % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc']; 4259 % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx, the result file is named [filename '.nc'] by CIVx 4260 4261 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4262 cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc']; 4263 cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.civ2.cmx' '\n'];%rename .cmx as .civ2.cmx, the result file is named [filename '.nc'] by CIVx 4264 % [Rootbat,Filebat,extbat]=fileparts(namelog); 4265 % ncName=fullfile(Rootbat,[ Filebat '.nc']); 4266 % cmd_CIV2=[cmd_CIV2 '\n' 'mv ' namelog ' ' regexprep(namelog,'\.log','') '.civ2.log' '\n' 'chmod g+w ' ncName]; 4240 4267 else 4268 filename=regexprep(filename,'\\','\\\\'); 4241 4269 cmd_CIV2=['"' sparam.Civ2Bin '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file 4242 4270 cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\'); 4243 namelog=regexprep(namelog,'\\','\\\\');4244 cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' namelog '" "' regexprep(namelog,'\.log','') '.civ2.log"'];4271 cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"']; 4272 cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.civ2.cmx"']; 4245 4273 end 4246 4274
Note: See TracChangeset
for help on using the changeset viewer.