Recipe: Matlab program fills the seam6

From GEOS-5
function [lons6 lats6 data6]=exendFace6(lons,lats,cubed_data)
% this southern face includes its four-side northern neighbors
     N=size(lons,1);

     lats6(N+2,N+2) = 0.0;
     lons6(N+2,N+2) = 0.0;
     data6(N+2,N+2) = 0.0;

     lats6(2:N+1,2:N+1)=lats(:,:,6);
     lons6(2:N+1,2:N+1)=lons(:,:,6);
     data6(2:N+1,2:N+1)=cubed_data(:,:,6);

     lats6(2:N+1,N+2)=lats(:,1,1);
     lons6(2:N+1,N+2)=lons(:,1,1);
     data6(2:N+1,N+2)=cubed_data(:,1,1);

     lats6(2:N+1,1)=fliplr(lats(N,:,4));
     lons6(2:N+1,1)=fliplr(lons(N,:,4));
     data6(2:N+1,1)=fliplr(cubed_data(N,:,4));

     lats6(N+2,2:N+1)=flipud(lats(:,1,2));
     lons6(N+2,2:N+1)=flipud(lons(:,1,2));
     data6(N+2,2:N+1)=flipud(cubed_data(:,1,2));
     lats6(1,2:N+1)=lats(N,:,5);
     lons6(1,2:N+1)=lons(N,:,5);
     data6(1,2:N+1)=cubed_data(N,:,5);

     lats6(1,1) = lats(N,1,5);
     lons6(1,1) = lons(N,1,5);
     data6(1,1) = cubed_data(N,1,5);

     lats6(1,N+2) = lats(1,1,1);
     lons6(1,N+2) = lons(1,1,1);
     data6(1,N+2) = cubed_data(1,1,1);

     lats6(N+2,1) = lats(N,1,4);
     lons6(N+2,1) = lons(N,1,4);
     data6(N+2,1) = cubed_data(N,1,4);

     lats6(N+2,N+2) = lats(1,1,2);
     lons6(N+2,N+2) = lons(1,1,2);
     data6(N+2,N+2) = cubed_data(1,1,2);