matlab 距平,[转载]基于Matlab软件进行EOF分解、回归趋势分析,并

本文展示了如何使用MATLAB对数据进行处理,包括剔除缺失值、计算距平,然后进行EOF(Empirical Orthogonal Functions,经验正交函数)分解和回归趋势分析。通过对选定区域的月度NDVI数据进行操作,最终将结果输出为适用于GRADS的二进制格式文件和对应的描述文件。
摘要由CSDN通过智能技术生成

clear

close

clc

ncload('E:/data/mon/ndvi79-06.nc','time','lat','lon','ndvi');

%第一部分:数据处理,剔除缺失值,求距平,并修正为等权重

%下面均针对温娜的sst进行标注

%选取区域:纬度:-9.5-59.5 ;经度:60.5-149.5

ilat=find(lat>=-10 &

lat<60);

nlat=length(ilat);

slat=lat(ilat);%选取区域纬度

ilon=find(lon>=60 &

lon<=150);

nlon=length(ilon);

slon=lon(ilon);%选取区域经度

itim=1:264; %选取时间为:1982.01-2003.12

ntim0=length(itim);

%表示月份数264 nyr=ntim0/12; %表示年数22

nph=nlat*nlon; %表示总共格点数

nph

st1=ndvi(itim,ilat,ilon);&4*70*90,将变量ndvi赋值给st1,以便后面统一使用公共变量st

st2=st1;&4*11*48,这里本该进行重新插值为低网格,即两两合并

%对每个格点进行计算月度年序列均值,然后计算月度年序列距平值

ndstp2=length(st2(1,:,1)); p

ndstp3=length(st2(1,1,:)); �

nlatlon=ndstp2*ndstp3;%表示低网格化后格点数目

% to get rid of the defaut value

%剔除缺失值,重新生成相应序列

st3=reshape(st2,ntim0,nlatlon);&4*6300(=70*90)

n1=find(abs(st3(1,:))<999); %寻找非缺失值位置 npstp=length(n1); %剔除缺失值后网个数:3136个

st4=st3(:,n1); %将剔除缺失值后的值重新赋值给264*3136

% to get rid of the seasonal cycle

st5=reshape(st4,12,nyr,npstp); *22*3136

st6_1=st5(3:5,:,:); %选取每个格点每年3到5月份值,3*22*3136 %从下面开始由于数据汇总,序列长度缩短为22个

st6_2=sum(st6_1,1); %对数据计算3-5月份ndvi和,得1*22*3136

st6=squeeze(st6_2); "*3136

% st7=st6-mean(st6,1); clear

ntim0;

ntim=nyr; %由于数据汇总 ,序列长度缩短,这里重新定义ntim;

for i=1:ntim

st7(i,:)=st6(i,:)-mean(st6,1); "*3136

end

st8=reshape(st7,ntim,npstp); "*3136

st9=st8; "*3136,这里本该进行剔除趋势

% to get equal weight in every point

%首先将缺失值部分补全,然后赋予等权重

st10(1:ntim,1:nlatlon)=-999; "*6300

st10(1:ntim,n1)=st8; "*6300

st11=reshape(st10,ntim,ndstp2,ndstp3);"*70*90

for i=1:ndstp2

st12(:,i,:)=st11(:,i,:)*sqrt(cos(slat(i)*3.14/180));"*70*90

end

%下面再次剔除缺失值

st13=reshape(st12,ntim,ndstp2*ndstp3); "*6300

st14(1:ntim,1:nps

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值