Index: /issm/trunk-jpl/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m
===================================================================
--- /issm/trunk-jpl/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m	(revision 24516)
+++ /issm/trunk-jpl/src/m/contrib/morlighem/modeldata/interpMouginotAntTimeSeries1973to2018.m	(revision 24517)
@@ -1,3 +1,3 @@
-function [vxout vyout]= interpMouginotAntTimeSeries1973to2018(X,Y,T)
+function [vxout vyout errxout erryout stdxout stdyout]= interpMouginotAntTimeSeries1973to2018(X,Y,T)
 %INTERPMOUGINOTANTTIMESERIES1973TO2018 - interpolate observed (time series) velocities 
 %
@@ -45,6 +45,8 @@
 %      [vxout vyout]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1986 1988; 1991 1992; 1995 1996; 2000 2001]);
 %
-%      Another example:
+%      Another examples:
 %      [vxout vyout]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1973 1975; 1973 1988; 1991 1992; 2011 2012]);
+%      [vel]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1986; 1991; 1995; 2000]);
+%      [vxout vyout errxout erryout stdxout stdyout]= interpMouginotAntTimeSeries1973to2018(md.mesh.x,md.mesh.y,[1986; 1991; 1995; 2000]);
 
 %read data
@@ -119,4 +121,8 @@
 	error('nargin not supported yet!');
 end
+if nargout~=1 & nargout~=2 & nargout~=6
+	error('nargout not supported!');
+end
+
 
 % get the spatial positions
@@ -136,4 +142,10 @@
 vxdata = [];
 vydata = [];
+if nargout==6 % it includes ERRX, ERRY, STDX and STDY
+	errxdata = [];
+	errydata = [];
+	stdxdata = [];
+	stdydata = [];
+end
 for i=1:length(pos), 
 	disp(['      step = ' int2str(i) '/' int2str(length(pos)) ', position = ' int2str(pos(i)) ', year = '  int2str(year1(pos(i))) ' - ' int2str(year2(pos(i)))]);
@@ -142,4 +154,14 @@
 	vxdata(:,:,i) = permute(vx,[2 1 3]);
 	vydata(:,:,i) = permute(vy,[2 1 3]);
+	if nargout==6 % it includes ERRX, ERRY, STDX and STDY
+		errx = double(ncread(nc,'ERRX',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));
+		erry = double(ncread(nc,'ERRY',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));	
+		stdx = double(ncread(nc,'STDX',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));
+		stdy = double(ncread(nc,'STDY',[id1x id1y pos(i)],[id2x-id1x+1 id2y-id1y+1 1],[1 1 1]));	
+		errxdata(:,:,i) = permute(errx,[2 1 3]);
+		errydata(:,:,i) = permute(erry,[2 1 3]);
+		stdxdata(:,:,i) = permute(stdx,[2 1 3]);
+		stdydata(:,:,i) = permute(stdy,[2 1 3]);
+	end
 end
 xdata=xdata(id1x:id2x);
@@ -149,8 +171,20 @@
 vxout = [];
 vyout = [];
+if nargout==6 % it includes ERRX, ERRY, STDX and STDY
+	errxout = [];
+	erryout = [];
+	stdxout = [];
+	stdyout = [];
+end
 for i=1:length(pos),
 	disp(['      step = ' int2str(i) '/' int2str(length(pos)) ', position = ' int2str(pos(i)) ', year = '  int2str(year1(pos(i))) ' - ' int2str(year2(pos(i)))]);
 	vxout = [vxout InterpFromGrid(xdata,ydata,vxdata(:,:,i),double(X),double(Y))];
 	vyout = [vyout InterpFromGrid(xdata,ydata,vydata(:,:,i),double(X),double(Y))];
+	if nargout==6 % it includes ERRX, ERRY, STDX and STDY
+		errxout = [errxout InterpFromGrid(xdata,ydata,errxdata(:,:,i),double(X),double(Y))];
+		erryout = [erryout InterpFromGrid(xdata,ydata,errydata(:,:,i),double(X),double(Y))];
+		stdxout = [stdxout InterpFromGrid(xdata,ydata,stdxdata(:,:,i),double(X),double(Y))];
+		stdyout = [stdyout InterpFromGrid(xdata,ydata,stdydata(:,:,i),double(X),double(Y))];
+	end
 end
 
