Index: issm/trunk/src/m/classes/@model/model.m
===================================================================
--- issm/trunk/src/m/classes/@model/model.m	(revision 2298)
+++ issm/trunk/src/m/classes/@model/model.m	(revision 2303)
@@ -236,14 +236,9 @@
 	%mesh2grid
 	md.mesh2grid_parameters={};
-	md.mesh2grid_interpolation={};
-	md.mesh2grid_filter={};
-	md.mesh2grid_cornereast=0;
-	md.mesh2grid_cornernorth=0;
-	md.mesh2grid_xposting=0;
-	md.mesh2grid_yposting=0;
-	md.mesh2grid_nlines=0;
-	md.mesh2grid_ncolumns=0;
-	md.mesh2grid_windowsize=0;
-	md.mesh2grid_results=NaN;
+	md.mesh2grid_data=NaN;
+	md.mesh2grid_xm=NaN;
+	md.mesh2grid_ym=NaN;
+
+	%dummy
 	md.dummy=NaN;
 
Index: issm/trunk/src/m/classes/@model/setdefaultparameters.m
===================================================================
--- issm/trunk/src/m/classes/@model/setdefaultparameters.m	(revision 2298)
+++ issm/trunk/src/m/classes/@model/setdefaultparameters.m	(revision 2303)
@@ -237,34 +237,4 @@
 md.alloc_cleanup=1;
 
-%mesh2grid parameter
-md.mesh2grid_parameters={'vel'};
-
-%interpolation type
-md.mesh2grid_interpolation={'node'};
-
-%filter
-md.mesh2grid_filter={'average'};
-
-%coordinate of the corner east (actually WEST...)
-md.mesh2grid_cornereast=0;
-
-%coordinate of the corner north
-md.mesh2grid_cornernorth=0;
-
-%x posting
-md.mesh2grid_xposting=1000;
-
-%y posting
-md.mesh2grid_yposting=1000;
-
-%number of lines
-md.mesh2grid_nlines=1000;
-
-%number of columns
-md.mesh2grid_ncolumns=1000;
-
-%window size
-md.mesh2grid_windowsize=1;
-
 %the string of solverstring is used directly by PETSc to solve finite element
 %systems KU=F. By default, we use MUMPS solver
Index: issm/trunk/src/m/classes/public/buildoverlay.m
===================================================================
--- issm/trunk/src/m/classes/public/buildoverlay.m	(revision 2298)
+++ 	(revision )
@@ -1,98 +1,0 @@
-function [image_rgb varargout]=buildoverlay(md,field,transparency,highres,smoothing,windowsize,border);
-%BUILDOVERLAY - creates an RGB image of a field
-%
-%   This routine is used by plotmodel to superimpose a radar
-%   image and a field of the model
-%
-%   Usage:
-%      image_rgb=buildoverlay(md,field,transparency,highres,smoothing,windowsize);
-%
-%   Example:
-%      image_rgb=buildoverlay(md,md.vel,0.5,1,1,10^3);
-%
-%   See also: RADARPOWER, PLOTMODEL, BUILDOVERLAYCOLORBAR
-
-%2d plots only
-if ~strcmpi(md.type,'2d'),
-	error('plot_overlay error message: only 2d plots allowed');
-end
-
-%Ok, first we need to recover the radar map.
-md=radarpower(md,highres);
-
-if isfield(struct(md),field)
-	data=eval(['md.' field ';']);
-else
-	data=field;
-end
-
-%load x,y, etc ... to speed up plot
-x=md.x;
-y=md.y;
-z=md.z;
-elements=md.elements;
-
-if md.numberofgrids==size(elements,1),
-	error('buildoverlay error message: the number of elements is the same as the number of grids! cannot plot anything with model/plot, use matlab/plot instead')
-end
-
-if smoothing,
-	data=averaging(md,data,1);
-end
-
-%use mesh2grid solution to get an gridded data to display using imagesc
-md.dummy=data;
-md.mesh2grid_parameters={'dummy'};
-if length(data)==length(elements),
-	md.mesh2grid_interpolation={'element'};
-elseif length(data)==md.numberofgrids,
-	md.mesh2grid_interpolation={'node'};
-else 
-	error('plot_overlay error message: data should be numberofgrids of numberofelements long');
-end
-md.mesh2grid_filter={'average'};
-md.mesh2grid_cornereast=min(md.x);
-md.mesh2grid_cornernorth=max(md.y);
-md.mesh2grid_ncolumns=length(md.sarxm);
-md.mesh2grid_xposting=(max(md.x)-min(md.x))/md.mesh2grid_ncolumns;
-md.mesh2grid_nlines=length(md.sarym);
-md.mesh2grid_yposting=(max(md.y)-min(md.y))/md.mesh2grid_nlines;
-md.mesh2grid_windowsize=windowsize;
-
-md.cluster='none';
-md=solve(md,'analysis_type','mesh2grid','package','cielo');
-
-%Ok, we have two images, double format: 
-radar=md.sarpwr;
-results=md.mesh2grid_results{1};
-
-%nullify NaN in results
-results(find(isnan(results)))=0;
-
-%Build hsv color image from radar and results
-%intensity
-v=radar/max(max(radar));
-
-%hue
-%cut results under 1.5, and log
-results(find(results<1.5))=1.5;
-h=bytscl(log(results))/(255+1); %1 offset on colormap
-
-%saturation
-s=(0.5+results/125)/transparency;s(find(s>1))=1;s(find(s<0))=0;
-s(find(results==1.5))=0;
-
-%Include border
-v((1:border),:)=0;  v((end-border+1:end),:)=0; v(:,1:border)=0;v(:,(end-border+1:end))=0;
-
-%Transform hsv to rgb
-image_hsv=zeros(size(results,1),size(results,2),3);
-image_hsv(:,:,1)=h;
-image_hsv(:,:,2)=s;
-image_hsv(:,:,3)=v;
-image_rgb=hsv2rgb(image_hsv);
-
-if nargout==3,
-	varargout{1}=md.sarxm;
-	varargout{2}=md.sarym;
-end
Index: issm/trunk/src/m/classes/public/plot/plot_overlay.m
===================================================================
--- issm/trunk/src/m/classes/public/plot/plot_overlay.m	(revision 2298)
+++ issm/trunk/src/m/classes/public/plot/plot_overlay.m	(revision 2303)
@@ -54,21 +54,20 @@
 	end
 
-	%use mesh2grid solution to get an gridded data to display using imagesc
-	[x_m y_m data_mesh2grid]=InterpFromMeshToGrid(elements,x,y,data,min(xlim),max(ylim),...
-		(max(xlim)-min(xlim))/length(md.sarxm),(max(ylim)-min(ylim))/length(md.sarym),length(md.sarym),length(md.sarxm),NaN);
+	%use InterpFromMeshToGrid to get an gridded data to display using imagesc
+	cornereast =min(xlim);
+	cornernorth=max(ylim);
+	xspacing=(max(xlim)-min(xlim))/(length(md.sarxm));
+	yspacing=(max(ylim)-min(ylim))/(length(md.sarym));
+	nlines=length(md.sarym);
+	ncols =length(md.sarxm);
+	[x_m y_m data_grid]=InterpFromMeshToGrid(elements,x,y,data,cornereast,cornernorth,xspacing,yspacing,nlines,ncols,0);
 else
 	%process mesh and data
 	[x y z elements is2d]=processmesh(md,options_structure);
 	[data isongrid isquiver]=processdata(md,data,options_structure);
-
-	%get previous result
-	data_mesh2grid=mesh2grid_results(find(ismember(data,mesh2grid_parameters)));
 end
 
 %Ok, we have two images, double format: 
 radar=md.sarpwr;
-
-%nullify NaN in results
-data_mesh2grid(find(isnan(data_mesh2grid)))=0;
 
 %Build hsv color image from radar and results
@@ -81,10 +80,10 @@
 %hue
 %cut results under 1.5, and log
-data_mesh2grid(find(data_mesh2grid<1.5))=1.5;
-h=bytscl(log(data_mesh2grid))/(255+1); %1 offset on colormap
+data_grid(find(data_grid<1.5))=1.5;
+h=bytscl(log(data_grid))/(255+1); %1 offset on colormap
 
 %saturation
-s=(0.5+data_mesh2grid/125)/transparency;s(find(s>1))=1;s(find(s<0))=0;
-s(find(data_mesh2grid==1.5))=0;
+s=(0.5+data_grid/125)/transparency;s(find(s>1))=1;s(find(s<0))=0;
+s(find(data_grid==1.5))=0;
 
 %Include border
@@ -92,5 +91,5 @@
 
 %Transform hsv to rgb
-image_hsv=zeros(size(data_mesh2grid,1),size(data_mesh2grid,2),3);
+image_hsv=zeros(size(data_grid,1),size(data_grid,2),3);
 image_hsv(:,:,1)=h;
 image_hsv(:,:,2)=s;
Index: issm/trunk/src/m/classes/public/plot/plotdoc.m
===================================================================
--- issm/trunk/src/m/classes/public/plot/plotdoc.m	(revision 2298)
+++ issm/trunk/src/m/classes/public/plot/plotdoc.m	(revision 2303)
@@ -79,5 +79,4 @@
 disp('       ''ylabel'': same as standard matlab option');
 disp('       ''overlay'': yes or no. This will overlay a radar amplitude image behind');
-disp('       ''windowsize'': default is 1. size of filter window when using overlay.');
 disp('       ''highres'': resolution of overlayed radar amplitude image (default is 0, high resolution is 1).');
 disp('       ''alpha'': transparency coefficient (the higher, the more transparent). Default is 1.5');
