Changeset 421 for trunk/src/series.m
- Timestamp:
- May 14, 2012, 7:03:14 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r419 r421 1571 1571 % last_j=str2num(get(handles.num_last_j,'String')); 1572 1572 TimeTable=get(handles.TimeTable,'Data'); 1573 1573 Pairs=get(handles.PairString,'Data'); 1574 1574 for iview=1:size(TimeTable,1) 1575 Pairs=get(handles.PairString,'Data'); 1575 if size(SeriesData.Time,1)<iview 1576 break 1577 end 1576 1578 i1=ref_i; 1577 1579 j1=ref_j; 1578 1580 i2=ref_i; 1579 1581 j2=ref_j; 1582 % case of pairs 1580 1583 if ~isempty(Pairs{iview,1}) 1581 r=regexp(Pa ram.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'); 1582 1585 if isempty(r) 1583 r=regexp(Pa ram.Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');1586 r=regexp(Pairs.list_pair_civ,'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names'); 1584 1587 end 1585 1588 switch r.mode … … 1595 1598 end 1596 1599 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 1606 1613 end 1607 1614 set(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 end1622 TimeTable=get(handles.TimeTable,'Data');1623 for iview=1:size(TimeTable,1)1624 time_first_cell{iview}='?';1625 time_last_cell{iview}='?';%default1626 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 end1634 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_j21644 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 files1647 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 else1661 if isfield(Attrib,'absolut_time_T0')1662 time_first=Attrib.absolut_time_T0;1663 end1664 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 end1667 end1668 end1669 [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 else1675 if isfield(Attrib,'absolut_time_T0')1676 time_last=Attrib.absolut_time_T0;1677 end1678 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 end1681 end1682 end1683 end1684 end1685 else1686 siz=size(time);1687 if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=11688 time_first=times(first_i,first_j);1689 time_last=times(last_i,last_j);1690 end1691 end1692 time_first_cell{iview}=num2str(time_first,4);1693 time_last_cell{iview}=num2str(time_last,4);1694 end1695 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 % 1696 1703 1697 1704 %------------------------------------------------------------------------ … … 2069 2076 if value 2070 2077 set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow 2071 % DataInit.ParentButton=handles.GetObject;2072 2078 hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle 2073 2079 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 2076 2081 else 2077 2082 %get the object file 2078 2083 InputTable=get(handles.InputTable,'Data'); 2079 2084 defaultname=InputTable{1,1}; 2080 % defaultname=get(handles.RootPath,'String');2081 2085 if isempty(defaultname) 2082 2086 defaultname={''}; … … 2088 2092 'Pick an xml object file (or use uvmat to create it)',defaultname{1}); 2089 2093 fileinput=[PathName FileName];%complete file name 2090 testblank=findstr(fileinput,' ');%look for blanks2091 if ~isempty(testblank)2092 msgbox_uvmat('ERROR','forbidden input file name: contain blanks')2093 return2094 end2095 2094 sizf=size(fileinput); 2096 2095 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end … … 2104 2103 data.ProjMode='projection'; 2105 2104 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; 2114 2106 [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface 2115 2107 end 2116 2108 else 2117 2109 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 % end2121 2110 end 2122 2111 set(handles.series,'UserData',SeriesData)
Note: See TracChangeset
for help on using the changeset viewer.