Changeset 41 for trunk/src/series.m
- Timestamp:
- Mar 10, 2010, 11:03:36 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r39 r41 1295 1295 end 1296 1296 end 1297 %--------------------------------------------------- 1297 1298 %------------------------------------------------------------------------ 1298 1299 % --- Executes on button press in RUN. 1299 %------------------------------------------------------1300 1300 function RUN_Callback(hObject, eventdata, handles) 1301 1301 %------------------------------------------------------------------------ 1302 1302 %read root name and field type 1303 1303 set(handles.RUN,'BusyAction','queue'); … … 1311 1311 end 1312 1312 SeriesData=get(handles.figure1,'UserData'); 1313 if isfield(SeriesData,'sethandles')1314 if iscell(SeriesData.sethandles)1315 Series.sethandles=SeriesData.sethandles{1};1316 else1317 Series.sethandles=SeriesData.sethandles;%retrieve the handles of the set_object interface (to define projection objects)1318 end1319 end1313 % if isfield(SeriesData,'sethandles') 1314 % if iscell(SeriesData.sethandles) 1315 % Series.sethandles=SeriesData.sethandles{1}; 1316 % else 1317 % Series.sethandles=SeriesData.sethandles;%retrieve the handles of the set_object interface (to define projection objects) 1318 % end 1319 % end 1320 1320 1321 1321 %reinitiate waitbar position … … 1358 1358 Series.CoordType='';%default 1359 1359 if isequal(menu_coord_state,'on') 1360 menu_coord=get(handles.transform_fct,'String');1360 % menu_coord=get(handles.transform_fct,'String'); 1361 1361 menu_index=get(handles.transform_fct,'Value'); 1362 Series.CoordType=menu_coord{menu_index}; 1363 end 1364 Series.hseries=get(hObject,'Parent'); 1365 if isequal(get(handles.ParamVal,'Visible'),'on') 1366 ParamKey=get(handles.ParamKey,'String'); 1367 if ischar(ParamKey) 1368 ParamKey{1}=ParamKey; 1369 end 1370 ParamString=get(handles.ParamVal,'String'); 1371 if ischar(ParamString) 1372 for ilist=1:size(ParamString,1) 1373 ParamVal{ilist}=ParamString(ilist,:); 1374 end 1375 else 1376 ParamVal=ParamString; 1377 end 1378 end 1362 transform_list=get(handles.transform_fct,'UserData'); 1363 Series.transform_fct=transform_list{menu_index};% transform function handles 1364 end 1365 Series.hseries=handles.figure1; % handles to the series GUI 1366 % if isequal(get(handles.ParamVal,'Visible'),'on') 1367 % ParamKey=get(handles.ParamKey,'String'); 1368 % if ischar(ParamKey) 1369 % ParamKey{1}=ParamKey; 1370 % end 1371 % ParamString=get(handles.ParamVal,'String'); 1372 % if ischar(ParamString) 1373 % for ilist=1:size(ParamString,1) 1374 % ParamVal{ilist}=ParamString(ilist,:); 1375 % end 1376 % else 1377 % ParamVal=ParamString; 1378 % end 1379 % end 1379 1380 1380 1381 %read the set of field numbers … … 1482 1483 end 1483 1484 1484 % RUN RUN'1485 % defining the ACTION function handle 1485 1486 path_series=which('series'); 1486 1487 list_path=get(handles.ACTION,'UserData'); … … 1489 1490 if ~isequal(fct_path,path_series) 1490 1491 eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION 1491 if ~isequal(spath,fct_path)& exist(fct_path,'dir') 1492 if ~exist(fct_path,'dir') 1493 msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist']) 1494 return 1495 end 1496 if ~isequal(spath,fct_path) 1492 1497 addpath(fct_path)% add the prescribed path if not the current one 1493 1498 end 1494 1499 end 1495 % fct_path 1496 eval(['h_fun=@' action ';']) 1500 eval(['h_fun=@' action ';'])%create a function handle for ACTION 1497 1501 if ~isequal(fct_path,path_series) 1498 1502 rmpath(fct_path)% add the prescribed path if not the current one 1499 1503 end 1500 1504 1505 % RUN ACTION 1501 1506 Series.Action=action;%name of the processing programme 1502 1507 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1503 1508 drawnow 1504 1509 if length(RootPath)>1 1505 % feval(action,num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series);1506 1510 h_fun(num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series); 1507 1511 else 1508 1512 h_fun(num_i1,num_i2,num_j1,num_j2,Series); 1509 % feval(action,num_i1,num_i2,num_j1,num_j2,Series);1510 1513 end 1511 1514 set(handles.RUN,'BackgroundColor',[1 0 0]) … … 1525 1528 % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) 1526 1529 1527 %---------------------------------------------------- 1530 %------------------------------------------------------------------------ 1528 1531 function STOP_Callback(hObject, eventdata, handles) 1532 %------------------------------------------------------------------------ 1529 1533 set(handles.RUN, 'BusyAction','cancel') 1530 1534 set(handles.RUN,'BackgroundColor',[1 0 0]) 1531 1535 1532 %---------------------------------------------- 1533 1534 %---------------------------------------------------- 1536 1537 %------------------------------------------------------------------------ 1535 1538 function first_i_Callback(hObject, eventdata, handles) 1539 %------------------------------------------------------------------------ 1536 1540 last_i_Callback(hObject, eventdata, handles) 1537 1541 1538 %---------------------------------------------- 1542 %------------------------------------------------------------------------ 1539 1543 function last_i_Callback(hObject, eventdata, handles) 1544 %------------------------------------------------------------------------ 1540 1545 % hseries=get(handles.last_i,'parent'); 1541 1546 first_i=str2num(get(handles.first_i,'String')); … … 1550 1555 displ_time(handles,SeriesData.Time{1}); 1551 1556 1552 %------------------------------------------------------- 1557 %------------------------------------------------------------------------ 1553 1558 function first_j_Callback(hObject, eventdata, handles) 1559 %------------------------------------------------------------------------ 1554 1560 last_j_Callback(hObject, eventdata, handles) 1555 1561 1556 %------------------------------------------------------- 1562 %------------------------------------------------------------------------ 1557 1563 function last_j_Callback(hObject, eventdata, handles) 1558 % hseries=get(handles.last_i,'parent'); 1564 %------------------------------------------------------------------------ 1559 1565 first_j=str2num(get(handles.first_j,'String')); 1560 1566 last_j=str2num(get(handles.last_j,'String')); 1561 1567 ref_j=ceil((first_j+last_j)/2); 1562 1568 set(handles.ref_j,'String', num2str(ref_j)) 1563 1564 1569 ref_j_Callback(hObject, eventdata, handles) 1565 1570 SeriesData=get(handles.figure1,'UserData'); … … 1570 1575 1571 1576 1572 1573 1574 %------------------------------------------------------- 1577 %------------------------------------------------------------------------ 1575 1578 function ref_i_Callback(hObject, eventdata, handles) 1579 %------------------------------------------------------------------------ 1576 1580 mode_list=get(handles.mode,'String'); 1577 1581 mode_value=get(handles.mode,'Value'); … … 1593 1597 end 1594 1598 1595 %---------------------------------------------------- 1599 %------------------------------------------------------------------------ 1596 1600 function ref_j_Callback(hObject, eventdata, handles) 1601 %------------------------------------------------------------------------ 1597 1602 mode_list=get(handles.mode,'String'); 1598 1603 mode_value=get(handles.mode,'Value'); … … 1611 1616 end 1612 1617 1613 %---------------------------------------------------- 1618 %------------------------------------------------------------------------ 1614 1619 % --- Executes on selection change in ACTION. 1615 1620 function ACTION_Callback(hObject, eventdata, handles) 1621 %------------------------------------------------------------------------ 1616 1622 global nb_builtin 1617 1623 list_ACTION=get(handles.ACTION,'String');% list menu fields … … 1710 1716 set(handles.transform_fct,'Enable','off') 1711 1717 %set the displayed GUI item needed for input parameters 1712 %list_input=feval(ACTION);% input list asked by the selected function1713 1718 if ~isequal(path_series,PathName) 1714 1719 addpath(PathName) … … 1720 1725 1721 1726 varargout=h_function(); 1722 %varargout=feval(ACTION);% input list asked by the selected function1723 1727 Param_list={}; 1724 % RootPath=get(handles.RootPath,'String');1725 % RootFile=get(handles.RootFile,'String');1726 1728 1727 1729 %nb_series=length(RootFile); … … 1839 1841 end 1840 1842 1841 %------------------------------------------------------------------- 1843 %------------------------------------------------------------------------ 1842 1844 % --- Executes on selection change in FieldMenu. 1843 %-------------------------------------------------------------------1844 1845 function FieldMenu_Callback(hObject, eventdata, handles) 1845 1846 %------------------------------------------------------------------------ 1846 1847 field_str=get(handles.FieldMenu,'String'); 1847 1848 field_index=get(handles.FieldMenu,'Value'); … … 1868 1869 end 1869 1870 1870 %------------------------------------------------------ 1871 %------------------------------------------------------------------------ 1871 1872 % --- Executes on selection change in FieldMenu_1. 1872 %-----------------------------------------------------1873 1873 function FieldMenu_1_Callback(hObject, eventdata, handles) 1874 %------------------------------------------------------------------------ 1874 1875 field_str=get(handles.FieldMenu_1,'String'); 1875 1876 field_index=get(handles.FieldMenu_1,'Value'); … … 1896 1897 update_menu(handles.FieldMenu_1,scalar) 1897 1898 end 1898 1899 1900 % %group the variables (fields of 'FieldData') in cells of variables with the same dimensions1901 % %%%%%%%%%%%%%%%%%%%%%%% Function independante maintenant1902 % %-----------------------------------------------------------------1903 % [CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1});1904 % %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS1905 % % CellVarIndex=cells of variable index arrays1906 % ivar_new=0; % index of the current variable in the projected field1907 % icoord=0;1908 % for icell=1:length(CellVarIndex)1909 % if NbDim(icell)==11910 % continue1911 % end1912 % VarIndex=CellVarIndex{icell};% indices of the selected variables in the list FieldData.ListVarName1913 % VarType=VarTypeCell{icell};1914 % ivar_X=VarType.coord_x;1915 % ivar_Y=VarType.coord_y;1916 % ivar_FF=VarType.errorflag;1917 % if isempty(ivar_X)1918 % test_grid=1;%test for input data on regular grid (e.g. image)coordinates1919 % else1920 % if length(ivar_Y)~=11921 % warndlg_uvmat('y coordinate missing in proj_field.m','ERROR')1922 % return1923 % end1924 % test_grid=0;1925 % end1926 % % DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)1927 % %case of input fields with unstructured coordinates1928 % if ~test_grid1929 % for ivar=VarIndex1930 % VarName=MergeData.ListVarName{ivar};1931 % for iview=1:nbview1932 % eval(['MergeData.' VarName '=[MergeData.' VarName '; Data{iview}.' VarName ';'])1933 % end1934 % end1935 % %case of fields defined on a structured grid1936 % else1937 % % DimValue=MergeData.DimValue(DimIndices);%set of dimension values1938 % testFF=0;1939 % for iview=2:nbview1940 % % if ~isequal(DimValue,Data{iview}.DimValue(DimIndices))1941 % % MergeData.Txt='ERROR: attempt at merging structured fields with different sizes';1942 % % return1943 % % end1944 % for ivar=VarIndex1945 % VarName=MergeData.ListVarName{ivar};1946 % if isfield(MergeData,'VarAttribute')1947 % if length(MergeData.VarAttribute)>=ivar && isfield(MergeData.VarAttribute{ivar},'Role') && isequal(MergeData.VarAttribute{ivar}.Role,'errorflag')1948 % testFF=1;1949 % end1950 % end1951 % eval(['MergeData.' VarName '=MergeData.' VarName '+ Data{iview}.' VarName ';'])1952 % end1953 % end1954 % if testFF1955 % nbaver=nbview-MergeData.FF;1956 % indgood=find(nbaver>0);1957 % for ivar=VarIndex1958 % VarName=MergeData.ListVarName{ivar};1959 % eval(['MergeData.' VarName '(indgood)=double(MergeData.' VarName '(indgood))./nbaver(indgood);'])1960 % end1961 % else1962 % for ivar=VarIndex1963 % VarName=MergeData.ListVarName{ivar};1964 % eval(['MergeData.' VarName '=double(MergeData.' VarName ')./nbview;'])1965 % end1966 % end1967 % end1968 % end1969 %1970 1899 1971 1900 %----------------------------- … … 2045 1974 end 2046 1975 2047 2048 %----------------------------------------------------------- 2049 % find the times corresponding to the first and last indices of a series 2050 % 1976 %------------------------------------------------------------------------ 1977 % ---- find the times corresponding to the first and last indices of a series 2051 1978 function displ_time(handles,times) 1979 %------------------------------------------------------------------------ 2052 1980 hseries=get(handles.last_i,'parent'); 2053 1981 SeriesData=get(hseries,'UserData');% … … 2146 2074 set(handles.time_last,'String',time_last_cell); 2147 2075 2148 %-------------------------------------------------------------------- 2149 % --- Executes on selection change in VelTypeMenu. 2150 function VelTypeMenu_Callback(hObject, eventdata, handles) 2151 % VelTypeList=get(handles.VelTypeMenu,'String'); 2152 % VelTypeIndex=get(handles.VelTypeMenu,'Value'); 2153 % VelTypeCell=get(handles.VelType,'String'); 2154 % VelTypeCell{1}=VelTypeList{VelTypeIndex}; 2155 % set(handles.VelType,'String',VelTypeCell) 2156 2157 2158 %-------------------------------------------------------------------- 2076 %------------------------------------------------------------------------ 2159 2077 % --- Executes on button press in GetObject. 2160 2078 function GetObject_Callback(hObject, eventdata, handles) 2079 %------------------------------------------------------------------------ 2161 2080 hseries=get(handles.GetObject,'parent'); 2162 2081 SeriesData=get(hseries,'UserData'); … … 2169 2088 [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface 2170 2089 else 2171 DataInit.TITLE='POINTS';%default option 2172 [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface 2090 %get the object file 2091 defaultname=get(handles.RootPath,'String'); 2092 [FileName, PathName, filterindex] = uigetfile( ... 2093 {'*.xml;*.mat', ' (*.xml,*.mat)'; 2094 '*.xml', '.xml files '; ... 2095 '*.mat', '.mat matlab files '}, ... 2096 'Pick a file',defaultname{1}); 2097 fileinput=[PathName FileName];%complete file name 2098 testblank=findstr(fileinput,' ');%look for blanks 2099 if ~isempty(testblank) 2100 msgbox_uvmat('ERROR','forbidden input file name: contain blanks') 2101 return 2102 end 2103 sizf=size(fileinput); 2104 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 2105 %read the file 2106 t=xmltree(fileinput); 2107 data=convert(t); 2108 if ~isfield(data,'Style') 2109 data.Style='points'; 2110 end 2111 if ~isfield(data,'ProjMode') 2112 data.ProjMode='projection'; 2113 end 2114 transform_menu=get(handles.transform_fct,'String'); 2115 ichoice=get(handles.transform_fct,'Value'); 2116 if isequal(transform_menu{ichoice},'px'); 2117 data.CoordType='px'; 2118 else 2119 data.CoordType='phys'; 2120 end 2121 data.desable_plot=1; 2122 [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface 2173 2123 end 2174 2124 else 2175 2125 set(handles.GetObject,'BackgroundColor',[0 1 0])%put activated buttons to green 2176 if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object)2177 close(SeriesData.hset_object)2178 end2126 % if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object) 2127 % close(SeriesData.hset_object) 2128 % end 2179 2129 end 2180 2130 set(hseries,'UserData',SeriesData) … … 2184 2134 value=get(handles.GetMask,'Value'); 2185 2135 if value 2186 errordlg('not implemented yet')2136 msgbox_uvmat('ERROR','not implemented yet') 2187 2137 end 2188 2138 %-------------------------------------------------------------- 2189 2139 2190 %------------------------------------------------------------------- -------2140 %------------------------------------------------------------------- 2191 2141 %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m' 2192 2142 function ncbrowser_uvmat(hObject, eventdata) 2143 %------------------------------------------------------------------- 2193 2144 bla=get(gcbo,'String'); 2194 2145 ind=get(gcbo,'Value'); … … 2198 2149 get_field(filename) 2199 2150 2200 % ------------------------------------------------------------------ --2151 % ------------------------------------------------------------------ 2201 2152 function MenuHelp_Callback(hObject, eventdata, handles) 2202 2153 %------------------------------------------------------------------- 2203 2154 path_to_uvmat=which ('uvmat');% check the path of uvmat 2204 2155 pathelp=fileparts(path_to_uvmat); … … 2210 2161 end 2211 2162 2212 2163 %------------------------------------------------------------------- 2213 2164 % --- Executes on selection change in transform_fct. 2214 2165 function transform_fct_Callback(hObject, eventdata, handles) 2215 2166 %------------------------------------------------------------------- 2216 2167 global nb_transform 2217 2168
Note: See TracChangeset
for help on using the changeset viewer.