- 积分
- 1701
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-5-12
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
最近在算150-10hPa的剩余速度,但是画出来的图就是不对。所用的资料是NCEP/NCAR2的1980-2015年月平均v、w资料。本人已研究好多天,也检查了程序(程序是一个师兄给的,感谢师兄,自己做了修改),但还是不对,所以想发个帖请教各位大神们,希望能寻求到帮助。。。。本人将不甚感激,谢谢啦,挺急的。。。图及程序附后:
计算公式:
计算公式:
程序:1、位温
- %%计算春季位温(150-10层次的)
- clc;
- clear;
- ncdisp('f:\data\air.mon.mean.nc');
- lon=ncread('f:\data\air.mon.mean.nc','lon');
- lat=ncread('f:\data\air.mon.mean.nc','lat');
- time=ncread('f:\data\air.mon.mean.nc','time');
- lev=ncread('f:\data\air.mon.mean.nc','level');
- air=ncread('f:\data\air.mon.mean.nc','air'); %温度单位:K
- air=air(:,:,11:17,:); %提取150-10层(共7层)
- air=fliplr(air); %设置数据纬度为自南向北
- air1=air;
- [nx,ny,nz,nt]=size(air);
- j=1;%air_monave=zeros(nx,ny,nz,24);
- for i=15:12:444
- air_monave(:,:,:,j)=nanmean(air(:,:,:,i:i+2),4); %提取1980-2015春季数据
- j=j+1;
- end
- [nx,ny,nz,nt]=size(air_monave);
- air1=nanmean(air_monave,4);
- air2=nanmean(air1,1);
- ave_T=reshape(air2,ny,nz); %纬向平均温度
- te=[];te=air_monave;
- t=[];t=reshape(te,144,73,7,36);
- p=[150 100 70 50 30 20 10];
- m=0.2856;
- th=[];
- for n=1:36
- for z=1:7
- for j=1:73
- for i=1:144
- th(i,j,z,n)=t(i,j,z,n)*((1000.0/p(z))^m);
- end
- end
- end
- end
- %th:位温;ave_T:纬向平均温度
- save F:\5\quan_bd\th.mat th ave_T;
- fid=fopen('F:\5\quan_bd\th.dat','w');
- fwrite(fid,th,'float32');
- fclose(fid);
复制代码 2、v- %计算春季剩余环流v*(150-10层次的)
- clc;
- clear;
- p(1)=15000;
- p(2)=10000;
- p(3)=7000;
- p(4)=5000;
- p(5)=3000;
- p(6)=2000;
- p(7)=1000;
- ncdisp('f:\data\vwnd.mon.mean.nc');
- lon=ncread('f:\data\vwnd.mon.mean.nc','lon');
- lat=ncread('f:\data\vwnd.mon.mean.nc','lat');
- time=ncread('f:\data\vwnd.mon.mean.nc','time');
- lev=ncread('f:\data\vwnd.mon.mean.nc','level');
- b=ncread('f:\data\vwnd.mon.mean.nc','vwnd');
- b=b(:,:,11:17,:);
- b=fliplr(b); %设置数据纬度为自南向北
- b_jian=b;
- [nx,ny,nz,nt]=size(b);
- j=1;b_xuan=zeros(nx,ny,nz,36);
- for i=15:12:444
- b_xuan(:,:,:,j)=nanmean(b(:,:,:,i:i+2),4); %提取1980-2015春季数据
- j=j+1;
- end
- %k=size(b_xuan,4);
- b_mon=[];b_mon=b_xuan;
- %k=size(b_mon,4);
- b1=[];b1=reshape(b_mon,144,73,7,36);
- b2=[];b2=nanmean(b1,4);
- b3=[];b3=nanmean(b2,1);
- b4=reshape(b3,ny,nz); %平均经向风速
- bb=[];
- for j=1:ny
- for i=1:nz
- bb(:,j,i)=b2(:,j,i)-b4(j,i); %经向风速扰动量
- end
- end
- load('f:\5\quan_bd\th.mat');
- T=th; %th:位温
- [nx,ny,nz,nt]=size(T);
- a1=[];a1=nanmean(T,4);
- a4=[];a4=reshape(nanmean(a1,1),ny,nz); %经向平均位温
- aa=[];
- for j=1:ny
- for i=1:nz
- aa(:,j,i)=a1(:,j,i)-a4(j,i); %位温扰动量
- end
- end
- yy=[];yy=nanmean(bb.*aa,1);
- y=zeros;y=reshape(yy,ny,nz); %位温扰动量*经向风速扰动量的平均
- for i=1:ny
- for j=1:nz
- if abs(y(i,j))<0.000001
- y(i,j)=0;
- end
- end
- end
- dx=[];fun=[];
- dx(1)=-(p(2)-p(1)); dx(7)=-(p(7)-p(6));
- for j=1:73
- fnn(j,1)=(a4(j,2)-a4(j,1))/dx(1);
- fnn(j,7)=(a4(j,7)-a4(j,6))/dx(7);
- for k=2:6
- dx(k)=-(p(k+1)-p(k-1));
- fnn(j,k)=(a4(j,k+1)-a4(j,k-1))/(2*dx(k)); %求平均位温偏导数
- end
- end
- fnn1=[];
- for j=1:73
- fnn1(j,1)=(y(j,2)/fnn(j,2)-y(j,1)/fnn(j,1))/dx(1);
- fnn1(j,7)=(y(j,7)/fnn(j,7)-y(j,6)/fnn(j,6))/dx(7);
- for k=2:6;
- fnn1(j,k)=(y(j,k+1)/fnn(j,k+1)-y(j,k-1)/fnn(j,k-1))/(2*dx(k));
- end
- end
- svdata=[];
- for j=1:73
- for k=1:7;
- svdata(j,k)=b4(j,k)-fnn1(j,k); %剩余环流v*
- if abs(svdata(j,k))<=0.00001
- svdata(j,k)=0;
- end;
- end
- end
- %svdata:剩余环流v*;a4:经向平均位温;y:位温扰动量*经向风速扰动量的平均;fnn:平均位温偏导数
- %b4:平均经向风速
- save F:\5\quan_bd\v.mat svdata a4 y fnn b4;
- fid=fopen('F:\5\quan_bd\v.dat','w');
- fwrite(fid,svdata,'float32');
- fclose(fid);
复制代码 3、w- %计算春季剩余环流w*(150-10层次的)
- clc;
- clear;
- p(1)=15000;
- p(2)=10000;
- p(3)=7000;
- p(4)=5000;
- p(5)=3000;
- p(6)=2000;
- p(7)=1000;
- a=6371000;
- g=9.80665;
- R=287.; %气体常数
- load('F:\5\quan_bd\th.mat');
- ave_T=ave_T; %纬向平均温度
- ncdisp('f:\data\omega.mon.mean.nc');
- lon=ncread('f:\data\omega.mon.mean.nc','lon');
- lat=ncread('f:\data\omega.mon.mean.nc','lat');
- time=ncread('f:\data\omega.mon.mean.nc','time');
- lev=ncread('f:\data\omega.mon.mean.nc','level');
- omega=ncread('f:\data\omega.mon.mean.nc','omega');
- omega1=omega(:,:,11:17,:);
- omega2=fliplr(omega1);
- [nx,ny,nz,nt]=size(omega2);
- j=1;omega2_xuan=zeros(nx,ny,nz,36);
- omega3=[];
- for i=15:12:444
- omega3(:,:,:,j)=nanmean(omega2(:,:,:,i:i+2),4); %提取1980-2015春季数据
- j=j+1;
- end
- %k=size(omega3,4);
- omega3_mon=[];omega3_mon=omega3;
- omega4=reshape(omega3_mon,nx,ny,nz,36);
- omega5=nanmean(omega4,4);
- o1=nanmean(omega5,1);
- o2=reshape(o1,ny,nz); %w*第一项
- %svdata:剩余环流v*;y:位温扰动量*经向风速扰动量的平均;fnn:平均位温偏导数
- load('F:\5\quan_bd\v.mat');
- epf=y;t3=fnn;
- [ny,nz]=size(epf);
- lat1=flipud(lat);
- for i=1:73
- coskk(i)=cos(lat1(i)/180*pi);
- if abs(lat1(i))==90
- coskk(i)=0;
- end
- end
- divx=[];
- for j=1:nz %w*第二项
- dx=2.5/180*pi;
- divx(1,j)=(epf(2,j)*coskk(2)/t3(2,j)-epf(1,j)...
- *coskk(1)/t3(1,j))/dx/(a*coskk(1));
- divx(ny,j)=(epf(ny,j)*coskk(ny)/t3(ny,j)-epf(ny-1,j)...
- *coskk(ny-1)/t3(ny-1,j))/dx/(a*coskk(ny));
- for i=2:ny-1
- divx(i,j)=(epf(i+1,j)*coskk(i+1)/t3(i+1,j)-epf(i-1,j)*...
- coskk(i-1)/t3(i-1,j))/(2*dx)/(a*coskk(i));
- end
- end
- womi=[];
- for j=1:ny
- for k=1:nz;
- womi(j,k)=o2(j,k)+divx(j,k);
- if abs(womi(j,k))>=1000000
- womi(j,k)=0;
- end;
- end
- end
- w=[];
- for k=1:nz
- for j=1:ny
- w(j,k)=-womi(j,k)*R*ave_T(j,k)/(g*p(k)); %转换为Z坐标,单位:m/s
- end
- end
- %womi:剩余环流w*;w:z坐标下w*
- save F:\5\quan_bd\w.mat womi w;
- fid=fopen('F:\5\quan_bd\w.dat','w');
- fwrite(fid,w,'float32');
- fclose(fid);
复制代码 ctl文件:
gs文件:
画出来的图:
|
|