求助,帮忙看一个程序!
clc; clear;load sjy.txt
sjy=flipud(sjy);
%
ncols = 177;
nrows = 64;
xllcorner = 89.401306152344;
yllcorner = 31.62291656;
cellsize = 0.07272727;
NODATA_value =-9999;
%
lon=[xllcorner:cellsize:xllcorner+(ncols-1)*cellsize];
lat=[yllcorner:cellsize:yllcorner+(nrows-1)*cellsize];
[sjy_lon, sjy_lat]=meshgrid(lon, lat); clear lon lat
%-----
% Pixelsize = 0.07272727;
glb_ncols = 4950;
glb_nrows = 2091;
UL= -179.99568;
LR = -62.849808;
lon=[UL:cellsize:UL+(glb_ncols-1)*cellsize];
lat=[LR:cellsize:LR+(glb_nrows-1)*cellsize];
[ndvi_lon, ndvi_lat]=meshgrid(lon, lat); clear lon lat
%
mm_list=['jan';'feb';'mar';'apr';'may';'jun';'jul';'aug';'sep';'oct';'nov';'dec'];
k=0;
for yy=1982:2006
yr=num2str(yy)
yr=yr(3:4);
for mm=1:12
for tt=1:2
k=k+1;
if tt==1
fna=['D:\matfiles\' yr mm_list(mm, :) '15a.mat'];
else
fna=['D:\matfiles\' yr mm_list(mm, :) '15b.mat'];
end
ndvidata=load(fna); ndvidata=ndvidata.ndvidata;
data=flipud(double(ndvidata)); clear ndvidata
flg=find(data<0); data(flg)=nan; clear flg
dist=(ndvi_lon-sjy_lon(1,1)).^2+(ndvi_lat-sjy_lat(1,1)).^2;
[xx yy]=find(~(dist>min(min(dist))));
sjy_ndvi=data(xx:xx+nrows-1, yy:yy+ncols-1);
flg=find(~(sjy==1));
sjy_ndvi(flg)=nan;
if k==1
ndvi=sjy_ndvi;
else
ndvi(:,:,k)=sjy_ndvi;
end
end
end
end
sjy_ndvi=ndvi; clear ndvi
%
hp=pcolor(sjy_lon, sjy_lat, mean(sjy_ndvi, 3));
set(hp,'edgecolor','none'); colorbar