%   Powered by He Yanchun, PKU,NZC,NERSC 
%   $Revision: 1.0  $  $Date: 2009/03/27 19:13:41 $

clear all;
close all;

%% Define Constants

%% Define Vars

%% Load Data

% loadfilename.mat b
% dat=importdata('filename.dat');
load grid.mat plat plon ;
% lat=nc_varget('sst.ltmmean.nc','lat');
% lon=nc_varget('sst.ltmmean.nc','lon');
sst=nc_varget('micom_sst_ltmmean_jun_1971-2000.nc','sst');
sst=double(sst);
sst(find(sst<-2))=NaN;   %get rid of the missing value.
sst(end+1,:)=sst(1,:);
plat(end+1,:)=plat(1,:);
plon(end+1,:)=plon(1,:);
lat=plat;
lon=plon;
clear plat plon;
% [lon lat]=meshgrid(lon,lat);
%% Compute ***


%% Plot Figures

% Hm_axes=axesm('MapProjection','eqdcylin');
axesm('MapProjection','eqdcylin');
setm(gca,'Frame','on','MeridianLabel','on',...
	'MLabelParallel','south','MLabelLocation',60,...
	'ParallelLabel','on','PLabelLocation',30,...
	'MapLatLimit',[-90 90],'MapLonLimit',[0 360],'Origin',[0 180 0]);
% pcolorm(lat,lon,squeeze(sst(end,:,:)));shading flat;
% [C Hm_ctourf]=contourfm(lat,lon,sst,[-3:3:30]);
pcolorm(lat,lon,sst);
hold on;

[C Hm_ctour]=contourm(lat,lon,sst);
set(Hm_ctour,'LineColor','k','LineStyle','-','LineWidth',0.5,...
   'LevelListMode','auto','LevelList',[-3:3:30],'ShowText','on',...
   'TextStep',5,'TextList',[-3:3:30]);
clabel(C,Hm_ctour);
% caxis([-0.20 0.20])
load BlueRed_ncl.mat
colormap(cmap);
axis tight
set(gcf,'Position',[0 400 1024 768],'Renderer','Painters');
h_cb=colorbar('location','southoutside');
pos=get(h_cb,'position');
pos(2)=pos(2)*0.80;
pos(4)=pos(4)/2; % half height of original size.
set(h_cb,'position',pos)

xlabel('','fontsize',12,'fontweight','bold');
ylabel('','fontsize',12,'fontweight','bold');
title('Micom Monthly Long Term Mean(1971-2000) Sea Surface Temperature @ June',...
    'fontsize',12,'fontweight','bold');

geoshow('landareas.shp','facecolor',[0.6 0.6 0.6]);
set(gca,'dataaspectratio',[1 1 1]);

%% Save the Figures and Data

% save filename.mata b;
% print -dpng -r300 micom_sst_ltmmean_June(1971-2000).png
% print -deps -r300 filename.eps