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