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

%% Define Constants

%% Define Vars

%% Load Data
load grid.mat plat plon ;
sshg=nc_varget('H04S5_2d_2000.07.nc','sealv');
% lat=nc_varget('sshg.2000.nc','lat');
% lon=nc_varget('sshg.2000.nc','lon');
% [lon lat]=meshgrid(lon,lat);
sshg=100*double(sshg); %switch from meter to centmeter
% var(:,end+1)=var(:,1);
% sshg(find(abs(sshg-3276.6)<2))=NaN; %mask out the missing value
sshg(end+1,:)=sshg(1,:);
plat(end+1,:)=plat(1,:);
plon(end+1,:)=plon(1,:);
lat=plat;lon=plon;
clear plat plon;
%% Compute ***
% 
% var=squeeze(sshg(7,:,:));  %plot these value
var=sshg;
clear sshg;
%% Plot Figures
Hm_axes=axesm('MapProjection','eqdcylin');
setm(Hm_axes,'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,var);shading flat;
% caxis([-30 30]);
load Odv4012
colormap(cmap);
axis tight

set(gcf,'Position',[0 400 1024 768]);
h_cb=colorbar('location','southoutside');
pos=get(h_cb,'position');
pos(2)=pos(2)*0.85;
pos(4)=pos(4)/2; % half height of original size.
set(h_cb,'position',pos)

textm(-74,5,['max  =',int2str(max(max(var))),' cm']);
textm(-80,5,['min   =',int2str(min(min(var))),' cm']);
textm(-86,5,['mean=',int2str(mean(mean(var(find(~isnan(var)))))),'  cm']);
xlabel('','fontsize',12,'fontweight','bold');
ylabel('','fontsize',12,'fontweight','bold');
title(['Micom Monthly Mean Sea Surface Height Relative to Geoid',...
    '@July,2000 (unit:cm)'],'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_sealv_2000_07.png
% print -deps -r300 filename.eps