Changeset 496


Ignore:
Timestamp:
Jul 20, 2012, 10:01:11 AM (12 years ago)
Author:
sommeria
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r494 r496  
    956956
    957957%% store last index in handles.lat_i and .last_j
    958 nbfield=max(max(i2_series));
     958nbfield=max(max(max(i2_series)));
    959959if isempty(nbfield)
    960     nbfield=max(max(i1_series));
    961 end
    962 nbfield_j=max(max(j2_series));
     960    nbfield=max(max(max(i1_series)));
     961end
     962nbfield_j=max(max(max(j2_series)));
    963963if isempty(nbfield_j)
    964     nbfield_j=max(max(j1_series));
     964    nbfield_j=max(max(max(j2_series)));
    965965end
    966966if ~isempty(XmlData.Time)
     
    20762076VelType_1=[];%default
    20772077FieldName_1=[];
     2078ParamIn_1=[];
    20782079ParamOut_1=[];
    20792080frame_index_1=1;
     
    21402141        ParamOut_1=UvData.ParamOut_1;
    21412142    else
    2142         if isstruct(ParamIn_1)
     2143        if isempty(ParamIn_1) || isstruct(ParamIn_1)
    21432144        ParamIn_1.FieldName=FieldName_1;
    21442145        ParamIn_1.VelType=VelType_1;
     
    21502151            return
    21512152        end
    2152 %         UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
    21532153    end
    21542154end
     
    23632363        Field{1}=transform(Field{1},XmlData);
    23642364    end
    2365     
     2365end   
    23662366    %% 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
     2367check_proj_tps=0;
     2368if 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
     2375end
     2376check_tps=0;         
     2377if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamOut.FieldName,'velocity')&&~strcmp(ParamOut.FieldName,'get_field...')
     2378       check_tps=1;
     2379end
     2380if (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');
    24052399    end
    24062400end
    24072401
    24082402%% 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')
     2403if 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
    24112406        Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    24122407    else
    2413     Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
     2408        Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
    24142409    end
    24152410end
    24162411if 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'))...
    24172412        &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')
    2418     if isfield(Field{2},'Coord_tps')
     2413    if check_proj_tps
    24192414        Field{2}.FieldList=[{ParamOut_1.FieldName} {ParamOut_1.ColorVar}];
    24202415    else
     
    43854380dlg_title = 'select properties of the output avi movie';
    43864381num_lines= 1;
    4387 % nbfield_cell=get(handles.last_i,'String');
    43884382def     = {[FileBase '_out.avi'];'10';'1';'[0.03 0.05 0.95 0.92]';'10'};
    43894383answer = inputdlg(prompt,dlg_title,num_lines,def,'on');
Note: See TracChangeset for help on using the changeset viewer.