Changeset 421 for trunk/src/series.m


Ignore:
Timestamp:
May 14, 2012, 7:03:14 AM (12 years ago)
Author:
sommeria
Message:

bugs corrections and improvements following tutorial presentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r419 r421  
    15711571% last_j=str2num(get(handles.num_last_j,'String'));
    15721572TimeTable=get(handles.TimeTable,'Data');
    1573 
     1573Pairs=get(handles.PairString,'Data');
    15741574for iview=1:size(TimeTable,1)
    1575     Pairs=get(handles.PairString,'Data');
     1575    if size(SeriesData.Time,1)<iview
     1576        break
     1577    end
    15761578    i1=ref_i;
    15771579    j1=ref_j;
    15781580    i2=ref_i;
    15791581    j2=ref_j;
     1582    % case of pairs
    15801583    if ~isempty(Pairs{iview,1})
    1581         r=regexp(Param.Pairs.list_pair_civ,'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
     1584        r=regexp(Pairs{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
    15821585        if isempty(r)
    1583             r=regexp(Param.Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');
     1586            r=regexp(Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');
    15841587        end
    15851588        switch r.mode
     
    15951598        end
    15961599    end
    1597     if isempty(ref_j)
    1598     time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2;
    1599     time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2;
    1600     else
    1601         time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2;
    1602         time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2;
    1603     end
    1604     TimeTable{iview,2}=time_first; %TODO: take into account pairs
    1605     TimeTable{iview,3}=time_last; %TODO: take into account pairs
     1600    TimeTable{iview,2}=[];
     1601    TimeTable{iview,3}=[];
     1602    if size(SeriesData.Time{iview},1)>=i2(2)&&size(SeriesData.Time{iview},1)>=j2(2)
     1603        if isempty(ref_j)
     1604            time_first=(SeriesData.Time{iview}(i1(1))+SeriesData.Time{iview}(i2(1)))/2;
     1605            time_last=(SeriesData.Time{iview}(i1(2))+SeriesData.Time{iview}(i2(2)))/2;
     1606        else
     1607            time_first=(SeriesData.Time{iview}(i1(1),j1(1))+SeriesData.Time{iview}(i2(1),j2(1)))/2;
     1608            time_last=(SeriesData.Time{iview}(i1(2),j1(2))+SeriesData.Time{iview}(i2(2),j2(2)))/2;
     1609        end
     1610        TimeTable{iview,2}=time_first; %TODO: take into account pairs
     1611        TimeTable{iview,3}=time_last; %TODO: take into account pairs
     1612    end
    16061613end
    16071614set(handles.TimeTable,'Data',TimeTable)
    1608 return
    1609 
    1610 
    1611 NomType=InputTable(:,4);
    1612 mode_list=get(handles.mode,'String');
    1613 index_mode=get(handles.mode,'Value');
    1614 
    1615 mode=mode_list{index_mode};
    1616 
    1617 time_first=[];
    1618 time_last=[];
    1619 if ~isfield(SeriesData,'Time')
    1620     SeriesData.Time{1}=[];
    1621 end
    1622 TimeTable=get(handles.TimeTable,'Data');
    1623 for iview=1:size(TimeTable,1)
    1624     time_first_cell{iview}='?';
    1625     time_last_cell{iview}='?';%default
    1626     time=SeriesData.Time{iview};
    1627     if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2')
    1628         if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num)
    1629             ind_shift=SeriesData.displ_num(iview,:);
    1630             if isequal(mode,'bursts')
    1631                 first_j=0;
    1632                 last_j=0;
    1633             end
    1634             first_i1=first_i +ind_shift(3);
    1635             first_i2 =first_i +ind_shift(4);
    1636             first_j1 =first_j +ind_shift(1);
    1637             first_j2 =first_j +ind_shift(2);
    1638             last_i1=last_i +ind_shift(3);
    1639             last_i2 =last_i +ind_shift(4);   
    1640             last_j1 =last_j +ind_shift(1);
    1641             last_j2 =last_j +ind_shift(2);
    1642             siz=size(SeriesData.Time{1});
    1643             if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2
    1644                 time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2;
    1645                 time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2;
    1646             else%read the time in the nc files
    1647                 RootPath=get(handles.RootPath,'String');
    1648                 RootFile=get(handles.RootFile,'String');
    1649                 SubDir=get(handles.SubDir,'String');
    1650                 %VelType=get(handles.VelType,'String');
    1651                 VelType_str=get(handles.VelTypeMenu,'String');
    1652                 VelType_val=get(handles.VelTypeMenu,'Value');
    1653                 VelType=VelType_str{VelType_val};
    1654                 filebase=fullfile(RootPath{1},RootFile{1});
    1655                 [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview});
    1656                 if  exist(filefirst,'file')
    1657                     Attrib=nc2struct(filefirst,[]);
    1658                     if isfield(Attrib,'Time')
    1659                         time_first=Attrib.Time;
    1660                     else
    1661                         if isfield(Attrib,'absolut_time_T0')
    1662                             time_first=Attrib.absolut_time_T0;
    1663                         end
    1664                         if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))
    1665                             time_first=Attrib.absolut_time_T0_2;
    1666                         end
    1667                     end
    1668                 end
    1669                 [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview});
    1670                 if exist(filelast,'file')
    1671                    Attrib=nc2struct(filelast,[]);
    1672                     if isfield(Attrib,'Time')
    1673                         time_last=Attrib.Time;
    1674                     else
    1675                         if isfield(Attrib,'absolut_time_T0')
    1676                             time_last=Attrib.absolut_time_T0;
    1677                         end
    1678                         if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))
    1679                             time_last=Attrib.absolut_time_T0_2;
    1680                         end
    1681                     end
    1682                 end
    1683             end
    1684         end
    1685     else
    1686         siz=size(time);
    1687         if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1
    1688             time_first=times(first_i,first_j);
    1689             time_last=times(last_i,last_j);
    1690         end
    1691     end
    1692     time_first_cell{iview}=num2str(time_first,4);
    1693     time_last_cell{iview}=num2str(time_last,4);
    1694 end
    1695 
     1615
     1616
     1617%
     1618% NomType=InputTable(:,4);
     1619% mode_list=get(handles.mode,'String');
     1620% index_mode=get(handles.mode,'Value');
     1621%
     1622% mode=mode_list{index_mode};
     1623%
     1624% time_first=[];
     1625% time_last=[];
     1626% if ~isfield(SeriesData,'Time')
     1627%     SeriesData.Time{1}=[];
     1628% end
     1629% TimeTable=get(handles.TimeTable,'Data');
     1630% for iview=1:size(TimeTable,1)
     1631%     time_first_cell{iview}='?';
     1632%     time_last_cell{iview}='?';%default
     1633%     time=SeriesData.Time{iview};
     1634%     if isequal(NomType{iview},'_1-2_1')|isequal(NomType{iview},'_1_1-2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_1-2')
     1635%         if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num)
     1636%             ind_shift=SeriesData.displ_num(iview,:);
     1637%             if isequal(mode,'bursts')
     1638%                 first_j=0;
     1639%                 last_j=0;
     1640%             end
     1641%             first_i1=first_i +ind_shift(3);
     1642%             first_i2 =first_i +ind_shift(4);
     1643%             first_j1 =first_j +ind_shift(1);
     1644%             first_j2 =first_j +ind_shift(2);
     1645%             last_i1=last_i +ind_shift(3);
     1646%             last_i2 =last_i +ind_shift(4);   
     1647%             last_j1 =last_j +ind_shift(1);
     1648%             last_j2 =last_j +ind_shift(2);
     1649%             siz=size(SeriesData.Time{1});
     1650%             if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2
     1651%                 time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2;
     1652%                 time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2;
     1653%             else%read the time in the nc files
     1654%                 RootPath=get(handles.RootPath,'String');
     1655%                 RootFile=get(handles.RootFile,'String');
     1656%                 SubDir=get(handles.SubDir,'String');
     1657%                 %VelType=get(handles.VelType,'String');
     1658%                 VelType_str=get(handles.VelTypeMenu,'String');
     1659%                 VelType_val=get(handles.VelTypeMenu,'Value');
     1660%                 VelType=VelType_str{VelType_val};
     1661%                 filebase=fullfile(RootPath{1},RootFile{1});
     1662%                 [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview});
     1663%                 if  exist(filefirst,'file')
     1664%                     Attrib=nc2struct(filefirst,[]);
     1665%                     if isfield(Attrib,'Time')
     1666%                         time_first=Attrib.Time;
     1667%                     else
     1668%                         if isfield(Attrib,'absolut_time_T0')
     1669%                             time_first=Attrib.absolut_time_T0;
     1670%                         end
     1671%                         if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))
     1672%                             time_first=Attrib.absolut_time_T0_2;
     1673%                         end
     1674%                     end
     1675%                 end
     1676%                 [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview});
     1677%                 if exist(filelast,'file')
     1678%                    Attrib=nc2struct(filelast,[]);
     1679%                     if isfield(Attrib,'Time')
     1680%                         time_last=Attrib.Time;
     1681%                     else
     1682%                         if isfield(Attrib,'absolut_time_T0')
     1683%                             time_last=Attrib.absolut_time_T0;
     1684%                         end
     1685%                         if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))
     1686%                             time_last=Attrib.absolut_time_T0_2;
     1687%                         end
     1688%                     end
     1689%                 end
     1690%             end
     1691%         end
     1692%     else
     1693%         siz=size(time);
     1694%         if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1
     1695%             time_first=times(first_i,first_j);
     1696%             time_last=times(last_i,last_j);
     1697%         end
     1698%     end
     1699%     time_first_cell{iview}=num2str(time_first,4);
     1700%     time_last_cell{iview}=num2str(time_last,4);
     1701% end
     1702%
    16961703
    16971704%------------------------------------------------------------------------
     
    20692076if value
    20702077     set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow
    2071 %      DataInit.ParentButton=handles.GetObject;
    20722078     hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
    20732079     if ishandle(hset_object)
    2074          uistack(hset_object,'top')
    2075         %[SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface
     2080         uistack(hset_object,'top')% show the GUI set_object if opened
    20762081     else
    20772082         %get the object file
    20782083         InputTable=get(handles.InputTable,'Data');
    20792084         defaultname=InputTable{1,1};
    2080 %          defaultname=get(handles.RootPath,'String');
    20812085         if isempty(defaultname)
    20822086            defaultname={''};
     
    20882092        'Pick an xml object file (or use uvmat to create it)',defaultname{1});
    20892093        fileinput=[PathName FileName];%complete file name
    2090         testblank=findstr(fileinput,' ');%look for blanks
    2091         if ~isempty(testblank)
    2092             msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
    2093             return
    2094         end
    20952094        sizf=size(fileinput);
    20962095        if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
     
    21042103             data.ProjMode='projection';
    21052104        end
    2106         transform_menu=get(handles.transform_fct,'String');
    2107         ichoice=get(handles.transform_fct,'Value');
    2108 %         if isequal(transform_menu{ichoice},'px');
    2109 %             data.CoordType='px';
    2110 %         else
    2111 %             data.CoordType='phys';
    2112 %         end
    2113         data.desable_plot=1;
     2105%         data.desable_plot=1;
    21142106        [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface
    21152107     end
    21162108else
    21172109    set(handles.GetObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green
    2118 %     if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object)
    2119 %         close(SeriesData.hset_object)
    2120 %     end
    21212110end
    21222111set(handles.series,'UserData',SeriesData)
Note: See TracChangeset for help on using the changeset viewer.