Index: trunk/src/series/civ_series.m
===================================================================
--- trunk/src/series/civ_series.m	(revision 1089)
+++ trunk/src/series/civ_series.m	(revision 1090)
@@ -331,6 +331,7 @@
     end
     if CheckInputFile
+        OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
         if iview_A==0 % no nc file has been entered
-            ncfile=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},Param.InputTable{1,5},...
+            ncfile=fullfile_uvmat(OutputPath,Param.InputTable{1,2},Param.InputTable{1,3},Param.InputTable{1,5},...
                 NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),j1_series_Civ1(ifield),j2_series_Civ1(ifield));
         else% an existing nc file has been entered
@@ -341,12 +342,13 @@
             end
             if strcmp(Param.ActionInput.ListCompareMode,'PIV')
-                ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
+                ncfile=fullfile_uvmat(OutputPath,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
                     j1_series_Civ1(ifield),j2_series_Civ1(ifield));
             else
-                ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],...
+                ncfile=fullfile_uvmat(OutputPath,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],...
                     j1_series_Civ1(ifield),j2_series_Civ1(ifield));
             end
         end
         ncfile_out=ncfile;% by default
+        
         if isfield (Param.ActionInput,'Civ2')
             i1_civ2=i1_series_Civ2(ifield);
@@ -409,5 +411,5 @@
                         end
                     end
-                    if ~exist(ImageName_A,'file')
+                    if isempty(regexp(ImageName_A,'(^http://)|(^https://)')) && ~exist(ImageName_A,'file')
                         disp([ImageName_A ' missing'])
                         continue
@@ -425,5 +427,5 @@
                         FileType_B=FileInfo_B.FileType;
                     end
-                    if ~exist(ImageName_B,'file')
+                    if isempty(regexp(ImageName_B,'(^http://)|(^https://)')) && ~exist(ImageName_B,'file')
                         disp([ImageName_B ' missing'])
                         continue
@@ -492,5 +494,5 @@
                 par_civ1.Mask=mask; %use mask already opened
             else
-                if exist(maskname,'file')
+                if ~isempty(regexp(maskname,'(^http://)|(^https://)'))|| exist(maskname,'file')
                     try
                         par_civ1.Mask=imread(maskname);%update the mask, an store it for future use
Index: trunk/src/series/merge_proj.m
===================================================================
--- trunk/src/series/merge_proj.m	(revision 1089)
+++ trunk/src/series/merge_proj.m	(revision 1090)
@@ -252,4 +252,5 @@
     CheckOverwrite=Param.CheckOverwrite;
 end
+OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
 for index=1:NbField
         update_waitbar(WaitbarHandle,index/NbField)
@@ -276,5 +277,5 @@
         end
     end
-    OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFileOut,FileExtOut,NomTypeOut,i1,i2,j1,j2);
+    OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,FileExtOut,NomTypeOut,i1,i2,j1,j2);
     if ~CheckOverwrite && exist(OutputFile,'file')
             disp(['existing output file ' OutputFile ' already exists, skip to next field'])
Index: trunk/src/series/sliding_average.m
===================================================================
--- trunk/src/series/sliding_average.m	(revision 1090)
+++ trunk/src/series/sliding_average.m	(revision 1090)
@@ -0,0 +1,277 @@
+%'turb_correlation_time': calculate the time correlation function at each point
+%------------------------------------------------------------------------
+% function ParamOut=turb_correlation_time(Param)
+%
+%%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%OUTPUT
+% ParamOut: sets options in the GUI series.fig needed for the function
+%
+%INPUT:
+% In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series.
+% In batch mode, Param is the name of the corresponding xml file containing the same information
+% when Param.Action.RUN=0 (as activated when the current Action is selected
+% in series), the function ouput paramOut set the activation of the needed GUI elements
+%
+% Param contains the elements:(use the menu bar command 'export/GUI config' in series to 
+% see the current structure Param)
+%    .InputTable: cell of input file names, (several lines for multiple input)
+%                      each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension}
+%    .OutputSubDir: name of the subdirectory for data outputs
+%    .OutputDirExt: directory extension for data outputs
+%    .Action: .ActionName: name of the current activated function
+%             .ActionPath:   path of the current activated function
+%             .ActionExt: fct extension ('.m', Matlab fct, '.sh', compiled   Matlab fct
+%             .RUN =0 for GUI input, =1 for function activation
+%             .RunMode='local','background', 'cluster': type of function  use
+%             
+%    .IndexRange: set the file or frame indices on which the action must be performed
+%    .FieldTransform: .TransformName: name of the selected transform function
+%                     .TransformPath:   path  of the selected transform function
+%    .InputFields: sub structure describing the input fields withfields
+%              .FieldName: name(s) of the field
+%              .VelType: velocity type
+%              .FieldName_1: name of the second field in case of two input series
+%              .VelType_1: velocity type of the second field in case of two input series
+%              .Coord_y: name of y coordinate variable
+%              .Coord_x: name of x coordinate variable
+%    .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object)
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%=======================================================================
+% Copyright 2008-2020, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
+%   http://www.legi.grenoble-inp.fr
+%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
+%
+%     This file is part of the toolbox UVMAT.
+%
+%     UVMAT is free software; you can redistribute it and/or modify
+%     it under the terms of the GNU General Public License as published
+%     by the Free Software Foundation; either version 2 of the license,
+%     or (at your option) any later version.
+%
+%     UVMAT is distributed in the hope that it will be useful,
+%     but WITHOUT ANY WARRANTY; without even the implied warranty of
+%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%     GNU General Public License (see LICENSE.txt) for more details.
+%=======================================================================
+
+function ParamOut=sliding_average(Param)
+
+%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
+if isstruct(Param) && isequal(Param.Action.RUN,0)
+    ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
+    ParamOut.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
+    ParamOut.NbSlice=1; %nbre of slices ('off' by default)
+    ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
+    ParamOut.FieldName='one';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
+    ParamOut.FieldTransform = 'on';%can use a transform function
+    ParamOut.ProjObject='off';%can use projection object(option 'off'/'on',
+    ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
+    ParamOut.OutputDirExt='.tfilter';%set the output dir extension
+    ParamOut.OutputFileMode='NbSlice';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
+%     filecell=get_file_series(Param);%check existence of the first input file
+%     if ~exist(filecell{1,1},'file')
+%         msgbox_uvmat('WARNING','the first input file does not exist')
+%     end
+    return
+end
+
+%%%%%%%%%%%%  STANDARD PART  %%%%%%%%%%%%
+ParamOut=[];%default output
+%% read input parameters from an xml file if input is a file name (batch mode)
+checkrun=1;
+if ischar(Param)
+    Param=xml2struct(Param);% read Param as input file (batch case)
+    checkrun=0;
+end
+
+hseries=findobj(allchild(0),'Tag','series');
+RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
+WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
+
+%% define the directory for result file (with path=RootPath{1})
+OutputDir=[Param.OutputSubDir Param.OutputDirExt];
+    
+%% root input file(s) name, type and index series
+RootPath=Param.InputTable(:,1);
+RootFile=Param.InputTable(:,3);
+SubDir=Param.InputTable(:,2);
+NomType=Param.InputTable(:,4);
+FileExt=Param.InputTable(:,5);
+[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
+%%%%%%%%%%%%
+% The cell array filecell is the list of input file names, while
+% filecell{iview,fileindex}:
+%        iview: line in the table corresponding to a given file series
+%        fileindex: file index within  the file series, 
+% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 
+% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
+%%%%%%%%%%%% NbView=1 : a single input series
+NbView=numel(i1_series);%number of input file series (lines in InputTable)
+NbField_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
+NbField_i=size(i1_series{1},2); %nb of fields for the i index
+NbField=NbField_j*NbField_i; %total number of fields
+
+%% determine the file type on each line from the first input file 
+ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
+NcTypeOptions={'netcdf','civx','civdata'};
+for iview=1:NbView
+    if ~exist(filecell{iview,1}','file')
+        msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'])
+        return
+    end
+    [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
+    FileType{iview}=FileInfo{iview}.FileType;
+    CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
+    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
+    if ~isempty(j1_series{iview})
+        frame_index{iview}=j1_series{iview};
+    else
+        frame_index{iview}=i1_series{iview};
+    end
+end
+
+%% calibration data and timing: read the ImaDoc files
+XmlData=[];
+[XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
+if size(time,1)>1
+    diff_time=max(max(diff(time)));
+    if diff_time>0
+        msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])
+    end   
+end
+
+%% coordinate transform or other user defined transform
+transform_fct='';%default
+if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
+    addpath(Param.FieldTransform.TransformPath)
+    transform_fct=str2func(Param.FieldTransform.TransformName);
+    rmpath(Param.FieldTransform.TransformPath)
+end
+
+%%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
+ % EDIT FROM HERE
+
+%% check the validity of  input file types
+if CheckImage{1}
+    FileExtOut='.png'; % write result as .png images for image inputs
+elseif CheckNc{1}
+    FileExtOut='.nc';% write result as .nc files for netcdf inputs
+else
+    msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])
+    return
+end
+
+
+%% settings for the output file
+NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
+first_i=i1_series{1}(1);
+last_i=i1_series{1}(end);
+if isempty(j1_series{1})% if there is no second index j
+    first_j=1;last_j=1;
+else
+    first_j=j1_series{1}(1);
+    last_j=j1_series{1}(end);
+end
+
+%% Set field names and velocity types
+InputFields{1}=[];%default (case of images)
+if isfield(Param,'InputFields')
+    InputFields{1}=Param.InputFields;
+end
+
+nbfiles=0;
+nbmissing=0;
+
+%% initialisation
+T=24.2; %main wave period
+NbPeriod=2; %number of periods for the sliding average
+omega=2*pi/T;
+
+DataOut.ListGlobalAttribute= {'Conventions','Time'};
+DataOut.Conventions='uvmat';
+DataOut.ListVarName={'coord_y','coord_x','Umean','Vmean','Ucos','Vcos','DUDXsin','DUDYsin','DVDXsin','DVDYsin','Ustokes','Vstokes'};
+DataOut.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},...
+    {'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'}};
+
+%%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
+% First get time %
+[Data,tild,errormsg]=nc2struct(filecell{1,1});    
+Time_1=Data.Time;
+if ~isempty(errormsg)
+    disp_uvmat('ERROR',errormsg,checkrun)
+    return
+end
+[Data,tild,errormsg]=nc2struct(filecell{1,end});    
+Time_end=Data.Time;
+dt=(Time_end-Time_1)/(NbField-1); %time interval 
+NpTime=round(NbPeriod*T/dt+1)
+
+%%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
+disp('loop for filtering started')
+for index=1:NbField
+    update_waitbar(WaitbarHandle,index/NbField)
+    if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
+        disp('program stopped by user')
+        break
+    end
+    [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
+    
+    %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
+    if index==1 %first field
+        DataOut.coord_x=Field.coord_x;
+        DataOut.coord_y=Field.coord_y;
+        npy=numel(DataOut.coord_y);
+        npx=numel(DataOut.coord_x);
+        Umean=zeros(NpTime,npy,npx);
+        Vmean=zeros(NpTime,npy,npx);
+        Ucos=zeros(NpTime,npy,npx);
+        Vcos=zeros(NpTime,npy,npx);
+        DUDXsin=zeros(NpTime,npy,npx);
+        DUDYsin=zeros(NpTime,npy,npx);
+        DVDXsin=zeros(NpTime,npy,npx);
+        DVDYsin=zeros(NpTime,npy,npx);
+    end
+      Time(index)=Field.Time;
+    Umean=circshift(Umean,[-1 0 0]); %shift U by ishift along the first index
+        Vmean=circshift(Vmean,[-1 0 0]); %shift U by ishift along the first index
+        Ucos=circshift(Ucos,[-1 0 0]); %shift U by ishift along the first index
+        Vcos=circshift(Vcos,[-1 0 0]); %shift U by ishift along the first index
+        DUDXsin=circshift(DUDXsin,[-1 0 0]);
+        DUDYsin=circshift(DUDYsin,[-1 0 0]);
+        DVDXsin=circshift(DVDXsin,[-1 0 0]);
+        DVDYsin=circshift(DVDYsin,[-1 0 0]);
+        Umean(end,:,:)=Field.U;
+        Vmean(end,:,:)=Field.V;
+        Ucos(end,:,:)=Field.U*cos(omega*Time(index));
+        Vcos(end,:,:)=Field.V*cos(omega*Time(index));
+        DUDXsin(end,:,:)=Field.DUDX*sin(omega*Time(index));
+        DUDYsin(end,:,:)=Field.DUDY*sin(omega*Time(index));
+        DVDXsin(end,:,:)=Field.DVDX*sin(omega*Time(index));
+        DVDYsin(end,:,:)=Field.DVDY*sin(omega*Time(index));
+        DataOut.Time=Time(index)-(NpTime-1)*dt/2;
+        DataOut.Umean=squeeze(nanmean(Umean,1));
+        DataOut.Vmean=squeeze(nanmean(Vmean,1));
+        DataOut.Ucos=2*squeeze(nanmean(Ucos,1));
+        DataOut.Vcos=2*squeeze(nanmean(Vcos,1));
+        DataOut.DUDXsin=2*squeeze(nanmean(DUDXsin,1));
+        DataOut.DUDYsin=2*squeeze(nanmean(DUDYsin,1));
+        DataOut.DVDXsin=2*squeeze(nanmean(DVDXsin,1));
+        DataOut.DVDYsin=2*squeeze(nanmean(DVDYsin,1));
+        DataOut.Ustokes=(1/omega)*(DataOut.Ucos.*DataOut.DUDXsin+DataOut.Vcos.*DataOut.DUDYsin);
+        DataOut.Vstokes=(1/omega)*(DataOut.Ucos.*DataOut.DVDXsin+DataOut.Vcos.*DataOut.DVDYsin);
+    % writing the result file as netcdf file
+    if index-round(NpTime/2)>=1
+        OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomType{1},index-round(NpTime/2));
+        %case of netcdf input file , determine global attributes
+        errormsg=struct2nc(OutputFile,DataOut); %save result file
+        if isempty(errormsg)
+            disp([OutputFile ' written']);
+        else
+            disp(['error in writting result file: ' errormsg])
+        end
+    end
+end
+%%%%%%%%%%%%%%%% end loop on field indices %%%%%%%%%%%%%%%%
+
