对于遥感降尺度,最简单的方法就是线性拟合模型。简单的来说就是若干幅高分辨率的影像和与之对应日期的若干幅低分辨率的影像之间建立一个线性回归模型。(Y=AX+B,其中Y是高分辨率影像,X是低分辨率影像,通过建立模型可以得到系数A,B影像)
建立高低分辨率影像的线性回归模型的Matlab 代码如下(这里举例是对NDVI进行降尺度):
[aa,R]=geotiffread('F:\yz\PhD\Recent_work\Rework\Downscaling\rework\Landsat\NDVI_clip\LC08_L2SP_133033_20130721_20200912_02_T1_SR_B4.TI.NDVI.tif_clp.tif');%先导入纬度数据
info=geotiffinfo('F:\yz\PhD\Recent_work\Rework\Downscaling\rework\Landsat\NDVI_clip\LC08_L2SP_133033_20130721_20200912_02_T1_SR_B4.TI.NDVI.tif_clp.tif');
[m,n]=size(aa);
%temsum=zeros(m*n,18);%16表示时间序列长度
presum=zeros(m*n,2);%10表示时间序列长度
ndvisum=zeros(m*n,2);%10表示时间序列长度
for year=2013:2014
%temp=importdata(['D:\qixiang\年尺度数据\插值的结果\年平均温度\tem',int2str(year),'.tif']) ;
pre=importdata(['F:\yz\PhD\Recent_work\Rework\Downscaling\rework\MODIS\NDVI_ree_clip _d\A',int2str(year),'.sample.tif_clp.tif']) ;
ndvi=importdata(['F:\yz\PhD\Recent_work\Rework\Downscaling\rework\Landsat\NDVI_clip_d\LC08_L2SP_133033_',int2str(year),'.NDVI.tif_clp.tif']) ;
%注意数据的有效范围
%temp(temp<-1000)=NaN;%温度有效范围
%pre(pre<0)=NaN;%有效范围大于0
%ndvi(ndvi<-1)=NaN; %有效范围是-1到1
%temsum(:,year-1999)=reshape(temp,m*n,1);
presum(:,year-2012)=reshape(pre,m*n,1);
ndvisum(:,year-2012)=reshape(ndvi,m*n,1);
end
%多元回归,ndvi=a*pre+b*tem
pre_slope=zeros(m,n);
%tem_slope=zeros(m,n)+NaN;
b_cofficient=zeros(m,n);
pz=zeros(m,n);
for i=1:m*n
pre=presum(i,:)';
ndvi=ndvisum(i,:)';
%tem=temsum(i,:)';
X=[ones(size(ndvi)),pre];
[b,bint,r,rint,stats] = regress(ndvi,X);
pre_slope(i)=b(2);
b_cofficient(i)=b(1);
%tem_slope(i)=b(2);
pz(i)=stats(3);
end
filename='F:\yz\PhD\Recent_work\Rework\Downscaling\rework\result/a.tif';
geotiffwrite(filename,pre_slope,R,'GeoKeyDirectoryTag',info.GeoTIFFTags.GeoKeyDirectoryTag)
%filename='G:/downscale_test/results/方程的显著性.tif';
%geotiffwrite(filename,pz,R,'GeoKeyDirectoryTag',info.GeoTIFFTags.GeoKeyDirectoryTag)
%pre_slope(pz>0.05)=NaN;
%filename='G:/downscale_test/results/方程通过0.05显著性检验的的a.tif';
geotiffwrite(filename,pre_slope,R,'GeoKeyDirectoryTag',info.GeoTIFFTags.GeoKeyDirectoryTag)
filename='F:\yz\PhD\Recent_work\Rework\Downscaling\rework\result/b.tif';
geotiffwrite(filename,b_cofficient,R,'GeoKeyDirectoryTag',info.GeoTIFFTags.GeoKeyDirectoryTag)
长路漫漫…
唯有坚持…