Changeset 867 for trunk/src/series.m
- Timestamp:
- Feb 12, 2015, 9:31:47 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r863 r867 135 135 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series 136 136 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series' 137 ActionExtList={'.m';'.sh' };% default choice of extensions (Matlab fct .m or compiled version .sh137 ActionExtList={'.m';'.sh';'.py (in dev.)'};% default choice of extensions (Matlab fct .m or compiled version .sh 138 138 ActionPathList=cell(NbBuiltinAction,1);%initiate the cell matrix of Action fct paths 139 139 ActionPathList(:)={path_series_fct}; %set the default path to series fcts to all list members … … 620 620 if ~exist(RootPath,'dir') 621 621 i1_series=[]; 622 RootPath=fileparts(RootPath); %will try the upper folder 622 %RootPath=fileparts(RootPath); %will try the upper folder 623 RootFile=''; 623 624 else %scan the input folder 624 625 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=... … … 626 627 end 627 628 % if no file is found, open a browser 628 if isempty( i1_series)629 if isempty(RootFile)&& isempty(i1_series) 629 630 fileinput=uigetfile_uvmat(['wrong input at line ' num2str(iview) ':pick a new input file'],RootPath); 630 631 if isempty(fileinput) … … 722 723 if strcmp(iview,'append') % display the input data as a new line in the table 723 724 iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line 724 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];725 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 725 726 elseif strcmp(iview,'one') % refresh the list of input file series 726 727 iview=1; %the first line in InputTable becomes the current line 727 728 InputTable={'','','','',''}; 728 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];729 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 729 730 set(handles.TimeTable,'Data',[{''},{[]},{[]},{[]},{[]}]) 730 731 set(handles.MinIndex_i,'Data',[]) … … 742 743 SeriesData.Time={}; 743 744 end 745 SeriesData.i1_series(iview+1:end)=[]; 746 SeriesData.i2_series(iview+1:end)=[]; 747 SeriesData.j1_series(iview+1:end)=[]; 748 SeriesData.j2_series(iview+1:end)=[]; 749 SeriesData.FileType(iview+1:end)=[]; 750 SeriesData.FileInfo(iview+1:end)=[]; 751 SeriesData.Time(iview+1:end)=[]; 752 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 744 753 if iview >1 745 754 set(handles.InputLine,'String',num2str(iview)) … … 1396 1405 ActionExt='.m';%default 1397 1406 if isfield(Param.Action,'ActionExt') 1398 ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)1407 ActionExt=Param.Action.ActionExt;% '.m', '.sh' (compiled) or '.py' (Python) 1399 1408 Param.Action=rmfield(Param.Action,'ActionExt');%remove from the recorded xml file to avoid interference during ImportConfig 1400 1409 end … … 1647 1656 set(handles.status,'UserData',StatusData) 1648 1657 1658 1659 if strcmp(ActionExt, '.py (in dev.)') 1660 fprintf([ 1661 '\n' ... 1662 '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n' ... 1663 'The option .py is used. It is still in development.\n' ... 1664 'Do not use it unless you really know what you do!\n' ... 1665 'To try it, first install Pyp and the most recent version of FluidDyn.\n' ... 1666 '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n']) 1667 RunMode = 'python'; 1668 t = struct2xml(Param); 1669 t = set(t, 1, 'name', 'Series'); 1670 filexml = fullfile_uvmat(DirXml, '', Param.InputTable{1,3}, '.xml', OutputNomType,... 1671 Param.IndexRange.first_i, Param.IndexRange.last_i, first_j, last_j); 1672 save(t, filexml); 1673 end 1674 1675 1649 1676 %% direct processing on the current Matlab session 1650 1677 if strcmp (RunMode,'local') … … 1682 1709 end 1683 1710 end 1684 else 1711 elseif ~strcmp(RunMode,'python') 1685 1712 %% processing on a different session of the same computer (background) or cluster, create executable files 1686 1713 batch_file_list=cell(NbProcess,1);% initiate the list of executable files … … 1837 1864 system(oar_command); 1838 1865 msgbox_uvmat('CONFIRMATION',[ActionName ' launched in cluster: press STATUS to see results']) 1866 case 'python' 1867 command = [ 1868 'LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "p.split('':'') | [s for s in p if ''matlab'' not in s] | '':''.join(p)") ' ... 1869 'python -m fluiddyn.postproc.uvmat ' filexml]; 1870 % fprintf(['command:\n' command '\n\n']) 1871 system(command, '-echo'); 1839 1872 end 1840 1873 … … 1859 1892 if isfield(Param,'Pairs') 1860 1893 Param=rmfield(Param,'Pairs'); %info Pairs not needed for output 1894 end 1895 if isfield(Param,'InputLine') 1896 Param=rmfield(Param,'InputLine'); 1897 end 1898 if isfield(Param,'EditObject') 1899 Param=rmfield(Param,'EditObject'); 1861 1900 end 1862 1901 Param.IndexRange.TimeSource=Param.IndexRange.TimeTable{end,1}; … … 2328 2367 SeriesData=get(handles.series,'UserData'); 2329 2368 % input line for which the field choice is relevant 2330 iview=find( strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));% all nc files, icluding civ2369 iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'}));% all nc files, icluding civ 2331 2370 hget_field=findobj(allchild(0),'name','get_field'); 2332 2371 if ~isempty(hget_field) … … 2337 2376 % check the existence of the first file in the series 2338 2377 first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1;%default setting for index j 2339 if isfield(Param.IndexRange,'first_j');% if index j is used 2378 if isfield(Param.IndexRange,'first_j');% if index j is used 2340 2379 first_j=Param.IndexRange.first_j; 2341 2380 last_j=Param.IndexRange.last_j; … … 2346 2385 if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString{iview}; end 2347 2386 [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString); 2348 FirstFileName=fullfile_uvmat(InputTable{1},InputTable{2},InputTable{3},... 2349 InputTable{5},InputTable{4},i1,i2,j1,j2); 2387 LineIndex=iview(1); 2388 if numel(iview)>1 2389 answer=msgbox_uvmat('INPUT_TXT',['select the line of the input table:' num2str(iview)] ,num2str(iview(1))); 2390 LineIndex=str2num(answer); 2391 % InputLine=str2num(get(handles.InputLine,'String')); 2392 % if ismember(InputLine,iview) 2393 % LineIndex=InputLine; 2394 % end 2395 end 2396 FirstFileName=fullfile_uvmat(InputTable{LineIndex,1},InputTable{LineIndex,2},InputTable{LineIndex,3},... 2397 InputTable{LineIndex,5},InputTable{LineIndex,4},i1,i2,j1,j2); 2350 2398 if exist(FirstFileName,'file') 2351 2399 ParamIn.Title='get_field: pick input variables and coordinates for series processing'; … … 2372 2420 XName='X'; 2373 2421 YName='y'; 2374 set(handles.VelType,'visible','on')2375 set(handles.VelType_title,'visible','on')2376 2422 end 2377 2423 set(handles.FieldName,'Value',1) 2378 2424 set(handles.FieldName,'String',[FieldList; {'get_field...'}]); 2379 2425 if ~strcmp(GetFieldData.FieldOption,'civdata...') 2380 set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default 2381 set(handles.VelType,'visible','off') 2382 set(handles.VelType_title,'visible','off') 2426 if ~isempty(regexp(FieldList{1},'^vec')) 2427 set(handles.FieldName,'Value',1) 2428 else 2429 set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default 2430 end 2383 2431 XName=GetFieldData.Coordinates.Coord_x; 2384 2432 YName=GetFieldData.Coordinates.Coord_y; … … 2392 2440 TimeName=['att:' GetFieldData.Time.TimeName]; 2393 2441 % update the time table 2394 TimeTable{ iview,2}=get_time(Param.IndexRange.MinIndex_i(iview),MinIndex_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % Min time2395 TimeTable{ iview,3}=get_time(Param.IndexRange.first_i,first_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % first time2396 TimeTable{ iview,4}=get_time(Param.IndexRange.last_i,last_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % last time2397 TimeTable{ iview,5}=get_time(Param.IndexRange.MaxIndex_i(iview),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName); % Max time2442 TimeTable{LineIndex,2}=get_time(Param.IndexRange.MinIndex_i(LineIndex),MinIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % Min time 2443 TimeTable{LineIndex,3}=get_time(Param.IndexRange.first_i,first_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % first time 2444 TimeTable{LineIndex,4}=get_time(Param.IndexRange.last_i,last_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % last time 2445 TimeTable{LineIndex,5}=get_time(Param.IndexRange.MaxIndex_i(LineIndex),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % Max time 2398 2446 case 'variable' 2399 2447 set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName]) … … 2409 2457 ParamIn.TimeDimName=GetFieldData.Time.TimeName; 2410 2458 end 2411 TimeTable{ iview,1}=TimeName;2459 TimeTable{LineIndex,1}=TimeName; 2412 2460 set(handles.TimeTable,'Data',TimeTable); 2413 2461 end 2414 2462 set(handles.Coord_x,'String',XName) 2415 2463 set(handles.Coord_y,'String',YName) 2464 set(handles.Coord_x,'Visible','on') 2465 set(handles.Coord_y,'Visible','on') 2416 2466 else 2417 2467 msgbox_uvmat('ERROR',[FirstFileName ' does not exist']) … … 3106 3156 ActionExtList=get(handles.ActionExt,'String'); 3107 3157 ActionExt=ActionExtList{get(handles.ActionExt,'Value')}; 3108 ActionList=get(handles.ActionName,'String'); 3109 ActionName=ActionList{get(handles.ActionName,'Value')}; 3158 if strcmp(ActionExt,'.py (in dev.)') 3159 set(handles.RunMode,'Value',2) 3160 end 3161 % ActionList=get(handles.ActionName,'String'); 3162 % ActionName=ActionList{get(handles.ActionName,'Value')}; 3110 3163 3111 3164 function num_NbProcess_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.