等距网格点和观测站点的散点分布图程序(在文件FORECAT 1中把lat,lon文件导入到Matlab中,在文件MEASURING把导入到Matlab中) x=lat; y=lon;
xi=A020618(:,2); yi=A020618(:,3);
plot(x,y,'.g',xi,yi,'.r') $91个预测点和91个观测点分布图 axis([ 125]); 附录二
可接受范围内的网格点到站点距离的计算 xi=A020618(:,2); yi=A020618(:,3);
plot(x,y,'.g',xi,yi,'.r') axis([ 125]); shice_x1=max(xi)+; shice_x2=min(xi); shice_y1=max(yi)+; shice_y2=min(yi);
b1=find(x>=shice_x2&x<=shice_x1); %满足条件的点的x坐标位置 xb2=x(b1); yb2=y(b1);
plot(xb2,yb2,'.g',xi,yi,'.r');
b3=find(yb2>=shice_y2&yb2<=shice_y1);%筛选后满足条件的点的y坐标位置 xb3=xb2(b3); %有效的点 yb3=yb2(b3);
plot(xb3,yb3,'.g',xi,yi,'.r'); axis([ ]); xb4=xi; yb4=yi;
l=length(xb3); d=zeros(91,l); for i=1:91 for j=1:l
d(i,j)=sqrt((xb4(i)-xb3(j))^2+(yb4(i)-yb3(j))^2); %计算距离 end end 附录三
观测站点预测降雨量的计算
[B,C]=sort(d,2); %对d从小到大排序,并记录在原矩阵中的坐标 D=C(:,[1,2,3,4,5]); E=B(:,[1,2,3,4,5]); F=1./E;
F(:,6)=sum(F,2); [r,l]=size(F);
for i=1:r
K(i,1:l)=F(i,:)/max(max(F(i,:))); %每个最小值点权的计算 end
H=K(:,[1,2,3,4,5]);
H(find(isnan(H)==1))=1 %将H中NaN替换为1
HH=reshape(H',455,1)'; %前五个最小值的权并排序 a=b1(b3(D)); %返回91*5个点在x中的矩阵位置
%%%%%%%%%%%%%%%%%%%%%预测数据调用和降雨量的筛选 %%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%将Current Directory路径改为数据所在位置%%%%%%%%%%%%% A1=[]; A2=[]; for month1=6:7 if month1==6;
for data1=18:28 for time1=1:4
str1=['f' int2str(month1) int2str(data1) int2str(time1) '_dis1']; str2=['f' int2str(month1) int2str(data1) int2str(time1) '_dis2']; tmp1=load(str1); tmp2=load(str2); A1=[A1; tmp1(:)']; A2=[A2; tmp2(:)']; end end else
for data1=1:30 if data1<10
strtmp=['0' int2str(data1)]; else
strtmp=int2str(data1); end
for time1=1:4
str1=['f' int2str(month1) strtmp int2str(time1) '_dis1']; str2=['f' int2str(month1) strtmp int2str(time1) '_dis2']; tmp1=load(str1); tmp2=load(str2); A1=[A1; tmp1(:)']; A2=[A2; tmp2(:)']; end end end end
?为第一种方法统计的所有数据,A2为第二种方法统计的所有数据 w=reshape(a',455,1)';%将91*5个点转换成455*1 A11=A1(:,w); %第一类164*455个降雨量 A22=A2(:,w); %第二类164*455个降雨量 gg=repmat(HH,164,1) % 为使HH与A11,A22大小相同,扩展平铺HH,gg大小为164*455 A1_1=gg.*A11 %第一类方法权与降雨量乘积
A2_2=gg.*A22 %第二类方法权与降雨量乘积大小为164*455
%%%%%%%%分别对A1_1,A2_2每隔5列求和并返回sum1,sum2%%%%%%%%% sum1=[];
for i=1:5:454
sum1=[sum1 A1_1(:,i)+A1_1(:,i+1)+A1_1(:,i+2)+A1_1(:,i+3)+A1_1(:,i+4)]; end
sum2=[];
for i=1:5:454
sum2=[sum2 A2_2(:,i)+A2_2(:,i+1)+A2_2(:,i+2)+A2_2(:,i+3)+A2_2(:,i+4)]; end 附录四
模型的求解
%%%%%%%%%%%%%%% 91个站实测数据的导入 %%%%%%%%%%%%%%%%%%%%%% %将Current Directory路径改为数据所在位置 B1=[];
for month1=6:7 if month1==6;
for data1=18:28
%str3=['020' int2str(month1) int2str(data1)];
str3=['020' int2str(month1) int2str(data1) '.SIX']; tmp3=load(str3);
B1=[B1;tmp3(:,4:7)']; end else
for data1=1:30 if data1<10
strtmp=['0' int2str(data1)]; else
strtmp=int2str(data1); end
str3=['020' int2str(month1) strtmp '.SIX']; tmp3=load(str3); B1=[B1; tmp3(:,4:7)']; end end end
B_1=abs(sum1-B1)./sum1; %第一种方法的偏差率 B_2=abs(sum2-B1)./sum2; %第二种方法的偏差率 B_1(find(isnan(B_1)==1))=0; %将B_1中NaN替换成为0 B_2(find(isnan(B_2)==1))=0; %将B_2中NaN替换成为0 B_11=B_1.^2
S1=sqrt(sum(B_11(:))) %第一种方法的算术平方根,即标准率 B_22=B_2.^2
S2=sqrt(sum(B_22(:))) %第二种方法的算术平方根,即标准率 附录五
问题二的求解
%%%%%将sum1,sum2,B1降雨量数据分等级,形成164*91大小的等级矩阵 sizesum1=size(sum1); z1=zeros(sizesum1); z2=z1; z3=z1; z4=z1; z5=z1; z6=z1; z7=z1;
z1(sum1<=0;
z2(sum1>=&sum1<==1; z3(sum1>&sum1<=6)=2; z4(sum1>6&sum1<=12)=3; z5(sum1>12&sum1<=25)=4; z6(sum1>25&sum1<=60)=5; z7(sum1>60)=6;
sum11=z1+z2+z3+z4+z5+z6+z7;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sizesum2=size(sum2); r1=zeros(sizesum2); r2=r1; r3=r1; r4=r1; r5=r1; r6=r1; r7=r1;
r1(sum2<=0;
r2(sum2>=&sum2<==1; r3(sum2>&sum2<=6)=2; r4(sum2>6&sum2<=12)=3; r5(sum2>12&sum2<=25)=4; r6(sum2>25&sum2<=60)=5; r7(sum2>60)=6;
sum22=r1+r2+r3+r4+r5+r6+r7;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sizeB1=size(B1); t1=zeros(sizeB1); t2=t1; t3=t1; t4=t1; t5=t1; t6=t1; t7=t1;
t1(B1<=0;
t2(B1>=&B1<==1; t3(B1>&B1<=6)=2; t4(B1>6&B1<=12)=3; t5(B1>12&B1<=25)=4; t6(B1>25&B1<=60)=5; t7(B1>60)=6;
B11=t1+t2+t3+t4+t5+t6+t7;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%做等级差%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sum_11=abs(sum11-B11); %%第一种方法的等级差 sum_22=abs(sum22-B11); %%第二种方法的等级差 %%%%%%%%%等级差分析%%%%%%%%%%%%%% J1=tabulate(sum_11(:));
J2=tabulate(sum_22(:));%tabulate函数输出第一列为元素种类,第二列为元素个数,第三列为频率
相关推荐: