Index: trunk/src/series/civ_input.m
===================================================================
--- trunk/src/series/civ_input.m	(revision 873)
+++ trunk/src/series/civ_input.m	(revision 874)
@@ -373,5 +373,5 @@
 
 %% Civ1 parameters
-Param.CheckCiv1=1;
+%Param.CheckCiv1=1;
 Param.Civ1.CorrBoxSize=[25 25];
 Param.Civ1.SearchBoxSize=[55 55];
@@ -387,5 +387,5 @@
 
 %% Fix1 parameters
-Param.CheckFix1=1;
+%Param.CheckFix1=1;
 Param.Fix1.CheckFmin2=1;
 Param.Fix1.CheckF3=1;
@@ -393,5 +393,5 @@
 
 %% Patch1 parameters
-Param.CheckPatch1=1;
+%Param.CheckPatch1=1;
 Param.Patch1.FieldSmooth=10;
 Param.Patch1.MaxDiff=1.5000;
@@ -400,5 +400,5 @@
 
 %% Civ2 parameters
-Param.CheckCiv2=1;
+%Param.CheckCiv2=1;
 Param.Civ2.CorrBoxSize=[21 21];
 Param.Civ2.SearchBoxSize=[27 27];
@@ -413,5 +413,5 @@
 
 %% Fix2 parameters
-Param.CheckFix2=1;
+%Param.CheckFix2=1;
 Param.Fix2.CheckFmin2=1;
 Param.Fix2.CheckF4=1;
@@ -420,5 +420,5 @@
 
 %% Patch2 parameters
-Param.CheckPatch2=1;
+%Param.CheckPatch2=1;
 Param.Patch2.FieldSmooth=2;
 Param.Patch2.MaxDiff=1.5000;
Index: trunk/src/series/merge_proj.m
===================================================================
--- trunk/src/series/merge_proj.m	(revision 873)
+++ trunk/src/series/merge_proj.m	(revision 874)
@@ -446,4 +446,5 @@
                         if iview==1
                             %MergeData.(VarName)=Data{1}.(VarName);% initiate MergeData with the first field
+                            MergeData.(VarName)(check_bad)=0; %set to zero NaN or data marked by error flag
                             NbAver=~check_bad;% initiate NbAver: the nbre of good data for each point
                         elseif size(Data{iview}.(VarName))~=size(MergeData.(VarName))
Index: trunk/src/series/time_series.m
===================================================================
--- trunk/src/series/time_series.m	(revision 873)
+++ trunk/src/series/time_series.m	(revision 874)
@@ -92,4 +92,9 @@
         end
     end
+    % test for subtraction
+       if size(Param.InputTable,1)==2
+            answer=msgbox_uvmat('INPUT_Y-N','substract the two input file series (Yes) or concatene them (No)');
+            ParamOut.ActionInput.CheckSub=str2double(answer);
+        end
     % check the existence of the first and last file in the series
      first_j=[];
@@ -161,4 +166,5 @@
 CheckNc=cell(1,nbview);
 frame_index=cell(1,nbview);
+
 for iview=1:nbview
     if ~exist(filecell{iview,1}','file')
@@ -284,4 +290,8 @@
     VarMesh=Param.ActionInput.VarMesh;
     end
+end
+CheckSub=0;%default
+if isfield(Parma,'ActionInput') && isfield(Param.ActionInput,'CheckSub')
+CheckSub=ParamOut.ActionInput.CheckSub;
 end
 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
@@ -312,21 +322,33 @@
         % coordinate transform (or other user defined transform)
         if ~isempty(transform_fct)
-            switch nargin(transform_fct)
-                case 4
-                    if length(Data)==2
-                        Field=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
-                    else
+            if CheckSub
+                switch nargin(transform_fct)
+                    case 4
+                        if length(Data)==2
+                            Field=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
+                        else
+                            Field=transform_fct(Data{1},XmlData{1});
+                        end
+                    case 3
+                        if length(Data)==2
+                            Field=transform_fct(Data{1},XmlData{1},Data{2});
+                        else
+                            Field=transform_fct(Data{1},XmlData{1});
+                        end
+                    case 2
                         Field=transform_fct(Data{1},XmlData{1});
-                    end
-                case 3
-                    if length(Data)==2
-                        Field=transform_fct(Data{1},XmlData{1},Data{2});
-                    else
-                        Field=transform_fct(Data{1},XmlData{1});
-                    end
-                case 2
-                    Field=transform_fct(Data{1},XmlData{1});
-                case 1
-                    Field=transform_fct(Data{1});
+                    case 1
+                        Field=transform_fct(Data{1});
+                end
+            else
+                if nargin(transform_fct)>=2
+                    for iview=1:nbview
+                        Data{iview}=transform_fct(Data{iview},XmlData{iview});
+                    end
+                else
+                    for iview=1:nbview
+                        Data{iview}=transform_fct(Data{iview});
+                    end
+                end
             end
         end
@@ -344,5 +366,5 @@
             end
         end
-%         nbfile=nbfile+1;
+        %         nbfile=nbfile+1;
         
         % initiate the time series at the first iteration
@@ -441,5 +463,5 @@
                 VarVal=Field.(VarName);
                 if testsum(ivar)==2% test for recorded variable
-                    if isempty(errormsg)                     
+                    if isempty(errormsg)
                         VarVal=shiftdim(VarVal,-1); %shift dimension
                         DataOut.(VarName)(index,:,:)=VarVal;%concanete the current field to the time series
