Changeset 771


Ignore:
Timestamp:
May 3, 2014, 5:20:29 PM (10 years ago)
Author:
sommeria
Message:
 
Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r764 r771  
    169169    set(handles.FieldOption,'value',1)
    170170    if isfield(Field,'Conventions')&& strcmp(Field.Conventions,'uvmat/civdata')
    171     set(handles.FieldOption,'String',{'pick variables';'civdata...'})
     171    set(handles.FieldOption,'String',{'scalar';'vectors';'civdata...'})
    172172    else
    173        set(handles.FieldOption,'String',{'pick variables'})
     173       set(handles.FieldOption,'String',{'scalar';'vectors'})
    174174    end
    175175    checkseries=1;
     
    247247set(hObject,'Position',pos_view_field)
    248248set(handles.get_field,'WindowStyle','modal')% Make the GUI modal
     249if isfield(ParamIn,'Title')
     250    set(hObject,'Name',ParamIn.Title)
     251end
    249252
    250253%% set z coordinate menu if relevant
     
    407410        ordinate_Callback(hObject, eventdata, handles)
    408411       
    409     case {'scalar','pick variables'}
     412    case {'scalar'}
    410413        set(handles.Coordinates,'Visible','on')
    411414        set(handles.PanelOrdinate,'Visible','off')
     
    958961    case '1D plot'
    959962       
    960     case {'scalar','pick variables'}
     963    case {'scalar'}
    961964       scalar_Callback(hObject, eventdata, handles)
    962965    case 'vectors'
  • trunk/src/get_file_type.m

    r752 r771  
    1717% fileinput: name, including path, of the file to analyse
    1818function [FileType,FileInfo,VideoObject]=get_file_type(fileinput)
    19 
    20 FileInfo=[];
     19%%%% TODO: suppress the output argument FileType, contained in FileInfo %%%%
     20FileInfo=[];% will remain empty in the absence of input file
    2121VideoObject=[];
    2222if exist(fileinput,'file')
     23    FileInfo.FileName=fileinput;
     24    FileInfo.FileType='txt'; %default
    2325    FileType='txt';%default, text file
    2426else
     
    3032switch FileExt
    3133    case '.fig'
     34        FileInfo.FileType='figure';
    3235        FileType='figure';
    3336    case '.xml'
     37        FileInfo.FileType='xml';
    3438        FileType='xml';
    3539    case '.xls'
     40        FileInfo.FileType='xls';
    3641        FileType='xls';
    3742    otherwise
     
    5156                            FileInfo.NumberOfFrames=1;
    5257                        end
     58                        FileInfo.FileName=FileInfo.Filename; %correct the info given by imfinfo
     59                        FileInfo.FileType=FileType;
    5360                    end
    5461                else
    5562                    error_nc=0;
    5663                    try
    57                         [Data,tild,tild,errormsg]=nc2struct(fileinput,'ListGlobalAttribute','absolut_time_T0','Conventions',...
    58                             'CivStage','patch2','fix2','civ2','patch','fix','hart');
     64                      %  [Data,tild,tild,errormsg]=nc2struct(fileinput,'ListGlobalAttribute','absolut_time_T0','Conventions',...
     65                       %     'CivStage','patch2','fix2','civ2','patch','fix','hart');
     66                       [Data,tild,tild,errormsg]=nc2struct(fileinput,[]);
    5967                        if ~isempty(errormsg)
    6068                            error_nc=1;
    6169                        else
    62                             if ~isempty(Data.absolut_time_T0') && ~isempty(Data.hart)
     70                            if isfield(Data,'absolut_time_T0') && isfield(Data,'hart') && ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart)
     71                                FileInfo.FileType='civx';
    6372                                FileType='civx'; % test for civx velocity fields
    64                                 if isequal(Data.patch2,1)
     73                                if isfield(Data,'patch2') && isequal(Data.patch2,1)
    6574                                    FileInfo.CivStage=6;
    66                                 elseif isequal(Data.fix2,1)
     75                                elseif isfield(Data,'fix2') && isequal(Data.fix2,1)
    6776                                    FileInfo.CivStage=5;
    68                                 elseif  isequal(Data.civ2,1)
     77                                elseif  isfield(Data,'civ2')&& isequal(Data.civ2,1)
    6978                                    FileInfo.CivStage=4;
    70                                 elseif isequal(Data.patch,1)
     79                                elseif isfield(Data,'patch')&&isequal(Data.patch,1)
    7180                                    FileInfo.CivStage=3;
    72                                 elseif isequal(Data.fix,1)
     81                                elseif isfield(Data,'fix')&&isequal(Data.fix,1)
    7382                                    FileInfo.CivStage=2;
    7483                                else
    7584                                    FileInfo.CivStage=1;
    7685                                end
    77                             elseif strcmp(Data.Conventions,'uvmat/civdata')
     86                            elseif isfield(Data,'Conventions') && strcmp(Data.Conventions,'uvmat/civdata')
     87                                FileInfo.FileType='civdata'; % test for civx velocity fields
    7888                                FileType='civdata'; % test for civx velocity fields
    7989                                FileInfo.CivStage=Data.CivStage;
    8090                            else
     91                                FileInfo.FileType='netcdf';
    8192                                FileType='netcdf';
     93                                FileInfo.ListVarName=Data.ListVarName;
    8294                            end
    8395                        end
     
    96108                                FileType='mmreader';
    97109                            end
     110                            FileInfo.FileName=fileinput;
     111                            FileInfo.FileType=FileType;
    98112                            FileInfo.BitDepth=FileInfo.BitsPerPixel/3;
    99113                        end
  • trunk/src/nc2struct.m

    r756 r771  
    1616%                  .DimValue= vlalues of dimensions (added information, not requested for field description)
    1717%                  .VarType= integers giving the type of variable as coded by netcdf= 2 for char, =4 for single,=( for double
    18 %         .Txt: error message
    1918%  var_detect: vector with same length as the cell array ListVarName, = 1 for each detected variable and 0 else.
    2019%            var_detect=[] in the absence of input cell array
     
    3130%            while output names will be set by the first line
    3231%       - the string 'ListGlobalAttribute' followed by a list of attribute  names: reads only these attributes (fast reading)
    33 %       - the string 'TimeVarName', a string (the variable considered as time), an integer or vector with integer values
    34 %            representing time indices to select, the cell of other input variable names.
     32%       - the string 'TimeVarName', a string (the name of the variable considered as time), an integer or vector with integer values
     33%            representing time indices to select for each variable, the cell of other input variable names.
    3534%       - the string 'TimeDimName', a string (the name of the dimension considered as time), an integer or vector with integer values
    36 %            representing time indices to select, the cell of other input variable names.
     35%            representing time indices to select for each variable, the cell of other input variable names.
    3736
    3837%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  • trunk/src/series.m

    r770 r771  
    234234    set(handles.FieldName,'Value',Param.index_fields);% selected string index
    235235end
    236 if isfield(Param,'Coord_x_str')&& isfield(Param,'Coord_x_val')
     236if isfield(Param,'Coord_x_str') && ischar(Param.Coord_x_str)
    237237        set(handles.Coord_x,'String',Param.Coord_x_str);% list menu fields
    238     set(handles.Coord_x,'Value',Param.Coord_x_val);% selected string index
    239 end
    240 if isfield(Param,'Coord_y_str')&& isfield(Param,'Coord_y_val')
     238%     set(handles.Coord_x,'Value',Param.Coord_x_val);% selected string index
     239end
     240if isfield(Param,'Coord_y_str')&& ischar(Param.Coord_y_str)
    241241        set(handles.Coord_y,'String',Param.Coord_y_str);% list menu fields
    242     set(handles.Coord_y,'Value',Param.Coord_y_val);% selected string index
     242%     set(handles.Coord_y,'Value',Param.Coord_y_val);% selected string index
    243243end
    244244
     
    10311031switch FileType
    10321032    case {'civx','civdata'}
    1033         FieldList=set_field_list('U','V');
    1034         set(handles.FieldName,'String',[FieldList;{'C'};{'get_field...'}]);%standard menu for civx data
    1035         set(handles.FieldName,'Value',1) % set menu to 'velocity
    1036         set(handles.Coord_x,'Value',1);
    1037         set(handles.Coord_x,'String',{'X'});
    1038         set(handles.Coord_y,'Value',1);
    1039         set(handles.Coord_y,'String',{'Y'});
     1033        FieldList=[set_field_list('U','V');{'C'}];%standard menu for civx data
     1034%         set(handles.Coord_x,'Value',1);
     1035        set(handles.Coord_x,'String','X');
     1036%         set(handles.Coord_y,'Value',1);
     1037        set(handles.Coord_y,'String','Y');
    10401038    case 'netcdf'
    1041         set(handles.FieldName,'Value',1)
    1042         set(handles.FieldName,'String',{'get_field...'})
    1043         if isempty(i2_series)
    1044             i2=[];
     1039        ind_x=find(strcmp(get(handles.Coord_x,'String'),FileInfo.ListVarName));
     1040        if isempty(ind_x)
     1041            FieldList={};% new kind of file opened, we need to pick variables with get_field...
     1042            set(handles.Coord_x,'String','')
     1043            set(handles.Coord_y,'String','')
    10451044        else
    1046             i2=i2_series(1,ref_j+1,ref_i+1);
    1047         end
    1048         if isempty(j1_series)
    1049             j1=[];j2=[];
    1050         else
    1051             j1=j1_series(1,ref_j+1,ref_i+1);
    1052             if isempty(j2_series)
    1053                 j2=[];
     1045            FileInfo.ListVarName(ind_x)=[];%remove coord-x from the list of variables to display
     1046            ind_y=find(strcmp(get(handles.Coord_y,'String'),FileInfo.ListVarName));
     1047            if isempty(ind_y)
     1048            FieldList={};% new kind of file opened, we need to pick variables with get_field...
     1049            set(handles.Coord_x,'String','')
     1050            set(handles.Coord_y,'String','')
    10541051            else
    1055                 j2=j2_series(1,ref_j+1,ref_i+1);
     1052                FileInfo.ListVarName(ind_y)=[];%remove coord-y from the list of variables to display
     1053                FieldList=(FileInfo.ListVarName)';
    10561054            end
    1057         end
    1058        % FieldName_Callback([], [], handles)
     1055        end 
    10591056    otherwise
    10601057        set(handles.FieldName,'Value',1) % set menu to 'image'
    10611058        set(handles.FieldName,'String',{'image'})
    1062         set(handles.Coord_x,'Value',1);
    1063         set(handles.Coord_x,'String',{'AX'});
    1064         set(handles.Coord_y,'Value',1);
    1065         set(handles.Coord_y,'String',{'AY'});
    1066 end
    1067 
     1059        set(handles.Coord_x,'String','AX');
     1060        set(handles.Coord_y,'String','AY');
     1061end
     1062if ismember(FileType,{'civx','civdata','netcdf'})
     1063    PrevMenu=get(handles.FieldName,'String');
     1064    PrevMenu=PrevMenu(get(handles.FieldName,'Value'));
     1065    FieldValue=[];
     1066    for ilist=1:numel(PrevMenu)
     1067        index_menu=find(strcmp(PrevMenu{ilist},FieldList));
     1068        if ~isempty(index_menu)
     1069            FieldValue=[FieldValue index_menu];
     1070        end
     1071    end
     1072    if isempty(FieldValue)
     1073        FieldValue=1;
     1074    end
     1075    set(handles.FieldName,'Value',FieldValue)
     1076    set(handles.FieldName,'String',[FieldList;{'get_field...'}])
     1077end
     1078
     1079     
    10681080%------------------------------------------------------------------------
    10691081function num_first_i_Callback(hObject, eventdata, handles)
     
    23112323        Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
    23122324    if exist(FirstFileName,'file')
     2325        ParamIn.Title='get_field: pick input variables and coordinates for series processing';
    23132326        ParamIn.SeriesInput=1;
    23142327        GetFieldData=get_field(FirstFileName,ParamIn);
     
    23222335                    ['norm(' UName ',' VName ')'];...
    23232336                    UName;VName};
    2324             case {'scalar','pick variables'}
     2337            case {'scalar'}
    23252338                FieldList=GetFieldData.PanelScalar.scalar;
    23262339                YName={GetFieldData.Coordinates.Coord_y};
     
    23282341                    FieldList={FieldList};
    23292342                end
    2330             case '1D plot'
    2331                 YName=GetFieldData.PanelOrdinate.ordinate;
    23322343            case 'civdata...'
    2333                 FieldList=[set_field_list('U','V','C') ;{'C'}];
    2334                 set(handles.FieldName,'Value',2) % set menu to 'velocity
     2344                FieldList=[set_field_list('U','V') ;{'C'}];
     2345                set(handles.FieldName,'Value',1) % set menu to 'velocity
    23352346                XName='X';
    23362347                YName='y';
     
    23402351        set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
    23412352        if ~strcmp(GetFieldData.FieldOption,'civdata...')
    2342             set(handles.FieldName,'Value',[1:numel(FieldList)])%select all input fields by default
     2353            set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default
    23432354            set(handles.VelType,'visible','off')
    23442355            XName=GetFieldData.Coordinates.Coord_x;
     2356            YName=GetFieldData.Coordinates.Coord_y;
    23452357            TimeNameStr=GetFieldData.Time.SwitchVarIndexTime;
    23462358            switch TimeNameStr
     
    23632375            end
    23642376        end
    2365                 set(handles.Coord_x,'String',{XName})
     2377        set(handles.Coord_x,'String',XName)
    23662378        set(handles.Coord_y,'String',YName)
    23672379    end
  • trunk/src/series/civ_input.m

    r765 r771  
    305305    end
    306306end
     307% indicate max and min indices updated from input file series (not stored in Param.ActionInput)
     308set(handles.MaxIndex_i,'String',num2str(MaxIndex_i));
     309set(handles.MinIndex_i,'String',num2str(MinIndex_i));
     310set(handles.MaxIndex_j,'String',num2str(MaxIndex_i));
     311set(handles.MinIndex_j,'String',num2str(MinIndex_i));
    307312
    308313%% set the GUI to modal: wait for OK to close
     
    546551checkbox(6)=get(handles.CheckPatch2,'Value');
    547552ind_selected=find(checkbox,1);
    548 % if ~isempty(ind_selected)
    549 %     RootPath=get(handles.RootPath,'String');
    550 %     if isempty(RootPath)
    551 %         msgbox_uvmat('ERROR','Please open an image or PIV .nc file with the upper bar menu Open/Browse...')
    552 %         return
    553 %     end
    554 % end
    555553set(handles.PairIndices,'Visible','on')
    556 %set(handles.Civ1_ImageB,'Visible','on')
    557 %set(handles.TitleSubdirCiv1,'Visible','on')
    558554if opening==0
    559555    errormsg=find_netcpair_civ(handles,1); % select the available netcdf files
     
    564560if max(checkbox(4:6))% case of civ2 pair choice needed
    565561    set(handles.TitlePairCiv2,'Visible','on')
    566 %    set(handles.TitleSubdirCiv2,'Visible','on')
    567 %    set(handles.Civ2_ImageA,'Visible','on')
    568     %set(handles.ListSubdirCiv2,'Visible','on')
    569562    set(handles.ListPairCiv2,'Visible','on')
    570563    if ~opening
     
    575568    end
    576569else
    577 %    set(handles.TitleSubdirCiv2,'Visible','off')
    578 %    set(handles.Civ2_ImageA,'Visible','off')
    579570    set(handles.ListPairCiv2,'Visible','off')
    580571end
     
    956947mode_value=get(handles.ListPairMode,'Value');
    957948mode=mode_list{mode_value};
     949errormsg='';
    958950if isequal(get(handles.CheckCiv1,'Value'),0)|| isequal(mode,'series(Dj)')
    959951    errormsg=find_netcpair_civ(handles,1);% update the menu of pairs depending on the available netcdf files
     
    963955    errormsg=find_netcpair_civ(handles,2);
    964956end
    965     if ~isempty(errormsg)
     957if ~isempty(errormsg)
    966958    msgbox_uvmat('ERROR',errormsg)
    967     end
     959end
    968960
    969961%------------------------------------------------------------------------
  • trunk/src/uvmat.m

    r764 r771  
    31383138    case 'get_field...'
    31393139        %% fill the axes and variables from selections in get_field
    3140         ParamIn=[];
     3140        ParamIn.Title='get_field: choose input field for display in uvmat' ;
    31413141        % in case of civ data, we use the civ choice as default input for the GUI get_field
    31423142        if strcmp(get(handles.VelType,'Visible'),'on')
Note: See TracChangeset for help on using the changeset viewer.