[/size][/backcolor][/color]
clear all;
clf;
warning('off');
yl={'Tmax','Tmin','Pr','Wind','Windmax'};%写在左边的y轴标签
xuhao={'(a)','(b)','(c)','(d)','(e)'};
season={'annual','DJF','MAM','JJA','SON'};
S=shaperead('G:\青藏高原验证\TP_county\TP_line.shp'); %读取shape文件
variablescn05={'tmax','tmin','pr','wind','windmax'};%观测路径名
variables={'tmax','tmin','','wind','windmax'};%模式路径名
top_margin = 0.04; % top margin
btm_margin = 0.15; % bottom margin,下面宽一点给colorbar留位置
left_margin = 0.05;% left margin
right_margin = 0.07;% right margin,右边宽一点给纬度留位置
fig_margin = 0.03; % margin beween figures(sub)
row = 5; % rows
col = 5; % cols
% Calculate figure height and width according to rows and cols
fig_h = (1- top_margin - btm_margin - (row-1) * fig_margin) / row;
fig_w = (1 - left_margin - right_margin - (col-1) * fig_margin) / col;%-0.01宽度缩一下,给经度留位置
data={'mo','bc'};
temp_nor=[];
for i=1:2%before and after
%将25个分布图的数据都读出来,算colorbar的取值范围
for m=1:row
for n=1:col%tmax\tmin\pr\wind\windmax
data_obs=xlsread(['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu7\',variablescn05{n},season{m},'.xlsx'],'o');
data_sim=xlsread(['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu7\',variablescn05{n},season{m},'.xlsx'],data{i});
data_sim=data_sim(16,:);%只取MME
%计算差异场
temp_nor=[temp_nor;data_sim-data_obs];
end
end
end
climmin=abs(min(temp_nor(:)));
climmax=abs(max(temp_nor(:)));
if climmin>=climmax
cl=climmin;
else
cl=climmax;
end
clim = [-cl cl]
%画图
for i=1:2
clf;
for m=1:row
for n=1:col%tmax\tmin\pr\wind\windmax
data_obs=xlsread(['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu7\',variablescn05{n},season{m},'.xlsx'],'o');
data_sim=xlsread(['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu7\',variablescn05{n},season{m},'.xlsx'],data{i});
data_sim=data_sim(16,:);%只取MME
%计算差异场
nex_cn=data_sim-data_obs;
temp=nex_cn;
temp=[zeros(1,102)*nan,temp];%前面102列是nan,读入时会丢失,在这里补回(1/2)
Z=[];
for w=1:56%纬度56行
Z=[Z;temp(1,(1+(w-1)*127):(127+(w-1)*127))];%f放在后面是因为要把纬度倒过来,127是经度,列
end
%前面102列是nan,读入时会丢失,在这里补回(2/2)
rasterSize=size(Z);
latlim=[26,40];
lonlim=[73.25,105];
R = georefcells(latlim,lonlim,rasterSize);%latlim,lonlim分别为1*2的南北、东西经纬度界限。
% 图位置,可以参考“help axes”查看参数含义,注意原始点在左下角
position = [left_margin + (n-1)*(fig_margin+fig_w),1- (top_margin + m * fig_h + (m-1) * fig_margin), fig_w, fig_h];
axes('position', position);
h=geoshow(Z,R,'DisplayType','surface','ZData',zeros(size(Z)),'CData',Z);%显示地理数据
set(gca,'CLim',clim);
colormap(darkb2r(-cl,cl));
box on;
geoshow(S,'color','k');%显示polyline
set(gca,'XLim',lonlim,'YLim',latlim);
set(gca,'XTick',[],'XTickLabel',[],'XTick',[],'YTickLabel',[]);
%在上面显示标题
if m==1
title(yl{n},'FontSize',8,'FontName','Times New Roman');
end
%在左边显示图名
if n==1
ylabel([xuhao{m},season{m}],'FontSize',8,'FontName','Times New Roman');
end
%在右边显示纬度
if n==col
set(gca,'YAxisLocation','right');
set(gca,'YTick',[30,40,50],'YTickLabel',{'30°N','40°N','50°N'},'FontName','Times New Roman','FontSize',7);
end
%在下面显示纬度
if m==row
set(gca,'XTick',[75,85,95,105],'XTickLabel',{'75°E','85°E','95°E','105°E'},'FontName','Times New Roman','FontSize',7);
end
end
end
% draw colorbar
axes('position', [left_margin,-0.03,1-right_margin-left_margin,0.02]);
axis off;
colorbar('FontName','Times New Roman','Location','Southoutside','FontSize',8);
caxis(clim);
%set(gcf,'color','white','paperpositionmode','auto');
set(gcf,'color','white');
saveas(gcf,['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu8\',data{i},'.pdf']);
saveas(gcf,['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu8\',data{i},'.eps']);
saveas(gcf,['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu8\',data{i},'.emf']);
saveas(gcf,['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu8\',data{i},'.png']);
saveas(gcf,['G:\青藏高原验证\biascorrection_re(cn05)\cn05.1chutu8\',data{i},'.tif']);
end
[color=#999999][backcolor=rgb(242, 242, 242)][size=12px]