探空仪测得数据按照分层报表要求进行处理(程序)

来源:互联网 发布:免费站长源码 编辑:程序博客网 时间:2024/06/05 09:11

地面接收到的是GPS电子探空仪测得的是每个采样点的数据,而大气研究一般是按照高度对大气进行分层,研究每个高度区间大气的温度、湿度、气压、风场等参数的分布情况。提供给应用部门的气象产品往往也需要使用分层垂直剖面大气数据。因此,需要对探空仪测得的数据按高度区间进行处理,得到分层数据报表。

获得的GPS探空仪探测数据,需要对数据按照分层数据报表要求处理。由于低空大气活动比较强烈,高度2000m以下按照50m步长进行分层;高空大气活动相对平缓,因此2000m~10000m按照200m步长进行分层,10000m~30000m按照500m步长进行分层。


clear 
clc 
load D:\MATLAB7\work\qiu\snd1.tpu %存放有时间、温度、湿度、气压、高度 
load D:\MATLAB7\work\qiu\snd2.wnd %存放有风向、风速 

temp=snd1(:,2);%温度 
shi=snd1(:,3);%湿度 
pres=snd1(:,4);%压强 
h=snd1(:,6);%高度 
fx=snd2(:,3)*pi/180;%风向 
fs=snd2(:,2);%风速 

%高度0~2000m,40组数据,间隔50m 
nn=1; 
for i=1:40 
xuhao=find(h<=(50*i) & h>(50*(i-1))); 
n=length(xuhao); 
%计算平均温度 
sum1=sum(temp(xuhao)); 
temp_mean=sum1/n; 
%计算平均湿度 
sum2=sum(shi(xuhao)); 
shi_mean=sum2/n; 
%计算平均气压 
sum3=sum(pres(xuhao)); 
pres_mean=sum3/n; 
%计算平均风速和风向 
jxf=fs(xuhao).*cos(fx(xuhao));%经向风 
wxf=fs(xuhao).*sin(fx(xuhao));%纬向风 
jxf_mean=sum(jxf)/n; 
wxf_mean=sum(wxf)/n; 
fs_mean=sqrt(jxf_mean^2+wxf_mean^2);%平均风速 
if wxf_mean>=0 
fx_mean=acos(jxf_mean/fs_mean)*180/pi; %平均风向 
else 
fx_mean=(2*pi-acos(jxf_mean/fs_mean))*180/pi; %平均风向 
end 
store(nn,:)=[50*i temp_mean shi_mean pres_mean fs_mean fx_mean]; 
nn=nn+1; 
end 

%高度2000~10000m,80组数据,间隔100m 
for i=1:80 
xuhao=find(h<=(2000+100*i) & h>(2000+100*(i-1))); 
n=length(xuhao); 
%计算平均温度 
sum1=sum(temp(xuhao)); 
temp_mean=sum1/n; 
%计算平均湿度 
sum2=sum(shi(xuhao)); 
shi_mean=sum2/n; 
%计算平均气压 
sum3=sum(pres(xuhao)); 
pres_mean=sum3/n; 
%计算平均风速和风向 
jxf=fs(xuhao).*cos(fx(xuhao));%经向风 
wxf=fs(xuhao).*sin(fx(xuhao));%纬向风 
jxf_mean=sum(jxf)/n; 
wxf_mean=sum(wxf)/n; 
fs_mean=sqrt(jxf_mean^2+wxf_mean^2);%平均风速 
if wxf_mean>=0 
fx_mean=acos(jxf_mean/fs_mean)*180/pi; %平均风向 
else 
fx_mean=(2*pi-acos(jxf_mean/fs_mean))*180/pi; %平均风向 
end 
store(nn,:)=[2000+100*i temp_mean shi_mean pres_mean fs_mean fx_mean]; 
nn=nn+1; 
end 

%高度10000m~30000,200组数据,间隔100m 
for i=1:200 
xuhao=find(h<=(10000+100*i) & h>(10000+100*(i-1))); 
n=length(xuhao); 
%计算平均温度 
sum1=sum(temp(xuhao)); 
temp_mean=sum1/n; 
%计算平均湿度 
sum2=sum(shi(xuhao)); 
shi_mean=sum2/n; 
%计算平均气压 
sum3=sum(pres(xuhao)); 
pres_mean=sum3/n; 
%计算平均风速和风向 
jxf=fs(xuhao).*cos(fx(xuhao));%经向风 
wxf=fs(xuhao).*sin(fx(xuhao));%纬向风 
jxf_mean=sum(jxf)/n; 
wxf_mean=sum(wxf)/n; 
fs_mean=sqrt(jxf_mean^2+wxf_mean^2);%平均风速 
if wxf_mean>=0 
fx_mean=acos(jxf_mean/fs_mean)*180/pi; %平均风向 
else 
fx_mean=(2*pi-acos(jxf_mean/fs_mean))*180/pi; %平均风向 
end 
store(nn,:)=[10000+100*i temp_mean shi_mean pres_mean fs_mean fx_mean]; 
nn=nn+1; 
end 
xlswrite('shujubaobiao.xls',store); 
figure(1) 
plot(store(:,2),store(:,1)/1000) 
ylabel('高度/km') 
xlabel('平均温度/^oC') 
grid on 
figure(2) 
plot(store(:,3),store(:,1)/1000) 
ylabel('高度/km') 
xlabel('平均湿度/%') 
grid on 
figure(3) 
plot(store(:,4),store(:,1)/1000) 
ylabel('高度/km') 
xlabel('平均气压/hPa') 
grid on 
figure(4) 
plot(store(:,5),store(:,1)/1000) 
ylabel('高度/km') 
xlabel('平均风速/(m/s)') 
grid on 
figure(5) 
plot(store(:,6),store(:,1)/1000) 
ylabel('高度/km') 
xlabel('平均风向/^o') 
grid on

0 0
原创粉丝点击