Changeset 319 for trunk/src/civ_matlab.m
- Timestamp:
- Dec 6, 2011, 8:14:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ_matlab.m
r317 r319 46 46 check_patch1=0;%default 47 47 48 if ischar(Param) 49 t=xmltree(Param); 50 Param=convert(t); 51 end 52 48 53 %% Civ1 49 54 if isfield (Param,'Civ1') … … 62 67 end 63 68 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];% {'Civ1_Time','Civ1_Dt'}]; 64 % if exist('ncfile','var')% TEST for use interactively with mouse_motion (no file created)65 66 67 68 69 70 71 69 % if exist('ncfile','var')% TEST for use interactively with mouse_motion (no file created) 70 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'};% cell array containing the names of the fields to record 71 Data.VarDimName={'nbvec1','nbvec1','nbvec1','nbvec1','nbvec1','nbvec1'}; 72 Data.VarAttribute{1}.Role='coord_x'; 73 Data.VarAttribute{2}.Role='coord_y'; 74 Data.VarAttribute{3}.Role='vector_x'; 75 Data.VarAttribute{4}.Role='vector_y'; 76 Data.VarAttribute{5}.Role='warnflag'; 72 77 Data.Civ1_X=reshape(xtable,[],1); 73 78 Data.Civ1_Y=reshape(Param.Civ1.ImageHeight-ytable+1,[],1); … … 77 82 Data.Civ1_F=reshape(F,[],1); 78 83 Data.CivStage=1; 79 84 80 85 else 81 Data=nc2struct(ncfile,'ListGlobalAttribute','absolut_time_T0') %look for the constant 'absolut_time_T0' to detect old civx data format 86 if exist('ncfile','var') 87 CivFile=ncfile; 88 elseif isfield(Param.Patch1,'CivFile') 89 CivFile=Param.Patch1.CivFile; 90 end 91 Data=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0') %look for the constant 'absolut_time_T0' to detect old civx data format 82 92 if isfield(Data,'Txt') 83 93 errormsg=Data.Txt; 84 94 return 85 95 end 86 96 if ~isempty(Data.absolut_time_T0')%read civx file 87 97 check_civx=1;% test for old civx data format 88 [Data,vardetect,ichoice]=nc2struct( ncfile);%read the variables in the netcdf file98 [Data,vardetect,ichoice]=nc2struct(CivFile);%read the variables in the netcdf file 89 99 else 90 100 if isfield(Param,'Fix1') 91 Data=nc2struct( ncfile,ListVarCiv1);%read civ1 data in the existing netcdf file101 Data=nc2struct(CivFile,ListVarCiv1);%read civ1 data in the existing netcdf file 92 102 else 93 Data=nc2struct( ncfile,ListVarFix1);%read civ1 and fix1 data in the existing netcdf file103 Data=nc2struct(CivFile,ListVarFix1);%read civ1 and fix1 data in the existing netcdf file 94 104 end 95 105 end 96 97 106 end 98 107 … … 296 305 297 306 %% write result in a netcdf file if requested 298 if exist('ncfile','var') && ~(isfield(Param,'CheckOuputFile')&&Param.CheckOuputFile)307 if exist('ncfile','var') 299 308 errormsg=struct2nc(ncfile,Data); 300 309 end … … 420 429 iref=par_civ.Grid(ivec,1);% xindex on the image A for the middle of the correlation box 421 430 jref=par_civ.Grid(ivec,2);% yindex on the image B for the middle of the correlation box 422 % xtable(ivec)=iref;423 % ytable(ivec)=jref;%default431 % xtable(ivec)=iref; 432 % ytable(ivec)=jref;%default 424 433 if ~(checkmask && par_civ.Mask(jref,iref)<=20) %velocity not set to zero by the black mask 425 if jref-iby2<1 || jref+iby2>par_civ.ImageHeight|| iref-ibx2<1 || iref+ibx2>par_civ.ImageWidth 434 if jref-iby2<1 || jref+iby2>par_civ.ImageHeight|| iref-ibx2<1 || iref+ibx2>par_civ.ImageWidth% we are outside the image 426 435 F(ivec)=3; 427 436 else … … 434 443 F(ivec)=3; 435 444 end 445 %threshold on image maximum 446 if check_MaxIma && (image1_mean > par_civ.MaxIma || image2_mean > par_civ.MaxIma) 447 F(ivec)=3; 448 end 436 449 end 437 %threshold on image maximum 438 if check_MaxIma && (image1_mean > par_civ.MaxIma || image2_mean > par_civ.MaxIma) 439 F(ivec)=3; 440 end 450 441 451 if F(ivec)~=3 442 452 image1_crop=image1_crop-image1_mean;%substract the mean
Note: See TracChangeset
for help on using the changeset viewer.