Changeset 496
- Timestamp:
- Jul 20, 2012, 10:01:11 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r494 r496 956 956 957 957 %% store last index in handles.lat_i and .last_j 958 nbfield=max(max( i2_series));958 nbfield=max(max(max(i2_series))); 959 959 if isempty(nbfield) 960 nbfield=max(max( i1_series));961 end 962 nbfield_j=max(max( j2_series));960 nbfield=max(max(max(i1_series))); 961 end 962 nbfield_j=max(max(max(j2_series))); 963 963 if isempty(nbfield_j) 964 nbfield_j=max(max( j1_series));964 nbfield_j=max(max(max(j2_series))); 965 965 end 966 966 if ~isempty(XmlData.Time) … … 2076 2076 VelType_1=[];%default 2077 2077 FieldName_1=[]; 2078 ParamIn_1=[]; 2078 2079 ParamOut_1=[]; 2079 2080 frame_index_1=1; … … 2140 2141 ParamOut_1=UvData.ParamOut_1; 2141 2142 else 2142 if is struct(ParamIn_1)2143 if isempty(ParamIn_1) || isstruct(ParamIn_1) 2143 2144 ParamIn_1.FieldName=FieldName_1; 2144 2145 ParamIn_1.VelType=VelType_1; … … 2150 2151 return 2151 2152 end 2152 % UvData.Field_1=Field{2}; %store the second field for possible use at next RUN2153 2153 end 2154 2154 end … … 2363 2363 Field{1}=transform(Field{1},XmlData); 2364 2364 end 2365 2365 end 2366 2366 %% check whether tps is needed, then calculate tps coefficients if needed 2367 check_tps=0; 2368 if strcmp(UvData.FileType{1},'civdata')|| strcmp(UvData.FileType{1},'civx') 2369 switch ParamOut.FieldName 2370 case {'vort','div','strain'} 2371 check_tps=1; 2372 otherwise 2373 check_tps=0; 2374 if isfield(UvData,'Object') 2375 for iobj=1:numel(UvData.Object) 2376 UvData.Object{iobj} 2377 if isfield(UvData.Object{iobj},'ProjMode')&& strcmp(UvData.Object{iobj}.ProjMode,'filter') 2378 check_tps=1; 2379 break 2380 end 2381 end 2382 end 2383 end 2384 end 2385 if check_tps 2386 SubDomain=1500; %default, estimated nbre of vectors in a subdomain used for tps 2387 if isfield(Field{1},'SubDomain') 2388 SubDomain=Field{1}.SubDomain;% 2389 end 2390 [Field{1}.SubRange,Field{1}.NbSites,Field{1}.Coord_tps,Field{1}.U_tps,Field{1}.V_tps,tild,U_smooth,V_smooth,W_smooth,FF] =... 2391 filter_tps([Field{1}.X(Field{1}.FF==0) Field{1}.Y(Field{1}.FF==0)],Field{1}.U(Field{1}.FF==0),Field{1}.V(Field{1}.FF==0),[],SubDomain,0); 2392 nbvar=numel(Field{1}.ListVarName); 2393 Field{1}.ListVarName=[Field{1}.ListVarName {'SubRange','NbSites','Coord_tps','U_tps','V_tps'}]; 2394 Field{1}.VarDimName=[Field{1}.VarDimName {{'nb_coord','nb_bounds','nb_subdomain'},{'nb_subdomain'},... 2395 {'nb_tps','nb_coord','nb_subdomain'},{'nb_tps','nb_subdomain'},{'nb_tps','nb_subdomain'}}]; 2396 Field{1}.VarAttribute{nbvar+3}.Role='coord_tps'; 2397 Field{1}.VarAttribute{nbvar+4}.Role='vector_x'; 2398 Field{1}.VarAttribute{nbvar+5}.Role='vector_y'; 2399 if isfield(Field{1},'ListDimName')%cleaning 2400 Field{1}=rmfield(Field{1},'ListDimName'); 2401 end 2402 if isfield(Field{1},'DimValue')%cleaning 2403 Field{1}=rmfield(Field{1},'DimValue'); 2404 end 2367 check_proj_tps=0; 2368 if isfield(UvData,'Object')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx')) 2369 for iobj=1:numel(UvData.Object) 2370 if isfield(UvData.Object{iobj},'ProjMode')&& strcmp(UvData.Object{iobj}.ProjMode,'filter') 2371 check_proj_tps=1; 2372 break 2373 end 2374 end 2375 end 2376 check_tps=0; 2377 if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamOut.FieldName,'velocity')&&~strcmp(ParamOut.FieldName,'get_field...') 2378 check_tps=1; 2379 end 2380 if (check_tps ||check_proj_tps)&&~isfield(Field{1},'Coord_tps') 2381 SubDomain=1500; %default, estimated nbre of vectors in a subdomain used for tps 2382 if isfield(Field{1},'SubDomain') 2383 SubDomain=Field{1}.SubDomain;% 2384 end 2385 [Field{1}.SubRange,Field{1}.NbSites,Field{1}.Coord_tps,Field{1}.U_tps,Field{1}.V_tps,tild,U_smooth,V_smooth,W_smooth,FF] =... 2386 filter_tps([Field{1}.X(Field{1}.FF==0) Field{1}.Y(Field{1}.FF==0)],Field{1}.U(Field{1}.FF==0),Field{1}.V(Field{1}.FF==0),[],SubDomain,0); 2387 nbvar=numel(Field{1}.ListVarName); 2388 Field{1}.ListVarName=[Field{1}.ListVarName {'SubRange','NbSites','Coord_tps','U_tps','V_tps'}]; 2389 Field{1}.VarDimName=[Field{1}.VarDimName {{'nb_coord','nb_bounds','nb_subdomain'},{'nb_subdomain'},... 2390 {'nb_tps','nb_coord','nb_subdomain'},{'nb_tps','nb_subdomain'},{'nb_tps','nb_subdomain'}}]; 2391 Field{1}.VarAttribute{nbvar+3}.Role='coord_tps'; 2392 Field{1}.VarAttribute{nbvar+4}.Role='vector_x'; 2393 Field{1}.VarAttribute{nbvar+5}.Role='vector_y'; 2394 if isfield(Field{1},'ListDimName')%cleaning 2395 Field{1}=rmfield(Field{1},'ListDimName'); 2396 end 2397 if isfield(Field{1},'DimValue')%cleaning 2398 Field{1}=rmfield(Field{1},'DimValue'); 2405 2399 end 2406 2400 end 2407 2401 2408 2402 %% calculate scalar 2409 if isstruct(ParamOut)&&~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx')) 2410 if isfield(Field{1},'Coord_tps') 2403 if isstruct(ParamOut)&&~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))... 2404 &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut.FieldName,'get_field...') 2405 if check_proj_tps 2411 2406 Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 2412 2407 else 2413 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});2408 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2414 2409 end 2415 2410 end 2416 2411 if isstruct(ParamOut_1)&& numel(Field)==2 && ~strcmp(ParamOut_1.FieldName,'get_field...')&& ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx'))... 2417 2412 &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2418 if isfield(Field{2},'Coord_tps')2413 if check_proj_tps 2419 2414 Field{2}.FieldList=[{ParamOut_1.FieldName} {ParamOut_1.ColorVar}]; 2420 2415 else … … 4385 4380 dlg_title = 'select properties of the output avi movie'; 4386 4381 num_lines= 1; 4387 % nbfield_cell=get(handles.last_i,'String');4388 4382 def = {[FileBase '_out.avi'];'10';'1';'[0.03 0.05 0.95 0.92]';'10'}; 4389 4383 answer = inputdlg(prompt,dlg_title,num_lines,def,'on');
Note: See TracChangeset
for help on using the changeset viewer.