%%%%IPSL
%数据处理
load('F:\毕业论文\program\Data\treeFrac_res\IPSL_deFrac.mat');
initial_datafile='F:\毕业论文\program\Data\treeFrac_initial\IPSL_';
expr_res_datafile='F:\毕业论文\program\Data\extreme_pr_res\IPSL_';
expr_datafile='F:\毕业论文\program\Data\extreme_yr_pr\IPSL\IPSL_';
load([initial_datafile,'lat']); load([initial_datafile,'lon']);
load([expr_res_datafile,'PRCPTOT_res.mat']);
load([expr_res_datafile,'mod_PRCPTOT_res.mat']);
%找出通过检验的点并将其坐标保存下来
sclat=[]; sclon=[];scres=[];
for i=1:2:length(lat); %R10mm,R20mm,PRCPTOT--2 SDII--1
for j=1:2:length(lon);
if isnan(mod_PRCPTOT_res(i,j))==0;
sclat=[sclat;lat(i)];
sclon=[sclon;lon(j)];
scres=[scres;mod_PRCPTOT_res(i,j)];
end
end
end
**[Lon,Lat] = meshgrid(lon,lat);
m = find(lon-180==min(abs(lon-180)));
%重新排列数据,使其位于我为投影给出的经度限制中
ind=[m+1:length(Lon(1,:)) 1:m]; % Move left side to right
mod_PRCPTOT_res = mod_PRCPTOT_res(:,ind);
PRCPTOT_res = PRCPTOT_res(:,ind);
deFrac=deFrac(:,ind);
Lat=Lat(:,ind);
Lon=Lon(:,ind);
Lon(Lon>180)=Lon(Lon>180)-360; %...and subtract 360 to some longitudes**
%不等间隔绘图
**edges=[-250 -200 -150 -100 -50 50 100 150 200 250 300]; % PRCPTOT
[A,new_pr]=histc(PRCPTOT_res,edges); %利用函数histc按照所需间隔将原数据进行分类**
for i=1:size(PRCPTOT_res,1);
for j=1:size(PRCPTOT_res,2);
if isnan(PRCPTOT_res(i,j))==1;
new_pr(i,j)=NaN;
end
end
end
m_proj('robinson','longitudes',[lon(m+1)-360 lon(m)],'latitudes',[-90 90]);
m_pcolor(Lon,Lat,new_pr);
colormap(C_brown2blue_11);
caxis([0 length(edges)]) ;
**cbar = colorbar;
set(cbar,'Ticks',1:length(edges)-1,'TickLabels',edges) ;
set(cbar,'TickLength',0);**
这里edges即为色卡中想要的间隔设定,图中并未展现间隔的不等,读者可自行设定,设定原理如下:
设定时应当注意原数据与分类后的新数据以及colorbar所设颜色的对应关系;
本程序colormap设有11个颜色,转换到新数据中的数字为0:1:10,对应关系如上图,例:与色卡颜色的对应关系如新数据5对应白色,即原数据-50~50对应白色。
最终在设置colorbar的坐标值时进行一定的调节,set(cbar,‘Ticks’,1:length(edges)-1,‘TickLabels’,edges) ;
仅展示-250~250,即只展示edges第1到10个值。