function llgrid(gridsize)
% changes the grid of the current figure window to a lat/lon grid
% with appropriate labels.
% For now the data is expected in decimal degrees and the gridsize
% argument is expected to be in minutes.

%figure out where to put the tick marks
% note that this only works in nw hemisphere for now
bounds=axis * 60.0;
lonstart=bounds(1)-(gridsize+rem(bounds(1),gridsize));
latstart=bounds(3)+(gridsize-rem(bounds(3),gridsize));
nx=fix(abs(lonstart-bounds(2))/gridsize);
ny=fix(abs(latstart-bounds(4))/gridsize);
xticks=(lonstart+gridsize*[0:nx].*ones(1,nx+1));
yticks=(latstart+gridsize*[0:ny].*ones(1,ny+1));

%now figure the lables(strings) to go with the ticks

lonDeg=fix(xticks/60);
lonMin=(xticks/60 - lonDeg)*60;
latDeg=fix(yticks/60);
latMin=(yticks/60 - latDeg)*60;

%create the x axis lables
xlbls=[];
for i=1:nx+1,
   if lonDeg(i)/abs(lonDeg(i)) < 0
	tmp=sprintf('%3d%s %2.0f''W',abs(lonDeg(i)),setstr(176),abs(lonMin(i)));
   else
	tmp=sprintf('%3d%s %2.0f''E',abs(lonDeg(i)),setstr(176),abs(lonMin(i)));
   end

   xlbls=[xlbls;tmp];
end

%create the y axis lables
ylbls=[];
for i=1:ny+1,
   if latDeg(i)/abs(latDeg(i)) < 0
	tmp=sprintf('%3d%s %2.0f''S',abs(latDeg(i)),setstr(176),abs(latMin(i)));
   else
	tmp=sprintf('%3d%s %2.0f''N',abs(latDeg(i)),setstr(176),abs(latMin(i)));
   end

   ylbls=[ylbls;tmp];
end

%now make the changes to the plot
set(gca,'Tickdir','out');
set(gca,'YTICK',yticks./60);
set(gca,'XTICK',xticks./60);
set(gca,'YTickLabel',ylbls);
set(gca,'XTickLabel',xlbls);
set(gca,'fontname','times');
set(gca,'fontsize',10);
