Changeset 672


Ignore:
Timestamp:
Aug 6, 2013, 3:47:07 PM (11 years ago)
Author:
sommeria
Message:

various bugs corrected

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_imadoc.m

    r507 r672  
    1010% RootPath,SubDir,RootFile,FileExt, as given from the input file name by fileparts_uvmat
    1111function XmlFileName=find_imadoc(RootPath,SubDir,RootFile,FileExt)
    12 SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
    13 XmlFileName=[fullfile(RootPath,SubDirBase) '.xml'];%new convention: xml at the level of the image folder
     12SubDirBase=SubDir;
     13XmlFileName=fullfile(RootPath,[SubDir '.xml']);
     14if ~exist (XmlFileName,'file')
     15    dotchar=regexp(SubDir,'\.');
     16    for idot=1:numel(dotchar)
     17        XmlFileName=fullfile(RootPath,[SubDir(1:dotchar(end-idot+1)) '.xml']);
     18        if exist(XmlFileName,'file')
     19            SubDirBase=fullfile(RootPath,SubDir(1:dotchar(end-idot+1)));
     20            break
     21        end
     22    end   
     23end
     24% SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
     25% XmlFileName=[fullfile(RootPath,SubDirBase) '.xml'];%new convention: xml at the level of the image folder
    1426if ~exist(XmlFileName,'file')
    1527    XmlFileName=[fullfile(RootPath,SubDirBase,RootFile) '.xml']; % old convention: xml inside the image folder, case of images or new civ files
  • trunk/src/geometry_calib.m

    r671 r672  
    6060                   'gui_LayoutFcn',  [] , ...
    6161                   'gui_Callback',   []);
    62 if nargin && ischar(varargin{1}) %&& ~isempty(regexp(varargin{1},'_Callback','once'))
     62if nargin
     63   [pp,ff]=fileparts(which(varargin{1})); % name of the input file
     64   if strcmp(ff,mfilename)% if we are activating a sub-function of geometry_calib
     65   % ~isempty(regexp(varargin{1},'_Callback','once'))
    6366    gui_State.gui_Callback = str2func(varargin{1});
     67   end
    6468end
    6569
     
    9296set(0,'Unit','pixels')
    9397ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
    94 FigSize=get(handles.geometry_calib,'Position');
    95 
    96 Width=FigSize(3);% fig width in points (1/72 inch)
    97 Height=FigSize(4);
    98 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40
    99 Bottom=ScreenSize(4)-Height-40; %put fig at top right
    100 set(handles.geometry_calib,'Position',[Left Bottom Width Height])
    101 
    102 % %set the position of the interface
    103 % if exist('pos','var')&& length(pos)>=4
    104 %     set(hObject,'Position',pos);
    105 % end
     98Left=ScreenSize(3)- 460; %right edge close to the right, with margin=40 (GUI width=420 px)
     99if ScreenSize(4)>880
     100    Height=840;%default height of the GUI
     101    Bottom=ScreenSize(4)-Height-40; %put fig at top right
     102else
     103    Height=ScreenSize(4)-40;
     104    Bottom=0; % GUI lies o the screen bottom
     105end
     106set(handles.calib_type,'Position',[1 Height-30 194 30])%  rank 1
     107set(handles.APPLY,'Position',[197 Height-30 110 30])%  rank 1
     108set(handles.REPLICATE,'Position',[309 Height-30 110 30])%  rank 1
     109set(handles.Intrinsic,'Position',[1 Height-30-2-92 418 92])%  rank 2
     110set(handles.Extrinsic,'Position',[1 Height-30-4-92-75 418 75])%  rank 3
     111set(handles.PointLists,'Position',[1 Height-30-6-92-75-117 418 117]) %  rank 4
     112set(handles.CheckEnableMouse,'Position',[3 Height-30-8-92-75-117-30 203 30])%  rank 5
     113set(handles.PLOT,'Position',[3 Height-384 120 30])%  rank 6
     114set(handles.Copy,'Position',[151 Height-384 120 30])%  rank 6
     115set(handles.CLEAR_PTS,'Position',[297 Height-384 120 30])%  rank 6
     116set(handles.phys_title,'Position',[38 Height-416 125 20])%  rank 7
     117set(handles.CoordUnit,'Position',[151 Height-416 120 30])%  rank 7
     118set(handles.px_title,'Position',[272 Height-416 125 20])%  rank 7
     119set(handles.ListCoord,'Position',[1 20 418 Height-436])% rank 8
     120set(handles.geometry_calib,'Position',[Left Bottom 420 Height])
    106121
    107122%set menu of calibration options
     
    150165if ~isempty(huvmat)
    151166    handles=guidata(huvmat);
     167    set(handles.MenuCalib,'Checked','off')
    152168    hobject=findobj(handles.PlotAxes,'tag','calib_points');
    153169    if ~isempty(hobject)
  • trunk/src/get_field.m

    r669 r672  
    9393    Field.VarAttribute(numel(Field.VarAttribute)+1:NbVar)=cell(1,NbVar-numel(Field.VarAttribute));
    9494end
     95% Field.Display = list of variables and corresponding properties obtained after removal of singletons
    9596Field.Display.ListVarName=Field.ListVarName(~Field.Check0D);
    9697Field.Display.VarAttribute=Field.VarAttribute(~Field.Check0D);
     
    137138set(handles.vector_x,'String',Field.Display.ListVarName)% fill the menu of x vector components
    138139set(handles.vector_y,'String',Field.Display.ListVarName)% fill the menu of y vector components
    139 set(handles.vector_z,'String',[{''} Field.ListVarName])% fill the menu of y vector components
    140 set(handles.vec_color,'String',[{''} Field.ListVarName])% fill the menu of y vector components
     140set(handles.vector_z,'String',[{''} Field.Display.ListVarName])% fill the menu of y vector components
     141set(handles.vec_color,'String',[{''} Field.Display.ListVarName])% fill the menu of y vector components
    141142set(handles.scalar,'Value',1)% fill the menu of y vector components
    142 set(handles.scalar,'String',Field.ListVarName)% fill the menu of y vector components
     143set(handles.scalar,'String',Field.Display.ListVarName)% fill the menu of y vector components
    143144set(handles.ordinate,'Value',1)% fill the menu of y vector components
    144 set(handles.ordinate,'String',Field.ListVarName)% fill the menu of y vector components
     145set(handles.ordinate,'String',Field.Display.ListVarName)% fill the menu of y vector components
    145146if isfield(Field,'Conventions')&& strcmp(Field.Conventions,'uvmat/civdata')
    146         set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors';'civdata...'})
     147    set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors';'civdata...'})
    147148else
    148      set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors'})
     149    set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors'})
    149150end
    150151if Field.MaxDim>=2 % case of 2D (or 3D) fields
     
    157158        set(handles.FieldOption,'Value',2)
    158159    end
    159 
    160160else % case of 1D fields
    161161    set(handles.FieldOption,'Value',1)
     
    182182%     end
    183183
    184 %% Make choices in menus from input
    185 % if exist('ParamIn','var')&&~isempty(ParamIn)
    186 %     fill_GUI(ParamIn,handles.get_field);
    187 % end
    188 %FieldOption_Callback([],[],handles)
    189 
     184%% Make choices of coordinates from input
     185if isfield(CellInfo{imax},'CoordIndex')
     186    CoordIndex=CellInfo{imax}.CoordIndex;
     187    if numel(CoordIndex)==2
     188        YName=Field.ListVarName{CoordIndex(1)};
     189        XName=Field.ListVarName{CoordIndex(2)};
     190        ListCoord=get(handles.Coord_x,'String');
     191        XIndex=find(strcmp(XName,ListCoord));
     192        if ~isempty(XIndex)
     193            set(handles.Coord_x,'Value',XIndex)
     194        end
     195        YIndex=find(strcmp(YName,ListCoord));
     196        if ~isempty(YIndex)
     197            set(handles.Coord_y,'Value',YIndex)
     198        end
     199    end
     200end
    190201
    191202%% put the GUI on the lower right of the sceen
     
    218229end
    219230
    220 
    221 
    222 %------------------------------------------------------------------------
    223 
    224231%------------------------------------------------------------------------
    225232% --- Outputs from this function are returned to the command line.
     233%------------------------------------------------------------------------
    226234function varargout = get_field_OutputFcn(hObject, eventdata, handles)
    227 %------------------------------------------------------------------------
     235
    228236varargout{1} = handles.output;
    229237delete(handles.get_field)
     
    242250end
    243251
    244 %---------------------------------------------------------
     252%------------------------------------------------------------------------
    245253% --- Executes on button press in OK.
    246254%------------------------------------------------------------------------
     
    254262% -----------------------------------------------------------------------
    255263% --- Activated by selection in the list of variables
     264% ----------------------------------------------------------------------
    256265function variables_Callback(hObject, eventdata, handles)
    257 % -----------------------------------------------------------------------
     266
    258267Tabchar={''};%default
    259268Tabcell=[];
     
    263272
    264273%% list global TimeAttribute names and values if index=1 (blank TimeVariable display) is selected
    265 if isequal(index,1) 
     274if isequal(index,1)
    266275    set(handles.attributes_txt,'String','global attributes')
    267276    if isfield(Field,'ListGlobalAttribute') && ~isempty(Field.ListGlobalAttribute)
    268277        for iline=1:length(Field.ListGlobalAttribute)
    269             Tabcell{iline,1}=Field.ListGlobalAttribute{iline};   
     278            Tabcell{iline,1}=Field.ListGlobalAttribute{iline};
    270279            if isfield(Field, Field.ListGlobalAttribute{iline})
    271280                val=Field.(Field.ListGlobalAttribute{iline});
     
    279288        Tabchar=cell2tab(Tabcell,'=');
    280289    end
    281 %% list Attribute names and values associated to the Variable # index-1   
     290    %% list Attribute names and values associated to the Variable # index-1
    282291else
    283292    list_var=get(handles.variables,'String');
     
    285294    set(handles.attributes_txt,'String', ['attributes of ' var_select])
    286295    if isfield(Field,'VarAttribute')&& length(Field.VarAttribute)>=index-1
    287 %         nbline=0;
     296        %         nbline=0;
    288297        VarAttr=Field.VarAttribute{index-1};
    289298        if isstruct(VarAttr)
     
    291300            for iline=1:length(attr_list)
    292301                Tabcell{iline,1}=attr_list{iline};
    293                 eval(['val=VarAttr.' attr_list{iline} ';']) 
     302                eval(['val=VarAttr.' attr_list{iline} ';'])
    294303                if ischar(val);
    295304                    Tabcell{iline,2}=val;
    296305                else
    297                      Tabcell{iline,2}=num2str(val);
     306                    Tabcell{iline,2}=num2str(val);
    298307                end
    299308            end
    300309        end
    301310    end
    302 
     311   
    303312end
    304313if ~isempty(Tabcell)
    305314    Tabchar=cell2tab(Tabcell,'=');
    306 %     Tabchar=[{''};Tabchar];
     315    %     Tabchar=[{''};Tabchar];
    307316end
    308317set(handles.attributes,'Value',1);% select the first item
     
    319328        if ischar(DimCell)
    320329            DimCell={DimCell};
    321         end   
     330        end
    322331        dim_indices=[];
    323332        for idim=1:length(DimCell)
    324             dim_index=strcmp(DimCell{idim},Field.ListDimName);%vector with size of Field.ListDimName, =0 
     333            dim_index=strcmp(DimCell{idim},Field.ListDimName);%vector with size of Field.ListDimName, =0
    325334            dim_index=find(dim_index,1);
    326335            dim_indices=[dim_indices dim_index];
     
    335344    Tabchar=[{''} ;Tabchar];
    336345    set(handles.dimensions,'Value',1)
    337     set(handles.dimensions,'String',Tabchar) 
    338 end 
     346    set(handles.dimensions,'String',Tabchar)
     347end
    339348
    340349%------------------------------------------------------------------------
     
    343352function FieldOption_Callback(hObject, eventdata, handles)
    344353
     354Field=get(handles.get_field,'UserData');
    345355FieldList=get(handles.FieldOption,'String');
    346356FieldOption=FieldList{get(handles.FieldOption,'Value')};
    347357switch FieldOption
     358   
    348359    case '1D plot'
    349360        set(handles.Coordinates,'Visible','on')
     
    361372        set(handles.Z_title,'Visible','off')
    362373        ordinate_Callback(hObject, eventdata, handles)
     374       
    363375    case 'scalar'
    364376        set(handles.Coordinates,'Visible','on')
     
    373385        set(handles.Coord_y,'Visible','on')
    374386        set(handles.Y_title,'Visible','on')
     387        %default scalar selection
     388        test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante
     389        for ilist=1:numel(Field.Display.VarDimName)
     390            if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ilist && isfield(Field.Display.VarAttribute{ilist},'Role')
     391                Role=Field.Display.VarAttribute{ilist}.Role;
     392                if strcmp(Role,'coord_x')||strcmp(Role,'coord_y')
     393                    test_coord(ilist)=1;
     394                end
     395            end
     396            dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist
     397            if numel(dimnames)==1 && strcmp(dimnames{1},Field.Display.ListVarName{ilist})%dimension variable
     398                test_coord(ilist)=1;
     399            end
     400        end
     401        scalar_index=find(~test_coord,1);%get the first variable not a coordiante
     402        if isempty(scalar_index)
     403            set(handles.scalar,'Value',1)
     404        else
     405            set(handles.scalar,'Value',scalar_index)
     406        end       
    375407        scalar_Callback(hObject, eventdata, handles)
     408       
    376409    case 'vectors'
    377410        set(handles.Coordinates,'Visible','on')
     
    385418        set(handles.PanelVectors,'Position',pos)
    386419        set(handles.Coord_y,'Visible','on')
    387         set(handles.Y_title,'Visible','on')     
     420        set(handles.Y_title,'Visible','on')
     421        %default vector selection
     422        test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante
     423        for ilist=1:numel(Field.Display.VarDimName)
     424            if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ilist && isfield(Field.Display.VarAttribute{ilist},'Role')
     425                Role=Field.Display.VarAttribute{ilist}.Role;
     426                if strcmp(Role,'coord_x')||strcmp(Role,'coord_y')
     427                    test_coord(ilist)=1;
     428                end
     429            end
     430            dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist
     431            if numel(dimnames)==1 && strcmp(dimnames{1},Field.Display.ListVarName{ilist})%dimension variable
     432                test_coord(ilist)=1;
     433            end
     434        end
     435        vector_index=find(~test_coord,2);%get the first variable not a coordiante
     436        if isempty(vector_index)
     437            set(handles.vector_x,'Value',1)
     438            set(handles.vector_y,'Value',2)
     439        else
     440            set(handles.vector_x,'Value',vector_index(1))
     441            set(handles.vector_y,'Value',vector_index(2))
     442        end       
    388443        vector_Callback(handles)
     444       
    389445    case 'civdata...'
    390446        set(handles.PanelOrdinate,'Visible','off')
     
    483539test_component=zeros(size(Field.Display.VarDimName));%=1 when variable #ilist is eligible as unstructured coordinate
    484540test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante
    485 ListCoord={''};
    486541dim_var=Field.Display.VarDimName{scalar_index};%list of dimensions of the selected variable
    487 
    488542for ilist=1:numel(Field.Display.VarDimName)
    489543    dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist
     
    494548    end
    495549end
    496 var_component=find(test_component);% list of variable indices elligible as unstructured coordiantes
     550var_component=find(test_component);% list of variable indices elligible as unstructured coordinates
    497551var_coord=find(test_coord);% % list of variable indices elligible as structured coordinates
    498552ListCoord=Field.Display.ListVarName([var_component var_coord]);
     
    502556    set(handles.SwitchVarIndexTime,'Value',3)% the last dim must be considered as time
    503557end
    504 if numel(var_component)<2
    505     if numel(test_coord)<2
    506         ListCoord={''};
     558% if numel(var_component)<2
     559%     if numel(test_coord)<2
     560%         ListCoord={''};
     561%     else
     562%         set(handles.Coord_x,'Value',2)
     563%         set(handles.Coord_y,'Value',1)
     564%     end
     565% else
     566coord_val=[0 0];
     567% look for labelled unstructured coordinates
     568for ilist=1:numel(var_component)
     569    ivar=var_component(ilist);
     570    if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ivar && isfield(Field.Display.VarAttribute{ivar},'Role')
     571        Role=Field.Display.VarAttribute{ivar}.Role;
     572        if strcmp(Role,'coord_x')
     573            coord_val(1)=ilist;
     574        elseif strcmp(Role,'coord_y')
     575            coord_val(2)=ilist;
     576        end
     577    end
     578end
     579if numel(find(coord_val))<2
     580    if numel(var_coord)>=2
     581        coord_val=[numel(var_component)+2 numel(var_component)+1];
    507582    else
    508         set(handles.Coord_x,'Value',2)
    509         set(handles.Coord_y,'Value',1)
    510     end
    511 else
    512     coord_val=[1 2];
    513     for ilist=1:numel(var_component)
    514         ivar=var_component(ilist);
    515         if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ivar && isfield(Field.Display.VarAttribute{ivar},'Role')
    516             Role=Field.Display.VarAttribute{ivar}.Role;
    517             if strcmp(Role,'coord_x')
    518                 coord_val(1)=ilist;
    519             elseif strcmp(Role,'coord_y')
    520                 coord_val(2)=ilist;
    521             end
    522         end
    523     end
    524     set(handles.Coord_x,'Value',coord_val(1))
    525     set(handles.Coord_y,'Value',coord_val(2))
    526 end
    527 
     583        coord_val=[1 2];
     584    end
     585end
     586set(handles.Coord_x,'Value',coord_val(1))
     587set(handles.Coord_y,'Value',coord_val(2))
    528588set(handles.Coord_y,'String',ListCoord)
    529589set(handles.Coord_x,'String',ListCoord)
     
    559619%------------------------------------------------------------------------
    560620% --- Executes on selection change in vector_x.
     621%------------------------------------------------------------------------
    561622function vector_x_Callback(hObject, eventdata, handles)
    562 %------------------------------------------------------------------------
     623
    563624vector_x_menu=get(handles.vector_x,'String');
    564625vector_x_index=get(handles.vector_x,'Value');
     
    617678    check_consistent=0;
    618679end
     680% the two vector components have consistent dimensions
    619681if check_consistent
    620682    for ilist=1:numel(Field.Display.VarDimName)
     
    642704        end
    643705    else
    644         coord_val=[1 2];
     706        coord_val=[0 0];
    645707        for ilist=1:numel(var_component)
    646708            ivar=var_component(ilist);
     
    654716            end
    655717        end
     718        if isempty(coord_val)
     719            coord_val=var_coord;% case of dimension coordinates
     720        end
     721        if numel(find(coord_val))<2
     722            coord_val=[numel(var_component)+2 numel(var_component)+1];
     723        end
    656724        set(handles.Coord_x,'Value',coord_val(1))
    657725        set(handles.Coord_y,'Value',coord_val(2))
     
    691759%------------------------------------------------------------------------
    692760% --- Executes on selection change in Coord_x.
     761%------------------------------------------------------------------------
    693762function Coord_x_Callback(hObject, eventdata, handles)
    694 %------------------------------------------------------------------------
     763
    695764index=get(handles.Coord_x,'Value');
    696765string=get(handles.Coord_x,'String');
     
    700769%------------------------------------------------------------------------
    701770% --- Executes on selection change in Coord_y.
     771%------------------------------------------------------------------------
    702772function Coord_y_Callback(hObject, eventdata, handles)
    703 %------------------------------------------------------------------------
     773
    704774index=get(handles.Coord_y,'Value');
    705775string=get(handles.Coord_y,'String');
     
    709779%------------------------------------------------------------------------
    710780% --- Executes on selection change in Coord_z.
     781%------------------------------------------------------------------------
    711782function Coord_z_Callback(hObject, eventdata, handles)
    712 %------------------------------------------------------------------------
     783
    713784index=get(handles.Coord_z,'Value');
    714785string=get(handles.Coord_z,'String');
     
    720791%------------------------------------------------------------------------
    721792function SwitchVarIndexTime_Callback(hObject, eventdata, handles)
     793
    722794Field=get(handles.get_field,'UserData');
    723795menu=get(handles.SwitchVarIndexTime,'String');
     
    781853end
    782854
    783 %-------------------------------------------------
    784 % give index numbers of the strings str in the list ListvarName
     855%------------------------------------------------------------------------
     856% --- give index numbers of the strings str in the list ListvarName
     857% -----------------------------------------------------------------------
    785858function VarIndex_y=name2index(cell_str,ListVarName)
     859
    786860VarIndex_y=[];
    787861if ischar(cell_str)
  • trunk/src/mask_proj.m

    r667 r672  
    3535for icell=1:numel(CellInfo)
    3636    if NbDimArray(icell)==2
     37        XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)};
     38        YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)};
     39        if isfield(CellInfo{icell},'VarIndex_errorflag')
     40            FFName=FieldData.ListVarName{CellInfo{icell}.VarIndex_errorflag};
     41        else
     42            FFName='FF';%default error (mask) flag name (if not already used)
     43            if isfield(FieldData,'FF')
     44                ind=1;
     45                while isfield(FieldData,['FF_' num2str(ind)])
     46                    ind=ind+1;
     47                end
     48                FFName=['FF_' num2str(ind)];% append an index to the name of error flag, FF_1,FF_2...
     49            end
     50            ProjData.ListVarName=[FieldData.ListVarName {FFName}];
     51            ProjData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.CoordIndex(1))];
     52            ProjData.VarAttribute{numel(FieldData.VarDimName)}.Role='errorflag';
     53        end
    3754        switch CellInfo{icell}.CoordType;
    38             case  'scattered'
    39                 XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)};
    40                 YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)};
     55            case  'scattered'               
    4156                mask_ind_i=round(0.5+(FieldData.(XName)-MaskData.AX(1))/DX);%nbpoint terms
    4257                mask_ind_j=round(0.5+(FieldData.(YName)-MaskData.AY(1))/DY);%nbpoint terms
     
    4661                MaskData.A=reshape(MaskData.A,1,[]);
    4762                checkfalse(MaskData.A(checkin)>200)=0;
    48                 if ~isfield(FieldData,'FF')
    49                     FieldData.FF=zeros(size(FieldData.(XName)));
    50                     FieldData.ListVarName=[FieldData.ListVarName {'FF'}];
    51                     FieldData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.CoordIndex(1))];
    52                     FieldData.VarAttribute{numel(FieldData.VarDimName)}.Role='errorflag';
    53                 end
    5463                for ivar=1:numel(CellInfo{icell}.VarIndex)
    5564                    VarName=FieldData.ListVarName{CellInfo{icell}.VarIndex(ivar)};
    56                     FieldData.(VarName)(checkfalse)=0;
    57                     FieldData.FF(checkfalse)=1;
     65                    ProjData.(VarName)(checkfalse)=0;
    5866                end
     67                if ~isfield(CellInfo{icell},'VarIndex_errorflag')% an error flag already exists in the current cell
     68                    ProjData.(FFName)=zeros(size(ProjData.(VarName)));
     69                end
     70                ProjData.(FFName)(checkfalse)=1;
    5971            case  'grid'
    60                 XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)};
    61                 YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)};
    6272                Var1Name=FieldData.ListVarName{CellInfo{icell}.VarIndex(1)};
    6373                [Npy_field,Npx_field]=size(FieldData.(Var1Name));
     
    7080                [XMask,YMask]=meshgrid(XMask,YMask);
    7181                Mask = interp2(XMask,YMask,MaskData.A,XArray,YArray','nearest');
    72 %                 figure(1)
    73 %                 image(MaskData.A)
    74                 Mask=Mask>200;
    75                 if ~isfield(FieldData,'FF')
    76                     FieldData.FF=zeros(size(FieldData.(XName)));
    77                     FieldData.ListVarName=[FieldData.ListVarName {'FF'}];
    78                     FieldData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.CoordIndex(1))];
    79                     FieldData.VarAttribute{numel(FieldData.VarDimName)}.Role='errorflag';
    80                 end
     82                Mask=Mask>200;               
    8183                for ivar=1:numel(CellInfo{icell}.VarIndex)
    8284                    VarName=FieldData.ListVarName{CellInfo{icell}.VarIndex(ivar)};
    83                     FieldData.(VarName)=FieldData.(VarName).*Mask;
    84                     FieldData.FF=~Mask;
     85                    if ~strcmp(VarName,FFName)
     86                        ProjData.(VarName)=FieldData.(VarName).*Mask;
     87                    end
     88                end
     89                if isfield(CellInfo{icell},'VarIndex_errorflag')% an error flag already exists in the current cell
     90                    ProjData.(FFName)=FieldData.(FFName) | ~Mask;
     91                else
     92                    ProjData.(FFName)= ~Mask;
    8593                end
    8694        end
    8795    end
    8896end
    89        
    9097
     98
  • trunk/src/proj_field.m

    r655 r672  
    10121012else
    10131013    %% case of a grid requested by the input field
    1014 
    10151014    for icell=1:numel(CellInfo)% TODO: recalculate coordinates here to get the bounds in the rotated coordinates
    10161015        if isfield(CellInfo{icell},'ProjModeRequest')
     
    15451544                        test_interp_tps=0;
    15461545                    end
    1547                     %                     ProjData.coord_y=[YMin YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined
    1548                     %                     ProjData.coord_x=[XMin XMax];
    15491546                    coord_x_proj=XMin:DX:XMax;
    15501547                    coord_y_proj=YMin:DY:YMax;
     
    15521549                    XI=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(3))-YI*sin(PlaneAngle(3));%corresponding coordinates in the original system
    15531550                    YI=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(3))+YI*cos(PlaneAngle(3));
    1554                     [X,Y]=meshgrid(Coord{2},Coord{1});%initial coordiantes
     1551                    Coord{1}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)});
     1552                    Coord{2}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)});
     1553                    if numel(Coord{1})==2% x coordiante defiend by its bounds, get the whole set
     1554                        Coord{1}=linspace(Coord{1}(1),Coord{1}(2),CellInfo{icell}.CoordSize(1));
     1555                    end
     1556                    if numel(Coord{2})==2% y coordiante defiend by its bounds, get the whole set
     1557                        Coord{2}=linspace(Coord{2}(1),Coord{2}(2),CellInfo{icell}.CoordSize(2));
     1558                    end
     1559                    [X,Y]=meshgrid(Coord{2},Coord{1});%initial coordinates
     1560                    %name of error flag variable
     1561                    FFName='FF';%default name (if not already used)
     1562                    if isfield(ProjData,'FF')
     1563                        ind=1;
     1564                        while isfield(ProjData,['FF_' num2str(ind)])
     1565                            ind=ind+1;
     1566                        end
     1567                        FFName=['FF_' num2str(ind)];% append an index to the name of error flag, FF_1,FF_2...
     1568                    end
     1569                    % project all variables in the cell
    15551570                    for ivar=VarIndex
    15561571                        VarName=FieldData.ListVarName{ivar};
    1557                         %                         if test_interp(1) || test_interp(2)%interpolate on a regular grid
    15581572                        if size(FieldData.(VarName),3)==1
    15591573                            ProjData.(VarName)=interp2(X,Y,double(FieldData.(VarName)),XI,YI,'*linear');
    15601574                        else
    15611575                            ProjData.(VarName)=interp2(X,Y,double(FieldData.(VarName)(:,:,1)),XI,YI,'*linear');
    1562                             for icolor=2:size(FieldData.(VarName),3)
     1576                            for icolor=2:size(FieldData.(VarName),3)% project 'color' components
    15631577                                ProjData.(VarName)=cat(3,ProjData.(VarName),interp2(X,Y,double(FieldData.(VarName)(:,:,icolor)),XI,YI,'*linear')); %TO TEST
    15641578                            end
     
    15701584                            VarAttribute{length(ListVarName)+nbcoord}=FieldData.VarAttribute{ivar};
    15711585                        end;
    1572                     end
     1586                        ProjData.(FFName)=isnan(ProjData.(VarName));%detact NaN (points outside the interpolation range)
     1587                        ProjData.(VarName)(ProjData.(FFName))=0; %set to 0 the NaN data
     1588                    end
     1589                    %update list of variables with error flag
     1590                    ListVarName=[ListVarName FFName];
     1591                    VarDimName=[VarDimName {DimCell}];
     1592                    VarAttribute{numel(ListVarName)}.Role='errorflag';
    15731593                elseif ~testangle
    15741594                    % unstructured z coordinate
  • trunk/src/series.m

    r669 r672  
    243243%% introduce the input file name(s) if defined from input Param
    244244if isfield(Param,'FileName')
    245     InputTable={'','','','',''}; % refresh the file input table
     245    %InputTable={'','','','',''}; % refresh the file input table
     246    InputTable={}
    246247    set(handles.InputTable,'Data',InputTable)
    247248    if isfield(Param,'FileName_1')
     
    584585SeriesData=get(handles.series,'UserData');
    585586if strcmp(iview,'append') % display the input data as a new line in the table
    586     iview=size(InputTable,1);% the next line in InputTable becomes the current line
    587     InputTable(iview+1,:)={'','','','',''};
     587    iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line
     588    %InputTable(iview+1,:)={'','','','',''};
    588589    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    589590elseif strcmp(iview,'one') % refresh the list of  input  file series
    590591    iview=1; %the first line in InputTable becomes the current line
    591     InputTable=[{'','','','',''};{'','','','',''}];
     592    InputTable={'','','','',''};
     593    %InputTable=[{'','','','',''};{'','','','',''}];
    592594    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    593595    set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}])
     
    607609    SeriesData.Time={};
    608610end
    609 nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line
     611%nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line
     612nbview=size(InputTable,1);
    610613set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1)))
    611614set(handles.ListView,'Value',iview)
     
    21562159    set(handles.OutputDirExt,'String',ParamOut.OutputDirExt)
    21572160    OutputDirVisible='on';
    2158     SubDir=InputTable(1:end-1,2); %set of subdirectories sorted in alphabetical order
     2161    SubDir=InputTable(1:end,2); %set of subdirectories sorted in alphabetical order
    21592162    SubDirOut=SubDir{1};
    21602163    if numel(SubDir)>1
     
    24852488    nbview=size(InputTable,1);
    24862489    %     MaskTable=cell(nbview,1);
     2490    MaskTable=cell(nbview,1);%default
     2491    ListMask=cell(nbview,1);%default
    24872492    for iview=1:nbview
     2493        ListMask{iview,1}=num2str(iview);
    24882494        RootPath=InputTable{iview,1};
    24892495        if ~isempty(RootPath)
     
    25002506        end
    25012507    end
    2502     nbview=size(MaskTable,1);
     2508    %nbview=size(MaskTable,1);
    25032509    set(handles.MaskTable,'Data',MaskTable)
    25042510    %     set(handles.MaskTable,'ColumnFormat',{MaskTable'})
     
    25072513    set(handles.ListMask,'Visible','on')
    25082514    set(handles.ListMask,'String',ListMask)
    2509     set(handles.ListMask,'Value',numel(ListMask))
     2515    set(handles.ListMask,'Value',1)
    25102516else
    25112517    set(handles.MaskTable,'Visible','off')
  • trunk/src/uvmat.m

    r671 r672  
    191191set(hObject,'Position',[LeftX LowY Width Height])
    192192UvData.OpenParam.PosColorbar=[0.80 0.02 0.018 0.445];
    193 UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE)
     193% UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib
    194194AxeData.LimEditBox=1; %initialise AxeData
    195195set(handles.PlotAxes,'UserData',AxeData)
     
    558558DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});
    559559hdir=dir(DirName); %list files and dirs
     560FileName='';
    560561for ilist=1:numel(hdir)
    561562    if ~isequal(hdir(ilist).isdir,1)%look for files, not dir
     
    568569    end
    569570end
     571if isempty(FileName)
     572    msgbox_uvmat('ERROR','no valid input file in the selected directory')
     573else
    570574display_file_name(handles,fullfile(DirName,FileName))
     575end
    571576set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])
    572577
Note: See TracChangeset for help on using the changeset viewer.