- Timestamp:
- Jan 10, 2012, 5:06:30 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r363 r364 257 257 % set(handles.thresh_text1,'Visible','off') 258 258 set(handles.num_MaxDiff,'Visible','off') 259 set(handles.num_Nx,'Visible','on') 260 set(handles.num_Ny,'Visible','on') 261 set(handles.title_Nx,'Visible','on') 262 set(handles.title_Ny,'Visible','on') 259 263 set(handles.title_MaxDiff,'Visible','off') 260 264 set(handles.num_Rho,'Style','edit') … … 272 276 set(handles.num_MaxDiff,'Visible','on') 273 277 set(handles.title_MaxDiff,'Visible','on') 274 275 % end 278 set(handles.num_Nx,'Visible','off') 279 set(handles.num_Ny,'Visible','off') 280 set(handles.title_Nx,'Visible','off') 281 set(handles.title_Ny,'Visible','off') 276 282 set(handles.num_Rho,'Style','popupmenu') 277 283 set(handles.num_Rho,'Value',1) … … 346 352 if strcmp(Data.Conventions,'uvmat/civdata')% case of new civ data, 347 353 set(handles.MenuMatlab,'checked','on') %select civ/Matlab by default 348 set(handles.MenuCivX,'checked','off')354 MenuMatlab_Callback([],[], handles) 349 355 if ~isempty(Data.CivStage)%test for civ files 350 356 ind_opening=Data.CivStage; … … 356 362 end 357 363 elseif ~isempty(Data.absolut_time_T0')% case of civx data, 358 set(handles.Menu Matlab,'checked','off') %select Cix by default359 set(handles.MenuCivX,'checked','on')364 set(handles.MenuCivX,'checked','on') %select Cix by default 365 MenuCivX_Callback([],[], handles) 360 366 if ~isempty(Data.fix2) 361 367 ind_opening=5; … … 575 581 set(handles.(ListOptions{index}),'value',0) 576 582 end 577 for index = ind_opening+1 578 set(handles.(ListOptions{index}),'value',1) 579 end 583 set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1) 584 580 585 update_CivOptions(handles,1) 581 586 … … 1144 1149 [filecell,i1_civ1,i2_civ1,j1_civ1,j2_civ1,i1_civ2,i2_civ2,j1_civ2,j2_civ2,nom_type_nc,xx,yy,compare]=... 1145 1150 set_civ_filenames(handles,ref_i,ref_j,box_test); 1151 1146 1152 Rootbat=fileparts(filecell.nc.civ1{1,1});%output netcdf file (without extention) 1147 1153 set(handles.civ,'UserData',filecell);%store for futur use of status callback … … 2248 2254 if checkbox(4)==0 ; %check the existence of civ2 if it is not calculated 2249 2255 Data=nc2struct(filename,'ListGlobalAttribute','CivStage','civ2'); 2250 if ~isempty(Data.CivStage) && Data.CivStage<4 %test for civ files 2256 if isfield(Data,'Txt') 2257 msgbox_uvmat('ERROR',Data.Txt); 2258 return 2259 elseif ~isempty(Data.CivStage)% case of new civ files 2260 if Data.CivStage<4 %test for civ files 2251 2261 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) 2252 2262 filecell=[]; 2253 2263 return 2264 end 2254 2265 elseif isempty(Data.civ2)||isequal(Data.civ2,0) 2255 2266 msgbox_uvmat('ERROR',['no civ2 data in ' filename]) -
trunk/src/civ_matlab.m
r363 r364 53 53 if isfield (Param,'Civ1') 54 54 check_civ1=1;% test for further use of civ1 results 55 % %% prepare images 56 par_civ1=Param.Civ1; 57 if isfield(par_civ1,'reverse_pair') 58 if par_civ1.reverse_pair 59 if ischar(par_civ1.ImageB) 60 temp=par_civ1.ImageA; 61 par_civ1.ImageA=imread(par_civ1.ImageB); 62 end 63 if ischar(temp) 64 par_civ1.ImageB=imread(temp); 65 end 66 end 67 else 68 if ischar(par_civ1.ImageA) 69 par_civ1.ImageA=imread(par_civ1.ImageA); 70 end 71 if ischar(par_civ1.ImageB) 72 par_civ1.ImageB=imread(par_civ1.ImageB); 73 end 74 end 75 55 76 % caluclate velocity data (y and v in indices, reverse to y component) 56 [xtable ytable utable vtable ctable F result_conv errormsg] = civ (Param.Civ1); 57 58 % to try the reverse_pair method, uncomment below 59 % [xtable1 ytable1 utable1 vtable1 ctable1 F1 result_conv1 errormsg1] = civ (Param.Civ1); 60 % Param.Civ1.reverse_pair=1; 61 % [xtable2 ytable2 utable2 vtable2 ctable2 F2 result_conv2 errormsg2] = civ (Param.Civ1); 62 % xtable=[xtable1; xtable2]; 63 % ytable=[ytable1; ytable2]; 64 % utable=[utable1; -utable2]; 65 % vtable=[vtable1; -vtable2]; 66 % ctable=[ctable1; ctable2]; 67 % F=[F1; F2]; 68 % result_conv=[result_conv1; result_conv2]; 69 % errormsg=[errormsg1; errormsg2]; 77 [xtable ytable utable vtable ctable F result_conv errormsg] = civ (par_civ1); 70 78 71 79 % to try the reverse_pair method, uncomment below 80 % [xtable1 ytable1 utable1 vtable1 ctable1 F1 result_conv1 errormsg1] = civ (Param.Civ1); 81 % Param.Civ1.reverse_pair=1; 82 % [xtable2 ytable2 utable2 vtable2 ctable2 F2 result_conv2 errormsg2] = civ (Param.Civ1); 83 % xtable=[xtable1; xtable2]; 84 % ytable=[ytable1; ytable2]; 85 % utable=[utable1; -utable2]; 86 % vtable=[vtable1; -vtable2]; 87 % ctable=[ctable1; ctable2]; 88 % F=[F1; F2]; 89 % result_conv=[result_conv1; result_conv2]; 90 % errormsg=[errormsg1; errormsg2]; 72 91 if ~isempty(errormsg) 73 92 return … … 80 99 end 81 100 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];% {'Civ1_Time','Civ1_Dt'}]; 82 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_ C','Civ1_F'};% cell array containing the names of the fields to record101 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C'};% cell array containing the names of the fields to record 83 102 Data.VarDimName={'NbVec1','NbVec1','NbVec1','NbVec1','NbVec1','NbVec1'}; 84 103 Data.VarAttribute{1}.Role='coord_x'; … … 93 112 Data.Civ1_C=reshape(ctable,[],1); 94 113 Data.Civ1_F=reshape(F,[],1); 95 Data.CivStage=1; 96 114 Data.CivStage=1; 97 115 else 98 116 if exist('ncfile','var') … … 111 129 else 112 130 Data=nc2struct(CivFile);%read civ1 and fix1 data in the existing netcdf file 113 % if isfield(Param,'Fix1')114 % Data=nc2struct(CivFile,ListVarCiv1);%read civ1 data in the existing netcdf file115 % else116 % Data=nc2struct(CivFile,ListVarFix1);%read civ1 and fix1 data in the existing netcdf file117 % end118 131 end 119 132 end … … 181 194 par_civ2=Param.Civ2; 182 195 if ~isfield (Param,'Civ1') || ~strcmp(Param.Civ1.ImageA,par_civ2.ImageA) 183 par_civ2.ImageA=imread( par_civ2.ImageA);%read first image if not already done for civ1196 par_civ2.ImageA=imread(Param.Civ2.ImageA);%read first image if not already done for civ1 184 197 else 185 par_civ2.ImageA= Param.Civ1.ImageA;198 par_civ2.ImageA=par_civ1.ImageA; 186 199 end 187 200 if ~isfield (Param,'Civ1') || ~strcmp(Param.Civ1.ImageB,par_civ2.ImageB) 188 par_civ2.ImageB=imread( par_civ2.ImageB);%read second image if not already done for civ1201 par_civ2.ImageB=imread(Param.Civ2.ImageB);%read second image if not already done for civ1 189 202 else 190 par_civ2.ImageB= Param.Civ1.ImageB;203 par_civ2.ImageB=par_civ1.ImageB; 191 204 end 192 205 ibx2=ceil(par_civ2.Bx/2); … … 269 282 Data.Civ2_Time=str2double(par_civ2.Time); 270 283 Data.Civ2_Dt=str2double(par_civ2.Dt); 271 Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_C','Civ2_F'}];% cell array containing the names of the fields to record 284 nbvar=numel(Data.ListVarName); 285 Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];% cell array containing the names of the fields to record 272 286 Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2','NbVec2','NbVec2','NbVec2','NbVec2'}]; 273 Data.VarAttribute{ 1}.Role='coord_x';274 Data.VarAttribute{ 2}.Role='coord_y';275 Data.VarAttribute{ 3}.Role='vector_x';276 Data.VarAttribute{ 4}.Role='vector_y';277 Data.VarAttribute{ 5}.Role='warnflag';287 Data.VarAttribute{nbvar+1}.Role='coord_x'; 288 Data.VarAttribute{nbvar+2}.Role='coord_y'; 289 Data.VarAttribute{nbvar+3}.Role='vector_x'; 290 Data.VarAttribute{nbvar+4}.Role='vector_y'; 291 Data.VarAttribute{nbvar+5}.Role='warnflag'; 278 292 Data.Civ2_X=reshape(xtable,[],1); 279 293 Data.Civ2_Y=reshape(size(par_civ2.ImageA,1)-ytable+1,[],1); … … 290 304 for ilist=1:length(ListFixParam) 291 305 ParamName=ListFixParam{ilist}; 292 ListName=['Fix 1_' ParamName];306 ListName=['Fix2_' ParamName]; 293 307 eval(['Data.ListGlobalAttribute=[Data.ListGlobalAttribute ''' ParamName '''];']) 294 308 eval(['Data.' ListName '=Param.Fix2.' ParamName ';']) … … 308 322 Data.VarAttribute{nbvar}.Role='errorflag'; 309 323 Data.Civ2_FF=fix(Param.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V); 310 Data.CivStage= 5;324 Data.CivStage=Data.CivStage+1; 311 325 end 312 326 … … 316 330 if isfield (Param,'Patch2') 317 331 Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch2_Rho','Patch2_Threshold','Patch2_SubDomain'}]; 318 Data.Patch2_Rho= str2double(Param.Patch2.Rho);319 Data.Patch2_Threshold= str2double(Param.Patch2.Threshold);320 Data.Patch2_SubDomain= str2double(Param.Patch2.SubDomain);332 Data.Patch2_Rho=Param.Patch2.SmoothingParam; 333 Data.Patch2_Threshold=Param.Patch2.MaxDiff; 334 Data.Patch2_SubDomain=Param.Patch2.SubdomainSize; 321 335 Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps'}]; 322 336 Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},'NbSubDomain2',... … … 337 351 Data.Civ2_V_Diff(ind_good)=Data.Civ2_V(ind_good)-Vres; 338 352 Data.Civ2_FF(ind_good)=FFres; 339 Data.CivStage= 6;340 end 353 Data.CivStage=Data.CivStage+1; 354 end 341 355 342 356 %% write result in a netcdf file if requested … … 379 393 shifty=-par_civ.Shifty;% sign minus because image j index increases when y decreases 380 394 if isfield(par_civ,'Grid') 381 if ischar(par_civ.Grid) 395 if ischar(par_civ.Grid)%read the drid file if the input is a file name 382 396 par_civ.Grid=dlmread(par_civ.Grid); 383 397 par_civ.Grid(1,:)=[];%the first line must be removed (heading in the grid file) … … 422 436 check_MaxIma=isfield(par_civ,'MaxIma') && ~isempty(par_civ.MaxIma); 423 437 424 % % prepare images425 if isfield(par_civ,'reverse_pair')426 if par_civ.reverse_pair427 if ischar(par_civ.ImageB)428 temp=par_civ.ImageA;429 par_civ.ImageA=imread(par_civ.ImageB);430 end431 if ischar(temp)432 par_civ.ImageB=imread(temp);433 end434 end435 else436 if ischar(par_civ.ImageA)437 par_civ.ImageA=imread(par_civ.ImageA);438 end439 if ischar(par_civ.ImageB)440 par_civ.ImageB=imread(par_civ.ImageB);441 end442 end438 % %% prepare images 439 % if isfield(par_civ,'reverse_pair') 440 % if par_civ.reverse_pair 441 % if ischar(par_civ.ImageB) 442 % temp=par_civ.ImageA; 443 % par_civ.ImageA=imread(par_civ.ImageB); 444 % end 445 % if ischar(temp) 446 % par_civ.ImageB=imread(temp); 447 % end 448 % end 449 % else 450 % if ischar(par_civ.ImageA) 451 % par_civ.ImageA=imread(par_civ.ImageA); 452 % end 453 % if ischar(par_civ.ImageB) 454 % par_civ.ImageB=imread(par_civ.ImageB); 455 % end 456 % end 443 457 444 458 [npy_ima npx_ima]=size(par_civ.ImageA); … … 660 674 end 661 675 end 662 return663 664 665 FF=double(FF);666 676 667 677 -
trunk/src/plot_field.m
r356 r364 666 666 667 667 if isfield(PlotParam.Scalar,'ListContour') 668 CheckContour=strcmp(PlotParam.Scalar.ListContour {1},'contours');668 CheckContour=strcmp(PlotParam.Scalar.ListContour,'contours'); 669 669 else 670 670 CheckContour=0; %default -
trunk/src/read_civdata.m
r316 r364 186 186 case 'civ1' 187 187 var={'X','Y','Z','U','V','W','C','F','FF';... 188 188 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF'}; 189 189 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 190 190 units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]}; 191 191 case 'interp1' 192 193 194 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','errorflag'};195 192 var={'X','Y','Z','U','V','W','FF';... 193 'Civ1_X','Civ1_Y','','Civ1_U_Diff','Civ1_V_Diff','','Civ1_FF'}; 194 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','errorflag'}; 195 units={'pixel','pixel','pixel','pixel','pixel','pixel',[]}; 196 196 case 'filter1' 197 197 var={'X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites';... 198 198 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites'}; 199 role={'','','','','','','','',''}; 200 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''}; 201 otherwise % if VelType=[] 199 role={'','','','','','','','',''}; 200 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''}; 201 case 'civ2' 202 var={'X','Y','Z','U','V','W','C','F','FF';... 203 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF'}; 204 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 205 units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]}; 206 case 'interp2' 207 var={'X','Y','Z','U','V','W','FF';... 208 'Civ2_X','Civ2_Y','','Civ2_U_Diff','Civ2_V_Diff','','Civ2_FF'}; 209 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','errorflag'}; 210 units={'pixel','pixel','pixel','pixel','pixel','pixel',[]}; 211 case 'filter2' 212 var={'X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites';... 213 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites'}; 214 role={'','','','','','','','',''}; 215 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''}; 216 otherwise % if VelType=[], choose the best field, civ in priority, or patch2 for derivatives 202 217 if testpatch 203 var={'X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites';...204 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites';...205 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites'};206 role={'','','','','','','',''}; 218 var={'X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites';... 219 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites';... 220 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites'}; 221 role={'','','','','','','',''}; 207 222 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel'}; 208 223 else 209 210 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF';...211 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF'};224 var={'X','Y','Z','U','V','W','C','F','FF';... 225 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF';... 226 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF'}; 212 227 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 213 228 units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]}; 214 end 229 end 215 230 end 216 231 if isempty(vel_type) || isequal(vel_type,'*') %undefined velocity type (civ1,civ2...)
Note: See TracChangeset
for help on using the changeset viewer.