Index: trunk/src/series.m
===================================================================
--- trunk/src/series.m	(revision 863)
+++ trunk/src/series.m	(revision 867)
@@ -135,5 +135,5 @@
 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series
 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series'
-ActionExtList={'.m';'.sh'};% default choice of extensions (Matlab fct .m or compiled version .sh
+ActionExtList={'.m';'.sh';'.py (in dev.)'};% default choice of extensions (Matlab fct .m or compiled version .sh
 ActionPathList=cell(NbBuiltinAction,1);%initiate the cell matrix of Action fct paths
 ActionPathList(:)={path_series_fct}; %set the default path to series fcts to all list members
@@ -620,5 +620,6 @@
     if ~exist(RootPath,'dir')
         i1_series=[];
-        RootPath=fileparts(RootPath); %will try the upper folder
+        %RootPath=fileparts(RootPath); %will try the upper folder
+        RootFile='';
     else %scan the input folder
         [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=...
@@ -626,5 +627,5 @@
     end
     % if no file is found, open a browser
-    if isempty(i1_series)
+    if isempty(RootFile)&& isempty(i1_series)
         fileinput=uigetfile_uvmat(['wrong input at line ' num2str(iview) ':pick a new input file'],RootPath);
         if isempty(fileinput)
@@ -722,9 +723,9 @@
 if strcmp(iview,'append') % display the input data as a new line in the table
     iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line
-    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
+%     InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
 elseif strcmp(iview,'one') % refresh the list of  input  file series
     iview=1; %the first line in InputTable becomes the current line
     InputTable={'','','','',''};
-    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
+%     InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
     set(handles.TimeTable,'Data',[{''},{[]},{[]},{[]},{[]}])
     set(handles.MinIndex_i,'Data',[])
@@ -742,4 +743,12 @@
     SeriesData.Time={};
 end
+   SeriesData.i1_series(iview+1:end)=[];
+    SeriesData.i2_series(iview+1:end)=[];
+    SeriesData.j1_series(iview+1:end)=[];
+    SeriesData.j2_series(iview+1:end)=[];
+    SeriesData.FileType(iview+1:end)=[];
+    SeriesData.FileInfo(iview+1:end)=[];
+    SeriesData.Time(iview+1:end)=[];
+ InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
 if iview >1
     set(handles.InputLine,'String',num2str(iview))
@@ -1396,5 +1405,5 @@
 ActionExt='.m';%default
 if isfield(Param.Action,'ActionExt')
-    ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)
+    ActionExt=Param.Action.ActionExt;% '.m', '.sh' (compiled)  or '.py' (Python)
     Param.Action=rmfield(Param.Action,'ActionExt');%remove from the recorded xml file to avoid interference during ImportConfig
 end
@@ -1647,4 +1656,22 @@
 set(handles.status,'UserData',StatusData)
 
+
+if strcmp(ActionExt, '.py (in dev.)')
+    fprintf([
+        '\n' ...
+        '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n' ...
+        'The option .py is used. It is still in development.\n' ...
+        'Do not use it unless you really know what you do!\n' ...
+        'To try it, first install Pyp and the most recent version of FluidDyn.\n' ...
+        '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'])
+    RunMode = 'python';
+    t = struct2xml(Param);
+    t = set(t, 1, 'name', 'Series');
+    filexml = fullfile_uvmat(DirXml, '', Param.InputTable{1,3}, '.xml', OutputNomType,...
+         Param.IndexRange.first_i, Param.IndexRange.last_i, first_j, last_j);
+    save(t, filexml);
+end
+
+
 %% direct processing on the current Matlab session
 if strcmp (RunMode,'local')
@@ -1682,5 +1709,5 @@
         end
     end
-else
+elseif ~strcmp(RunMode,'python')
     %% processing on a different session of the same computer (background) or cluster, create executable files
     batch_file_list=cell(NbProcess,1);% initiate the list of executable files
@@ -1837,4 +1864,10 @@
         system(oar_command);  
         msgbox_uvmat('CONFIRMATION',[ActionName ' launched in cluster: press STATUS to see results'])
+    case 'python'
+        command = [
+            'LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "p.split('':'') | [s for s in p if ''matlab'' not in s] | '':''.join(p)") ' ...
+            'python -m fluiddyn.postproc.uvmat ' filexml];
+        % fprintf(['command:\n' command '\n\n'])
+        system(command, '-echo');
 end
 
@@ -1859,4 +1892,10 @@
 if isfield(Param,'Pairs')
     Param=rmfield(Param,'Pairs'); %info Pairs not needed for output
+end
+if isfield(Param,'InputLine')
+    Param=rmfield(Param,'InputLine');
+end
+if isfield(Param,'EditObject')
+    Param=rmfield(Param,'EditObject');
 end
 Param.IndexRange.TimeSource=Param.IndexRange.TimeTable{end,1};
@@ -2328,5 +2367,5 @@
     SeriesData=get(handles.series,'UserData');
     % input line for which the field choice is relevant
-    iview=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));% all nc files, icluding civ
+    iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'}));% all nc files, icluding civ
     hget_field=findobj(allchild(0),'name','get_field');
     if ~isempty(hget_field)
@@ -2337,5 +2376,5 @@
     % check the existence of the first file in the series
     first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1;%default setting for index j
-    if isfield(Param.IndexRange,'first_j');% if index j is used
+    if isfield(Param.IndexRange,'first_j');% if index j is used     
         first_j=Param.IndexRange.first_j;
         last_j=Param.IndexRange.last_j;
@@ -2346,6 +2385,15 @@
     if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString{iview}; end
     [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
-    FirstFileName=fullfile_uvmat(InputTable{1},InputTable{2},InputTable{3},...
-        InputTable{5},InputTable{4},i1,i2,j1,j2);
+    LineIndex=iview(1);
+    if numel(iview)>1      
+        answer=msgbox_uvmat('INPUT_TXT',['select the line of the input table:' num2str(iview)] ,num2str(iview(1)));
+        LineIndex=str2num(answer);
+%         InputLine=str2num(get(handles.InputLine,'String'));
+%         if ismember(InputLine,iview)
+%             LineIndex=InputLine;
+%         end
+    end
+    FirstFileName=fullfile_uvmat(InputTable{LineIndex,1},InputTable{LineIndex,2},InputTable{LineIndex,3},...
+        InputTable{LineIndex,5},InputTable{LineIndex,4},i1,i2,j1,j2);
     if exist(FirstFileName,'file')
         ParamIn.Title='get_field: pick input variables and coordinates for series processing';
@@ -2372,13 +2420,13 @@
                 XName='X';
                 YName='y';
-                set(handles.VelType,'visible','on')
-                set(handles.VelType_title,'visible','on')
         end
         set(handles.FieldName,'Value',1)
         set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
         if ~strcmp(GetFieldData.FieldOption,'civdata...')
-            set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default
-            set(handles.VelType,'visible','off')
-            set(handles.VelType_title,'visible','off')
+           if ~isempty(regexp(FieldList{1},'^vec'))
+                set(handles.FieldName,'Value',1)
+           else
+                set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default
+           end
             XName=GetFieldData.Coordinates.Coord_x;
             YName=GetFieldData.Coordinates.Coord_y;
@@ -2392,8 +2440,8 @@
                     TimeName=['att:' GetFieldData.Time.TimeName];
                     % update the time table
-                    TimeTable{iview,2}=get_time(Param.IndexRange.MinIndex_i(iview),MinIndex_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName);  % Min time     
-                    TimeTable{iview,3}=get_time(Param.IndexRange.first_i,first_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName);  % first time              
-                    TimeTable{iview,4}=get_time(Param.IndexRange.last_i,last_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName);  % last time                     
-                    TimeTable{iview,5}=get_time(Param.IndexRange.MaxIndex_i(iview),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{iview},GetFieldData.Time.TimeName);  % Max time
+                    TimeTable{LineIndex,2}=get_time(Param.IndexRange.MinIndex_i(LineIndex),MinIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName);  % Min time     
+                    TimeTable{LineIndex,3}=get_time(Param.IndexRange.first_i,first_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName);  % first time              
+                    TimeTable{LineIndex,4}=get_time(Param.IndexRange.last_i,last_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName);  % last time                     
+                    TimeTable{LineIndex,5}=get_time(Param.IndexRange.MaxIndex_i(LineIndex),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName);  % Max time
                 case 'variable'
                     set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
@@ -2409,9 +2457,11 @@
                     ParamIn.TimeDimName=GetFieldData.Time.TimeName;
             end
-            TimeTable{iview,1}=TimeName;
+            TimeTable{LineIndex,1}=TimeName;
             set(handles.TimeTable,'Data',TimeTable);
         end
         set(handles.Coord_x,'String',XName)
         set(handles.Coord_y,'String',YName)
+        set(handles.Coord_x,'Visible','on')
+        set(handles.Coord_y,'Visible','on')
     else
         msgbox_uvmat('ERROR',[FirstFileName ' does not exist'])
@@ -3106,6 +3156,9 @@
 ActionExtList=get(handles.ActionExt,'String');
 ActionExt=ActionExtList{get(handles.ActionExt,'Value')};
-ActionList=get(handles.ActionName,'String');
-ActionName=ActionList{get(handles.ActionName,'Value')};
+if strcmp(ActionExt,'.py (in dev.)')
+    set(handles.RunMode,'Value',2)
+end
+% ActionList=get(handles.ActionName,'String');
+% ActionName=ActionList{get(handles.ActionName,'Value')};
 
 function num_NbProcess_Callback(hObject, eventdata, handles)
